Jump to content
thirty bees forum
  • 0

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


lukewood

Question

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

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

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.

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...