News:

Looking for documentation? Take a look on our wiki

Main Menu

seprating code from pricing code

Started by Jerome, February 24, 2013, 23:46:13 PM

Previous topic - Next topic

Jerome

The the default.php of the product details. It has rating, shipment/payment and prices all tide together. It seems like it's coded together. How can I separate the code so that I can place each code on different parts of the page? Or should I not do this? I am also doing this in a override file.

<?php
if ($this->showRating) {
    $maxrating VmConfig::get('vm_maximum_rating_scale'5);

    if (empty($this->rating)) {
?>

<span class="vote"><?php echo JText::_('COM_VIRTUEMART_RATING') . ' ' JText::_('COM_VIRTUEMART_UNRATED'?></span>
    <?php
} else {
    $ratingwidth $this->rating->rating 24//I don't use round as percetntage with works perfect, as for me
    ?>

<span class="vote">
<?php echo JText::_('COM_VIRTUEMART_RATING') . ' ' round($this->rating->rating) . '/' $maxrating?><br/>
    <span title=" <?php echo (JText::_("COM_VIRTUEMART_RATING_TITLE") . round($this->rating->rating) . '/' $maxrating?>" class="ratingbox" style="display:inline-block;">
<span class="stars-orange" style="width:<?php echo $ratingwidth.'px'?>">
</span>
    </span>
</span>
<?php
    }
}
if (is_array($this->productDisplayShipments)) {
    foreach ($this->productDisplayShipments as $productDisplayShipment) {
echo $productDisplayShipment '<br />';
    }
}
if (is_array($this->productDisplayPayments)) {
    foreach ($this->productDisplayPayments as $productDisplayPayment) {
echo $productDisplayPayment '<br />';
    }
}
// Product Price
    // the test is done in show_prices
//if ($this->show_prices and (empty($this->product->images[0]) or $this->product->images[0]->file_is_downloadable == 0)) {
    echo $this->loadTemplate('showprices');
//}
?>

Peter Pillen

normally you can cut the pieces out and place them anywhere you want on the template. Just make sure you take the whole "if ($this->showRating) {" loop together with it. Otherwise it will not work properly. You will need to check and adpat your layout when changing this

Jerome

Thanks for the confirmation I understand now.