adding delivery date estimation
This commit is contained in:
parent
e33d2da73d
commit
b8a4934278
@ -79,15 +79,24 @@ class BlockOrderSummary extends Module {
|
||||
$i++;
|
||||
}
|
||||
|
||||
if(count($products_keys) > 0) {
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT l.`id_delay`, l.`name`
|
||||
FROM `'._DB_PREFIX_.'privatesale` s
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale_delay_lang` l ON (s.`delivery_delay` = l.`id_delay`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON (s.`id_sale` = c.`id_sale`)
|
||||
WHERE l.`id_lang` = '.(int) $cookie->id_lang.'
|
||||
AND c.`id_product` IN ('.implode(', ', array_keys($products_keys)).')
|
||||
') as $row) {
|
||||
// assign delay to Products
|
||||
if (Module::isInstalled('privatesales_delay')) {
|
||||
if (!class_exists('SaleDelay')) {
|
||||
require_once _PS_ROOT_DIR_.'/modules/privatesales_delay/saledelay.php';
|
||||
}
|
||||
$delay_products = SaleDelay::associateDelay($products);
|
||||
|
||||
$delays = array_keys($delay_products);
|
||||
$date = new DateTime();
|
||||
$delivery_date = SaleDelay::getDeliveryDate($delays, null, $date);
|
||||
|
||||
foreach($delays as $delay) {
|
||||
$row = Db::getInstance()->getRow('
|
||||
SELECT l.`name`
|
||||
FROM `'._DB_PREFIX_.'privatesale_delay_lang` l
|
||||
WHERE l.`id_lang` = '.(int) $cookie->id_lang.'
|
||||
AND l.`id_delay`='.(int)$delay.'
|
||||
');
|
||||
$delay_name = $row['name'];
|
||||
break;
|
||||
}
|
||||
@ -97,6 +106,7 @@ class BlockOrderSummary extends Module {
|
||||
'order_address' => $order_address,
|
||||
'carrier_name' => $carrier_name,
|
||||
'delay_name' => $delay_name,
|
||||
'delivery_date' => (isset($delivery_date)?$delivery_date:null)
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'blockordersummary.tpl');
|
||||
|
@ -19,6 +19,13 @@
|
||||
<div>
|
||||
<h5>{l s='Delivery delays' mod='blockordersummary'}</h5>
|
||||
<p class="delivery-delay">{$delay_name}</p>
|
||||
{if isset($delivery_date)}
|
||||
{foreach from=delivery_date item=date}
|
||||
<p class="delivery-date">
|
||||
{l s='Date de réception prévue entre le'} <strong>{$date.date_start|date_format:'%d/%m/%Y'}</strong> {l s='et le'} <strong>{$date.date_end|date_format:'%d/%m/%Y'}</strong>
|
||||
</p>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
<div>
|
||||
<h5>{l s='My shipping address' mod='blockordersummary'}</h5>
|
||||
|
@ -6625,6 +6625,13 @@ table#carrierTable tbody td {
|
||||
#blockordersummary p {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
#blockordersummary p.delivery-delay {
|
||||
color: #e36ea2;
|
||||
font-weight: 600;
|
||||
}
|
||||
#blockordersummary p.delivery-date strong{
|
||||
font-size: 11px;
|
||||
}
|
||||
#blockordersummary .price {
|
||||
float: right;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user