// Fix products image duplication on multishop mode #PSCFV-2572

This commit is contained in:
rMalie
2012-05-28 08:26:33 +00:00
parent 8a750e5f06
commit ed260dfd99
+7 -2
View File
@@ -227,6 +227,7 @@ class ImageCore extends ObjectModel
$image_new = clone $image_old;
unset($image_new->id);
$image_new->id_product = (int)$id_product_new;
// A new id is generated for the cloned image when calling add()
if ($image_new->add())
{
@@ -241,10 +242,14 @@ class ImageCore extends ObjectModel
$new_path.'-'.$image_type['name'].'.jpg');
}
}
if (file_exists(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'.jpg'))
copy(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'.jpg', $new_path.'.jpg');
if (file_exists(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'.jpg'))
copy(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'.jpg', $new_path.'.jpg');
Image::replaceAttributeImageAssociationId($combination_images, (int)$image_old->id, (int)$image_new->id);
// Duplicate shop associations for images
$image_new->duplicateShops($id_product_old);
}
else
return false;