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

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15703 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2012-05-28 08:26:33 +00:00
parent e3b23ce851
commit a7b4c666ac
+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;