News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Help - can't figure out how to show price with and without discount

Started by Henrik Holm Nielsen, February 14, 2012, 16:40:55 PM

Previous topic - Next topic

Henrik Holm Nielsen

Hi all,

I have read a few posts about this issue, but can't find a way out of this - so I need a few hints!

My problem is, that if a product has a discounted price, the I wish to show the price before discount (Baseprice with Tax, but without discounts) and have this styled with the usual linethru and red font, and also show the price including discount (Final salesprice).

But so far, all the hacks i've found in the forum doing this, have not worked for me.
In shop configuration, pricing tab I have ticked both "Baseprice with Tax, but without discounts" and "Final salesprice".

So basically what I want to implement in my template, is the following logic:

If discount > 0
   display "Baseprice with Tax, but without discounts" (red and linethru)
   display "Final salesprice"
else
   display "Final salesprice"
endif

But for some reason, I can't seem to nail the first part of the if as I always only get show the last part.

What I have tried to implement in my category template (/components/com_virtuemart/views/category/tmpl/default.php), right after this:

if( $this->showBasePrice){
echo $this->currency->createPriceDiv('basePrice','COM_VIRTUEMART_PRODUCT_BASEPRICE',$product->prices);
echo $this->currency->createPriceDiv('basePriceVariant','COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT',$product->prices);
}


is the following code
if ($this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices)) {
echo $this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$product->prices);
echo $this->currency->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE',$product->prices);
} else {
echo $this->currency->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE',$product->prices);
}


But like I said, I just get shown the line after the "else" statement.

I other threads, I've also read about editing the file "/administrator/components/com_virtuemart/helpers/currencydisplay.php", but doing so, I end up with the same result as above.

Could somebody please guide me in the right direction with this? I would be very gratefull!

Note: Using Joomla 1.7.5 and VM 2.0.1f
/Zorroson :)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Billigt og professionelt design af din hjemmeside | Brug for en billig, flot og professionel hjemmeside?

Mole_LR

This should work (but not correctly in product details default.php), at least with Joomla 2.5.1 and VM2.0.1e:
http://forum.virtuemart.net/index.php?topic=97672.0