// Fix bugs with category positions

This commit is contained in:
rGaillard
2012-09-11 16:33:21 +00:00
parent 9f768e6b61
commit 479861bcc7
4 changed files with 24 additions and 17 deletions
+4 -4
View File
@@ -460,7 +460,7 @@ class CategoryCore extends ObjectModel
WHERE 1 '.$sql_filter.' '.($id_lang ? 'AND `id_lang` = '.(int)$id_lang : '').'
'.($active ? 'AND `active` = 1' : '').'
'.(!$id_lang ? 'GROUP BY c.id_category' : '').'
'.($sql_sort != '' ? $sql_sort : 'ORDER BY c.`level_depth` ASC, c.`position` ASC').'
'.($sql_sort != '' ? $sql_sort : 'ORDER BY c.`level_depth` ASC, category_shop.`position` ASC').'
'.($sql_limit != '' ? $sql_limit : '')
);
@@ -567,14 +567,14 @@ class CategoryCore extends ObjectModel
$order_way = 'ASC';
if ($order_by == 'id_product' || $order_by == 'date_add' || $order_by == 'date_upd')
$order_by_prefix = 'p';
else if ($order_by == 'name')
elseif ($order_by == 'name')
$order_by_prefix = 'pl';
else if ($order_by == 'manufacturer')
elseif ($order_by == 'manufacturer')
{
$order_by_prefix = 'm';
$order_by = 'name';
}
else if ($order_by == 'position')
elseif ($order_by == 'position')
$order_by_prefix = 'cp';
if ($order_by == 'price')
@@ -162,14 +162,14 @@ class AdminCategoriesControllerCore extends AdminController
else
$id_parent = $this->context->shop->id_category;
$this->_select = 'sa.position position';
$this->_filter .= ' AND `id_parent` = '.(int)$id_parent.' ';
if (Shop::isFeatureActive())
{
if (Shop::getContext() == Shop::CONTEXT_SHOP)
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'category_shop` sa ON (a.`id_category` = sa.`id_category` AND sa.id_shop = '.(int)$this->context->shop->id.') ';
else
if (Shop::getContext() == Shop::CONTEXT_SHOP)
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'category_shop` sa ON (a.`id_category` = sa.`id_category` AND sa.id_shop = '.(int)$this->context->shop->id.') ';
else
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'category_shop` sa ON (a.`id_category` = sa.`id_category` AND sa.id_shop = a.id_shop_default) ';
}
// we add restriction for shop
if (Shop::getContext() == Shop::CONTEXT_SHOP && $is_multishop)
@@ -201,9 +201,7 @@ class AdminCategoriesControllerCore extends AdminController
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
{
$alias = 'a';
if (Shop::isFeatureActive())
$alias = 'sa';
$alias = 'sa';
parent::getList($id_lang, $alias.'.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
+6 -3
View File
@@ -158,7 +158,6 @@ class AdminImportControllerCore extends AdminController
'minimal_quantity' => 1,
'weight' => 0,
'default_on' => 0,
'shop' => Configuration::get('PS_SHOP_DEFAULT'),
);
break;
@@ -258,7 +257,6 @@ class AdminImportControllerCore extends AdminController
'link_rewrite' => array((int)Configuration::get('PS_LANG_DEFAULT') => ''),
'online_only' => 0,
'condition' => 'new',
'shop' => Configuration::get('PS_SHOP_DEFAULT'),
'date_add' => date('Y-m-d H:i:s'),
'condition' => 'new',
);
@@ -1012,8 +1010,10 @@ class AdminImportControllerCore extends AdminController
AdminImportController::setEntityDefaultValues($product);
AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $product);
if (!Shop::isFeatureActive() || !isset($product->shop) || empty($product->shop))
if (!Shop::isFeatureActive())
$product->shop = 1;
elseif (!isset($product->shop) || empty($product->shop))
$product->shop = implode($this->multiple_value_separator, Shop::getContextListShopID());
if (!Shop::isFeatureActive())
$product->id_shop_default = 1;
@@ -1457,6 +1457,9 @@ class AdminImportControllerCore extends AdminController
// Get shops for each attributes
$info['shop'] = explode($this->multiple_value_separator, $info['shop']);
if (!isset($info['shop']) || !count($info['shop']))
$info['shop'] = Shop::getContextListShopID();
$id_shop_list = array();
foreach ($info['shop'] as $shop)
if (!is_numeric($shop))
+7 -1
View File
@@ -78,6 +78,7 @@ class Blocktopmenu extends Module
!$this->registerHook('actionObjectManufacturerDeleteAfter') ||
!$this->registerHook('actionObjectProductUpdateAfter') ||
!$this->registerHook('actionObjectProductDeleteAfter') ||
!$this->registerHook('categoryUpdate') ||
!$this->installDB())
return false;
return true;
@@ -805,7 +806,7 @@ class Blocktopmenu extends Module
$this->clearMenuCache();
}
public function hookActionObjectCmsUpdateUpdate($params)
public function hookActionObjectCmsUpdateAfter($params)
{
$this->clearMenuCache();
}
@@ -845,6 +846,11 @@ class Blocktopmenu extends Module
$this->clearMenuCache();
}
public function hookCategoryUpdate($params)
{
$this->clearMenuCache();
}
private function clearMenuCache()
{
$this->_clearCache('blocktopmenu.tpl');