December 3, 20188 yr Hi, I am using combinations with price reductions. As I sell secondhand books, my main listed price is 'As New'. I reduce for each degradation in book condition such as 'Very Good', 'Good', 'Acceptable' etc in the combinations. I have just created a new customer group, offering these shoppers a 10% discount. The product page reduces the price of the combination price by 10% of the main 'As New' price, when displaying combinations. The shopping cart is unaffected. There is something on the Prestashop forum about this but the solution is to replace the following files: \controllers\front\ProductController.php \classes\Product.php https://www.prestashop.com/forums/topic/499621-1609-to-1614-item-with-combination-is-showing-incorrect-prices/ Is there anyway to sort this quickly or should I report this as a bug on GitHub? Any help would be greatly appreciated. Regards, Luke
December 3, 20188 yr Price on the product page and in the shopping cart being different can't be right. But which is the right price? 8.64 - 10% = 7.85
December 3, 20188 yr P.S.: replacing entire files is a bad idea. Perhaps this gets rid of this particular problem, but it also resets all bug fixes since then.
December 3, 20188 yr Author Thanks for replying. The shopping cart price is correct. The Retail Price is RM12. The price is reduced by RM2.40 for being a Library Very Good Copy (RM9.60). A customer group discount of 10% (RM0.96) should reduce this to RM8.64 as the cart displays. However, on the product listing 10% of the Retail price (RM1.20) is being subtracted RM9.60 - RM1.20 = RM8.40.
December 3, 20188 yr Author I managed to recreate the exact same problem on the http://back.thirtybees.com. I wanted to be sure that it wasn't something on my installation.
December 4, 20187 yr @lukewood said in Product page displaying incorrect prices when using combinations price reduction and customer group discounts: I managed to recreate the exact same problem on the http://back.thirtybees.com. I wanted to be sure that it wasn't something on my installation. I've also noticed some unexpected behavior when it comes to combination reductions, though independently of customer group discounts. It could be the bug is there somewhere.
December 4, 20187 yr Author I managed to fix the problem by editing contollers/front/ProductController.php. I added the following function ``` protected function getGroupReduction() { $idcustomer = (isset($this->context->customer) ? (int)$this->context->customer->id : 0); $idgroup = (int)Group::getCurrent()->id; $idcountry = $idcustomer ? (int)Customer::getCurrentCountry($id_customer) : (int)Tools::getCountry(); $group_reduction = GroupReduction::getValueForProduct($this->product->id, $id_group); if ($group_reduction === false) { $group_reduction = Group::getReduction((int)$this->context->cookie->id_customer) / 100; } return $group_reduction; } One line 742 (after function about line 756), I replaced the following code: $combinations[$row['idproductattribute']]['price'] = (float) Tools::convertPriceFull($row['price'], null, $this->context->currency, false); with $groupreduction = $this->getGroupReduction(); $price = $row['price'] - $row['price']* $groupreduction; $combinations[$row['idproductattribute']]['price'] = (float)Tools::convertPriceFull($price, null, Context::getContext()->currency, false); ``` My test server appears to be working well. I would appreciate it if any programmers could see if this could cause any other problems down the line. I am not a coder and worried that I might make spheres of things. Cheers, Luke
December 4, 20187 yr Thanks for the code. Still it smells like too much code. Cart calculates the price correctly already, so code for the right calculation has to exist somewhere already.
December 4, 20187 yr I just see we have a bug report for this already: https://github.com/thirtybees/thirtybees/issues/538 Does the description there match your case?
December 4, 20187 yr Author @traumflug Yes, this appears to be the same although I could not tell you if it is JS Variables or PHP. i did try this fix but it did not work for me: Modify from themes the product.js find around line 680 basePriceWithTax = basePriceWithTax + +combination.price * (taxRate/100 + 1) and replace with basePriceWithTax = basePriceWithTax + +combination.price * (taxRate/100 + 1) * (1 - groupReduction); and few lines bellow find basePriceWithTax = +combination.specific_price.price * (taxRate/100 + 1) and replace with basePriceWithTax = +combination.specific_price.price * (taxRate/100 + 1) * (1 - groupReduction);
December 4, 20187 yr Author @Traumflug Yes, this is definitely the same issue. I tested on http://back.thirtybees.com and it behaves the same.
Create an account or sign in to comment