'PRODUCT')); exit; } $id_product_attribute = (int) Tools::getValue('id_product_attribute'); $value = Tools::getValue('value'); if($value === FALSE) { echo json_encode(array('result' => 'EMPTY')); exit; } if(!Validate::isEan13($value)) { echo json_encode(array('result' => 'FORMAT')); exit; } if($value == '0') { if($id_product_attribute != 0) { Db::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'product_attribute` SET `ean13` = "" WHERE `id_product` = '.$id_product.' AND `id_product_attribute` = '.$id_product_attribute.' LIMIT 1 '); } else { Db::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'product` SET `ean13` = "" WHERE `id_product` = '.$id_product.' LIMIT 1 '); } Db::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'order_detail` SET `product_ean13` = "" WHERE `product_id` = '.(int) $id_product.' AND `product_attribute_id` = '.(int) $id_product_attribute.' '); } elseif($value != '') { if($id_product_attribute != 0) { Db::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'product_attribute` SET `ean13` = "'.pSQL($value).'" WHERE `id_product` = '.$id_product.' AND `id_product_attribute` = '.$id_product_attribute.' LIMIT 1 '); } else { Db::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'product` SET `ean13` = "'.pSQL($value).'" WHERE `id_product` = '.$id_product.' LIMIT 1 '); } Db::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'order_detail` SET `product_ean13` = "'.pSQL($value).'" WHERE `product_id` = '.(int) $id_product.' AND `product_attribute_id` = '.(int) $id_product_attribute.' '); } echo json_encode(array('result' => 'OK')); exit; }