id_lang; return $db->ExecuteS($sql); } function getProductId() { global $cookie; $ean = (float)Tools::getValue('ean', false); if (!$ean) { http_response_code(500); return Tools::displayError('Code EAN non spécifié'); } if (!is_float($ean)) { http_response_code(500); return Tools::displayError('Code EAN invalid'); } $db = Db::getInstance(); $sql = 'SELECT `ps_product_lang`.`id_product`, `ps_product_lang`.`name` FROM `ps_product` LEFT JOIN `ps_product_lang` ON `ps_product`.id_product = `ps_product_lang`.id_product WHERE `ean13` = '.$ean.' AND `id_lang` = '.$cookie->id_lang.' ORDER BY `date_add` DESC LIMIT 1'; $result = $db->ExecuteS($sql); if (count($result) > 0) { return $result[0]; } else { http_response_code(500); return Tools::displayError('Aucun produit trouvé'); } }