'SO à domicile', 'RDV' => 'SO sur RDV', 'BPR' => 'SO en bureau de poste', 'ACP' => 'SO en agence ColiPoste', 'CDI' => 'SO en centre de distribution', 'A2P' => 'SO en commerce de proximité', 'MRL' => 'SO à domicile (+?)', 'CIT' => 'SO en espace Cityssimo', 'DOS' => 'SO à domicile contre signature', 'COLI' => 'Colissimo Expert Inter', 'COL' => 'Colissimo Expert France', 'COM' => 'Colissimo Access OM', 'COLD' => 'Colissimo Access France', 'COE' => 'Colissimo Eco OM', 'CORE' => 'Colissimo Service France', 'CDS' => 'Colissimo Expert OM', 'COP' => 'Colissimo Expert Interne', ); $mr_modes = array( '24R' => '24R : Livraison dans un Point Relais', '24L' => '24L : Livraison dans un Point Relais XL', '24X' => '24X : Livraison dans un Point Relais XXL', 'DRI' => 'DRI : Livraison Colis Drive', 'LD1' => 'LD1 : Livraison à domicile RDC (1 personne)', 'LDS' => 'LDS : Livraison à domicile spécialisée (2 personnes)', 'HOM' => 'HOM : Livraison à domicile spécialisée', ); function stripaccents($str) { return preg_replace( '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);~i', '$1', htmlentities($str, ENT_NOQUOTES, 'UTF-8') ); } $mr_carriers = array_map('intval',explode(',', Configuration::get('ANT_CARRIERS_MR'))); $laposte_carriers = array_map('intval',explode(',', Configuration::get('ANT_CARRIERS_SOCOL'))); $ooh = array_map('intval',explode(',', Configuration::get('ANT_CARRIERS_OOH'))); if(($id_order = (int) Tools::getValue('id_order')) && (Tools::getValue('token') === Tools::getAdminToken('AdminAntLogistic'.(int) Tab::getIdFromClassName('AdminAntLogistic').(int) Tools::getValue('id_employee')))) { $profile = Tools::getValue('id_profile'); $order = new Order($id_order); if(Validate::isLoadedObject($order)) { $locked_products = array(); $_locked_products = Configuration::get('LOGISTICS_LOCK'); if($_locked_products === FALSE || $_locked_products == 0 || $_locked_products == 's:8:"s:1:"0"' || empty($_locked_products)) { $_locked_products = serialize(array()); } foreach(unserialize($_locked_products) as $id_s) { $_s = new Sale($id_s); foreach($_s->getProducts() as $p) { $locked_products[] = $p; } } $sales_list = array(); if(isset($_COOKIE['logistics_sales'])) { foreach(explode('-', $_COOKIE['logistics_sales']) as $chunk) { $sales_list[] = (int) $chunk; } } $customer = Db::getInstance()->getRow(' SELECT `firstname`, `lastname`, `email` FROM `'._DB_PREFIX_.'customer` WHERE `id_customer` = '.(int) $order->id_customer.' '); $delivery_infos_laposte = FALSE; $delivery_infos_exapaq = FALSE; $delivery_infos_mr = FALSE; if($order->id_carrier == Configuration::get('SOCOLISSIMO_CARRIER_ID')) { $delivery_infos_laposte = Db::getInstance()->getRow(' SELECT i.*, cl.`name` AS `country_name` FROM `'._DB_PREFIX_.'socolissimo_delivery_info` i LEFT JOIN `'._DB_PREFIX_.'country` c ON i.`cecountry` = c.`iso_code` LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON c.`id_country` = cl.`id_country` WHERE i.`id_cart` = '.(int) $order->id_cart.' AND cl.`id_lang` = 2 '); } elseif(in_array((int) $order->id_carrier, $mr_carriers)) { // MondialRelay $delivery_infos_mr = Db::getInstance()->getRow(' SELECT mr_s.*, mr_m.*, cl.`name` AS `country_name` FROM `'._DB_PREFIX_.'mr_selected` mr_s LEFT JOIN `'._DB_PREFIX_.'country` c ON (mr_s.`MR_Selected_Pays` = c.`iso_code`) LEFT JOIN `'._DB_PREFIX_.'mr_method` mr_m ON (mr_m.`id_mr_method` = mr_s.`id_method`) LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`) WHERE mr_s.`id_cart` = '.(int) $order->id_cart.' AND cl.`id_lang` = 2 '); if(!$delivery_infos_mr || empty($delivery_infos_mr)) { $delivery_infos_mr = Db::getInstance()->getRow(' SELECT * FROM `'._DB_PREFIX_.'mr_selected` s INNER JOIN `'._DB_PREFIX_.'mr_method` m ON (m.`id_mr_method` = s.`id_method`) WHERE s.`id_cart` = '.(int) $order->id_cart.' '); } } $delivery_infos_exapaq = Db::getInstance()->getRow(' SELECT * FROM `'._DB_PREFIX_.'icirelais_selected` WHERE `id_cart` = '.(int) $order->id_cart.' '); $status = Db::getInstance()->getRow(' SELECT `name` FROM `'._DB_PREFIX_.'order_state_lang` WHERE `id_order_state` = '.(int) $order->getCurrentState().' AND `id_lang` = 2 '); $locations = array(); foreach(Db::getInstance()->ExecuteS(' SELECT d.`product_id`, d.`product_attribute_id`, IF(IFNULL(a.`location`, "") = "", p.`location`, a.`location`) AS `location` FROM `'._DB_PREFIX_.'order_detail` d LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = d.`product_id` LEFT JOIN `'._DB_PREFIX_.'product_attribute` a ON a.`id_product_attribute` = d.`product_attribute_id` WHERE d.`id_order` = '.(int) $order->id.' ') as $row) { $locations[(int) $row['product_id'].'-'.(int) $row['product_attribute_id']] = $row['location']; } $invoice_address = new Address($order->id_address_invoice); $delivery_address = new Address($order->id_address_delivery); $france_address_error = FALSE; $france_address_suggestions = array(); $id_order_details = array(); $sales_carriers = array(); $link = new Link(2); $products = array(); foreach($order->getProductsDetail() as $p) { // --- Get quantity sent $p['product_quantity_sent'] = 0; // LaPoste $p['product_quantity_sent'] += (int) Db::getInstance()->getValue(' SELECT IFNULL(SUM(`quantity`), 0) FROM `'._DB_PREFIX_.'lapostews` WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] ); // Exapaq $p['product_quantity_sent'] += (int) Db::getInstance()->getValue(' SELECT IFNULL(SUM(`quantity`), 0) FROM `'._DB_PREFIX_.'exapaqws` WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] ); // MondialRelay $p['product_quantity_sent'] += (int) Db::getInstance()->getValue(' SELECT IFNULL(SUM(`quantity`), 0) FROM `'._DB_PREFIX_.'mondialrelay_parcel` WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] ); // Philea $p['product_quantity_sent'] += (int) Db::getInstance()->getValue(' SELECT IFNULL(SUM(`quantity`), 0) FROM `'._DB_PREFIX_.'philea_parcel` WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] ); // DropShipping $p['product_quantity_sent'] += (int) Db::getInstance()->getValue(' SELECT IFNULL(SUM(`quantity`), 0) FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] ); // Image $p['id_image'] = 0; if ((int) $p['product_attribute_id'] != 0) { $img = Db::getInstance()->getRow(' SELECT `id_image` FROM `'._DB_PREFIX_.'product_attribute_image` WHERE `id_product_attribute` = '.(int) $p['product_attribute_id'].' '); $p['id_image'] = $img['id_image']; } if ($p['id_image'] == 0) { $img = Db::getInstance()->getRow(' SELECT `id_image` FROM `'._DB_PREFIX_.'image` WHERE `cover` = 1 AND `id_product` = '.(int) $p['product_id'].' '); $p['id_image'] = $img['id_image']; } $p['image'] = '//'.$link->getImageLink('image', $p['product_id'].'-'.$p['id_image'], 'home'); $p['id_shipping'] = 1; $p['id_sale'] = (int) Db::getInstance()->getValue(' SELECT `id_sale` FROM `'._DB_PREFIX_.'product_ps_cache` WHERE `id_product` = '.(int) $p['product_id'].' '); $p['is_pending'] = Db::getInstance()->getValue(' SELECT COUNT(id_product) FROM `'._DB_PREFIX_.'logistics_pending` WHERE `id_product` = '.(int) $p['product_id'].' AND id_order = '.(int)$id_order ); if (!isset($sales_carriers[(int) $p['id_sale']])) { $sales_carriers[(int) $p['id_sale']] = array(); foreach(Db::getInstance()->ExecuteS(' SELECT `id_carrier` FROM `'._DB_PREFIX_.'privatesale_carrier` WHERE `id_sale` = '.(int) $p['id_sale'].' ') as $row) { $sales_carriers[(int) $p['id_sale']][] = (int) $row['id_carrier']; } } $p['carriers'] = $sales_carriers[(int) $p['id_sale']]; // --- Get Shipping Numbers $shipping_numbers = array(); // Philea foreach (Db::getInstance()->ExecuteS(' SELECT l.`shipping_number` FROM `'._DB_PREFIX_.'philea_parcel` l LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = l.`id_order_detail`) LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`) WHERE h.`id_order` = '.(int) $order->id.' ') as $row) { $shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"'; } // LaPoste foreach (Db::getInstance()->ExecuteS(' SELECT l.`shipping_number` FROM `'._DB_PREFIX_.'lapostews` l LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = l.`id_order_detail`) LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`) WHERE h.`id_order` = '.(int) $order->id.' ') as $row) { $shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"'; } // Exapaq foreach (Db::getInstance()->ExecuteS(' SELECT e.`shipping_number` FROM `'._DB_PREFIX_.'exapaqws` e LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = e.`id_order_detail`) LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`) WHERE h.`id_order` = '.(int) $order->id.' ') as $row) { $shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"'; } // MondialRelay foreach (Db::getInstance()->ExecuteS(' SELECT l.`shipping_number` FROM `'._DB_PREFIX_.'mondialrelay_parcel` l LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = l.`id_order_detail`) LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`) WHERE h.`id_order` = '.(int) $order->id.' ') as $row) { $shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"'; } if ((int)$p['product_quantity_sent'] === 0) { if (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']).' AND h.`id_order` = '.(int) $order->id.' '.(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'] ); } } /* Pack */ if (Pack::isPack($p['product_id'])){ $p['items_pack'] = Pack::getCompleteSimplePack((int) $p['product_id']); } $products[] = $p; $id_order_details[] = (int) $p['id_order_detail']; } $id_carriers = array((int) $order->id_carrier); foreach(array_values($sales_carriers) as $c) { $id_carriers = array_merge($id_carriers, $c); } $carriers = array(); foreach(Db::getInstance()->ExecuteS(' SELECT `id_carrier`, `name` FROM `'._DB_PREFIX_.'carrier` WHERE `id_carrier` IN ('.implode(', ', array_unique($id_carriers)).') ') as $row) { $carriers[(int) $row['id_carrier']] = $row['name']; } if (count($id_order_details) > 0) { $logs = array(); // Send by PHILEA if($l = Db::getInstance()->ExecuteS(' SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, "Philea" as firstname, (CASE c.`external_module_name` WHEN "soflexibilite" THEN "laposte" ELSE c.`external_module_name` END) as carrier, "1" as philea FROM `'._DB_PREFIX_.'philea_parcel` l LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail` LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order` LEFT JOIN `'._DB_PREFIX_.'carrier` c ON c.`id_carrier` = o.`id_carrier` WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).') AND l.`quantity` > 0 ORDER BY l.`date_add` DESC ')) { $logs = array_merge($logs, $l); } // Send by LAPOSTE if($l = Db::getInstance()->ExecuteS(' SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, e.`firstname`, e.`lastname`, "laposte" as carrier, "0" as philea FROM `'._DB_PREFIX_.'lapostews` l LEFT JOIN `'._DB_PREFIX_.'employee` e ON l.`id_employee` = e.`id_employee` LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail` LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order` LEFT JOIN `ps_carrier` c ON c.`id_carrier` = o.`id_carrier` WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).') AND l.`quantity` > 0 ORDER BY l.`date_add` DESC ')) { $logs = array_merge($logs, $l); } // Send by EXAPAQ if($l = Db::getInstance()->ExecuteS(' SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, e.`firstname`, e.`lastname`, "exapaq" as carrier, "0" as philea FROM `'._DB_PREFIX_.'exapaqws` l LEFT JOIN `'._DB_PREFIX_.'employee` e ON l.`id_employee` = e.`id_employee` LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail` LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order` LEFT JOIN `'._DB_PREFIX_.'carrier` c ON c.`id_carrier` = o.`id_carrier` WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).') AND l.`quantity` > 0 ORDER BY l.`date_add` DESC ')) { $logs = array_merge($logs, $l); } // Send by MONDIAL RELAY if($l = Db::getInstance()->ExecuteS(' SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, e.`firstname`, e.`lastname`, "mondialrelay" as carrier, "0" as philea FROM `'._DB_PREFIX_.'mondialrelay_parcel` l LEFT JOIN `'._DB_PREFIX_.'employee` e ON l.`id_employee` = e.`id_employee` LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail` LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order` LEFT JOIN `ps_carrier` c ON c.`id_carrier` = o.`id_carrier` WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).') AND l.`quantity` > 0 ORDER BY l.`date_add` DESC ')) { $logs = array_merge($logs, $l); } // Send by DROPSHIPPING if($l = Db::getInstance()->ExecuteS(' SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, "Dropshipping" as firstname, "0" as philea FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` l LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail` LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order` LEFT JOIN `'._DB_PREFIX_.'carrier` c ON c.`id_carrier` = o.`id_carrier` WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).') AND l.`quantity` > 0 ORDER BY l.`date_add` DESC ')) { $logs = array_merge($logs, $l); } } else { $logs = array(); } // Carriers $_carriers = $carriers[$order->id_carrier].($delivery_infos_laposte ? ' ('.$laposte_modes[$delivery_infos_laposte['delivery_mode']].')' : ($delivery_infos_exapaq ? ' (ICI Relais)' : ($delivery_infos_mr ? ' ('.$mr_modes[$delivery_infos_mr['dlv_mode']].')' : '' ) ) ); $html_detail = ''; $html_invoice_address = ($invoice_address->company? $invoice_address->company.'
':'') .$invoice_address->firstname.' '.$invoice_address->lastname.'
' .($invoice_address->address1? $invoice_address->address1.'
': '') .($invoice_address->address2? $invoice_address->address2.'
': '') .$invoice_address->postcode.' '.$invoice_address->city.'
' .($invoice_address->country? $invoice_address->country.'
':'') .($invoice_address->phone? $invoice_address->phone.'
':'') .($invoice_address->phone_mobile? $invoice_address->phone_mobile.'
':''); if(in_array((int) $order->id_carrier,$ooh) && in_array((int) $order->id_carrier,$mr_carriers)){ $html_delivery_address = ($delivery_address->company? $delivery_address->company.'
':'') .$delivery_address->firstname.' '.$delivery_address->lastname.'
' .($delivery_infos_mr['MR_Selected_LgAdr1']?$delivery_infos_mr['MR_Selected_LgAdr1'].'
':'') .($delivery_infos_mr['MR_Selected_LgAdr2']?$delivery_infos_mr['MR_Selected_LgAdr2'].'
':'') .($delivery_infos_mr['MR_Selected_LgAdr3']?$delivery_infos_mr['MR_Selected_LgAdr3'].'
':'') .($delivery_infos_mr['MR_Selected_LgAdr4']?$delivery_infos_mr['MR_Selected_LgAdr4'].'
':'') .$delivery_infos_mr['MR_Selected_CP'].' '.$delivery_infos_mr['MR_Selected_Ville'].'
' .$delivery_infos_mr['MR_Selected_Pays'].'
'; } elseif (in_array((int) $order->id_carrier,$ooh) && in_array((int) $order->id_carrier,$laposte_carriers) && $delivery_infos_laposte){ $html_delivery_address = ($delivery_infos_laposte['prcompladress']? $delivery_infos_laposte['prcompladress'].'
': '') .$delivery_infos_laposte['prfirstname'].' '.$delivery_infos_laposte['prname'].'
' .$delivery_infos_laposte['cefirstname'].' '.$delivery_infos_laposte['cename'].'
' .($delivery_infos_laposte['pradress1']? $delivery_infos_laposte['pradress1'].'
': '') .($delivery_infos_laposte['pradress2']? $delivery_infos_laposte['pradress2'].'
': '') .($delivery_infos_laposte['pradress3']? $delivery_infos_laposte['pradress3'].'
': '') .($delivery_infos_laposte['pradress4']? $delivery_infos_laposte['pradress4'].'
': '') .$delivery_infos_laposte['przipcode'].' '.$delivery_infos_laposte['prtown'].'
' .$delivery_infos_laposte['country_name'].'
' .($delivery_infos_laposte['cephonenumber']? $delivery_infos_laposte['cephonenumber'].'
':''); } else { $html_delivery_address = ($delivery_address->company? $delivery_address->company.'
':'') .$delivery_address->firstname.' '.$delivery_address->lastname.'
' .($delivery_address->address1? $delivery_address->address1.'
':'') .($delivery_address->address2? $delivery_address->address2.'
':'') .$delivery_address->postcode.' '.$delivery_address->city.'
' .($delivery_address->country? $delivery_address->country.'
':'') .($delivery_address->phone? $delivery_address->phone.'
':'') .($delivery_address->phone_mobile? $delivery_address->phone_mobile.'
':''); } $html_products = ''; foreach($products as $key => $p) { $html_products.=' LOT':'').' '.str_replace(' - ','
',$products[$key]['product_name']).'
'.($products[$key]['product_reference']? $products[$key]['product_reference'].'
': '').($products[$key]['product_ean13']? $products[$key]['product_ean13']: '').($products[$key]['location']?'
'.$products[$key]['location'].'': '').' '.($products[$key]['product_supplier_reference']? $products[$key]['product_supplier_reference']: '').' '.$products[$key]['product_quantity'].' / '.($products[$key]['product_quantity_refunded'] > 0 ? $products[$key]['product_quantity_refunded']: $products[$key]['product_quantity_return']).' / '.$products[$key]['product_quantity_sent'].' '.max(in_array($products[$key]['product_id'], $locked_products)? '0': ($products[$key]['product_quantity'] - ($products[$key]['product_quantity_refunded'] > 0? $products[$key]['product_quantity_refunded']: $products[$key]['product_quantity_return']) - $products[$key]['product_quantity_sent']), 0).' 0?'checked disabled':'').'/> '; if ($products[$key]['id_shipping'] != 2 || ($products[$key]['id_shipping'] == 2 && in_array((int)$profile, array(1,7))) ) { if(isset($p['items_pack'])){ $html_products.=''; } else { $html_products.='+-'; } } $html_products.=' '; if(isset($p['items_pack'])){ foreach($p['items_pack'] as $item){ $link = new Link(2); $img = Db::getInstance()->getRow(' SELECT `id_image` FROM `'._DB_PREFIX_.'image` WHERE `cover` = 1 AND `id_product` = '.(int) $item['id_product'].' '); $id_image = $img?$img['id_image']:0; $quantity = ($p['product_quantity']*$item['pack_quantity']) - ($p['product_quantity_return']*$item['pack_quantity']) - ($p['product_quantity_sent']*$item['pack_quantity']); $html_products.=' '.str_replace(' - ','
',$item['name']).'
'.($item['reference']? $item['reference'].'
': '').($item['ean13']? $item['ean13']: '').($item['location']?'
'.$item['location'].'': '').' '.($item['supplier_reference']? $item['supplier_reference']: '').' '.max(in_array($p['product_id'], $locked_products)? '0': (($p['product_quantity']*$item['pack_quantity']) - (($p['product_quantity_refunded']*$item['pack_quantity']) > 0? $p['product_quantity_refunded']*$item['pack_quantity']: ($p['product_quantity_return']*$item['pack_quantity'])) - ($p['product_quantity_sent']*$item['pack_quantity'])), 0).' '; if ($products[$key]['id_shipping'] != 2 || ($products[$key]['id_shipping'] == 2 && in_array((int)$profile, array(1,7))) ) { $html_products.='+-'; } $html_products.=' '; } } } $carrier_names = array('laposte' => 'La Poste', 'mondialrelay' => 'Mondial Relay'); $html_logs = ''; foreach($logs as $key => $log){ $html_logs .= ' '.str_replace(" ", "
",date('d/m/Y H:i:s',strtotime($logs[$key]['date_add']))).'\ '.(!isset($logs[$key]['lastname'])? $logs[$key]['firstname'] : $logs[$key]['firstname'] .' '.$logs[$key]['lastname']) .' '.$logs[$key]['quantity'].' '.str_replace(" - ", "
",$logs[$key]['product_name']).'\ '.$logs[$key]['product_reference'].' '.$logs[$key]['product_supplier_reference'].' '.$logs[$key]['shipping_number'].' '.(($logs[$key]['carrier'] == "laposte" || $logs[$key]['carrier'] == "mondialrelay") ? $carrier_names[$logs[$key]['carrier']] : $logs[$key]['carrier']) .' '.(( in_array((int)$profile, array(1,9,7,13,14)) ) ? (($logs[$key]['carrier'] == "laposte" || $logs[$key]['carrier'] == "mondialrelay") ? '': ''):'').' '.(( in_array((int)$profile, array(1,9,7,13,14)) )? (($logs[$key]['carrier'] == "laposte" || $logs[$key]['carrier'] == "mondialrelay") ? '",$logs[$key]['product_name']).'" data-weight="'.((float)$logs[$key]['weight']>0?(float)$logs[$key]['weight']:0.24).'" data-ref="'.$logs[$key]['product_reference'] .'" data-id_order="'.$order->id.'" data-carrier="'.$logs[$key]['carrier'].'" data-id_order_detail="'.$logs[$key]['id_order_detail'].'">': ''):'').' '; } $html_form ='
'; if((in_array($order->id_carrier, $laposte_carriers) || in_array($order->id_carrier, $mr_carriers)) && in_array((int)($delivery_address->id_country), array(1, 2, 3, 6, 8, 10, 12, 13, 15, 17, 26, 40, 148, 245)) ){ $html_form.= '
'; } $html_form .= '
kg
'; echo json_encode(array( 'errors' => false, 'html_detail' => (string)$html_detail, 'html_invoice_address' => (string)$html_invoice_address, 'html_delivery_address' => (string)$html_delivery_address, 'html_products' => (string)$html_products, 'html_logs' => (string)$html_logs, 'html_form' => (string)$html_form, 'order' => $order, 'products' => $products, 'status' => $status['name'], 'carrier' => $_carriers, 'carriers' => $carriers, 'customer' => $customer['firstname'].' '.$customer['lastname'].' ('.$customer['email'].')', 'invoice_address' => $invoice_address, 'delivery_address' => $delivery_address, 'delivery_infos_laposte' => $delivery_infos_laposte, 'delivery_infos_exapaq' => $delivery_infos_exapaq, 'delivery_infos_mr' => $delivery_infos_mr, 'weight' => $order->getTotalWeight(), 'logs' => $logs, 'france_address_error' => $france_address_error, 'france_address_suggestions' => $france_address_suggestions, )); } else { echo json_encode(array('errors' => 'not found')); } }