'. $err .'
';
+ foreach ($errors AS $err)
+ $output .= ''. $err .'
';
else
{
$method = Tools::getValue('method');
@@ -441,17 +433,18 @@ class Dejala extends CarrierModule
public function displayForm()
{
+ global $smarty, $cookie;
$errors = array();
$outputMain = '';
- $this->context->smarty->assign("djl_mode", $this->dejalaConfig->mode);
- $this->context->smarty->assign("disabled", '');
+ $smarty->assign("djl_mode", $this->dejalaConfig->mode);
+ $smarty->assign("disabled", '');
if ($this->dejalaConfig->mode == 'PROD')
- $this->context->smarty->assign("disabled", 'disabled="disabled"');
+ $smarty->assign("disabled", 'disabled="disabled"');
if (true !== extension_loaded('curl'))
{
$errors[] = $this->l('This module requires php extension cURL to function properly. Please install the php extension "cURL" first.');
- $this->context->smarty->assign("disabled", 'disabled="disabled"');
+ $smarty->assign("disabled", 'disabled="disabled"');
}
$registered = TRUE;
@@ -465,49 +458,49 @@ class Dejala extends CarrierModule
if (200 != $responsePing['status'])
{
if (401 == $responsePing['status'])
- $errors[] = $this->l('An error occurred while authenticating your account on Dejala.com. Your credentials were not recognized.');
+ $errors[] = $this->l('An error occurred while authenticating your account on Dejala.com. Your credentials were not recognized.');
else
- $errors[] = $this->l('An error occurred while authenticating your account on Dejala.com. This may be due to a temporary network or platform problem. Please try again later or contact Dejala.com');
+ $errors[] = $this->l('An error occurred while authenticating your account on Dejala.com. This may be due to a temporary network or platform problem. Please try again later or contact Dejala.com');
unset($_GET['cat']);
$registered= FALSE;
}
}
- $this->context->smarty->assign("registered", $registered?"1":"0");
+ $smarty->assign("registered", $registered?"1":"0");
if (!isset($_GET['cat']) || ($_GET['cat']==='home') || ($_GET['cat']===''))
- $currentTab = "home";
+ $currentTab="home";
else
- $currentTab = $_GET['cat'];
+ $currentTab=$_GET['cat'];
- $this->context->smarty->assign("currentTab", $currentTab);
- $this->context->smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']);
- $this->context->smarty->assign("formAction", Tools::safeOutput($_SERVER['REQUEST_URI']));
+ $smarty->assign("currentTab", $currentTab);
+ $smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']);
+ $smarty->assign("formAction", Tools::safeOutput($_SERVER['REQUEST_URI']));
$outputMenu = $this->display(__FILE__, 'dejala_menu.tpl');
if ($currentTab === 'home')
{
- $this->context->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8'));
+ $smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8'));
if ($registered)
{
- $this->context->smarty->assign("visibility_status", $this->dejalaConfig->visibility_status);
- $this->context->smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list);
- $this->context->smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8'));
+ $smarty->assign("visibility_status", $this->dejalaConfig->visibility_status);
+ $smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list);
+ $smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8'));
$smartifyErrors = $this->smartyfyStoreAttributes();
if (isset($smartifyErrors) && count($smartifyErrors))
- $errors = $smartifyErrors;
+ $errors = $smartifyErrors;
}
else
{
$shopName = Configuration::get('PS_SHOP_NAME');
if (strlen($shopName) >= 15)
- $shopName = substr($shopName, 0, 15);
- $this->context->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8'));
+ $shopName = substr($shopName, 0, 15);
+ $smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8'));
}
$outputMain = $this->display(__FILE__, 'dejala_home.tpl');
}
- else if ($currentTab==='contacts')
+ elseif ($currentTab==='contacts')
{
$contacts = array();
$djlUtil = new DejalaUtils();
@@ -516,13 +509,13 @@ class Dejala extends CarrierModule
{
foreach ($contacts as $contactName=>$contactData) {
foreach ($contactData as $key=>$value) {
- $this->context->smarty->assign($contactName.'_'.$key, $value);
+ $smarty->assign($contactName.'_'.$key, $value);
}
}
}
$outputMain = $this->display(__FILE__, 'dejala_contacts.tpl');
}
- else if ($currentTab === 'location')
+ elseif ($currentTab === 'location')
{
$location = array();
$djlUtil = new DejalaUtils();
@@ -530,12 +523,11 @@ class Dejala extends CarrierModule
if ('200' == $responseArray['status'])
{
foreach ($location as $key=>$value)
- $this->context->smarty->assign($key, $value);
-
+ $smarty->assign($key, $value);
$outputMain = $this->display(__FILE__, 'dejala_location.tpl');
}
}
- else if ($currentTab==='processes')
+ elseif ($currentTab==='processes')
{
$processes = array();
$djlUtil = new DejalaUtils();
@@ -543,12 +535,12 @@ class Dejala extends CarrierModule
if ('200' == $responseArray['status'])
{
foreach ($processes as $key=>$value)
- $this->context->smarty->assign($key, $value);
+ $smarty->assign($key, $value);
$outputMain = $this->display(__FILE__, 'dejala_processes.tpl');
}
}
- else if ($currentTab==='prices')
+ elseif ($currentTab==='prices')
{
$products = array();
$djlUtil = new DejalaUtils();
@@ -564,19 +556,20 @@ class Dejala extends CarrierModule
$product['public_price'] = number_format(round($product['price'] + $product['margin'], 2), 2, '.', '');
$product['public_price_notax'] = number_format(round($product['public_price']/$vat_factor, 2), 2, '.', '');
}
- $this->context->smarty->assign('products', $products);
+ $smarty->assign('products', $products);
$outputMain = $this->display(__FILE__, 'dejala_products.tpl');
}
}
- else if ($currentTab === 'accounting')
+ elseif ($currentTab === 'accounting')
{
$smartifyErrors = $this->smartyfyStoreAttributes();
if (isset($smartifyErrors) && count($smartifyErrors))
- $errors = $smartifyErrors;
+ $errors = $smartifyErrors;
$djlUtil = new DejalaUtils();
$deliveries = array();
$responseArray = $djlUtil->getStoreDeliveries($this->dejalaConfig, $deliveries);
+
if ('200'==$responseArray['status'])
{
foreach ($deliveries as &$delivery)
@@ -602,18 +595,18 @@ class Dejala extends CarrierModule
$delivery['delivery_time'] = date('H\hi', $delivery['delivery_utc']);
}
}
- $this->context->smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php');
- $this->context->smarty->assign('defaultDateFrom', date('01/m/Y'));
- $this->context->smarty->assign('defaultDateTo', date('d/m/Y'));
- $this->context->smarty->assign('deliveries', $deliveries);
+ $smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php');
+ $smarty->assign('defaultDateFrom', date('01/m/Y'));
+ $smarty->assign('defaultDateTo', date('d/m/Y'));
+ $smarty->assign('deliveries', $deliveries);
$outputMain = $this->display(__FILE__, 'dejala_deliveries.tpl');
}
}
- else if ($currentTab==='delivery_options')
+ elseif ($currentTab==='delivery_options')
{
$outputMain = $this->displayDeliveryOptions();
}
- else if ($_GET['cat']==='technical_options')
+ elseif ($_GET['cat']==='technical_options')
{
$states = $this->getOrderStates();
$triggers = explode(',', $this->dejalaConfig->trigerringStatuses);
@@ -623,21 +616,21 @@ class Dejala extends CarrierModule
$m_status['id'] = (int)$status['id_order_state'];
$m_status['label'] = $status['name'];
if (in_array($status['id_order_state'], $triggers))
- $m_status['checked'] = '1';
+ $m_status['checked'] = '1';
else
- $m_status['checked'] = '0';
+ $m_status['checked'] = '0';
$orderStatuses[] = $m_status;
}
- $this->context->smarty->assign('statuses', $orderStatuses);
+ $smarty->assign('statuses', $orderStatuses);
- $this->context->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses);
+ $smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses);
$outputMain = $this->display(__FILE__, 'dejala_technical_options.tpl');
}
$outputErr = '';
if (count($errors))
- foreach ($errors AS $err)
- $outputErr .= ''. $err .'
';
+ foreach ($errors AS $err)
+ $outputErr .= ''. $err .'
';
$output = $outputErr;
$output = $output . $outputMenu;
@@ -650,28 +643,31 @@ class Dejala extends CarrierModule
// put in smarty context store attributes
function smartyfyStoreAttributes()
{
+ global $smarty;
+
$errors = array();
$djlUtil = new DejalaUtils();
$storeAttrs = array();
$response = $djlUtil->getStoreAttributes($this->dejalaConfig, $storeAttrs);
if (200 != $response['status'])
- $errors[] = $this->l('An error occurred while getting store, please try again later or contact Dejala.com');
+ $errors[] = $this->l('An error occurred while getting store, please try again later or contact Dejala.com');
else
{
- $this->context->smarty->assign("account_balance", $storeAttrs['account_balance']);
- $this->context->smarty->assign("store_name", $storeAttrs['name']);
+ $smarty->assign("account_balance", $storeAttrs['account_balance']);
+ $smarty->assign("store_name", $storeAttrs['name']);
// Check if account exists in production
$responsePing = $djlUtil->ping($this->dejalaConfig, 'PROD');
- if ('200' == $responsePing['status'])
- $this->context->smarty->assign('isLiveReady', '1');
- else
- {
- $this->context->smarty->assign('isLiveReady', '0');
+ if ('200' == $responsePing['status']) {
+ $smarty->assign('isLiveReady', '1');
+ $smarty->assign('isLiveRequested', '0');
+ }
+ else {
+ $smarty->assign('isLiveReady', '0');
if (isset($storeAttrs['attributes']) && isset($storeAttrs['attributes']['request_live']) && ($storeAttrs['attributes']['request_live']=='true'))
- $this->context->smarty->assign('isLiveRequested', '1');
+ $smarty->assign('isLiveRequested', '1');
else
- $this->context->smarty->assign('isLiveRequested', '0');
+ $smarty->assign('isLiveRequested', '0');
}
}
return ($errors);
@@ -679,47 +675,51 @@ class Dejala extends CarrierModule
function getOrderStates(){
+ global $cookie;
+
$states = OrderState::getOrderStates($this->id_lang);
return ($states);
}
function displayDeliveryOptions(){
- /*
- Au moment du choix du créneau
- Pour déterminer le créneau de départ proposé :
- - Aller sur le prochain créneau libre
- - Ajouter le délai de traitement de la commande
- - Aller sur le prochain créneau libre
+ global $smarty;
- - Le marchand configure l ouverture de sa boutique en weedkay (hStart-hStop) + exception (date fermeture) tous produits confondus
- On fait le min au moment de l afichage des creneaux dispo
- => trouver une slideBar avec deux curseurs
- */
+ /*
+ Au moment du choix du créneau
+ Pour déterminer le créneau de départ proposé :
+ - Aller sur le prochain créneau libre
+ - Ajouter le délai de traitement de la commande
+ - Aller sur le prochain créneau libre
+
+ - Le marchand configure l ouverture de sa boutique en weedkay (hStart-hStop) + exception (date fermeture) tous produits confondus
+ On fait le min au moment de l afichage des creneaux dispo
+ => trouver une slideBar avec deux curseurs
+ */
$output = '';
$djlUtil = new DejalaUtils();
$response = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
if ($response['status'] == 200)
{
- $this->context->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']);
- $this->context->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']);
+ $smarty->assign('nb_days', $store['attributes']['nb_days_displayed']);
+ $smarty->assign('delivery_delay', $store['attributes']['delivery_delay']);
if (isset($store['attributes']['delivery_partial']))
- $this->context->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']);
+ $smarty->assign('delivery_partial', $store['attributes']['delivery_partial']);
}
$wday_selected = array(1, 1, 1, 1, 1, 1, 1);
- $this->context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
- $this->context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
- $this->context->smarty->assign("weekdayLabels", $this->wday_labels);
- $this->context->smarty->assign("weekdaySelected", $wday_selected);
+ // $smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
+ // $smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
+ $smarty->assign("weekdayLabels", $this->wday_labels);
+ $smarty->assign("weekdaySelected", $wday_selected);
$calendar = array();
$response = $djlUtil->getStoreCalendar($this->dejalaConfig, $calendar);
if ($response['status'] == 200)
{
- $this->context->smarty->assign("calendar", $calendar);
- $this->context->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl");
+ $smarty->assign("calendar", $calendar);
+ $smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl");
}
$output = $output . $this->display(__FILE__, 'dejala_delivery_options.tpl');
@@ -728,7 +728,7 @@ class Dejala extends CarrierModule
/**
* Retourne FALSE si un des produits du cart n'est pas en stock, retourne FALSE sinon
- **/
+ **/
function isCartOutOfStock($cart)
{
$products = $cart->getProducts();
@@ -740,19 +740,20 @@ class Dejala extends CarrierModule
$orderedQuantity = (_PS_VERSION_ < "1.3.0.1" ? (int)($product['quantity']) : (int)($product['cart_quantity']));
$productQuantity = (int)($product['stock_quantity']);
if ( ($productQuantity < $orderedQuantity) || ($productQuantity <= 0) )
- return (TRUE);
+ return (TRUE);
}
return (FALSE);
}
-
/**
- ** Affiche le transporteur Dejala.com dans la liste des transporteurs sur le Front Office
- */
+ ** Affiche le transporteur Dejala.com dans la liste des transporteurs sur le Front Office
+ */
public function hookExtraCarrier($params)
{
+ global $smarty, $defaultCountry;
$cart = $params['cart'];
+ $cookie = $params['cookie'];
$this->hooklog("ExtraCarrier", $params);
@@ -760,35 +761,32 @@ class Dejala extends CarrierModule
if ($this->dejalaConfig->visibility_status == "invisible")
return ;
- if (($this->dejalaConfig->visibility_status == "visible_limited") && ((int)$this->context->customer->id > 0))
+ if (($this->dejalaConfig->visibility_status == "visible_limited") && ((int)($cookie->id_customer) > 0))
{
- $customer = $this->context->customer;
+ $customer = new Customer((int)($cookie->id_customer));
if (!in_array($customer->email, preg_split("/[\s,]+/", $this->dejalaConfig->visible_users_list)))
return ;
}
- $djlUtil = new DejalaUtils();
- $responseGetStore = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
- if ($responseGetStore['status']!='200')
- return ;
-
- $isCartOutOfStock = '0';
- if ($this->isCartOutOfStock($cart))
- $isCartOutOfStock = '1';
+ // $djlUtil = new DejalaUtils();
+ // $responseGetStore = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
+ // if ($responseGetStore['status']!='200')
+ // return ;
+ //
+ $isCartOutOfStock = $this->isCartOutOfStock($cart) ;
$this->mylog('isCartOutOfStock=' . $isCartOutOfStock . '');
- $acceptPartial = true;
- if (!isset($store['attributes']) || !isset($store['attributes']['delivery_partial']) || ($store['attributes']['delivery_partial'] != '1'))
- $acceptPartial = false;
- if ( ($isCartOutOfStock == '1') && !$acceptPartial)
- return ;
-
$electedProduct = $this->getDejalaProduct($cart) ;
- // Get id zone
- if (isset($cart->id_address_delivery) AND $cart->id_address_delivery)
- $id_zone = (int)Address::getZoneById((int)($cart->id_address_delivery));
- else
- $id_zone = (int)$this->context->country->id_zone;
+ $this->mylog("product$=" . $this->logValue($electedProduct,1));
+
+ if (is_null($electedProduct)) return "" ;
+
+ $acceptPartial = false;
+ if (isset($electedProduct['store_attributes']) && isset($electedProduct['store_attributes']['delivery_partial']) && ($electedProduct['store_attributes']['delivery_partial'] == '1'))
+ $acceptPartial = true;
+
+ if ($isCartOutOfStock && !$acceptPartial)
+ return ;
$djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ;
@@ -797,166 +795,73 @@ class Dejala extends CarrierModule
if ($djlCarrier == null)
return null ;
- // Calcul des dates dispo
- $productCalendar = $electedProduct['calendar']['entries'];
- // MFR090831 - add picking time : the store is open to (stop_hour - picking time), it is more natural to merchants to set opening hours instead of dejala delivery time
- if ($electedProduct['pickingtime'])
- $pickingtime = (int)($electedProduct['pickingtime']);
- else
- $pickingtime = $electedProduct['timelimit'];
- $djlUtil = new DejalaUtils();
- $storeCalendar = array();
- $calendar = array();
- $response = $djlUtil->getStoreCalendar($this->dejalaConfig, $storeCalendar);
- $this->mylog("productCalendar=" . $this->logValue($productCalendar,1));
- $this->mylog("storeCalendar=" . $this->logValue($storeCalendar,1));
- $this->mylog("response['status']=" . $response['status']);
- if ($response['status'] == 200)
- {
- foreach ($storeCalendar['entries'] as $weekday=>$calEntry)
- {
- if (isset($productCalendar[$weekday]))
- {
- $calendar[$weekday]["weekday"] = $weekday;
- $calendar[$weekday]["start_hour"] = max((int)($productCalendar[$weekday]["start_hour"]), (int)($calEntry["start_hour"]));
- // MFR090831 - manage picking time : the store is open to (stop_hour - picking time)
- $calendar[$weekday]["stop_hour"] = min((int)($productCalendar[$weekday]["stop_hour"]-1), (int)($calEntry["stop_hour"] - $pickingtime));
- if ($calendar[$weekday]["stop_hour"] < $calendar[$weekday]["start_hour"])
- unset($calendar[$weekday]);
+ $dates = $electedProduct['computed_calendar']['entries'] ;
- }
- }
+ // Adjust labels
+ foreach ($dates as $idx => $date) {
+ $dates[$idx]['label'] = $this->wday_labels[date('w', $date['ts'])] . " " . date("j", $date['ts']);
}
- // Calcul de la date de démarrage pour les créneaux :
- // Avancement jusque jour dispo & ouvert
- // Ajout du temps de préparation : 0.5 jour ou 1 nb de jours
- // Ajustement de l'heure sur l'ouverture ou l'heure suivante xxh00
- $deliveryDelay = $store['attributes']['delivery_delay'];
- $skipCurDay = false ;
- $calUtils = new CalendarUtils();
- $all_exceptions = array_merge($storeCalendar['exceptions'], $electedProduct['calendar']['exceptions']);
- $dateUtc = $calUtils->getNextDateAvailable(time(), $calendar, $all_exceptions);
-
- if ($dateUtc == NULL)
- return ;
- if ($deliveryDelay > 0)
- {
- if ($skipCurDay)
- $dateUtc = $calUtils->skipCurDay($dateUtc);
-
- $dateUtc = $calUtils->addDelay($dateUtc, $deliveryDelay, $calendar, $all_exceptions);
- }
-
- if ($dateUtc == NULL)
- return ;
- $dateUtc = $calUtils->adjustHour($dateUtc, $calendar);
- $this->mylog("calendar=" . $this->logValue($calendar,1));
- $this->mylog("starting date=" . $this->logValue(date("d/m/Y - H:i:s", $dateUtc),1));
-
- $today = getDate();
- $ctime = time();
- $nbDeliveryDates = $deliveryDelay = $store['attributes']['nb_days_displayed'];
- $iDate = 0;
- $dates = array();
- $balladUtc = $dateUtc;
-
- do
- {
- $wd = date("w", $balladUtc);
- if ((int)($calendar[$wd]['stop_hour']) < (int)($calendar[$wd]['start_hour'])) continue ;
-
- $dates[$iDate]['value'] = date("Y/m/d", $balladUtc);
- $dates[$iDate]['ts'] = $balladUtc ;
- $dates[$iDate]['label'] = $this->wday_labels[$wd] . " " . date("j", $balladUtc);
- $dates[$iDate]['start_hour'] = (int)($calendar[$wd]['start_hour']);
- $dates[$iDate]['stop_hour'] = (int)($calendar[$wd]['stop_hour']);
- $balladUtc = strtotime(date("Y-m-d", $balladUtc) . " +1 day");
- $balladUtc = mktime(0, 0, 0, date('m', $balladUtc), date('d', $balladUtc), date('Y', $balladUtc));
- $balladUtc = $calUtils->getNextDateAvailable($balladUtc, $calendar, $all_exceptions);
- $iDate++;
- } while (($iDate < $nbDeliveryDates) && ($balladUtc));
- // impossibilité de trouver un jour dispo
- if (!isset($dates[0]))
- return ;
-
- $now = (int)(date("H", $ctime)) ;
- if ((int)($dates[0]['stop_hour']) > $now && (int)($dates[0]['start_hour']) < $now)
- $dates[0]['start_hour'] = $now ;
- elseif ((int)($dates[0]['ts']) == $now && (int)($dates[0]['stop_hour']) < $now)
- array_shift($dates) ;
-
-
$this->mylog("date$=" . $this->logValue($dates,1));
- $this->context->smarty->assign('nb_days', $nbDeliveryDates);
- $this->context->smarty->assign('dates', $dates);
- for ($i=0; $i < 24; $i++)
- {
+ $smarty->assign('nb_days', sizeof($dates));
+ $smarty->assign('dates', $dates);
+ for ($i=0; $i < 24; $i++) {
$endHour = (($i+$electedProduct['timelimit'])%24);
if ($endHour == 0)
- $endHour = 24;
+ $endHour = 24;
$hourLabels[] = $i . 'h-' . $endHour . 'h';
}
- $this->context->smarty->assign('hourLabels', $hourLabels);
+ $smarty->assign('hourLabels', $hourLabels);
- $this->context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
- $this->context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
+ $smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
$this->mylog("electedCarrier->id=" . $this->logValue($djlCarrier->id));
$mCarrier = $djlCarrier;
$row['id_carrier'] = (int)($djlCarrier->id);
$row['name'] = $this->l('Dejala.com');
- $row['delay'] = $this->l('When you want... Dispatch rider') . ', ' . $electedProduct['timelimit'].'H' ;
$row['price'] = $cart->getOrderShippingCost($djlCarrier->id);
$row['price_tax_exc'] = $cart->getOrderShippingCost($djlCarrier->id, false);
$row['img'] = _MODULE_DIR_.$this->name.'/dejala_carrier.gif';
+ if ($isCartOutOfStock) {
+ $row['info'] = $this->l('I will select my shipping date when my product is available.');
+ }
+ else {
+ $row['info'] = $this->l('When you want... Dispatch rider') . ', ' . $electedProduct['timelimit'].'H' ;
+ }
+
$resultsArray[] = $row;
- $this->context->smarty->assign('carriers', $resultsArray);
- $this->context->smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ;
- $this->context->smarty->assign('product', $electedProduct);
+ $smarty->assign('djlCarriers', $resultsArray);
+ $smarty->assign('djlCarrierChecked', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id ? $djlCarrier->id : -1)) ;
+ $smarty->assign('product', $electedProduct);
$djlCart = new DejalaCart($cart->id);
$setDefaultDate = TRUE;
+
+ $smarty->assign("deliveryDateSelected", $dates[0]['value']);
+ $smarty->assign("deliveryHourSelected", $dates[0]['start_hour']);
+
if ($djlCart && isset($djlCart->shipping_date) && !empty($djlCart->shipping_date))
{
$mShippingDate = $djlCart->shipping_date;
$this->mylog("shipping_date=" . $this->logValue($mShippingDate));
- $m_day = date("d", $mShippingDate);
$m_hour = date("H", $mShippingDate);
$deliveryDateSelected = date("Y/m/d", $mShippingDate);
$this->mylog("shipping_date=" . $this->logValue($deliveryDateSelected));
- foreach ($dates as $l_key=>$l_date)
- {
- if ($l_date['value'] == $deliveryDateSelected)
- {
- $this->context->smarty->assign("deliveryDateIndexSelected", $l_key);
- $this->context->smarty->assign("deliveryDateSelected", $deliveryDateSelected);
- $this->context->smarty->assign("deliveryHourSelected", $m_hour);
- $setDefaultDate = FALSE;
- }
- }
- }
- if ($setDefaultDate)
- {
- $this->context->smarty->assign("deliveryDateIndexSelected", 0);
- $this->context->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc));
- $this->context->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc)));
+ $smarty->assign("deliveryDateSelected", $deliveryDateSelected);
+ $smarty->assign("deliveryHourSelected", $m_hour);
+ $setDefaultDate = FALSE;
}
- $this->context->smarty->assign("isCartOutOfStock", $isCartOutOfStock);
- if (!$isCartOutOfStock)
- {
- $buffer = $this->display(__FILE__, 'dejala_carrier.tpl');
- $buffer = $buffer . $this->display(__FILE__, 'dejala_timetable.tpl');
- }
- else
- {
- $this->context->smarty->assign('nostock_info', $this->l('I will select my shipping date when my product is available.'));
- $buffer = $this->display(__FILE__, 'dejala_carrier_nostock.tpl');
- }
+// $smarty->assign('one_page_checkout', (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0)) ;
+
+ $smarty->assign("isCartOutOfStock", $isCartOutOfStock);
+
+ $buffer = $this->display(__FILE__, 'dejala_carrier.tpl');
+ $buffer = $buffer . $this->display(__FILE__, 'dejala_timetable.tpl');
+
return $buffer;
}
@@ -997,9 +902,9 @@ class Dejala extends CarrierModule
if ($response['status'] == 200)
{
if ($l_delivery && $l_delivery['status'] && $l_delivery['status']['labels'] && $l_delivery['status']['labels'][Language::getIsoById((int)$this->id_lang)])
- echo $this->l('Order') . ' ' . $l_delivery['status']['labels'][Language::getIsoById((int)$this->id_lang)].'
|
-
+
|
|
- {$carrier.delay|escape:'htmlall':'UTF-8'} |
+ {$carrier.info|escape:'htmlall':'UTF-8'} |
{if $carrier.price}
diff --git a/modules/dejala/dejala_carrier_nostock.tpl b/modules/dejala/dejala_carrier_nostock.tpl
index 831bc51d0..bf76b9912 100644
--- a/modules/dejala/dejala_carrier_nostock.tpl
+++ b/modules/dejala/dejala_carrier_nostock.tpl
@@ -1,9 +1,9 @@
- {foreach from=$carriers item=carrier name=myLoop}
+ {foreach from=$djlCarriers item=carrier name=myLoop}
|
-
+
|
| |