addition of new delivery delay and cleaning of sale combination
This commit is contained in:
parent
61ae6d6fc1
commit
abd8e88343
@ -252,10 +252,10 @@ class BlockOrderSummary extends Module {
|
||||
<p class="carrier-info"><span class="carrier-name">'.$data['carrier_name'].'</span> <span class="price price_total">'.Tools::displayPrice($cart->getOrderTotal(TRUE, 5),$currency).'</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<h5>'.$this->l('Delivery delays').'</h5>
|
||||
<p class="delivery-delay">'.$data['delay_name'].'</p>';
|
||||
<h5>'.$this->l('Delivery delays').'</h5>';
|
||||
if(isset($data['delivery_date'])){
|
||||
foreach($data['delivery_date'] as $k => $date) {
|
||||
echo '<p class="delivery-delay">'.$data['delay_name'][$k].'</p>';
|
||||
if($k == 1) {
|
||||
echo '<p class="delivery-date">
|
||||
'.$this->l('Date de réception prévue entre le').' <strong>'.$date['date_start']->format('d/m/Y').'</strong> '.$this->l('et le').' <strong>'.$date['date_end']->format('d/m/Y').'</strong>
|
||||
@ -264,6 +264,8 @@ class BlockOrderSummary extends Module {
|
||||
echo '<p class="delivery-date">'.$this->l('Livraison prévue avant le').' <strong>'.$this->l('24/12').'</strong></p>';
|
||||
} elseif ($k == 8){
|
||||
echo '<p class="delivery-date">'.$this->l('Envoi en 48h').'</p>';
|
||||
} elseif ($k == 9){
|
||||
echo '<p class="delivery-date">'.$this->l('Delai indiqué sur la fiche produit').'</p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -428,6 +430,7 @@ class BlockOrderSummary extends Module {
|
||||
}
|
||||
$delivery_date = SaleDelay::getDeliveryDate($delays, null, $date, true);
|
||||
|
||||
$delay_name = array();
|
||||
foreach($delays as $delay) {
|
||||
$row = Db::getInstance()->getRow('
|
||||
SELECT l.`name`
|
||||
@ -435,8 +438,7 @@ class BlockOrderSummary extends Module {
|
||||
WHERE l.`id_lang` = '.(int) $id_lang.'
|
||||
AND l.`id_delay`='.(int)$delay.'
|
||||
');
|
||||
$delay_name = $row['name'];
|
||||
break;
|
||||
$delay_name[(int)$delay] = $row['name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,9 @@
|
||||
</div>
|
||||
<div>
|
||||
<h5>{l s='Delivery delays' mod='blockordersummary'}</h5>
|
||||
<p class="delivery-delay">{$delay_name}</p>
|
||||
{if isset($delivery_date)}
|
||||
{foreach from=$delivery_date key=k item=date}
|
||||
<p class="delivery-delay">{$delay_name[$k]}</p>
|
||||
{if $k == 1}
|
||||
<p class="delivery-date">
|
||||
{l s='Date de réception prévue entre le' mod='blockordersummary'} <strong>{$date.date_start|date_format:'%d/%m/%Y'}</strong> {l s='et le' mod='blockordersummary'} <strong>{$date.date_end|date_format:'%d/%m/%Y'}</strong>
|
||||
@ -33,6 +33,10 @@
|
||||
<p class="delivery-date">
|
||||
{l s='Envoi en 48h' mod='blockordersummary'}
|
||||
</p>
|
||||
{elseif $k == 9}
|
||||
<p class="delivery-date">
|
||||
{l s='Delai indiqué sur la fiche produit' mod='blockordersummary'}
|
||||
</p>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
@ -493,6 +493,11 @@ class AdminPrivateSalesSales extends AdminTab {
|
||||
'value' => 8,
|
||||
'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 8?true:false)
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Livraison spécifique'),
|
||||
'value' => 9,
|
||||
'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 8?true:false)
|
||||
),
|
||||
);
|
||||
// Delivery delay
|
||||
$input = array(
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,10 @@
|
||||
<p>
|
||||
<b style="color: #e26ea2;">{l s='Livraison avant Noel' mod='privatesales_delay'}</b> : {l s='Envoi en 48h' mod='privatesales_delay'}
|
||||
</p>
|
||||
{elseif $k == 0}
|
||||
<p>
|
||||
<b style="color: #e26ea2;">{l s='Livraison Spécifique' mod='privatesales_delay'}</b>
|
||||
</p>
|
||||
{else}
|
||||
<p>
|
||||
<b style="color: #e26ea2;">{$date.name}</b> : {l s='Date de réception prévue entre le' mod='privatesales_delay'} <b>{$date.date_start|date_format:'%d/%m/%Y'}</b> {l s='et le' mod='privatesales_delay'} <b>{$date.date_end|date_format:'%d/%m/%Y'}</b>
|
||||
|
@ -148,6 +148,9 @@ if (!class_exists('SaleDelay')) {
|
||||
case '8':
|
||||
return '48h Noël';
|
||||
break;
|
||||
case '9':
|
||||
return 'Spé';
|
||||
break;
|
||||
default:
|
||||
return 'Inconnu';
|
||||
break;
|
||||
@ -175,6 +178,9 @@ if (!class_exists('SaleDelay')) {
|
||||
case '7':
|
||||
return '72h';
|
||||
break;
|
||||
case '9':
|
||||
return 'Spé';
|
||||
break;
|
||||
case '8':
|
||||
return '48h Noël';
|
||||
break;
|
||||
|
@ -60,13 +60,6 @@ class CartController extends CartControllerCore
|
||||
if ($add){
|
||||
$current_sale = array();
|
||||
foreach(self::$cart->getProducts() as $product) {
|
||||
/*$current_sale = Db::getInstance()->getRow('
|
||||
SELECT ps.`delivery_delay`, ps.`id_sale`
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache` psc
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale` ps ON (ps.`id_sale` = psc.`id_sale`)
|
||||
WHERE psc.`id_product` = '.(int) $product['id_product']
|
||||
);*/
|
||||
|
||||
$sale = Sale::getSaleFromCategory((int)$product['id_category_default'], false);
|
||||
$current_sale = array(
|
||||
'id_sale'=> (int) $sale->id,
|
||||
@ -76,12 +69,6 @@ class CartController extends CartControllerCore
|
||||
// Only one delivery id per cart, so we can break now
|
||||
break;
|
||||
}
|
||||
/*$adding_sale = Db::getInstance()->getRow('
|
||||
SELECT ps.`delivery_delay`, ps.`id_sale`
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache` psc
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale` ps ON (ps.`id_sale` = psc.`id_sale`)
|
||||
WHERE psc.`id_product` = '.(int) $idProduct
|
||||
);*/
|
||||
$current_product = new Product((int) $idProduct);
|
||||
$sale2 = Sale::getSaleFromCategory($current_product->id_category_default, false);
|
||||
$adding_sale = array(
|
||||
@ -90,49 +77,24 @@ class CartController extends CartControllerCore
|
||||
'shipping' => Sale::getShippingSale((int)$sale2->id)
|
||||
);
|
||||
|
||||
//die('{"hasError" : true,"popup_error_cart": true, "errors" : [" '.implode(' , ',$current_sale).' - '.implode(' , ',$adding_sale).'"]}');
|
||||
|
||||
if (!empty($current_sale)) {
|
||||
global $smarty;
|
||||
// Only classic/Noel delivery sales can be added together or product of the same sale or philea sales with same delivery delay
|
||||
if ((
|
||||
((int)$current_sale['delivery_delay'] != 1 && (int)$current_sale['delivery_delay'] != 5)
|
||||
&& (int)$adding_sale['id_sale'] != (int)$current_sale['id_sale']
|
||||
&& (
|
||||
(
|
||||
((int)$current_sale['shipping'] == 1 && (int)$current_sale['shipping'] == (int)$adding_sale['shipping'])
|
||||
&& (int)$adding_sale['delivery_delay'] != (int)$current_sale['delivery_delay']
|
||||
)
|
||||
|| ((int)$current_sale['shipping'] != 1 && (int)$adding_sale['shipping'] == 1)
|
||||
|| ((int)$current_sale['shipping'] == 1 && (int)$adding_sale['shipping'] != 1)
|
||||
|| ((int)$current_sale['shipping'] != 1 && (int)$adding_sale['shipping'] != 1)
|
||||
)
|
||||
) || (
|
||||
((int)$current_sale['delivery_delay'] != 1 && (int)$adding_sale['delivery_delay'] == 1)
|
||||
|| (
|
||||
(int)$current_sale['delivery_delay'] == 1
|
||||
&& (int)$adding_sale['delivery_delay'] == 1
|
||||
&& (int)$current_sale['shipping'] != (int)$adding_sale['shipping']
|
||||
)
|
||||
) || (
|
||||
((int)$current_sale['delivery_delay'] != 5 && (int)$adding_sale['delivery_delay'] == 5)
|
||||
|| ((int)$current_sale['delivery_delay'] == 5 && (int)$adding_sale['delivery_delay'] != 5)
|
||||
)
|
||||
) {
|
||||
// Product in cart comes from special delivery sale - only products from the same sale can be added
|
||||
if (Tools::getValue('ajax') == 'true') {
|
||||
die('{"hasError" : true,"popup_error_cart": true, "errors" : ["'.Tools::displayError('Sorry your cart already contains products from a sale shipped within a special period. To continue, please confirm your order or empty your cart.', false).'"]}');
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Sorry your cart already contains products from a sale shipped within a special period. To continue, please confirm your order or empty your cart.', false);
|
||||
}
|
||||
} elseif ((int)$current_sale['delivery_delay'] == 1 && (int)$adding_sale['delivery_delay'] != 1) {
|
||||
// Product in cart comes from classic delivery sale - only products from classic delivery sale can be added
|
||||
if ((int)$current_sale['delivery_delay'] == 1 && !Sale::isCombinable($current_sale,$adding_sale)){
|
||||
// Product in cart comes from classic delivery sale
|
||||
if (Tools::getValue('ajax') == 'true') {
|
||||
die('{"hasError" : true,"popup_error_cart": true, "errors" : ["'.Tools::displayError('Sorry your cart already contains products from a sale shipped within 3 weeks. To continue, please confirm your order or empty your cart.', false).'"]}');
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Sorry your cart already contains products from a sale shipped within 3 weeks. To continue, please confirm your order or empty your cart.', false);
|
||||
}
|
||||
}
|
||||
elseif (!Sale::isCombinable($current_sale,$adding_sale)){
|
||||
// Product in cart comes from special delivery sale
|
||||
if (Tools::getValue('ajax') == 'true') {
|
||||
die('{"hasError" : true,"popup_error_cart": true, "errors" : ["'.Tools::displayError('Sorry your cart already contains products from a sale shipped within a special period. To continue, please confirm your order or empty your cart.', false).'"]}');
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Sorry your cart already contains products from a sale shipped within a special period. To continue, please confirm your order or empty your cart.', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// @End adding Antadis
|
||||
|
@ -515,8 +515,12 @@ var oneQuantityAvailableSentence = '{l s='Warning: 1 item in stock!' js=1}';
|
||||
{include file="./themes/site/delay.tpl" delivery_delay=$sale->delivery_delay}
|
||||
{else}
|
||||
<span class="picto"></span>
|
||||
{if $sale->delivery_delay == 1}
|
||||
{l s='Livraison estimée sous'} <br />
|
||||
<span class="pink">{l s=' 3 semaines'}</span>
|
||||
{elseif $sale->delivery_delay == 9}
|
||||
<br />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="info info_2">
|
||||
|
@ -230,6 +230,10 @@
|
||||
<span>
|
||||
- {l s='Livraison prévue avant le'} <strong>{l s='24/12'}</strong>
|
||||
</span>
|
||||
{elseif $k==9 && $k==$key}
|
||||
<span>
|
||||
- {l s='Livraison spécifique'}
|
||||
</span>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
@ -464,8 +464,12 @@ var oneQuantityAvailableSentence = '{l s='Warning: 1 item in stock!' js=1}';
|
||||
{include file="./themes/site_mobile/delay.tpl" delivery_delay=$sale->delivery_delay}
|
||||
{else}
|
||||
<span class="picto"></span>
|
||||
{if $sale->delivery_delay == 1}
|
||||
{l s='Livraison estimée sous'} <br />
|
||||
<span class="pink">{l s=' 3 semaines'}</span>
|
||||
{elseif $sale->delivery_delay == 9}
|
||||
<br />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="info info_2">
|
||||
|
Loading…
Reference in New Issue
Block a user