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

how to show the prices only with discount

Started by fnavarro, November 11, 2018, 20:48:35 PM

Previous topic - Next topic

fnavarro

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

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

fnavarro

Can you explain how to do it please?
thank you

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

fnavarro

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?

fnavarro

I think that the new function is

if ($product->prices['basePrice'] = $product->prices['salesPrice'] ) {

            no show price????
}

jenkinhill

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.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

GJC Web Design

Quotethen set a zero tax rule and apply it to the products.

this is clever -- must remember
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation