modif prod noel tpl + stats sale

This commit is contained in:
Srv Bebeboutik 2016-01-08 12:04:41 +01:00
parent 9f6d7f84d7
commit 883f095864
4 changed files with 41 additions and 29 deletions

View File

@ -99,11 +99,7 @@
<td align="left">
{delivery_date}
<br />
Vous recevrez un email contenant le num&eacute;ro de suivi du colis 48h avant.
<p>
<b>Les ventes garanties pour Noël seront livrées avant le 24 décembre.</b>
</p>
<p><b>ATTENTION :</b> si lune des marques commandées nest pas garantie pour Noël, nous ne serons pas en mesure de vous livrer lensemble de votre commande avant les fêtes !</p>
Vous recevrez un email contenant le num&eacute;ro de suivi du colis 48h avant.
</td>
</tr>
<tr><td>&nbsp;</td></tr>

View File

@ -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()
)
');

View File

@ -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()
)
');

View File

@ -405,13 +405,13 @@
{/if}*}
<!--
<p style="margin-top: 15px; color:#222; margin-bottom:0px ">
<img src="http://static2.bebeboutik.com/img/delay/noel_site_{$cookie->id_lang}.png" alt="" style="float:left; margin: 0 10px 10px 0 ">
<span style="top:6px; position: relative">
<strong style="color: #e26ea2">{l s='ATTENTION'}</strong>{l s=' : si lune des marques commandées nest pas garantie pour Noël , nous ne serons pas en mesure de vous livrer lensemble de votre commande avant les fêtes !'}
</span>
</p>
</p> -->
<p class="cart_navigation">
{if !$opc}<a href="{$link->getPageLink('order.php', true)}?step=1{if $back}&amp;back={$back}{/if}" class="exclusive" title="{l s='Next'}">{l s='Next'}</a>{/if}