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