// 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:
+7
-2
@@ -227,6 +227,7 @@ class ImageCore extends ObjectModel
|
|||||||
$image_new = clone $image_old;
|
$image_new = clone $image_old;
|
||||||
unset($image_new->id);
|
unset($image_new->id);
|
||||||
$image_new->id_product = (int)$id_product_new;
|
$image_new->id_product = (int)$id_product_new;
|
||||||
|
|
||||||
// A new id is generated for the cloned image when calling add()
|
// A new id is generated for the cloned image when calling add()
|
||||||
if ($image_new->add())
|
if ($image_new->add())
|
||||||
{
|
{
|
||||||
@@ -241,10 +242,14 @@ class ImageCore extends ObjectModel
|
|||||||
$new_path.'-'.$image_type['name'].'.jpg');
|
$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);
|
Image::replaceAttributeImageAssociationId($combination_images, (int)$image_old->id, (int)$image_new->id);
|
||||||
|
|
||||||
|
// Duplicate shop associations for images
|
||||||
|
$image_new->duplicateShops($id_product_old);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user