From cdde16496e731eaf8564f185769879eca4536c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Thu, 7 Feb 2013 16:06:32 +0100 Subject: [PATCH] [-] FO: Fix #PSCFV-7627 customer group reduction was applied on combinations for unidentified users on the product page --- classes/Group.php | 8 ++++---- controllers/front/ProductController.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/classes/Group.php b/classes/Group.php index a4ce1f990..fe294eaa8 100644 --- a/classes/Group.php +++ b/classes/Group.php @@ -106,10 +106,10 @@ class GroupCore extends ObjectModel public static function getReduction($id_customer = null) { if (!isset(self::$cache_reduction['customer'][(int)$id_customer])) - { - $id_group = $id_customer ? Customer::getDefaultGroupId((int)$id_customer) : (int)Configuration::get('PS_CUSTOMER_GROUP'); - self::$cache_reduction['customer'][(int)$id_customer] = Group::getReductionByIdGroup($id_group); - } + { + $id_group = $id_customer ? Customer::getDefaultGroupId((int)$id_customer) : (int)Group::getCurrent()->id; + self::$cache_reduction['customer'][(int)$id_customer] = Group::getReductionByIdGroup($id_group); + } return self::$cache_reduction['customer'][(int)$id_customer]; } diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 84c45a956..8e7e2aaf0 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -275,7 +275,7 @@ class ProductControllerCore extends FrontController protected function assignPriceAndTax() { $id_customer = (isset($this->context->customer) ? (int)$this->context->customer->id : 0); - $id_group = (isset($this->context->customer) ? $this->context->customer->id_default_group : (int)Configuration::get('PS_CUSTOMER_GROUP')); + $id_group = (int)Group::getCurrent()->id; $id_country = (int)$id_customer ? Customer::getCurrentCountry($id_customer) : Configuration::get('PS_COUNTRY_DEFAULT'); $group_reduction = GroupReduction::getValueForProduct($this->product->id, $id_group);