diff --git a/modules/loyalty/controllers/front/default.php b/modules/loyalty/controllers/front/default.php index 851f660f5..80320dfdd 100644 --- a/modules/loyalty/controllers/front/default.php +++ b/modules/loyalty/controllers/front/default.php @@ -166,14 +166,14 @@ class LoyaltyDefaultModuleFrontController extends ModuleFrontController */ public function assignSummaryExecution() { - $customerPoints = (int)(LoyaltyModule::getPointsByCustomer((int)($this->context->customer->id))); - $orders = LoyaltyModule::getAllByIdCustomer((int)($this->context->cookie->id_customer), (int)($this->context->cookie->id_lang)); - $displayorders = LoyaltyModule::getAllByIdCustomer((int)($this->context->cookie->id_customer), (int)($this->context->cookie->id_lang), false, true, ((int)(Tools::getValue('n')) > 0 ? (int)(Tools::getValue('n')) : 10), ((int)(Tools::getValue('p')) > 0 ? (int)(Tools::getValue('p')) : 1)); + $customerPoints = (int)(LoyaltyModule::getPointsByCustomer((int)$this->context->customer->id)); + $orders = LoyaltyModule::getAllByIdCustomer((int)$this->context->customer->id, (int)$this->context->lang->id); + $displayorders = LoyaltyModule::getAllByIdCustomer((int)$this->context->customer->id, (int)$this->context->lang->id, false, true, ((int)(Tools::getValue('n')) > 0 ? (int)(Tools::getValue('n')) : 10), ((int)(Tools::getValue('p')) > 0 ? (int)(Tools::getValue('p')) : 1)); $this->context->smarty->assign(array( 'orders' => $orders, 'displayorders' => $displayorders, 'totalPoints' => (int)$customerPoints, - 'voucher' => LoyaltyModule::getVoucherValue($customerPoints, (int)($this->context->cookie->id_currency)), + 'voucher' => LoyaltyModule::getVoucherValue($customerPoints, (int)$this->context->currency->id), 'validation_id' => LoyaltyStateModule::getValidationId(), 'transformation_allowed' => $customerPoints > 0, 'page' => ((int)(Tools::getValue('p')) > 0 ? (int)(Tools::getValue('p')) : 1), @@ -185,7 +185,7 @@ class LoyaltyDefaultModuleFrontController extends ModuleFrontController /* Discounts */ $nbDiscounts = 0; $discounts = array(); - if ($ids_discount = LoyaltyModule::getDiscountByIdCustomer((int)$this->context->cookie->id_customer)) + if ($ids_discount = LoyaltyModule::getDiscountByIdCustomer((int)$this->context->customer->id)) { $nbDiscounts = count($ids_discount); foreach ($ids_discount as $key => $discount) diff --git a/modules/loyalty/loyalty-program.php b/modules/loyalty/loyalty-program.php index 563b2a2dc..4c0f8ad70 100644 --- a/modules/loyalty/loyalty-program.php +++ b/modules/loyalty/loyalty-program.php @@ -57,8 +57,8 @@ if (Tools::getValue('transform-points') == 'true' AND $customerPoints > 0) /* Voucher creation and affectation to the customer */ $cartRule = new CartRule(); $cartRule->code = $voucherCode; - $cartRule->id_customer = (int)$cookie->id_customer; - $cartRule->id_currency = (int)$cookie->id_currency; + $cartRule->id_customer = (int)$context->customer->id; + $cartRule->id_currency = (int)$context->currency->id; $cartRule->reduction_amount = LoyaltyModule::getVoucherValue((int)$customerPoints); $cartRule->quantity = 1; $cartRule->quantity_per_user = 1; @@ -114,7 +114,7 @@ $smarty->assign(array( 'displayorders' => $displayorders, 'pagination_link' => __PS_BASE_URI__.'modules/loyalty/loyalty-program.php', 'totalPoints' => (int)$customerPoints, - 'voucher' => LoyaltyModule::getVoucherValue($customerPoints, (int)($cookie->id_currency)), + 'voucher' => LoyaltyModule::getVoucherValue($customerPoints, (int)$context->currency->id), 'validation_id' => LoyaltyStateModule::getValidationId(), 'transformation_allowed' => $customerPoints > 0, 'page' => ((int)(Tools::getValue('p')) > 0 ? (int)(Tools::getValue('p')) : 1),