VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: cerhio on December 15, 2012, 21:51:00 PM

Title: how to display discount price for items with discoun only
Post by: cerhio on December 15, 2012, 21:51:00 PM
Hi everybody!

I cannot find proper configuration settings.

I want to display old price and discount price only for the items, where discount is set. If there is now discount only real price value is dispayed.

Thank you!
Title: Re: how to display discount price for items with discoun only
Post by: randomdev on December 20, 2012, 03:56:42 AM
There is no configuration for this.

If you like you can copy
components\com_virtuemart\views\productdetails\tmpl\default.php

to
templates\yourtemplatesname\html\com_virtuemart\productdetails\default.php (assuming this doesnt already exist)

Then edit the price display line something like this:

if (round($this->product->prices['basePriceWithTax'],VmConfig::get('salesPriceRounding')) != $this->product->prices['salesPrice']) {
echo '<span class="price-crossed" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices) . "</span>";
}


instead of just

echo '<span class="price-crossed" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices) . "</span>";


I just realised the default price display of virtuemart is a bit different now so you may need to do the same as above but with default_showprices.php instead of default.php
Title: Re: how to display discount price for items with discoun only
Post by: bytelord on December 20, 2012, 14:04:39 PM
Also if you search the forum you will find a lot of similar posts from me and others...

Use firebug to examine you site code and css styling: https://forum.virtuemart.net/index.php?topic=102850.0

Template Overrides:
Creating Template overrides: https://forum.virtuemart.net/index.php?topic=98505.0
Template System: https://dev.virtuemart.net/projects/virtuemart/wiki/Hints_for_the_use_of_the_template_system

Regards