diff --git a/classes/Order.php b/classes/Order.php index 2f715bff..1b195a55 100755 --- a/classes/Order.php +++ b/classes/Order.php @@ -184,7 +184,7 @@ class OrderCore extends ObjectModel /* MySQL does not allow 'order' for a table name */ protected $table = 'orders'; protected $identifier = 'id_order'; - protected $_taxCalculationMethod = PS_TAX_EXC; + protected $_taxCalculationMethod = PS_TAX_EXC; protected static $_historyCache = array(); @@ -449,9 +449,9 @@ class OrderCore extends ObjectModel if ($row['group_reduction'] > 0) { if ($this->_taxCalculationMethod == PS_TAX_EXC) - $row['product_price'] = $row['product_price'] * $group_reduction; + $row['product_price'] = $row['product_price'] * $group_reduction; else - $row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] * $group_reduction , 2); + $row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] * $group_reduction , 2); } if (($row['reduction_percent'] OR $row['reduction_amount'] OR $row['group_reduction']) AND $this->_taxCalculationMethod == PS_TAX_EXC) @@ -526,7 +526,7 @@ class OrderCore extends ObjectModel /** * Check if order contains (only) virtual products - * + * * @param boolean $strict If false return true if there are at least one product virtual * @return boolean true if is a virtual order or false * @@ -922,7 +922,7 @@ class OrderCore extends ObjectModel // I use mysql 4, I can't make sub query in FROM $number = Order::getLastInvoiceNumber() + 1; } - else + else $number = '(SELECT `invoice_number` FROM ( SELECT MAX(`invoice_number`) + 1 AS `invoice_number` diff --git a/controllers/OrderDetailController.php b/controllers/OrderDetailController.php index 22f0037c..61cefc1b 100755 --- a/controllers/OrderDetailController.php +++ b/controllers/OrderDetailController.php @@ -145,7 +145,7 @@ class OrderDetailControllerCore extends FrontController 'messages' => Message::getMessagesByOrderId((int)($order->id)), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, - 'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'), + 'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'), 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC), 'customizedDatas' => $customizedDatas)); diff --git a/mails/en/in_transit_dropshipping_noinfo.html b/mails/en/in_transit_dropshipping_noinfo.html new file mode 100644 index 00000000..4c03ad46 --- /dev/null +++ b/mails/en/in_transit_dropshipping_noinfo.html @@ -0,0 +1,51 @@ + + + + + Message de {shop_name} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {shop_name} +
 
Bonjour {firstname} {lastname},
 
+ Vous avez passé commande récemment sur notre site Bébé Boutik. + Nous vous informons que le/les produits de la marque {sale} pour votre commande n°{id_order} vient d'être envoyé directement de chez notre fournisseur. +
 
+ Vous recevrez votre commande prochainement. +
 
+ A très vite sur Bébé Boutik ! +
 
+ Cordialement, +
 
+ {shop_name} - {shop_url} +
+ + diff --git a/mails/en/in_transit_dropshipping_noinfo.txt b/mails/en/in_transit_dropshipping_noinfo.txt new file mode 100644 index 00000000..7848e820 --- /dev/null +++ b/mails/en/in_transit_dropshipping_noinfo.txt @@ -0,0 +1,11 @@ +Bonjour {firstname} {lastname} + +Vous avez passé commande récemment sur notre site Bébé Boutik. Nous vous informons que le/les produits de la marque {sale} pour votre commande n°{id_order} vient d'être envoyé directement de chez notre fournisseur. + +Vous recevrez votre commande prochainement. + +A très vite sur Bébé Boutik ! + +Cordialement, + +{shop_name} - {shop_url} \ No newline at end of file diff --git a/mails/es/in_transit_dropshipping_noinfo.html b/mails/es/in_transit_dropshipping_noinfo.html new file mode 100644 index 00000000..0d6bcc76 --- /dev/null +++ b/mails/es/in_transit_dropshipping_noinfo.html @@ -0,0 +1,44 @@ + + + + + Message de {shop_name} + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {shop_name} +
 
Buenos días {firstname} {lastname},,
 
+ Te informamos de que el/los producto(s) de la marca {sale} de tu pedido nº{id_order}, te los ha enviado directamente el proveedor a la dirección que nos has indicado. +
 
+ Recibirás tu pedido en breve. +
 
+ ¡Hasta pronto! ¡Nos vemos en Bébé Boutik! +
 
+ {shop_name} - {shop_url} +
+ + diff --git a/mails/es/in_transit_dropshipping_noinfo.txt b/mails/es/in_transit_dropshipping_noinfo.txt new file mode 100644 index 00000000..c8875f67 --- /dev/null +++ b/mails/es/in_transit_dropshipping_noinfo.txt @@ -0,0 +1,11 @@ +Buenos días {firstname} {lastname}, + +Recientemente has pasado pedido en Bébé Boutik y te damos las gracias. + +Te informamos de que el/los producto(s) de la marca {sale} de tu pedido nº{id_order}, te los ha enviado directamente el proveedor a la dirección que nos has indicado. + +Recibirás tu pedido en breve. + +¡Hasta pronto! ¡Nos vemos en Bébé Boutik! + +{shop_name} - {shop_url} \ No newline at end of file diff --git a/mails/fr/in_transit_dropshipping.html b/mails/fr/in_transit_dropshipping.html index 2555ba4c..97c0fb29 100755 --- a/mails/fr/in_transit_dropshipping.html +++ b/mails/fr/in_transit_dropshipping.html @@ -18,7 +18,8 @@   - Vous avez passé commande récemment sur notre site Bébé Boutik. Nous vous informons que le/les produits de la marque {sale} pour votre commande n°{id_order} vient d'être envoyé directement de chez notre fournisseur par le transporteur {carrier}. + Vous avez passé commande récemment sur notre site Bébé Boutik. + Nous vous informons que le/les produits de la marque {sale} pour votre commande n°{id_order} vient d'être envoyé directement de chez notre fournisseur par le transporteur {carrier}.   @@ -30,7 +31,7 @@   - Vous pourrez consulter l'acheminnement de votre colis à l'adresse suivante : {followup} + Vous pourrez consulter l'acheminement de votre colis à l'adresse suivante : {followup}   diff --git a/mails/fr/in_transit_dropshipping.txt b/mails/fr/in_transit_dropshipping.txt index aa19ec1b..5e2c07d3 100755 --- a/mails/fr/in_transit_dropshipping.txt +++ b/mails/fr/in_transit_dropshipping.txt @@ -4,7 +4,7 @@ Vous avez passé commande récemment sur notre site Bébé Boutik. Nous vous inf Voici votre numéro de suivi : {tracking_number} -Vous pourrez consulter l'acheminnement de votre colis à l'adresse suivante : {followup} +Vous pourrez consulter l'acheminement de votre colis à l'adresse suivante : {followup} A très vite sur Bébé Boutik ! diff --git a/mails/fr/in_transit_dropshipping_noinfo.html b/mails/fr/in_transit_dropshipping_noinfo.html new file mode 100644 index 00000000..4c03ad46 --- /dev/null +++ b/mails/fr/in_transit_dropshipping_noinfo.html @@ -0,0 +1,51 @@ + + + + + Message de {shop_name} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {shop_name} +
 
Bonjour {firstname} {lastname},
 
+ Vous avez passé commande récemment sur notre site Bébé Boutik. + Nous vous informons que le/les produits de la marque {sale} pour votre commande n°{id_order} vient d'être envoyé directement de chez notre fournisseur. +
 
+ Vous recevrez votre commande prochainement. +
 
+ A très vite sur Bébé Boutik ! +
 
+ Cordialement, +
 
+ {shop_name} - {shop_url} +
+ + diff --git a/mails/fr/in_transit_dropshipping_noinfo.txt b/mails/fr/in_transit_dropshipping_noinfo.txt new file mode 100644 index 00000000..7848e820 --- /dev/null +++ b/mails/fr/in_transit_dropshipping_noinfo.txt @@ -0,0 +1,11 @@ +Bonjour {firstname} {lastname} + +Vous avez passé commande récemment sur notre site Bébé Boutik. Nous vous informons que le/les produits de la marque {sale} pour votre commande n°{id_order} vient d'être envoyé directement de chez notre fournisseur. + +Vous recevrez votre commande prochainement. + +A très vite sur Bébé Boutik ! + +Cordialement, + +{shop_name} - {shop_url} \ No newline at end of file diff --git a/modules/ant_dropshippingtracking/AdminAntDropshippingtracking.php b/modules/ant_dropshippingtracking/AdminAntDropshippingtracking.php index 1409c971..4c800cd9 100644 --- a/modules/ant_dropshippingtracking/AdminAntDropshippingtracking.php +++ b/modules/ant_dropshippingtracking/AdminAntDropshippingtracking.php @@ -1,9 +1,10 @@ _html = ''; + + if ($id_sale = Tools::getValue('id_sale')) { + // Selection des produits de la vente $errors = 0; - $id_sale = (int)Tools::getValue('id_sale'); $sale_names = array(); foreach(Db::getInstance()->ExecuteS(' SELECT c.`name`, c.`id_lang` @@ -41,41 +45,114 @@ class AdminAntDropshippingtracking extends AdminTab ') as $key => $row) { $sale_products[(int)$row['id_product']] = (int)$row['id_product']; } - - if(isset($_FILES['csvfile']) && $_FILES['csvfile']['name'] != '') { - + + $infosTrackingEnable = $infosTrackingDisable = 0; + // Fichier avec infos tracking + if (Tools::isSubmit('submitOrderTracking')) { + $infosTrackingEnable = 1; + } + // Fichier sans infos de tracking + if (Tools::isSubmit('submitOrderTrackingNull')) { + $infosTrackingDisable = 1; + } + + // Gestion du fichier CSV + $orders = array(); + if (isset($_FILES['csvfile']) && $_FILES['csvfile']['name'] != '') { + $cols = array( + 'id_order', + 'tracking_number', + 'carrier', + 'link', + ); + $i = 0; $f = fopen($_FILES['csvfile']['tmp_name'], 'r'); - fgetcsv($f, 0, ';'); - $i = 1; - - $orders = array(); - while($line = fgetcsv($f, 0, ';')) { + while ($data = fgetcsv($f, 0, ';')) { $i++; - $orders[(int) $line[0]] = array( - 'id_order' => (int) $line[0], - 'tracking_number' => trim($line[1]), - 'carrier' => $line[2], - 'link' => trim($line[3]), + if ($i == 1) { + continue; + } + + // Get Data + $num = count($data); + + // Check line integrity + if ($num != count($cols)) { + $orders = array(); + break; + } + + // Assign var + $line = array(); + for ($c=0; $c<$num; $c++) { + $name = $cols[$c]; + switch ($name) { + case 'tracking_number': + case 'link'; + $line[$name] = trim($data[$c]); + break; + default: + $line[$name] = $data[$c]; + break; + } + + } + + // Vérification des données + if ($infosTrackingDisable == 1) { + if ($line['tracking_number'] != ''){ + $orders = array(); + break; + } + if ($line['link'] != ''){ + $orders = array(); + break; + } + } + if ($infosTrackingEnable == 1) { + if ($line['tracking_number'] == ''){ + $orders = array(); + break; + } + if ($line['link'] == ''){ + $orders = array(); + break; + } + } + + // Assign orders + $orders[(int) $line['id_order']] = array( + 'id_order' => (int)$line['id_order'], + 'tracking_number' => $line['tracking_number'], + 'carrier' => $line['carrier'], + 'link' => $line['link'], ); } - if(!empty($orders)) { - foreach ($orders as $id_order => $o) { - if($id_order != 0){ - $order = new Order((int)$id_order); - if(Validate::isLoadedObject($order)) { - $order_details = array(); - foreach(Db::getInstance()->ExecuteS(' - SELECT DISTINCT `id_order_detail`, `product_name`,`product_id`, `product_attribute_id`, `product_quantity` - GREATEST(`product_quantity_return`, `product_quantity_refunded`) AS `quantity` - FROM `'._DB_PREFIX_.'order_detail` - WHERE `id_order` = '.(int) $id_order.' - ') as $key => $row) { - $order_details[(int)$row['id_order_detail']] = $row; - } - - $fully_sent = false; - $products_sent = array(); - - foreach(Db::getInstance()->ExecuteS(' + } + else { + $this->_html .= HelperFormBootstrap::displayErrors($this->l('Fichier manquant !')); + } + + // Traitement des commandes + if (count($orders) > 0) { + foreach ($orders as $id_order => $o) { + if ($id_order != 0) { + $order = new Order((int)$id_order); + if (Validate::isLoadedObject($order)) { + $order_details = array(); + foreach (Db::getInstance()->ExecuteS(' + SELECT DISTINCT `id_order_detail`, `product_name`,`product_id`, `product_attribute_id`, `product_quantity` - GREATEST(`product_quantity_return`, `product_quantity_refunded`) AS `quantity` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `id_order` = '.(int) $id_order.' + ') as $key => $row) { + $order_details[(int)$row['id_order_detail']] = $row; + } + + $fully_sent = false; + + // Calcul des produits déjà envoyés par LaPoste + $products_sent = array(); + foreach (Db::getInstance()->ExecuteS(' SELECT d.`id_order_detail`, IF( (d.`product_quantity` - IF( d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded` @@ -87,12 +164,13 @@ class AdminAntDropshippingtracking extends AdminTab WHERE d.`id_order` = '.(int) $order->id.' GROUP BY d.`id_order_detail` ') as $quantity_remain) { - if((int) $quantity_remain['remain'] == 0) { - $products_sent[] = (int) $quantity_remain['id_order_detail']; - } + if ((int) $quantity_remain['remain'] == 0) { + $products_sent[] = (int) $quantity_remain['id_order_detail']; } - - foreach(Db::getInstance()->ExecuteS(' + } + + // Calcul des produits déjà envoyé Exapaq + foreach (Db::getInstance()->ExecuteS(' SELECT d.`id_order_detail`, IF( (d.`product_quantity` - IF( d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded` @@ -104,12 +182,13 @@ class AdminAntDropshippingtracking extends AdminTab WHERE d.`id_order` = '.(int) $order->id.' GROUP BY d.`id_order_detail` ') as $quantity_remain) { - if((int) $quantity_remain['remain'] == 0) { - $products_sent[] = (int) $quantity_remain['id_order_detail']; - } + if ((int) $quantity_remain['remain'] == 0) { + $products_sent[] = (int) $quantity_remain['id_order_detail']; } - - foreach(Db::getInstance()->ExecuteS(' + } + + // Calcul des produits déjà envoyé MondialRelay + foreach (Db::getInstance()->ExecuteS(' SELECT d.`id_order_detail`, IF( (d.`product_quantity` - IF( d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded` @@ -121,12 +200,13 @@ class AdminAntDropshippingtracking extends AdminTab WHERE d.`id_order` = '.(int) $order->id.' GROUP BY d.`id_order_detail` ') as $quantity_remain) { - if((int) $quantity_remain['remain'] == 0) { - $products_sent[] = (int) $quantity_remain['id_order_detail']; - } + if ((int) $quantity_remain['remain'] == 0) { + $products_sent[] = (int) $quantity_remain['id_order_detail']; } - - foreach(Db::getInstance()->ExecuteS(' + } + + // Calcul des produits déjà envoyé Philea + foreach (Db::getInstance()->ExecuteS(' SELECT d.`id_order_detail`, IF( (d.`product_quantity` - IF( d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded` @@ -138,12 +218,13 @@ class AdminAntDropshippingtracking extends AdminTab WHERE d.`id_order` = '.(int) $order->id.' GROUP BY d.`id_order_detail` ') as $quantity_remain) { - if((int) $quantity_remain['remain'] == 0) { - $products_sent[] = (int) $quantity_remain['id_order_detail']; - } + if ((int) $quantity_remain['remain'] == 0) { + $products_sent[] = (int) $quantity_remain['id_order_detail']; } - - foreach(Db::getInstance()->ExecuteS(' + } + + // Calcul des produits déjà envoyé Dropshipping + foreach (Db::getInstance()->ExecuteS(' SELECT d.`id_order_detail`, IF( (d.`product_quantity` - IF( d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded` @@ -155,17 +236,21 @@ class AdminAntDropshippingtracking extends AdminTab WHERE d.`id_order` = '.(int) $order->id.' GROUP BY d.`id_order_detail` ') as $quantity_remain) { - if((int) $quantity_remain['remain'] == 0) { - $products_sent[] = (int) $quantity_remain['id_order_detail']; - } + if ((int) $quantity_remain['remain'] == 0) { + $products_sent[] = (int) $quantity_remain['id_order_detail']; } - $remaining = array(); - $html_products_sent = ''; - foreach($order_details as $id_order_detail => $d) { - if(!in_array($id_order_detail, $products_sent) && !in_array($d['product_id'],$sale_products)) { - $remaining[] = (int)$id_order_detail; - } elseif(!in_array($id_order_detail, $products_sent) && in_array((int)$d['product_id'],$sale_products)) { - $html_products_sent .= '
'."\r\n".$d['quantity'] . 'x' . ' ' . $p['product_name']; + } + + $remaining = array(); + foreach($order_details as $id_order_detail => $d) { + // Calcul des produits restant + if (!in_array($id_order_detail, $products_sent) && !in_array($d['product_id'], $sale_products)) { + $remaining[] = (int)$id_order_detail; + } + // Marquage envoi + elseif (!in_array($id_order_detail, $products_sent) && in_array((int)$d['product_id'],$sale_products)) { + + if ($infosTrackingEnable == 1) { Db::getInstance()->ExecuteS(' INSERT INTO `'._DB_PREFIX_.'ant_dropshipping_parcel` VALUES ( @@ -178,14 +263,51 @@ class AdminAntDropshippingtracking extends AdminTab ) '); } + + if ($infosTrackingDisable == 1) { + // Supprimer tracking_number et link + Db::getInstance()->ExecuteS(' + INSERT INTO `'._DB_PREFIX_.'ant_dropshipping_parcel` + VALUES ( + '.(int) $id_order_detail.', + '.(int) $d['quantity'].', + "", + "NOTRACKING", + "", + NOW() + ) + '); + } } - - if(count($remaining) == 0) { - $fully_sent = true; - } else { - $fully_sent = false; - } - + } + + if (count($remaining) == 0) { + $fully_sent = true; + } else { + $fully_sent = false; + } + + $history = new OrderHistory(); + $history->id_order = (int) $order->id; + $history->changeIdOrderState(($fully_sent ? Configuration::get('PS_OS_SHIPPING') : 17), (int) $order->id); + $history->id_employee = 0; + $history->add(); + + // Send Mail with tracking info + if ($infosTrackingEnable == 1) { + Db::getInstance()->ExecuteS(' + INSERT INTO `'._DB_PREFIX_.'shipping_history` + VALUES ( + '.(int) $order->id.', + "'.pSQL($o['tracking_number']).'", + NOW(), + 0, + '.(int)$id_sale.' + ) + '); + + global $_LANGMAIL; + $subject = 'Package in transit'; $customer = new Customer((int) $order->id_customer); $templateVars = array( '{followup}' => $o['link'], @@ -195,59 +317,59 @@ class AdminAntDropshippingtracking extends AdminTab '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{id_order}' => (int) $order->id, - // '{product_list}' => !empty($html_products_sent)? $content_html.$html_products_sent: '', - // '{product_list_txt}' => !empty($html_products_sent)? $content_txt.strip_tags($html_products_sent): '', ); - - $history = new OrderHistory(); - $history->id_order = (int) $order->id; - $history->changeIdOrderState(($fully_sent? Configuration::get('PS_OS_SHIPPING'): 17), (int) $order->id); - $history->id_employee = 0; - $history->add(); - - Db::getInstance()->ExecuteS(' - INSERT INTO `'._DB_PREFIX_.'shipping_history` - VALUES ( - '.(int) $order->id.', - "'.pSQL($o['shipping_number']).'", - NOW(), - 0, - '.(int)$id_sale.' - ) - '); - - global $_LANGMAIL; - $subject = 'Package in transit'; - if(!Mail::Send(intval($order->id_lang), 'in_transit_dropshipping', ((is_array($_LANGMAIL) && key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname)){ - $errors++; + if (!Mail::Send(intval($order->id_lang), 'in_transit_dropshipping', + ((is_array($_LANGMAIL) && key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject), + $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname)) { + $errors++; } } + + // Send Mail without tracking info + if ($infosTrackingDisable == 1) { + $subject = 'Package in transit'; + $customer = new Customer((int) $order->id_customer); + $templateVars = array( + '{sale}' => $sale_names[(int)$order->id_lang], + '{firstname}' => $customer->firstname, + '{lastname}' => $customer->lastname, + '{id_order}' => (int) $order->id, + ); + if (!Mail::Send(intval($order->id_lang), 'in_transit_dropshipping_noinfo', + ((is_array($_LANGMAIL) && key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject), + $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname)) { + $errors++; + } + } + } + + if ($errors == 0) { + $this->_html .= HelperFormBootstrap::displaySuccess($this->l('Fichier importé avec succès !')); + } else { + $this->_html .= HelperFormBootstrap::displayErrors($this->l($errors.' mails n\'ont pas pu être envoyés')); } } - if(!isset($_COOKIE['logistics_sales'])){ - setcookie('logistics_sales', $id_sale, 0, __PS_BASE_URI__); - } else { - $sales = explode('-', $_COOKIE['logistics_sales']); - if(!in_array($id_sale,$sales)){ - $sales[] = $id_sale; - } - setcookie('logistics_sales', implode('-', $sales), 0, __PS_BASE_URI__); - } - if($errors==0){ - $this->_html .= HelperFormBootstrap::displaySuccess($this->l('Fichier importé avec succès !')); - } else { - $this->_html .= HelperFormBootstrap::displayErrors($this->l($errors.' mails n\'ont pas pu être envoyés')); - } - } else { - $this->_html .= HelperFormBootstrap::displayErrors($this->l('Aucune commande trouvée, vérifier votre fichier')); } - } else { - $this->_html .= HelperFormBootstrap::displayErrors($this->l('Fichier manquant !')); + + // Cookie + if (!isset($_COOKIE['logistics_sales'])){ + setcookie('logistics_sales', $id_sale, 0, __PS_BASE_URI__); + } else { + $sales = explode('-', $_COOKIE['logistics_sales']); + if(!in_array($id_sale,$sales)){ + $sales[] = $id_sale; + } + setcookie('logistics_sales', implode('-', $sales), 0, __PS_BASE_URI__); + } + } + else { + $this->_html .= HelperFormBootstrap::displayErrors($this->l('Aucune commande trouvée, vérifier votre fichier')); } } } - public function display() { + public function display() + { global $cookie, $currentIndex; $base_link = $currentIndex . '&token='.Tools::getAdminTokenLite('AdminAntDropshippingtracking'); @@ -287,10 +409,12 @@ class AdminAntDropshippingtracking extends AdminTab
-
'; +
'; $help = '

'.$this->l('Format: id_order;tracking_number;carrier;tracking_link').'

'.$this->l('The subsequent columns and the first line are ignored.').'

+

'.$this->l('With tracking infos, all columns must be set.').'

+

'.$this->l('Without tracking infos, use the same format but columns tracking_number, carrier and tracking_link must be empty.').'

'; $input = array( 'label' => $this->l('Sale: '), @@ -313,13 +437,15 @@ class AdminAntDropshippingtracking extends AdminTab
- + +
- '; + + '; $this->_html .= $helperForm->renderScript(); diff --git a/modules/logistics/ajax.php b/modules/logistics/ajax.php index c4b70cfa..2bcb431c 100644 --- a/modules/logistics/ajax.php +++ b/modules/logistics/ajax.php @@ -163,7 +163,7 @@ if(($id_order = (int) Tools::getValue('id_order')) // Image $p['id_image'] = 0; - if((int) $p['product_attribute_id'] != 0) { + if ((int) $p['product_attribute_id'] != 0) { $img = Db::getInstance()->getRow(' SELECT `id_image` FROM `'._DB_PREFIX_.'product_attribute_image` @@ -173,7 +173,7 @@ if(($id_order = (int) Tools::getValue('id_order')) $p['id_image'] = $img['id_image']; } - if($p['id_image'] == 0) { + if ($p['id_image'] == 0) { $img = Db::getInstance()->getRow(' SELECT `id_image` FROM `'._DB_PREFIX_.'image` @@ -257,12 +257,12 @@ if(($id_order = (int) Tools::getValue('id_order')) $shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"'; } - if(((int) $p['product_quantity_sent'] === 0) && Db::getInstance()->getRow(' + if (((int) $p['product_quantity_sent'] === 0) && Db::getInstance()->getRow(' SELECT h.`id_sale` FROM `'._DB_PREFIX_.'shipping_history` h - WHERE h.`id_sale` = '.((int) $p['id_sale'] === 999999 ? 0: (int) $p['id_sale']).' + WHERE h.`id_sale` = '.((int) $p['id_sale'] === 999999 ? 0 : (int) $p['id_sale']).' AND h.`id_order` = '.(int) $order->id.' - '.(count($shipping_numbers) > 0? 'AND h.`shipping_number` NOT IN ('.implode(', ', $shipping_numbers).')': '').' + '.(count($shipping_numbers) > 0 ? 'AND h.`shipping_number` NOT IN ('.implode(', ', $shipping_numbers).')': '').' ')) { $p['product_quantity_sent'] = $p['product_quantity'] - ( $p['product_quantity_return'] > 0 ? $p['product_quantity_return']: $p['product_quantity_refunded'] );