// categories multishop improved
This commit is contained in:
@@ -76,12 +76,16 @@
|
||||
<ul id="categories-treeview" class="filetree">
|
||||
<li id="{$categories.trads.Root.id_category}" class="hasChildren">
|
||||
<span class="folder">
|
||||
<input type="{if !$categories.use_radio}checkbox{else}radio{/if}"
|
||||
name="{$categories.input_name}"
|
||||
value="{$categories.trads.Root.id_category}"
|
||||
{if $home_is_selected}checked{/if}
|
||||
onclick="clickOnCategoryBox($(this));" />
|
||||
{$categories.trads.Root.name}
|
||||
{if $categories.top_category->id != $categories.trads.Root.id_category}
|
||||
<input type="{if !$categories.use_radio}checkbox{else}radio{/if}"
|
||||
name="{$categories.input_name}"
|
||||
value="{$categories.trads.Root.id_category}"
|
||||
{if $home_is_selected}checked{/if}
|
||||
onclick="clickOnCategoryBox($(this));" />
|
||||
<span class="category_label">{$categories.trads.Root.name}</span>
|
||||
{else}
|
||||
|
||||
{/if}
|
||||
</span>
|
||||
<ul>
|
||||
<li><span class="placeholder"> </span></li>
|
||||
|
||||
@@ -673,6 +673,8 @@ class CategoryCore extends ObjectModel
|
||||
$shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
else
|
||||
$shop = $context->shop;
|
||||
else
|
||||
return new Category($shop->getCategory(), $id_lang);
|
||||
$is_more_than_one_root_category = count(Category::getCategoriesWithoutParent()) > 1;
|
||||
if ((!Shop::isFeatureActive() && $is_more_than_one_root_category) ||
|
||||
Shop::isFeatureActive() && $is_more_than_one_root_category && $context->shop() != Shop::CONTEXT_SHOP)
|
||||
@@ -922,7 +924,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
$categories = null;
|
||||
$id_current = $this->id;
|
||||
$context->shop = ($context->shop->id) ? $context->shop : new Shop(Configuration::get('PS_DEFAULT_SHOP'));
|
||||
$context->shop = ($context->shop->id) ? $context->shop : new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
while (true)
|
||||
{
|
||||
$sql = '
|
||||
|
||||
@@ -165,7 +165,9 @@ class HelperCore
|
||||
);
|
||||
|
||||
$top_category = Category::getTopCategory();
|
||||
$root_category = Category::getRootCategory();
|
||||
$id_shop = Tools::isSubmit('id_shop') ? Tools::getValue('id_shop'): Configuration::get('PS_SHOP_DEFAULT');
|
||||
$shop = new Shop($id_shop);
|
||||
$root_category = Category::getRootCategory(null, $shop);
|
||||
$disabled_categories[] = $top_category->id;
|
||||
if (!$root)
|
||||
$root = array('name' => $root_category->name, 'id_category' => $root_category->id);
|
||||
|
||||
@@ -323,6 +323,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'use_radio' => true,
|
||||
'use_search' => false,
|
||||
'disabled_categories' => array(4),
|
||||
'top_category' => Category::getTopCategory(),
|
||||
)
|
||||
),
|
||||
array(
|
||||
@@ -407,6 +408,15 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'class' => 'button'
|
||||
)
|
||||
);
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
'values' => Shop::getTree()
|
||||
);
|
||||
}
|
||||
if (Tools::isSubmit('add'.$this->table.'root'))
|
||||
unset($this->fields_form['input'][2],$this->fields_form['input'][3]);
|
||||
|
||||
|
||||
@@ -2466,7 +2466,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
$product = $obj;
|
||||
$data = $this->createTemplate($this->tpl_form);
|
||||
// Prepare Categories tree for display in Associations tab
|
||||
$default_category = Tools::getValue('id_category', 1);
|
||||
$root = Category::getRootCategory();
|
||||
$default_category = Tools::getValue('id_category', $root->id);
|
||||
|
||||
if (!$product->id)
|
||||
$selected_cat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language);
|
||||
|
||||
Reference in New Issue
Block a user