While setting up my own shop, I stumbled upon some nasty bugs in the product page when dealing with volume discounts, different currencies and product combinations.
Background:
It's multi-currency shop. Version is Bleeding Edge 1.1.x (the same problems are present in 1.1.0 too).
It has EUR and BGN. Default (base) currency is EUR. For the record: 1EUR = 1,9558 BGN
I've set up following discounts for my products (Catalog Price Rules):
1+ - 10%
7+ - 15%
11+ - 20%
16+ - 25%
There are both simple products and products with attributes that affect the price (Impact on price + Impact on unit price).
So, I encountered following problems:
Case 1:
Preconditions:
Product with combinations is loaded.
Currency is set to non-default.
Admin: Preferences - Product - Display discounted price: Yes
Issue:
Discounted prices both in the Volume discounts table and on the product price when crossing the threshold are wrong. More precisely they equal the correct prices * 1,9558 (the exchange rate).
Cause:
Wrong calculation in function updateDiscountTable() in product.js
Product with combinations is loaded.
A combination which affects the prices is selected.
Admin: Preferences - Product - Display discounted price: No
Issue:
Discounted price when crossing the threshold is wrong. It shows the discounted base price of the product.
Example:
A product costs 100 EUR.
An option which increases the price to 110 EUR is selected.
When crossing the threshold of 7 products the displayed price is 85 EUR instead of 93,5%
Cause:
Attribut not set in function updateDiscountTable() in product.js
The setting of the 'data-real-discount-value' was moved outside the "if" clause.
Case 3:
Preconditions:
Product without combinations is loaded.
Catalog price rules Reduction type: Percentage
Reduction with or without taxes: Tax Excluded
Admin: Preferences - Product - Display discounted price: Yes
Issue:
Discounted prices in the Volume discounts table are wrong. They show the product's base price.
(However the product itself has correct price and proper quantity discounts are applied.)
Cause:
It seems that $quantity_discount.reduction_with_tax returns zero, which is quite logical when the reduction is "Tax Excluded"
Since mathematically it's equal if you apply the percentage discount before or after tax, I think the code shouldn't branch either, so lines 522, 523, 524 and 526 are removed.
Question
Enev
Hello guys,
While setting up my own shop, I stumbled upon some nasty bugs in the product page when dealing with volume discounts, different currencies and product combinations.
Background:
It's multi-currency shop. Version is Bleeding Edge 1.1.x (the same problems are present in 1.1.0 too).
It has EUR and BGN. Default (base) currency is EUR. For the record: 1EUR = 1,9558 BGN
I've set up following discounts for my products (Catalog Price Rules):
1+ - 10%
7+ - 15%
11+ - 20%
16+ - 25%
There are both simple products and products with attributes that affect the price (Impact on price + Impact on unit price).
So, I encountered following problems:
Case 1:
Preconditions:
Product with combinations is loaded.
Currency is set to non-default.
Admin: Preferences - Product - Display discounted price: Yes
Issue:
Discounted prices both in the Volume discounts table and on the product price when crossing the threshold are wrong. More precisely they equal the correct prices * 1,9558 (the exchange rate).
Cause:
Wrong calculation in function updateDiscountTable() in product.js
Solution:
\themes\niara\js\product.jsproduct.js
Line 980-984:
"* currencyRate" has been removed.
Case 2:
Preconditions:
Product with combinations is loaded.
A combination which affects the prices is selected.
Admin: Preferences - Product - Display discounted price: No
Issue:
Discounted price when crossing the threshold is wrong. It shows the discounted base price of the product.
Example:
A product costs 100 EUR.
An option which increases the price to 110 EUR is selected.
When crossing the threshold of 7 products the displayed price is 85 EUR instead of 93,5%
Cause:
Attribut not set in function updateDiscountTable() in product.js
Solution:
\themes\niara\js\product.js
Again in the Line 980-984 block:
The setting of the 'data-real-discount-value' was moved outside the "if" clause.
Case 3:
Preconditions:
Product without combinations is loaded.
Catalog price rules Reduction type: Percentage
Reduction with or without taxes: Tax Excluded
Admin: Preferences - Product - Display discounted price: Yes
Issue:
Discounted prices in the Volume discounts table are wrong. They show the product's base price.
(However the product itself has correct price and proper quantity discounts are applied.)
Cause:
It seems that $quantity_discount.reduction_with_tax returns zero, which is quite logical when the reduction is "Tax Excluded"
Solution:
\themes\niara\product.tpl
Line 521-529:
Since mathematically it's equal if you apply the percentage discount before or after tax, I think the code shouldn't branch either, so lines 522, 523, 524 and 526 are removed.
Price * Tax * Discount = Price * Discount * Tax
e.g. 100 EUR * 1,2 (20% Tax) * 0,9 (10% Discount) = 100 EUR * 0,9 (10% Discount) * 1,2 (20% Tax)
As attachments I have uploaded my modified files. I'm not very good with github but i tried to commit them there too: https://github.com/enev13/niara
product.tpl
10 answers to this question
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