fix pb file exist
This commit is contained in:
parent
51442d7287
commit
6c0a154096
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user