layamazon Posted August 3, 2020 Share Posted August 3, 2020 (edited) How do I display a marked discount on an image to display as a percentage? Edited August 7, 2020 by Toma Oda (see edit history) Link to comment Share on other sites More sharing options...
Richard Avenia Posted August 4, 2020 Share Posted August 4, 2020 You can easily do this by setting the discount as a % of the total price instead of a specific amount of money. Link to comment Share on other sites More sharing options...
layamazon Posted August 6, 2020 Author Share Posted August 6, 2020 Hello, I know that, but the client has already created in 500 products. I need to convert that price in the code into a percentage. Link to comment Share on other sites More sharing options...
musicmaster Posted August 6, 2020 Share Posted August 6, 2020 5 hours ago, Toma Oda said: Hello, I know that, but the client has already created in 500 products. I need to convert that price in the code into a percentage. Assuming that all those prices are different you have two options: - edit the template to do some math there - write a little script that adapts the ps_specific_price table Link to comment Share on other sites More sharing options...
layamazon Posted August 6, 2020 Author Share Posted August 6, 2020 (edited) 47 minutes ago, musicmaster said: Assuming that all those prices are different you have two options: - edit the template to do some math there - write a little script that adapts the ps_specific_price table I tried the first suggestion but I didn't succeed. Don't count exactly. Do you have any code suggestions? Edited August 6, 2020 by Toma Oda (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted August 6, 2020 Share Posted August 6, 2020 11 minutes ago, Toma Oda said: I tried the first suggestion but I didn't succeed. Don't count exactly. Do you have any code suggestions? Sorry, I cannot help you when you talk in steno. Show the code. Show what you did. Show what went wrong. Link to comment Share on other sites More sharing options...
Guest Posted August 7, 2020 Share Posted August 7, 2020 What is your programming knowledge of Prestashop? What is your programming knowledge with PHP? Realize that without knowledge, the thread will grow another 40 posts. Hire a programmer, pay an hour of work and be done right away. I can only advise you that the tpl template uses a function to convert a mathematical result to a currency value by entering {Tools :: displayPrice (mathematical calculation)} Link to comment Share on other sites More sharing options...
hugoter Posted October 4, 2022 Share Posted October 4, 2022 - {((($product.regular_price_amount-$product.price_amount)/$product.regular_price_amount)*100)|round:"0"} % 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now