// Helper::renderAdminCategorieTree refactoring
This commit is contained in:
@@ -98,7 +98,7 @@ class HelperCore
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.5 - use Helper::renderCategoryTree() instead
|
||||
* Since 1.5 - This function will be deprecated in 1.6 - use Helper::renderCategoryTree() instead
|
||||
* @static
|
||||
* @param $translations
|
||||
* @param array $selected_cat
|
||||
@@ -145,7 +145,6 @@ class HelperCore
|
||||
* (
|
||||
* [id_category] => 1
|
||||
* [name] => Home page
|
||||
* [link_rewrite] => home
|
||||
* )
|
||||
* )
|
||||
* @param string $input_name name of input
|
||||
|
||||
@@ -247,21 +247,11 @@ class AdminGroupsControllerCore extends AdminController
|
||||
)
|
||||
)
|
||||
);
|
||||
$root_category = Category::getRootCategory();
|
||||
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name[$this->context->language->id]);
|
||||
|
||||
$this->fields_value['reduction'] = isset($group->reduction) ? $group->reduction : 0;
|
||||
|
||||
$trads = array(
|
||||
'Root' => $root_category,
|
||||
'selected' => $this->l('selected'),
|
||||
'Collapse All' => $this->l('Collapse All'),
|
||||
'Expand All' => $this->l('Expand All'),
|
||||
'Check All' => $this->l('Check All'),
|
||||
'Uncheck All' => $this->l('Uncheck All'),
|
||||
'search' => $this->l('Search a category')
|
||||
);
|
||||
|
||||
$this->tpl_form_vars['categoryTreeView'] = Helper::renderAdminCategorieTree($trads, array(), 'id_category', true, false, array(), true);
|
||||
$helper = new Helper();
|
||||
$this->tpl_form_vars['categoryTreeView'] = $helper->renderCategoryTree(null, array(), 'id_category', true, false, array(), true);
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
@@ -2477,17 +2477,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
else
|
||||
$selected_cat = Product::getProductCategoriesFull($product->id, $this->default_form_language);
|
||||
}
|
||||
$root_category = Category::getRootCategory();
|
||||
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name[$this->context->language->id]);
|
||||
$translations = array(
|
||||
'Root' => $root_category,
|
||||
'selected' => $this->l('selected'),
|
||||
'Collapse All' => $this->l('Collapse All'),
|
||||
'Expand All' => $this->l('Expand All'),
|
||||
'Check All' => $this->l('Check All'),
|
||||
'Uncheck All' => $this->l('Uncheck All'),
|
||||
'search' => $this->l('Search a category')
|
||||
);
|
||||
|
||||
// Multishop block
|
||||
$data->assign('feature_shop_active', Shop::isFeatureActive());
|
||||
@@ -2515,10 +2504,11 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
$product->manufacturer_name = Manufacturer::getNameById($product->id_manufacturer);
|
||||
|
||||
$helper = new Helper();
|
||||
$data->assign(array('default_category' => $default_category,
|
||||
'selected_cat_ids' => implode(',', array_keys($selected_cat)),
|
||||
'selected_cat' => $selected_cat,
|
||||
'category_tree' => Helper::renderAdminCategorieTree($translations, $selected_cat, 'categoryBox', false, true),
|
||||
'category_tree' => $helper->renderCategoryTree(null, $selected_cat, 'categoryBox', false, true),
|
||||
'product' => $product,
|
||||
'link' => $this->context->link
|
||||
));
|
||||
|
||||
@@ -176,15 +176,9 @@ class AdminShopControllerCore extends AdminController
|
||||
{
|
||||
$root_category = new Category((int)Tools::getValue('id_category'));
|
||||
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name[$this->context->language->id]);
|
||||
$trads = array(
|
||||
'Root' => $root_category,
|
||||
'selected' => $this->l('selected'),
|
||||
'Collapse All' => $this->l('Collapse All'),
|
||||
'Check All' => $this->l('Check All'),
|
||||
'Uncheck All' => $this->l('Uncheck All'),
|
||||
'Expand All' => $this->l('Expand All')
|
||||
);
|
||||
echo Helper::renderAdminCategorieTree($trads, array($root_category['id_category']));
|
||||
|
||||
$helper = new Helper();
|
||||
echo $helper->renderCategoryTree($root_category, array($root_category['id_category']));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,16 +501,8 @@ class AdminShopControllerCore extends AdminController
|
||||
else
|
||||
$root_category = new Category($id_root);
|
||||
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name[$this->context->language->id]);
|
||||
$translations = array(
|
||||
'Root' => $root_category,
|
||||
'selected' => $this->l('selected'),
|
||||
'Collapse All' => $this->l('Collapse All'),
|
||||
'Expand All' => $this->l('Expand All'),
|
||||
'Check All' => $this->l('Check All'),
|
||||
'Uncheck All' => $this->l('Uncheck All'),
|
||||
'search' => $this->l('Search a category')
|
||||
);
|
||||
|
||||
return Helper::renderAdminCategorieTree($translations, $selected_cat, 'categoryBox', false, true);
|
||||
$helper = new Helper();
|
||||
return $helper->renderCategoryTree($root_category, $selected_cat, 'categoryBox', false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,31 +324,10 @@ class Loyalty extends Module
|
||||
<label>'.$this->l('Vouchers created by the loyalty system can be used in the following categories :').'</label>';
|
||||
$index = explode(',', Configuration::get('PS_LOYALTY_VOUCHER_CATEGORY'));
|
||||
$indexedCategories = isset($_POST['categoryBox']) ? $_POST['categoryBox'] : $index;
|
||||
// Translations are not automatic for the moment ;)
|
||||
if (version_compare(_PS_VERSION_,'1.5','>'))
|
||||
{
|
||||
if ($this->context->shop() == Shop::CONTEXT_SHOP)
|
||||
{
|
||||
$root_category = Category::getRootCategory();
|
||||
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name);
|
||||
}
|
||||
else
|
||||
$root_category = array('id_category' => '0', 'name' => $this->l('Root'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$root_category = array('id_category' => '1', 'name' => $this->l('Home'));
|
||||
}
|
||||
$trads = array(
|
||||
'Root' => $root_category,
|
||||
'selected' => $this->l('selected'),
|
||||
'Collapse All' => $this->l('Collapse All'),
|
||||
'Expand All' => $this->l('Expand All'),
|
||||
'Check All' => $this->l('Check All'),
|
||||
'Uncheck All' => $this->l('Uncheck All')
|
||||
);
|
||||
$html .= '<div class="margin-form">'.Helper::renderAdminCategorieTree($trads, $indexedCategories).'</div>';
|
||||
$html .= '
|
||||
|
||||
$helper = new Helper();
|
||||
$html .= '<div class="margin-form">'.$helper->renderCategoryTree(null, $indexedCategories).'</div>';
|
||||
$html .= '
|
||||
<p style="padding-left:200px;">'.$this->l('Mark the box(es) of categories in which loyalty vouchers are usable.').'</p>
|
||||
<div class="clear"></div>
|
||||
<h3 style="margin-top:20px">'.$this->l('Loyalty points progression').'</h3>
|
||||
|
||||
Reference in New Issue
Block a user