How to hide Old price, when my product hasn't Discount?

kostianev
51 Posts
kostianev posted this 29 June 2017

Hello, I have products without Discout, but there is shown Old price too, which is the same with main price. How to disable not to show on products, where is no discount?

Hello, I have products without Discout, but there is shown Old price too, which is the same with main price. How to disable not to show on products, where is no discount?
Vote to pay developers attention to this features or issue.
12 Comments
Order By: Standard | Newest
Support Team
Support Team posted this 29 June 2017

Hello,

Please use the shortcode suggested in this article for showing base price for products with discount only: http://answers.themler.com/articles/67028/tips-and-tricks#t_price ( see "Base Price for products with discount only" section).

Sincerely,
Nettie,
BillionDigital Team

Hello, Please use the shortcode suggested in this article for showing base price for products with discount only: http://answers.themler.com/articles/67028/tips-and-tricks#t_price ( see "Base Price for products with discount only" section). Sincerely, Nettie, BillionDigital Team
kostianev
51 Posts
kostianev posted this 29 June 2017

Okay, I found this code and where to import it? I tried with CMS Code, but with no success?

<?php if(!(isset($currency))){ $currency (); } if ($product-?>prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {
echo $currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);
}
?>

Okay, I found this code and where to import it? I tried with CMS Code, but with no success? &lt;?php if(!(isset($currency))){ $currency (); } if ($product-?&gt;prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) { echo $currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices); } ?>

Last edited 29 June 2017 by kostianev

Support Team
Support Team posted this 30 June 2017

Hello,

To what template did you add the code? Please note that the code that you mentioned should work for the Product Details template only, but for Products template a different code is needed.

Sincerely,
Nettie,
BillionDigital Team

Hello, To what template did you add the code? Please note that the code that you mentioned should work for the Product Details template only, but for Products template a different code is needed. Sincerely, Nettie, BillionDigital Team
kostianev
51 Posts
kostianev posted this 30 June 2017

Thank you

Thank you
kostianev
51 Posts
kostianev posted this 04 July 2017

Hello again, I am trying to change the function to not show the old price for products without discount, but with not success. I can't understand where I must add the code in which file, because when I save my template the code is missing every time? Can you assist me and explain me how to modify and where?

Hello again, I am trying to change the function to not show the old price for products without discount, but with not success. I can't understand where I must add the code in which file, because when I save my template the code is missing every time? Can you assist me and explain me how to modify and where?
Support Team
Support Team posted this 04 July 2017

Hello,

Please open Product Details template in Themler, then in the Insert tab >> More select "CMS Code" control and add it to the desired location on page. After this select CMS ode, then in the CMS Code tab >> Edit Code enter the code.

Sincerely,
Nettie,
BillionDigital Team

Hello, Please open Product Details template in Themler, then in the Insert tab >> More select "CMS Code" control and add it to the desired location on page. After this select CMS ode, then in the CMS Code tab >> Edit Code enter the code. Sincerely, Nettie, BillionDigital Team
kostianev
51 Posts
kostianev posted this 04 July 2017

So, is that mean that I must remove the original Product price control which is added, and there to add the CMS Code with the desired custom code?

So, is that mean that I must remove the original Product price control which is added, and there to add the CMS Code with the desired custom code?
Support Team
Support Team posted this 04 July 2017

Hello,

In Product Details tab >> Product Price please disable the "Show Old Price" option. This will remove base price for all products. And the code added to CMS Code will make the base price shown for discounted products only.

Sincerely,
Nettie,
BillionDigital Team

Hello, In Product Details tab >> Product Price please disable the "Show Old Price" option. This will remove base price for all products. And the code added to CMS Code will make the base price shown for discounted products only. Sincerely, Nettie, BillionDigital Team
kostianev
51 Posts
kostianev posted this 04 July 2017

Hi, I understand and tried, but the condition "if product have discount" not working and showing the old price for products without discounts too. Please, see my video with demo: https://db.tt/CzeSlpLfbr

Hi, I understand and tried, but the condition "if product have discount" not working and showing the old price for products without discounts too. Please, see my video with demo: https://db.tt/CzeSlpLfbr
Support Team
Support Team posted this 06 July 2017

Hi,

So, you have products and products with discount, right? Do you have tax price modifiers? Could you please provide a screenshot that demonstrate product price settings and price modifier settings? The provided solution is quite general because joomla provides a lot of price modifiers and we cannot count all of them.
For example, this code
<?php if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {
echo $this->currency->createPriceDiv ( 'basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices );
} ?>

compares discounted Price without tax and base price without tax if they are not equal then it shows base price. But if works if the discount is applied after tax. If discount is applied before tax then we need to compare discounted Price with tax and base price with tax. This solution provides for a tax.

All this is not something specific to Themler. These solutions operate basic VirtueMart prices and conditions. You can find a lot of ready solutions in the internet that you can use in your projects.

Thank you,
Olivia

Hi, So, you have products and products with discount, right? Do you have tax price modifiers? Could you please provide a screenshot that demonstrate product price settings and price modifier settings? The provided solution is quite general because joomla provides a lot of price modifiers and we cannot count all of them. For example, this code `<?php if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) { echo $this->currency->createPriceDiv ( 'basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices ); } ?>` compares *discounted Price without tax* and *base price without tax* if they are not equal then it shows base price. But if works if the discount is applied after tax. If discount is applied before tax then we need to compare *discounted Price with tax* and *base price with tax*. This solution provides for a tax. All this is not something specific to Themler. These solutions operate basic VirtueMart prices and conditions. You can find a lot of ready solutions in the internet that you can use in your projects. Thank you, Olivia
César Mendoza
10 Posts
César Mendoza posted this 12 April 2018

Hi, I understand and tried, but the condition "if product have discount" not working and showing the old price for products without discounts too. Please, see my video with demo: https://db.tt/CzeSlpLfbr

Hi Kostianev, I have the same problem, did you find a solution? Could you share me ..

> Hi, I understand and tried, but the condition "if product have discount" not working and showing the old price for products without discounts too. Please, see my video with demo: https://db.tt/CzeSlpLfbr Hi Kostianev, I have the same problem, did you find a solution? Could you share me ..
kostianev
51 Posts
kostianev posted this 13 April 2018

Hi César Mendoza, contact me by email (kostianev (at) gmail.com) to tell you.

Hi César Mendoza, contact me by email (kostianev (at) gmail.com) to tell you.
You must log in or register to leave comments