[-] BO : Categories do not appear in allshop context
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15302 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -2000,7 +2000,10 @@ class AdminControllerCore extends Controller
|
||||
$lang_join = 'LEFT JOIN `'._DB_PREFIX_.$this->table.'_lang` b ON (b.`'.$this->identifier.'` = a.`'.$this->identifier.'`';
|
||||
$lang_join .= ' AND b.`id_lang` = '.(int)$id_lang;
|
||||
if ($id_lang_shop)
|
||||
$lang_join .= ' AND b.`id_shop`='.(int)$id_lang_shop;
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||
$lang_join .= ' AND b.`id_shop`='.(int)$id_lang_shop;
|
||||
else
|
||||
$lang_join .= ' AND b.`id_shop` IN ('.implode(',', array_map('intval', Shop::getContextListShopID())).')';
|
||||
$lang_join .= ')';
|
||||
}
|
||||
|
||||
|
||||
@@ -154,10 +154,8 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$id_parent = $this->context->shop->id_category;
|
||||
|
||||
$this->_filter .= ' AND `id_parent` = '.(int)$id_parent.' ';
|
||||
$this->_select = 'cs.`position` ';
|
||||
$id = $this->context->shop->id;
|
||||
$id_shop = $id ? $id : Configuration::get('PS_SHOP_DEFAULT');
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (a.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')';
|
||||
$this->_select = 'category_shop.`position` ';
|
||||
$this->_join = Shop::addSqlAssociation('category', 'a');
|
||||
// we add restriction for shop
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP && $is_multishop)
|
||||
$this->_where = ' AND cs.`id_shop` = '.(int)Context::getContext()->shop->id;
|
||||
@@ -188,7 +186,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
parent::getList($id_lang, 'cs.position', $order_way, $start, $limit, Context::getContext()->shop->id);
|
||||
parent::getList($id_lang, 'category_shop.position', $order_way, $start, $limit, Context::getContext()->shop->id);
|
||||
// Check each row to see if there are combinations and get the correct action in consequence
|
||||
|
||||
$nb_items = count($this->_list);
|
||||
@@ -650,8 +648,9 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
}
|
||||
$delete = substr($delete, 0, strlen($delete) - 1);
|
||||
$insert = substr($insert, 0, strlen($insert) - 1);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$type.
|
||||
($id_object ? ' WHERE `'.$this->identifier.'` = '.(int)$id_object.' AND `id_'.$type.'` NOT IN ('.$delete.')' : ''));
|
||||
if (!empty($delete))
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$type.
|
||||
($id_object ? ' WHERE `'.$this->identifier.'` = '.(int)$id_object.' AND `id_'.$type.'` NOT IN ('.$delete.')' : ''));
|
||||
|
||||
if (!empty($insert))
|
||||
Db::getInstance()->execute('
|
||||
|
||||
@@ -196,11 +196,11 @@ class AdminProductsControllerCore extends AdminController
|
||||
else
|
||||
$this->_category = new Category();
|
||||
|
||||
$this->_join = Shop::addSqlAssociation('product', 'a').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang`)
|
||||
$this->_join =
|
||||
'LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = a.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (sa.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$this->context->country->id.' AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0
|
||||
@@ -210,7 +210,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($this->_category) && empty($this->_filter))
|
||||
$this->_filter = 'AND cp.`id_category` = '.(int)$this->_category->id;
|
||||
|
||||
$this->_select = 'cl.name `name_category`, cp.`position`, i.`id_image`, (a.`price` * ((100 + (t.`rate`))/100)) AS price_final, sav.`quantity` as sav_quantity';
|
||||
$this->_select = 'cl.name `name_category`, cp.`position`, i.`id_image`, sa.`price`, (sa.`price` * ((100 + (t.`rate`))/100)) AS price_final, sav.`quantity` as sav_quantity';
|
||||
|
||||
}
|
||||
protected function _cleanMetaKeywords($keywords)
|
||||
|
||||
Reference in New Issue
Block a user