[-] 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
This commit is contained in:
fGaillard
2012-03-13 17:06:42 +00:00
parent 998ef4263e
commit 7a6339d50f
6 changed files with 22 additions and 16 deletions
+2 -1
View File
@@ -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));
+1 -1
View File
@@ -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;
+10 -10
View File
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>loyalty</name>
<displayName><![CDATA[Customer loyalty and rewards]]></displayName>
<version><![CDATA[1.8]]></version>
<description><![CDATA[Provide a loyalty program to your customers.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[pricing_promotion]]></tab>
<module>
<name>loyalty</name>
<displayName><![CDATA[Customer loyalty and rewards]]></displayName>
<version><![CDATA[1.8]]></version>
<description><![CDATA[Provide a loyalty program to your customers.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[pricing_promotion]]></tab>
<confirmUninstall>Are you sure you want to delete all loyalty points and customer history?</confirmUninstall>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<is_configurable>0</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>
</module>
@@ -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')));
}
}
+1 -1
View File
@@ -229,6 +229,7 @@ class Loyalty extends Module
$errors .= $error.'<br />';
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'));
@@ -129,6 +129,9 @@
{/if}
<br />
<br />
<br />
<h2>{l s='My vouchers from loyalty points' mod='loyalty'}</h2>
{if $nbDiscounts}