VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Enter_PL on January 24, 2012, 10:36:27 AM

Title: Sales Price or discount amount shown only if exist.
Post by: Enter_PL on January 24, 2012, 10:36:27 AM

I try to insert striked sales price or discount amount shown only when exist. But i don't know how show this values only when discount is active. I was try:

if ($this->currency->createPriceDiv('discountAmount','',$product->prices)) {........................}

Why this condition always is TRUE? Although the value equals ""?

How to get value of discount without curency?
Title: Re: Sales Price or discount amount shown only if exist.
Post by: stephensaid on January 30, 2012, 00:36:10 AM
Did you get this answer? I have the same problem.

Thanks
Stephen
http://ideasoftmalta.com
Title: Re: Sales Price or discount amount shown only if exist.
Post by: Enter_PL on January 30, 2012, 06:22:50 AM
No, but I found own solution. Not so clean, but working.
I put  this:

$testowa =    strlen(   $this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices));
            
//if ($this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices)) {
if ($testowa > 107 ) {
            echo '<s>',$this->currency->createPriceDiv('basePriceWithTax','',$product->prices),'</s>';   
     }
   
I don't have idea how to get pure value of "discountAmount", so I used a this "stupid" solution.

Value "107" could be different for your currency. You need to set this experimentally.
Title: Re: Sales Price or discount amount shown only if exist.
Post by: Stamos on February 24, 2012, 15:35:57 PM
WHere i have to set the value 107?