Describe the bug
I upgraded from 1.6.0.11 to 1.6.1.24
In the cart, reduction is shown in amount instead of percentage.
Debugging, I suspect the bug is due to the line 585 in classes/Cart.php :
SpecificPrice::getSpecificPrice( ... (6 parameters), $this->id_shop_group, ...)
But looking at the definition of this method :
public static function getSpecificPrice(... (6 parameters), $id_group, ...)
In other words : the method is asking for a (customer) group id, and a shop_group id is given instead.
(Consequence :
To Reproduce
I didn't try to reduce the case to a reproductible one, but following steps should be sufficient :
This line has been introduced by the following commit :
https://github.com/PrestaShop/PrestaShop/commit/20b7c28f188560f2ccc243d77aae3b6ce339bd05 − Optimize Cart::getProducts performances & factorize some queries by @jocel1
All suggestions to correct this bug are welcome.
Test in Prestashop 1.7 are also welcome.
PrestaShop version: 1.6.1.24
PHP version: 5.6
Hi @Yopai,
I did not manage to reproduce the issue with PS1.7.5.2.

As you may already know, normal maintenance support for PrestaShop 1.6 ended in October 2018, which is now in extended maintenance mode until June 30, 2019.
During this period, and in order to ensure the stability of current 1.6 shops, only critical bugs and security fixes will be fixed.
Thanks for your understanding!
hi @khouloudbelguith , I've just took a look at the code, and @Yopai is right, the wrong variable is used in the code :)
I mean, even in 1.7 code ;)
If I've all understood correctly, it's more than just a variable : a customer can have multiple groups. So either getSpecificPrice must be extended to allow an array of groups ids, or you have to loop over it for each customer group. Moreover, you have to ensure the specific price that is retrieved is the same that the one applied by the method computing the price (in case there are multiple specific prices for different groups)
It may be worth creating a reproducible case in 1.7 and reopen the bug (or open a new one), then, isn't it ?
@jocel1, thanks for your feedback.
Yes, I found the issue.
$id_group is used https://github.com/PrestaShop/PrestaShop/blob/aec97ddb1551fd7d6d56f75549a992d6937caf50/classes/SpecificPrice.php#L488
but in the cart class, id_shop_group is used instead of id_group
https://github.com/PrestaShop/PrestaShop/blob/1.7.5.2/classes/Cart.php#L754
I’ll add this to the debug roadmap so that it’s fixed.
@Yopai, If you have already fixed it on your end or if you think you can do it, please do send us a pull request!
Thanks!
Thanks for your interest
If I had fixed it cleanly, I would have been pleased to send a pull request.
Unfortunately, as :