I want to show the prices crossed out only when they have a discount, as shown in the figure below, in the figure above it shows me the price crossed out and has no discount. How can I do it?
thank you
IMHO this is the case when no taxes are applied .. u need to adjust the display in an over ride for
components\com_virtuemart\sublayouts\prices.php
Can you explain how to do it please?
thank you
No - because it depends entirely on your case
study the code in that very short file and work out what SHOULD be the logic to display and cross out a discounted price..
there is only one line there that has this function
My case is that I do not want to show the price when there is no discount applied. Sorry I'm not very expert in this, can you help me please?
I think that the new function is
if ($product->prices['basePrice'] = $product->prices['salesPrice'] ) {
no show price????
}
If you look in the code of the VM default prices template /components/com_virtuemart/sublayouts/prices.php you will see this:
echo '<span class="price-crossed" >' . $currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>";
Together with other code this tells you that COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX would be shown crossed through if there is a discount price set. If not then it does not display.
If you don't apply tax on your products then set a zero tax rule and apply it to the products. Then the prices you should set to display in VM Configuration/Pricing are:
Baseprice with Tax, but without discounts ( COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX )
and
Final salesprice ( COM_VIRTUEMART_PRODUCT_SALESPRICE )
From the image you show it looks like you are using a template override so you may have to edit template/[Your Joomla Template]/html/com_virtuemart/overrides/prices.php if simply applying zero tax and setting the prices to display does not show what you want.
Quotethen set a zero tax rule and apply it to the products.
this is clever -- must remember