Only on product page, when the client is choosing one of the attributes the product price calculated with JavaScript will differ from the price calculated with PHP but only in situation when
- the product attribute has a price impact
- and there is a Group price reduction
ps. Product price in cart is correct (calculated with PHP).
ps. Prestashop 1.6.1.19 also have this problem.
ps. Prestashop 1.7.3.3 don't have this problem.
The example is using prices/values without tax.
[Create a PRODUCT]
Set the base price to 10 (priceTEReal=10)
[Create 2 combinations]
- first with 0 impact
- second with impact of +5 [attribute_price_impact=1, attribute_price=5]
[Create a GROUP]
With reduction=10
Set price_display_method=1 (without tax)
[Assign a customer to this group]
id_default_group=groupID
[THE PROBLEM / DIFFRENCE IN CALCULATIONS]
finalPricePHP = (10+5)-10% = 13.5
finalPriceJS = (10-10%)+5 = 14
[PROBABLE CAUSE / JS Variables]
var productBasePriceTaxExcl = 9;
JavaScript is using a precalculated value "productBasePriceTaxExcl" that prematurely contains group reduction.
Only on product page, when the client is choosing one of the attributes the product price calculated with JavaScript will differ from the price calculated with PHP but only in situation when
ps. Product price in cart is correct (calculated with PHP).
ps. Prestashop 1.6.1.19 also have this problem.
ps. Prestashop 1.7.3.3 don't have this problem.
The example is using prices/values without tax.
[Create a PRODUCT]
Set the base price to 10 (priceTEReal=10)
[Create 2 combinations]
[Create a GROUP]
With reduction=10
Set price_display_method=1 (without tax)
[Assign a customer to this group]
id_default_group=groupID
[THE PROBLEM / DIFFRENCE IN CALCULATIONS]
finalPricePHP = (10+5)-10% = 13.5
finalPriceJS = (10-10%)+5 = 14
[PROBABLE CAUSE / JS Variables]
var productBasePriceTaxExcl = 9;
JavaScript is using a precalculated value "productBasePriceTaxExcl" that prematurely contains group reduction.