Merge branch 'ticket-fidelite' into develop

This commit is contained in:
Marion Muszynski 2016-06-08 12:25:26 +02:00
commit eafb801028

View File

@ -42,28 +42,26 @@ Tools::addCSS(_PS_CSS_DIR_.'jquery.cluetip.css', 'all');
Tools::addJS(array(_PS_JS_DIR_.'jquery/jquery.dimensions.js',_PS_JS_DIR_.'jquery/jquery.cluetip.js'));
$displayorders = LoyaltyModule::getAllByIdCustomerCustom((int)($cookie->id_customer), (int)($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));
//$orderToConvert = LoyaltyModule::getAllByIdCustomerCustom((int)($cookie->id_customer), (int)($cookie->id_lang), true, false, $nb = 10, $page = 1);
//$total_discount = LoyaltyModule::getVoucherValueByPercentOfOrder($orderToConvert, (int)($cookie->id_currency));
/*$total_discount = Db::getInstance()->getValue('
SELECT SUM(`discount_value`) FROM `'._DB_PREFIX_.'loyalty`
WHERE `id_loyalty_state`=2
AND `id_discount`=0
AND `id_customer` = ' .(int) $cookie->id_customer
);*/
$allOrders = LoyaltyModule::getOrdersWithDiscountByIdCustomer((int) $cookie->id_customer);
$total_discount = 0;
if (!empty($allOrders)) {
$nb_orders = count($allOrders);
foreach ($allOrders as $key => $order) {
if ((int)$order['id_loyalty_state'] !=2){
continue;
if ($displayorders && !empty($displayorders)) {
$allOrders = LoyaltyModule::getOrdersWithDiscountByIdCustomer((int) $cookie->id_customer);
$total_discount = 0;
if (!empty($allOrders)) {
$nb_orders = count($allOrders);
foreach ($allOrders as $key => $order) {
if ((int)$order['id_loyalty_state'] !=2){
continue;
}
$total_discount += (float)$order['discount_value'];
}
$total_discount += (float)$order['discount_value'];
} else {
$nb_orders = 0;
}
} else {
$nb_orders = 0;
$total_discount = 0;
}
/* transform point into voucher if needed */
if (Tools::getValue('transform-points') == 'true' AND $total_discount > 0)
{
@ -162,7 +160,7 @@ if ($ids_discount = LoyaltyModule::getDiscountByIdCustomer((int)($cookie->id_cus
}
}
$allCategories = Category::getSimpleCategories((int)($cookie->id_lang));
/*$allCategories = Category::getSimpleCategories((int)($cookie->id_lang));
$voucherCategories = Configuration::get('PS_LOYALTY_VOUCHER_CATEGORY');
if ($voucherCategories != '' AND $voucherCategories != 0)
$voucherCategories = explode(',', Configuration::get('PS_LOYALTY_VOUCHER_CATEGORY'));
@ -181,12 +179,12 @@ else
$categoriesNames = Tools::truncate(implode(', ', $categoriesNames), 100).'.';
else
$categoriesNames = null;
}
}*/
$smarty->assign(array(
'nbDiscounts' => (int)$nbDiscounts,
'discounts' => $discounts,
'minimalLoyalty' => (float)Configuration::get('PS_LOYALTY_MINIMAL'),
'categories' => $categoriesNames
/*'categories' => $categoriesNames*/
));
echo Module::display(dirname(__FILE__).'/loyalty.php', 'loyalty.tpl');