Dolfijn Posted May 30, 2020 Posted May 30, 2020 I think I have found a problem with the calculation of the baseprice when a customer wants to order a product in quantity, there is a quantity discount and he can choose an article attribute that changes the base price. In my scenario it goes as follows. - I have an article which comes in 3 options (one attribute with three values). The options change the base price (in my case the price increases significantly, but that is slightly off topic). The default option does not have an impact on the base price. - I have a discount rule for customers if they order 5 articles or more. And another one for quantities of more then 10 (but that also does not matter, the problem already starts with the first discount rule). If a customer sticks to the default option. Every works as expected, including the discounting rules. However, if the customer chooses an option which has a price increasing effect. The following happens: - For quantities lower then the quantity discount rule threshold (5 in my case), the correct increased base price is displayed. - For quantities higher then the price discount threshold, the default option base price is displayed instead of the one linked to the option chosen. Although it then correctly applies the qty discount to this base price, it is completely wrong. If we the proceed to the check out, everything is well again. All prices and calculations turn to be ok. But I discovered that customers get in confusion and most of the time stop the order process. In most cases, they contact me through email but this is not the way to go. So, Am I doing things wrong or is it indeed a bug? I also uploaded some screen images.
Traumflug Posted May 30, 2020 Posted May 30, 2020 This looks like a problem which should be reported on Github.
Dolfijn Posted September 5, 2021 Author Posted September 5, 2021 Hi there, Last week I had a customer complaining about much higher product pricing during checkout then 'promised' in product view, caused by this problem. So, I decided to give it a try and I think I have solved it :-). Root cause is the construction of the product page which uses a table to display volume discount. In this table, some CSS attributes are used to store the volume discount prices and that values are (only) set on page creation (from the product.tpl code). And these CSS attributes are used to display the price (when in product view). That all works ok, until you add product attributes (combinations) that influence the price. Because, that influence is not reflected back in the mentioned DOM css attributes of the volume discount table. So, the effect is that you always use the price levels of the first product attribute, regardless of the actual attribute chosen by the user. What I did is add a new function (UpdateDOMdiscountPriceTable(newPrice)) that updates the table DOM elements that store the prices with the correct new price levels and call it from UpdateDisplay(). All changes are made in product.js. I attached the file for those interested. Final warning: I'm not an thirthybees expert and also not a seasoned JavaScript programmer. I also only tested it for my shop config (using attributes and volume discount using some percentage). product.js 1
30knees Posted September 5, 2021 Posted September 5, 2021 @datakickSee above for a potential bug fix.@DolfijnThank you! 🙂
datakick Posted September 6, 2021 Posted September 6, 2021 @Dolfijn what theme do you use? Both product.js and product.tpl are part of the theme. If there is a bug, we can fix it inside community-default-theme and niara, but it will still be part of third party themes.
Dolfijn Posted September 7, 2021 Author Posted September 7, 2021 It is a copy of the default theme that I used in Prestashop 1.6. After my migration to Thirtybees, I'm still using that same theme. Hopes this gives you any clue? If you need more info, please let me know.
datakick Posted September 7, 2021 Posted September 7, 2021 Hi @Dolfijn, I can't reproduce this issue on latest niara/community theme. The price calculation works correctly for all calculations and volume discounts. This looks like a bug specific to your old ps16 theme. I'm glad you already have a solution, maybe it will help others that comes with old ps16 default theme.
Dolfijn Posted September 9, 2021 Author Posted September 9, 2021 Okay, and maybee, I shoulld also migrate to the latest theme anyways 🙂
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