[-] Core: Fix the listings in multishop context when you have at least a combination on one shop and not on the others and the same for the images
This commit is contained in:
@@ -162,7 +162,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = '.(int)$this->context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.(int)$this->context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop='.(int)$this->context->shop->id.')';
|
||||
$this->_where .= 'AND (i.id_image IS NULL OR image_shop.id_shop='.(int)$this->context->shop->id.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -170,7 +169,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default)
|
||||
LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = a.id_shop_default)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop=a.id_shop_default)';
|
||||
$this->_where .= 'AND (i.id_image IS NULL OR image_shop.id_shop=a.id_shop_default)';
|
||||
}
|
||||
$this->_select .= 'shop.name as shopname, ';
|
||||
}
|
||||
@@ -181,11 +179,15 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = 1)';
|
||||
}
|
||||
|
||||
$this->_select .= 'MAX('.$alias_image.'.id_image) id_image,';
|
||||
|
||||
$this->_join .= ($join_category ? 'INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = '.(int)$this->_category->id.')' : '').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0
|
||||
'.StockAvailable::addSqlShopRestriction(null, null, 'sav').') ';
|
||||
$this->_select .= 'cl.name `name_category` '.($join_category ? ', cp.`position`' : '').', '.$alias_image.'.`id_image`, '.$alias.'.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, '.$alias.'.`active`';
|
||||
|
||||
|
||||
$this->_group = 'GROUP BY '.$alias.'.id_product';
|
||||
|
||||
$this->fields_list = array();
|
||||
$this->fields_list['id_product'] = array(
|
||||
'title' => $this->l('ID'),
|
||||
|
||||
Reference in New Issue
Block a user