Show discount prices in CATEGORY VIEW - VIRTUEMART
Joomla webshop template with CSS3-based animations, VirtueMart support and one-page checkout.
- GK User
- Fri Aug 01, 2014 12:54 pm
Hi, I need a little customization.
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:
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>
-
- Senior Boarder
- GK User
- Sun Aug 03, 2014 8:29 pm
Seems I found a solution with this code:
I just replaced all entries: $this->product->prices with $product->prices
Don't know what this means
, but it is working.
Can someone ecxplain to me?
Thank you
- Code: Select all
if (round($product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) != round($product->prices['salesPrice'],$this->currency->_priceConfig['salesPrice'][1])) {
echo '<span class="price-crossed" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>";
}
if (round($product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) == round($product->prices['salesPrice'],$this->currency->_priceConfig['salesPrice'][1])) {
echo '<span class="price-ok" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>";
}
I just replaced all entries: $this->product->prices with $product->prices
Don't know what this means

Can someone ecxplain to me?

Thank you
-
- Senior Boarder
- GK User
- Fri Nov 14, 2014 4:51 pm
This really helped me today - many thanks for sharing
-
- Junior Boarder
3 posts
• Page 1 of 1