function _getChronoOrders($withRelais = true) { if (Tools::getIsset('multi')) { $multi = Tools::jsonDecode(Tools::getValue('multi'), true); } else { $multi = array(); } $r = array(); if (Tools::getIsset('orders')) { $o = explode(';', Tools::getValue('orders')); } else { $o = Order::getOrdersIdByDate(date('Y-m-d H:i:s', 0), date('Y-m-d H:i:s')); } foreach ($o as $i) { $or = new Order($i); if ($withRelais) { if (Chronopost::isChrono($or->id_carrier)) { if (array_key_exists($i, $multi)) { $cpt = $multi[$i]; } else { $cpt = 1; } for (; $cpt > 0; $cpt--) { $r[] = $or; } } } else { // no relais export for CSO if (Chronopost::isChrono($or->id_carrier) && $or->id_carrier != Configuration::get('CHRONORELAIS_CARRIER_ID')) { if (array_key_exists($i, $multi)) { $cpt = $multi[$i]; } else { $cpt = 1; } for (; $cpt > 0; $cpt--) { $r[] = $or; } } } } return $r; }