id_customer)); $carrier = new Carrier($expeditor['id_carrier']); if ($carrier->external_module_name == 'socolissimo') { $delivery_info = Db::getInstance()->getRow('SELECT * FROM '._DB_PREFIX_.'socolissimo_delivery_info WHERE id_cart = '.intval($order->id_cart).' AND id_customer = '.intval($customer->id)); if ($delivery_info['delivery_mode'] && !in_array($delivery_info['delivery_mode'], array('RDV', 'DOM', 'CORE'))) $address = new Address(intval($order->id_address_invoice)); else $address = new Address(intval($order->id_address_delivery)); } else $address = new Address(intval($order->id_address_delivery)); $country = new Country(intval($address->id_country)); echo formatItem('EXP'.intval($order->id)); /*if($delivery_info['delivery_mode'] && $delivery_info['delivery_mode'] == 'BPR') { echo utf8_decode(formatItem(trim((!empty($address->company) ? $address->company.' - ' : '').$customer->lastname))); } else {*/ echo utf8_decode(formatItem(trim((!empty($address->company) ? $address->company.' - ' : (!empty($delivery_info['cecompanyname'])? $delivery_info['cecompanyname'].' - ': '')).$address->lastname))); /*} if($delivery_info['delivery_mode'] && $delivery_info['delivery_mode'] == 'BPR') { echo utf8_decode(formatItem($customer->firstname)); } else {*/ echo utf8_decode(formatItem($address->firstname)); /*}*/ /*if($delivery_info['delivery_mode'] && $delivery_info['delivery_mode'] == 'BPR') { $address->address2 = $address->address1; $address->address1 = $address->lastname; }*/ $address->address1 = str_replace(array("\n", "\r"), ' ', $address->address1); $address->address2 = str_replace(array("\n", "\r"), ' ', $address->address2); $address->other = str_replace(array("\n", "\r"), ' ', $address->other); $address->address1 = str_replace(' ', ' ', $address->address1); $address->address2 = str_replace(' ', ' ', $address->address2); $address->other = str_replace(' ', ' ', $address->other); // Address line is limited to 35 chars $wholeAddress = utf8_decode(trim($address->address1)); if(strlen($wholeAddress) < 35 /*&& $delivery_info['delivery_mode'] && $delivery_info['delivery_mode'] != 'BPR'*/) { echo formatItem(substr($wholeAddress, 0, 35)); echo formatItem(substr($address->address2, 0, 35)); echo formatItem(''); echo formatItem(''); } elseif(strlen($wholeAddress) < 70 && $delivery_info['delivery_mode'] /*&& $delivery_info['delivery_mode'] != 'BPR'*/) { echo formatItem(substr($wholeAddress, 0, 35)); echo formatItem(substr($wholeAddress, 35, 70)); echo formatItem(substr($address->address2, 0, 35)); echo formatItem(''); } else { echo formatItem(substr($wholeAddress, 0, 35)); echo formatItem(substr($wholeAddress, 35, 70)); echo formatItem(substr($wholeAddress, 70, 105)); echo formatItem(substr($address->address2, 0, 35)); } echo formatItem(str_replace(' ', '', $address->postcode)); echo utf8_decode(formatItem($address->city)); echo utf8_decode(formatItem($country->iso_code)); echo formatItem($expeditor['weight']); echo getStandardSize($expeditor['standard_size']); //for socolissimo if ($carrier->external_module_name == 'socolissimo') { $soCarrier = new Carrier(Configuration::get('SOCOLISSIMO_CARRIER_ID')); if (Validate::isLoadedObject($soCarrier)) { echo utf8_decode(formatItem($delivery_info['delivery_mode'])); if(empty($delivery_info['cephonenumber'])) { if(empty($address->phone_mobile)) { echo formatItem($address->phone); } else { echo formatItem($address->phone_mobile); } } else { echo utf8_decode(formatItem($delivery_info['cephonenumber'])); } echo utf8_decode(formatItem($customer->email)); if ($delivery_info['prid'] == 0) echo formatItem(''); else echo utf8_decode(formatItem($delivery_info['prid'])); echo utf8_decode(formatItem($delivery_info['cedoorcode1'])); echo utf8_decode(formatItem($delivery_info['cedoorcode2'])); } } else { echo formatItem(str_replace('CORE', 'COLD', Configuration::get('EXPEDITOR_CARRIER_CODES_'.intval($expeditor['id_carrier'])))); echo formatItem(''); echo formatItem(''); echo formatItem(''); echo formatItem(''); echo formatItem(''); } echo formatItem(Configuration::get('PS_SHOP_NAME')); echo formatItem(substr(trim(str_replace("\r", ' ', str_replace("\n", ' ', str_replace('|', '', utf8_decode($address->other))))), 0, 35)); echo chr(13); // CR --> carriage return echo chr(10); // LF --> new line } exit(); ?>