Joomla + Virtuemart 3 crossed out the old price-the correct conclusion of the discounted price

Sometimes frankly enrages that in “cool” and “thought over” engines of shops some elementary things need to be done through crutches and by “picking” the code. One of these things is to make the correct display of prices at a discount in the store based on Virtuemart 3 (the same situation in all previous versions) – namely – the old price crossed out, the new price as the main. By manipulating the settings, you can achieve only the output of both prices, and then not where you want (for example, in products where there is no discount – kakraz will show two identical prices, and where you need – in products with a discount – only the final). this manual is intended for the store on Virtuemart 3-for previous versions the implementation is different.

Joomla + Virtuemart 3 crossed out the old price – the correct conclusion of the discounted price

Step 1. Configure Virtuemart and products.

Configure the desired price parameters in the admin panel. This is done in the settings of VirtueMart in the “pricing”. Put a tick near the “Final price” and ” Price”

virtuemart discounted price

Next, you need to assign a discount in the product. To do this on the edit page/add product to the unit price in the “Override” setting new price and note the button “Overwrite completely”:

virtuemart-skidki

As a result, we get the situation described in the beginning – two prices are displayed but not where necessary. Now proceed to edit the code.

Step 2. Crossed out the old Virtuemart price code change.

Looking for the file in the folder with the theme on the way (from the themes folder):

\ html\com_virtuemart\sublayouts\prices.php

or if the folder with the theme of this file is missing the path from the root of the site:

\components\com_virtuemart\sublayouts\prices.php

replace code:

on

Then get almost what you need. Two prices are displayed only in products with a discount, but so far the old price is not crossed out:

virtuemart-skidki-zacherknut

Strikethrough implement a simple edit to the css. In any css file (I usually insert a style for the class into the theme style file instead of virtuemart itself) :

As a result, we get what we need – the old price is crossed out and the new output as the main.

virtuemart two prices

This method was introduced for the last time in the shop VirtueMart 3.0.16, but should work in all branch 3, although in the latest versions of VirtueMart 3.2 in an editable file has a new line of code responsible for the display of prices, but the changes remain identical. With the new code, we will understand when the customer appears for revision with the appropriate version – always pleasant to learn when you do it and pay extra 😉 .

I hope this article will help someone to save time and not spend it more than necessary for the decision of trivial tasks. The solution though not very elegant, but working.

I will also be glad to comment on how this code behaved on different versions of stores.

Leave a Reply

Your email address will not be published. Required fields are marked *