News:

Looking for documentation? Take a look on our wiki

Main Menu

Moving Product Description to Under Price on Product Details View

Started by croppertiger, November 08, 2012, 12:34:42 PM

Previous topic - Next topic

croppertiger

 I was wondering if anyone knows how to move the product description to under the price area?

Like so:


Hope someone can help out a noob :)

bytelord

Hello,

Please make an override for the file default.php file for product details. This file is located under your_joomla_folder\components\com_virtuemart\views\productdetails\tmpl\default.php, to create a template override just copy that file under: your_joomla_folder\templates\your_joomla_folder\html\com_virtuemart\productdetails\default.php if the folders com_virtuemart and productdetails does not exist, you create them.

Now, edit the file default.php in out new location. Around line 253 you will find the following code

<?php
// Product Description
if (!empty($this->product->product_desc)) {
    ?>

        <div class="product-description">
<?php /** @todo Test if content plugins modify the product description */ ?>
    <span class="title"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE'?></span>
<?php echo $this->product->product_desc?>
        </div>
<?php
    
// Product Description END


Move that part of the code around line 207, after add to card button code area ... or after availability if you want (where you like, just take care not to break any <?php ?> ...

Some more information regarding template system and template overrides:
Template overrides: http://forum.virtuemart.net/index.php?topic=98505.0
Template System: https://dev.virtuemart.net/projects/virtuemart/wiki/Hints_for_the_use_of_the_template_system
Using firebug to examine your code & css styling: http://forum.virtuemart.net/index.php?topic=102850.0

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

MihkelK

Hi,

for me it did not work, but when i copied a longer part:


<?php
// Product Description
if (!empty($this->product->product_desc)) {
    ?>

        <div class="product-description">
<?php /** @todo Test if content plugins modify the product description */ ?>
    <span class="title"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE'?></span>
<?php echo $this->product->product_desc?>
        </div>
<?php
    
// Product Description END

    
if (!empty($this->product->customfieldsSorted['normal'])) {
$this->position 'normal';
echo $this->loadTemplate('customfields');
    } 
// Product custom_fields END
    // Product Packaging
    
$product_packaging '';
    if (
$this->product->product_box) {
?>

        <div class="product-box">
    <?php
        echo 
JText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX') .$this->product->product_box;
    ?>

        </div>
    <?php // Product Packaging END
    
?>



And put it between "Add to Cart Button" and "Avalivility Image" like this:


<?php
// Add To Cart Button
//  if (!empty($this->product->prices) and !empty($this->product->images[0]) and $this->product->images[0]->file_is_downloadable==0 ) {
// if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices['salesPrice'])) {
    echo $this->loadTemplate('addtocart');
// }  // Add To Cart Button END
?>

<?php
// Product Description
if (!empty($this->product->product_desc)) {
    ?>

        <div class="product-description">
<?php /** @todo Test if content plugins modify the product description */ ?>
    <span class="title"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE'?></span>
<?php echo $this->product->product_desc?>
        </div>
<?php
    
// Product Description END

    
if (!empty($this->product->customfieldsSorted['normal'])) {
$this->position 'normal';
echo $this->loadTemplate('customfields');
    } 
// Product custom_fields END
    // Product Packaging
    
$product_packaging '';
    if (
$this->product->product_box) {
?>

        <div class="product-box">
    <?php
        echo 
JText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX') .$this->product->product_box;
    ?>

        </div>
    <?php // Product Packaging END
    
?>


<?php
// Availability Image
$stockhandle VmConfig::get('stockhandle''none');
if (($this->product->product_in_stock $this->product->product_ordered) < 1) {
if ($stockhandle == 'risetime' and VmConfig::get('rised_availability') and empty($this->product->product_availability)) {
?>
<div class="availability">
    <?php echo (file_exists(JPATH_BASE DS VmConfig::get('assets_general_path') . 'images/availability/' VmConfig::get('rised_availability'))) ? JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' VmConfig::get('rised_availability''7d.gif'), VmConfig::get('rised_availability''7d.gif'), array('class' => 'availability')) : VmConfig::get('rised_availability'); ?>
</div>
    <?php
} else if (!empty($this->product->product_availability)) {
?>

<div class="availability">
<?php echo (file_exists(JPATH_BASE DS VmConfig::get('assets_general_path') . 'images/availability/' $this->product->product_availability)) ? JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' $this->product->product_availability$this->product->product_availability, array('class' => 'availability')) : $this->product->product_availability?>
</div>
<?php
}
}
?>



Then It worked

Hope this helps someone