From 7a6339d50f2b1441fb7e334c6261dc8b0da2b28a Mon Sep 17 00:00:00 2001 From: fGaillard Date: Tue, 13 Mar 2012 17:06:42 +0000 Subject: [PATCH] [-] Classes : #PSFV-634 : BugFix Currency was not set for loyalty discounts git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14110 b9a71923-0436-4b27-9f14-aed3839534dd --- controllers/front/DiscountController.php | 3 ++- js/jquery/plugins/cluetip/jquery.cluetip.css | 2 +- modules/loyalty/config.xml | 20 +++++++++---------- modules/loyalty/controllers/front/default.php | 8 +++++--- modules/loyalty/loyalty.php | 2 +- .../loyalty/views/templates/front/loyalty.tpl | 3 +++ 6 files changed, 22 insertions(+), 16 deletions(-) diff --git a/controllers/front/DiscountController.php b/controllers/front/DiscountController.php index a20a5e443..373a7aae5 100644 --- a/controllers/front/DiscountController.php +++ b/controllers/front/DiscountController.php @@ -42,8 +42,9 @@ class DiscountControllerCore extends FrontController $discounts = Discount::getCustomerDiscounts($this->context->language->id, $this->context->customer->id, true, false); $nbDiscounts = 0; + foreach ($discounts as $discount) - if ($discount['quantity_for_user']) + if (isset($discount['quantity_for_user']) && $discount['quantity_for_user']) $nbDiscounts++; $this->context->smarty->assign(array('nbDiscounts' => (int)($nbDiscounts), 'discount' => $discounts)); diff --git a/js/jquery/plugins/cluetip/jquery.cluetip.css b/js/jquery/plugins/cluetip/jquery.cluetip.css index 335e03591..74408aa57 100755 --- a/js/jquery/plugins/cluetip/jquery.cluetip.css +++ b/js/jquery/plugins/cluetip/jquery.cluetip.css @@ -12,7 +12,7 @@ width: 43px; height: 11px; position: absolute; - background-image: url('../img/loader.gif'); + background-image: url('../../../../img/loader.gif'); } .cluetip-arrows { display: none; diff --git a/modules/loyalty/config.xml b/modules/loyalty/config.xml index c91c5bbb3..81ca85cda 100755 --- a/modules/loyalty/config.xml +++ b/modules/loyalty/config.xml @@ -1,13 +1,13 @@ - - loyalty - - - - - + + loyalty + + + + + Are you sure you want to delete all loyalty points and customer history? - 1 - 0 + 0 + 0 - \ No newline at end of file + \ No newline at end of file diff --git a/modules/loyalty/controllers/front/default.php b/modules/loyalty/controllers/front/default.php index 3f0349a34..18776e905 100644 --- a/modules/loyalty/controllers/front/default.php +++ b/modules/loyalty/controllers/front/default.php @@ -36,6 +36,8 @@ class LoyaltyDefaultModuleFrontController extends ModuleFrontController { parent::__construct(); + $this->context = Context::getContext(); + include_once($this->module->getLocalPath().'LoyaltyModule.php'); include_once($this->module->getLocalPath().'LoyaltyStateModule.php'); @@ -69,8 +71,8 @@ class LoyaltyDefaultModuleFrontController extends ModuleFrontController // Voucher creation and affectation to the customer $cartRule = new CartRule(); $cartRule->code = $voucherCode; - $cartRule->id_customer = (int)$this->context->cookie->id_customer; - $cartRule->id_currency = (int)$this->context->cookie->id_currency; + $cartRule->id_customer = (int)$this->context->customer->id; + $cartRule->reduction_currency = (int)$this->context->currency->id; $cartRule->reduction_amount = LoyaltyModule::getVoucherValue((int)$customerPoints); $cartRule->quantity = 1; $cartRule->quantity_per_user = 1; @@ -114,7 +116,7 @@ class LoyaltyDefaultModuleFrontController extends ModuleFrontController // Register order(s) which contributed to create this voucher LoyaltyModule::registerDiscount($cartRule); - Tools::redirect($this->context->link->getModuleLink('loyalty', 'default')); + Tools::redirect($this->context->link->getModuleLink('loyalty', 'default', array('process' => 'summary'))); } } diff --git a/modules/loyalty/loyalty.php b/modules/loyalty/loyalty.php index 26dc03b11..f6b095dc1 100644 --- a/modules/loyalty/loyalty.php +++ b/modules/loyalty/loyalty.php @@ -229,6 +229,7 @@ class Loyalty extends Module $errors .= $error.'
'; echo $this->displayError($errors); } +// redirect($this->context->link); } } @@ -246,7 +247,6 @@ class Loyalty extends Module $this->instanceDefaultStates(); $this->_postProcess(); - $categories = Category::getCategories($this->context->language->id); $order_states = OrderState::getOrderStates($this->context->language->id); $currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT'))); $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT')); diff --git a/modules/loyalty/views/templates/front/loyalty.tpl b/modules/loyalty/views/templates/front/loyalty.tpl index 6c2ad2d78..c6300973f 100644 --- a/modules/loyalty/views/templates/front/loyalty.tpl +++ b/modules/loyalty/views/templates/front/loyalty.tpl @@ -129,6 +129,9 @@ {/if}
+
+
+

{l s='My vouchers from loyalty points' mod='loyalty'}

{if $nbDiscounts}