I managed to modify code in productdetails/default.php to show old prices crossed if discounted price exists. This works OK. The logic is:
- IF THERE IS A DISCOUNT CROSS REGULAR PRICE (add span="price-crosed")
- IF THERE IS NO DISCOUNT HIDE PRICE (add span="price-ok" and set display:none in css)
Now I want to do the same in category/deafult.php .. , but the same code doesn't work:
Here is the code:
- Code: Select all
<div class="catProductPrice" id="productPrice<?php echo $product->virtuemart_product_id ?>">
<?php
if ($this->show_prices == '1') {
if ($product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and !$product->images[0]->file_is_downloadable) {
echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE');
}
echo $this->currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
/******************* THIS IS MY CUSTOM CODE WHICH WORKS IN PRODUCT VIEW *******/
if (round($this->product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) != round($this->product->prices['salesPrice'],$this->currency->_priceConfig['salesPrice'][1])) {
echo '<span class="price-crossed" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices) . "</span>";
}
if (round($this->product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) == round($this->product->prices['salesPrice'],$this->currency->_priceConfig['salesPrice'][1])) {
echo '<span class="price-ok" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices) . "</span>";
}
/*************************************** END OF CUSTOM CODE ***************/
} ?>
</div>