Skip to content
View in the app

A better way to browse. Learn more.

thirty bees forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Product page displaying incorrect prices when using combinations price reduction and customer group discounts

Featured Replies

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.

0_1543834790195_Price-difference-screenshot.png

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

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

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.

  • 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.

  • 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.

0_1543844040178_price-wrong-1.png

0_1543844051525_price-wrong-2.png

@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.

  • 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

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.

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?

  • 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);

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.