From 6c0a1540960581fd19f0dae6c9665681ade6b5ce Mon Sep 17 00:00:00 2001 From: root Date: Mon, 26 Jun 2017 09:52:48 +0200 Subject: [PATCH] fix pb file exist --- erp/erp_update_product.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/erp/erp_update_product.php b/erp/erp_update_product.php index c020cfd..f60b357 100644 --- a/erp/erp_update_product.php +++ b/erp/erp_update_product.php @@ -31,8 +31,9 @@ $ids_product = $models->execute_kw($db, $uid, $password, $d = Db::getInstance(); -foreach ($ids_product as $key => $id) { +$date = date('Y-m-d H:i:s'); +foreach ($ids_product as $key => $id) { // get product's information $record = $models->execute_kw($db, $uid, $password, 'product.template', 'read', array($id) @@ -80,7 +81,8 @@ foreach ($ids_product as $key => $id) { p.`reference` = "'.$record['default_code'].'", p.`weight` = '.(float)$record['weight'].', p.`out_of_stock` = 2, - pl.`name` = "'.pSQL(trim(utf8_encode($name_product))).'" + pl.`name` = "'.pSQL(trim(utf8_encode($name_product))).'", + p.`date_upd` = "' . $date .'" WHERE `id_erp` = '.(int)$id.' AND p.`id_product` = pl.id_product @@ -97,6 +99,8 @@ foreach ($ids_product as $key => $id) { $sql = 'SELECT `id_image` FROM '._DB_PREFIX_.'image WHERE `id_product` = '.(int)$product_id; $id_image = $d->getValue($sql); + + if ($id_image) { $image = new Image($id_image); $imagesTypes = ImageType::getImagesTypes('products'); @@ -104,7 +108,7 @@ foreach ($ids_product as $key => $id) { $image_exists = true; foreach ($imagesTypes as $imageType) { - $image_exists = file_exists($existing_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format); + $image_exists = file_exists('../img/p/'.$existing_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format); if (!$image_exists) { break; }