[-] MO : fixed context issues in loyalty #PNM-332
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16751 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user