/**
  * On supprime tous les produits qui n'ont pas de code EAN13.
  * @param $t_product
  * @param $is_display
  * @return array
  */
 private function delProductWithoutEAN($products, $is_display)
 {
     return $products;
     $products_with_ean = array();
     foreach ($products as $key => $product) {
         if (!empty($product['id_product_attribute']) && !empty($product['ean13_declinaison']) || empty($product['id_product_attribute']) && !empty($product['ean13'])) {
             $products_with_ean[] = $product;
         } else {
             if ($this->getValue('debug')) {
                 Toolbox::addLogLine(self::getL('No EAN13 for product') . ' : ' . $product['id_product'] . '/' . $product['id_produt_attribute']);
                 Toolbox::displayDebugMessage(self::getL('No EAN13 for product') . ' : ' . $product['id_product'] . '/' . $product['id_produt_attribute']);
             }
         }
     }
     return $products_with_ean;
 }
 /**
  * Set order NetEven
  * @param $param
  */
 public function setOrderNetEven($params)
 {
     if (!self::$send_order_state_to_neteven) {
         return;
     }
     if ($res = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders_gateway` WHERE `id_order` = ' . (int) $params['id_order'])) {
         $status = '';
         $track = '';
         $date_now = date('Y-m-d H:i:s');
         if ($params['newOrderStatus']->id == (int) Configuration::get('PS_OS_PREPARATION')) {
             $status = 'Confirmed';
         }
         if ($params['newOrderStatus']->id == (int) Configuration::get('PS_OS_CANCELED')) {
             $status = 'Canceled';
         }
         if ($params['newOrderStatus']->id == (int) Configuration::get('PS_OS_DELIVERED')) {
             $res_order = Db::getInstance()->getRow('SELECT `shipping_number` FROM `' . _DB_PREFIX_ . 'orders` WHERE `id_order` = ' . (int) $params['id_order']);
             $status = 'Shipped';
             $track = $res_order['shipping_number'];
         }
         if ($params['newOrderStatus']->id == (int) Configuration::get('PS_OS_REFUND')) {
             $status = 'Refunded';
         }
         if ($status != '') {
             $order1 = array('OrderID' => $res['id_order_neteven'], 'Status' => $status);
             if (!empty($track)) {
                 $order1['TrackingNumber'] = $track;
             }
             $params_web = array('orders' => array($order1));
             try {
                 $response = $this->_client->PostOrders($params_web);
                 $order_status = $response->PostOrdersResult->MarketPlaceOrderStatusResponse;
             } catch (Exception $e) {
                 Toolbox::manageError($e, 'Update order statu in neteven');
                 $order_status = NULL;
             }
             if ($this->getValue('send_request_to_mail')) {
                 $this->sendDebugMail($this->getValue('mail_list_alert'), self::getL('Debug - Control request') . ' setOrderNetEven', $this->_client->__getLastRequest(), true);
             }
             if (!isset($order_status->StatusResponse) || isset($order_status->StatusResponse) && $order_status->StatusResponse != 'Updated' || is_null($order_status)) {
                 $complement = !is_array($order_status->StatusResponse) ? $order_status->StatusResponse : '';
                 $complement .= is_array($order_status->StatusResponse) ? '<pre>' . print_r($order_status->StatusResponse, true) . '</pre>' : '';
                 if ($this->getValue('send_request_to_mail')) {
                     $this->sendDebugMail($this->getValue('mail_list_alert'), self::getL('Fail for update order state'), self::getL('Order Id') . ' (' . (int) $params['id_order'] . '). ' . self::getL('NetEven response') . ' : ' . $complement);
                 }
             }
             if (!empty($order_status) && !is_null($order_status)) {
                 Toolbox::addLogLine(self::getL('Update order state') . ' ' . $status . ' ' . self::getL('NetEven Order Id') . ' ' . $res['id_order_neteven'] . ' ' . self::getL('Order Id') . ' ' . $res['id_order'] . ' - ' . $order_status->StatusResponse . '');
             }
             if (!Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'orders_gateway_order_state` (`id_order`, `id_order_state`, `date_add`, `date_upd`) VALUES (' . (int) $res['id_order'] . ', ' . (int) $params['newOrderStatus']->id . ', "' . pSQL($date_now) . '", "' . pSQL($date_now) . '")')) {
                 Toolbox::addLogLine(self::getL('Failed for save export NetEven order state Id') . ' ' . (int) $res['id_order']);
             } else {
                 Toolbox::addLogLine(self::getL('Save export of NetEven order state Id') . ' ' . (int) $res['id_order']);
             }
         }
     }
     Toolbox::writeLog();
 }