Added feature service products as normal product
This commit is contained in:
@@ -45,10 +45,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// redirect to admin dashboard as no entry allowed in category controller. It will be managed solely from
|
||||
// hotel creation , updation and deletion
|
||||
$this->context = Context::getContext();
|
||||
// Tools::redirectAdmin($this->context->link->getAdminLink('AdminDashboard'));
|
||||
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'category';
|
||||
@@ -116,13 +113,18 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
// context->shop is set in the init() function, so we move the _category instanciation after that
|
||||
if (($id_category = Tools::getvalue('id_category')) && $this->action != 'select_delete') {
|
||||
$this->_category = new Category($id_category);
|
||||
// check if this category lies in location, if true then set category to products category.
|
||||
if (!$this->_category->hasParent(Configuration::get('PS_SERVICE_CATEGORY'))) {
|
||||
$this->_category = new Category(Configuration::get('PS_SERVICE_CATEGORY'));
|
||||
}
|
||||
} else {
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP) {
|
||||
$this->_category = new Category($this->context->shop->id_category);
|
||||
|
||||
$this->_category = new Category(Configuration::get('PS_SERVICE_CATEGORY'));
|
||||
} elseif (count(Category::getCategoriesWithoutParent()) > 1 && Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(true, null, true)) != 1) {
|
||||
$this->_category = Category::getTopCategory();
|
||||
} else {
|
||||
$this->_category = new Category(Configuration::get('PS_HOME_CATEGORY'));
|
||||
$this->_category = new Category(Configuration::get('PS_SERVICE_CATEGORY'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +143,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$id_parent = (int)Configuration::get('PS_ROOT_CATEGORY');
|
||||
}
|
||||
} else {
|
||||
$id_parent = $this->context->shop->id_category;
|
||||
$id_parent = Configuration::get('PS_SERVICE_CATEGORY');
|
||||
}
|
||||
$this->_select = 'sa.position position';
|
||||
$this->original_filter = $this->_filter .= ' AND `id_parent` = '.(int)$id_parent.' ';
|
||||
@@ -172,8 +174,6 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
parent::initPageHeaderToolbar();
|
||||
|
||||
if ($this->display != 'edit' && $this->display != 'add') {
|
||||
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE')) {
|
||||
$this->page_header_toolbar_btn['new-url'] = array(
|
||||
@@ -189,6 +189,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'icon' => 'process-icon-new'
|
||||
);
|
||||
}
|
||||
parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
@@ -334,7 +335,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
if (!$this->lite_display && isset($this->toolbar_btn['back']['href']) && $this->_category->level_depth > 1
|
||||
&& $this->_category->id_parent && $this->_category->id_parent != (int)Configuration::get('PS_ROOT_CATEGORY')) {
|
||||
&& $this->_category->id_parent && $this->_category->id_parent != (int)Configuration::get('PS_SERVICE_CATEGORY')) {
|
||||
$this->toolbar_btn['back']['href'] .= '&id_category='.(int)$this->_category->id_parent;
|
||||
}
|
||||
}
|
||||
@@ -381,14 +382,14 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_categories';
|
||||
$kpis[] = $helper->generate();
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-empty-categories';
|
||||
$helper->icon = 'icon-bookmark-empty';
|
||||
$helper->color = 'color2';
|
||||
$helper->href = $this->context->link->getAdminLink('AdminTracking');
|
||||
$helper->title = $this->l('Empty Categories', null, null, false);
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=empty_categories';
|
||||
$kpis[] = $helper->generate();
|
||||
// $helper = new HelperKpi();
|
||||
// $helper->id = 'box-empty-categories';
|
||||
// $helper->icon = 'icon-bookmark-empty';
|
||||
// $helper->color = 'color2';
|
||||
// $helper->href = $this->context->link->getAdminLink('AdminTracking');
|
||||
// $helper->title = $this->l('Empty Categories', null, null, false);
|
||||
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=empty_categories';
|
||||
// $kpis[] = $helper->generate();
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-top-category';
|
||||
@@ -505,7 +506,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'id' => 'categories-tree',
|
||||
'selected_categories' => $selected_categories,
|
||||
'disabled_categories' => (!Tools::isSubmit('add'.$this->table) && !Tools::isSubmit('submitAdd'.$this->table)) ? array($this->_category->id) : null,
|
||||
'root_category' => $context->shop->getCategory()
|
||||
'root_category' => Configuration::get('PS_SERVICE_CATEGORY')
|
||||
)
|
||||
),
|
||||
array(
|
||||
|
||||
Reference in New Issue
Block a user