From 883f095864385b439de10b92e6d53b6a549dae34 Mon Sep 17 00:00:00 2001 From: Srv Bebeboutik Date: Fri, 8 Jan 2016 12:04:41 +0100 Subject: [PATCH] modif prod noel tpl + stats sale --- mails/fr/order_conf.html | 6 +--- modules/privatesales_livestats/cron.php | 30 ++++++++++++------- .../privatesales_livestats/cron_hourly.php | 30 ++++++++++++------- themes/site/shopping-cart.tpl | 4 +-- 4 files changed, 41 insertions(+), 29 deletions(-) diff --git a/mails/fr/order_conf.html b/mails/fr/order_conf.html index cc47842f..c925e8c6 100755 --- a/mails/fr/order_conf.html +++ b/mails/fr/order_conf.html @@ -99,11 +99,7 @@ {delivery_date}
- Vous recevrez un email contenant le numéro de suivi du colis 48h avant. -

- Les ventes garanties pour Noël seront livrées avant le 24 décembre. -

-

ATTENTION : si l’une des marques commandées n’est pas garantie pour Noël, nous ne serons pas en mesure de vous livrer l’ensemble de votre commande avant les fêtes !

+ Vous recevrez un email contenant le numéro de suivi du colis 48h avant.   diff --git a/modules/privatesales_livestats/cron.php b/modules/privatesales_livestats/cron.php index d7676883..4668c7d6 100644 --- a/modules/privatesales_livestats/cron.php +++ b/modules/privatesales_livestats/cron.php @@ -31,6 +31,9 @@ $langs = array('fr' => 2, 'es' => 3); * PART 1 * Data by lang */ + +$ids_total = array(); +$multi_total = array(); foreach ($langs as $iso => $id_lang) { $sales = array(); foreach(Db::getInstance()->ExecuteS(' @@ -51,8 +54,6 @@ foreach ($langs as $iso => $id_lang) { $period = array(); $ids_actual = array(); - $ids_total = array(); - $multi_total = array(); foreach($sales as $sale) { $period[(int) $sale['id_sale']] = array(0, 0); @@ -72,7 +73,7 @@ foreach ($langs as $iso => $id_lang) { AND o.`date_add` < DATE_ADD("'.pSQL(date('Y-m-d 00:00:00', strtotime($day_from))).'", INTERVAL 1 DAY) '); - $ids_total[(int) $sale['id_sale']] = array(); + $ids_total[(int) $id_lang][(int) $sale['id_sale']] = array(); $ids_actual[(int) $sale['id_sale']] = array(); $ids = Db::getInstance()->ExecuteS(' @@ -90,7 +91,7 @@ foreach ($langs as $iso => $id_lang) { '); foreach ($ids as $key => $id) { - $ids_total[(int) $sale['id_sale']][] = $id['id_order']; + $ids_total[(int) $id_lang][(int) $sale['id_sale']][] = $id['id_order']; if ($id['date_add'] == $day_from) { $ids_actual[(int) $sale['id_sale']][] = $id['id_order']; } @@ -99,14 +100,14 @@ foreach ($langs as $iso => $id_lang) { // multi orders by sale $sale_obj = new Sale((int) $sale['id_sale']); $statuts = array(17, Configuration::get('PS_OS_PAYMENT')); - $all_multi = $sale_obj->getMultiForStats($ids_total[(int) $sale['id_sale']], 2); + $all_multi = $sale_obj->getMultiForStats($ids_total[(int) $id_lang][(int) $sale['id_sale']], 2); - $multi_total[(int) $sale['id_sale']] = array(); - $multi_total[(int) $sale['id_sale']] = $all_multi; + $multi_total[(int) $id_lang][(int) $sale['id_sale']] = array(); + $multi_total[(int) $id_lang][(int) $sale['id_sale']] = $all_multi; $multi = array(); - if ($multi_total[(int) $sale['id_sale']]) { - foreach ($multi_total[(int) $sale['id_sale']] as $key => $id_order) { + if ($multi_total[(int) $id_lang][(int) $sale['id_sale']]) { + foreach ($multi_total[(int) $id_lang][(int) $sale['id_sale']] as $key => $id_order) { if (in_array($id_order, $ids_actual[(int) $sale['id_sale']])) { $multi[] = $id_order; } @@ -393,6 +394,13 @@ foreach($sales as $sale) { WHERE `id_sale` = '.(int) $sale['id_sale'].' '); + $total_sale = 0; + $multi_total_sale = 0; + foreach ($langs as $key => $id_lang) { + $multi_total_sale += count($multi_total[(int) $id_lang][(int) $sale['id_sale']]); + $total_sale += count($ids_total[(int) $id_lang][(int) $sale['id_sale']]); + } + Db::getInstance()->ExecuteS(' INSERT INTO `'._DB_PREFIX_.'privatesale_livestats_sale` VALUES ( @@ -404,8 +412,8 @@ foreach($sales as $sale) { '.(int) $stocks_sold[(int) $sale['id_sale']].', '.(float) $margin.', '.(int) $warn.', - '.count($ids_total[(int) $sale['id_sale']]).', - '.count($multi_total[(int) $sale['id_sale']]).', + '.$total_sale.', + '.$multi_total_sale.', NOW() ) '); diff --git a/modules/privatesales_livestats/cron_hourly.php b/modules/privatesales_livestats/cron_hourly.php index 920b9cd9..460045d7 100644 --- a/modules/privatesales_livestats/cron_hourly.php +++ b/modules/privatesales_livestats/cron_hourly.php @@ -20,6 +20,9 @@ $langs = array('fr' => 2, 'es' => 3); * PART 1 * Data by lang */ +$ids_total = array(); +$multi_total = array(); + foreach ($langs as $iso => $id_lang) { $sales = array(); foreach(Db::getInstance()->ExecuteS(' @@ -40,8 +43,6 @@ foreach ($langs as $iso => $id_lang) { $period = array(); $ids_actual = array(); - $ids_total = array(); - $multi_total = array(); foreach($sales as $sale) { $period[(int) $sale['id_sale']] = array(0, 0); @@ -61,7 +62,7 @@ foreach ($langs as $iso => $id_lang) { AND o.`date_add` < DATE_ADD("'.pSQL(date('Y-m-d 00:00:00', strtotime($day_from))).'", INTERVAL 1 DAY) '); - $ids_total[(int) $sale['id_sale']] = array(); + $ids_total[(int) $id_lang][(int) $sale['id_sale']] = array(); $ids_actual[(int) $sale['id_sale']] = array(); $ids = Db::getInstance()->ExecuteS(' @@ -79,7 +80,7 @@ foreach ($langs as $iso => $id_lang) { '); foreach ($ids as $key => $id) { - $ids_total[(int) $sale['id_sale']][] = $id['id_order']; + $ids_total[(int) $id_lang][(int) $sale['id_sale']][] = $id['id_order']; if ($id['date_add'] == $day_from) { $ids_actual[(int) $sale['id_sale']][] = $id['id_order']; } @@ -88,14 +89,14 @@ foreach ($langs as $iso => $id_lang) { // multi orders by sale $sale_obj = new Sale((int) $sale['id_sale']); $statuts = array(17, Configuration::get('PS_OS_PAYMENT')); - $all_multi = $sale_obj->getMultiForStats($ids_total[(int) $sale['id_sale']], 2); + $all_multi = $sale_obj->getMultiForStats($ids_total[(int) $id_lang][(int) $sale['id_sale']], 2); - $multi_total[(int) $sale['id_sale']] = array(); - $multi_total[(int) $sale['id_sale']] = $all_multi; + $multi_total[(int) $id_lang][(int) $sale['id_sale']] = array(); + $multi_total[(int) $id_lang][(int) $sale['id_sale']] = $all_multi; $multi = array(); - if ($multi_total[(int) $sale['id_sale']]) { - foreach ($multi_total[(int) $sale['id_sale']] as $key => $id_order) { + if ($multi_total[(int) $id_lang][(int) $sale['id_sale']]) { + foreach ($multi_total[(int) $id_lang][(int) $sale['id_sale']] as $key => $id_order) { if (in_array($id_order, $ids_actual[(int) $sale['id_sale']])) { $multi[] = $id_order; } @@ -385,6 +386,13 @@ foreach($sales as $sale) { WHERE `id_sale` = '.(int) $sale['id_sale'].' '); + $total_sale = 0; + $multi_total_sale = 0; + foreach ($langs as $key => $id_lang) { + $multi_total_sale += count($multi_total[(int) $id_lang][(int) $sale['id_sale']]); + $total_sale += count($ids_total[(int) $id_lang][(int) $sale['id_sale']]); + } + Db::getInstance()->ExecuteS(' INSERT INTO `'._DB_PREFIX_.'privatesale_livestats_sale` VALUES ( @@ -396,8 +404,8 @@ foreach($sales as $sale) { '.(int) $stocks_sold[(int) $sale['id_sale']].', '.(float) $margin.', '.(int) $warn.', - '.count($ids_total[(int) $sale['id_sale']]).', - '.count($multi_total[(int) $sale['id_sale']]).', + '.$total_sale.', + '.$multi_total_sale.', NOW() ) '); diff --git a/themes/site/shopping-cart.tpl b/themes/site/shopping-cart.tpl index 6453134e..75bb4dbb 100755 --- a/themes/site/shopping-cart.tpl +++ b/themes/site/shopping-cart.tpl @@ -405,13 +405,13 @@ {/if}*} - +

{if !$opc}{l s='Next'}{/if}