// Fix product images association for multishop #PSTEST-745
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13697 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -123,6 +123,7 @@
|
||||
{
|
||||
assoc = assoc.slice(0, -1);
|
||||
assoc += {literal}"}"{/literal};
|
||||
assoc = jQuery.parseJSON(assoc);
|
||||
}
|
||||
else
|
||||
assoc = false;
|
||||
@@ -188,7 +189,7 @@
|
||||
cover = "forbbiden";
|
||||
if (responseJSON.cover == "1")
|
||||
cover = "enabled";
|
||||
imageLine(responseJSON.id, responseJSON.path, responseJSON.position, cover, false)
|
||||
imageLine(responseJSON.id, responseJSON.path, responseJSON.position, cover, responseJSON.shops)
|
||||
$("#imageTable tr:last").after(responseJSON.html);
|
||||
$("#countImage").html(parseInt($("#countImage").html()) + 1);
|
||||
$("#img" + id).remove();
|
||||
@@ -318,8 +319,7 @@
|
||||
line = line.replace("</tbody>", "");
|
||||
if (shops != false)
|
||||
{
|
||||
tmp = jQuery.parseJSON(shops);
|
||||
$.each(tmp, function(key, value){
|
||||
$.each(shops, function(key, value){
|
||||
if (value == 1)
|
||||
line = line.replace('id="' + key + '' + id + '"','id="' + key + '' + id + '" checked=checked');
|
||||
});
|
||||
|
||||
@@ -1072,6 +1072,14 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (isset($result['success']))
|
||||
{
|
||||
$obj = new Image((int)$result['success']['id_image']);
|
||||
|
||||
// Associate image to shop from context
|
||||
$shops = Shop::getContextListShopID();
|
||||
$obj->associateTo($shops);
|
||||
$json_shops = array();
|
||||
foreach ($shops as $id_shop)
|
||||
$json_shops[$id_shop] = true;
|
||||
|
||||
$json = array(
|
||||
'name' => $result['success']['name'],
|
||||
'status' => 'ok',
|
||||
@@ -1079,6 +1087,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
'path' => $obj->getExistingImgPath(),
|
||||
'position' => $obj->position,
|
||||
'cover' => $obj->cover,
|
||||
'shops' => $json_shops,
|
||||
);
|
||||
@unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$obj->id_product.'.jpg');
|
||||
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$obj->id_product.'.jpg');
|
||||
|
||||
Reference in New Issue
Block a user