News:

Looking for documentation? Take a look on our wiki

Main Menu

How to show custom prices?

Started by inopia, July 16, 2012, 13:22:38 PM

Previous topic - Next topic

inopia

Hi,

i want to show custom prices on category view and product view.

Category view: I want to show only total price with discount. I´ve done this adding a comment on this line:

//echo $this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$product->prices);

but i don´t like this way.

Product view: I want to show total price without discount and total price with discount. If there are product without discount price appears duplicate.

are there alternative way to do it? i´ve looking for a methods on classes can checks this options (COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX) and i can handle if it appears o not.

Pseudocode on product view:

if (discount is set) {show price without discount; show price with discount }
else {show only price without discount}

pseudocode on category view:
if (discount is set) {show only price with discount}
else {show price}

Conclusion: I need check methods for diferents prices. How can i check this values???

Any idea?

Thanks.

ivus

Hi inopia,

Firstly I hope you're using layout overrides to achieve this.

Please try the following for your category view:


      if ($product->prices['discountAmount'] > 0) :
         echo $this->currency->createPriceDiv('salesPriceWithDiscount','COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT',$product->prices);
      else :
         echo $this->currency->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE',$product->prices);
      endif;


If that works, then you can modify it accordingly for your product view.

I hope this helps.