[*] BO : Adding category management with multishop
This commit is contained in:
+2
-2
@@ -725,9 +725,9 @@ if (Tools::isSubmit('getAdminHomeElement'))
|
||||
die(Tools::jsonEncode($result));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getChildrenCategories') && Tools::getValue('id_category_parent'))
|
||||
if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent'))
|
||||
{
|
||||
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id);
|
||||
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id, null, Tools::getValue('use_shop_context'));
|
||||
die(Tools::jsonEncode($children_categories));
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,17 @@
|
||||
{block name=leadin}
|
||||
<div class="cat_bar2">
|
||||
{if count($categories_tree) == 0}
|
||||
<img src="../img/admin/home.gif" alt="" /> {l s='Home'}
|
||||
{if $category_root->id_category == 0}
|
||||
<img src="../img/admin/home.gif" alt="" /> {$category_root->name}
|
||||
{else}
|
||||
<img src="../img/admin/home.gif" alt="" /> {$categories_name}
|
||||
{/if}
|
||||
{else}
|
||||
<a href="{$currentIndex}&token={$token}"><img src="../img/admin/home.gif" alt="" /> {l s='Home'}</a> >
|
||||
{if $category_root->id_category == 0}
|
||||
<a href="{$currentIndex}&token={$token}"><img src="../img/admin/home.gif" alt="" /> {$category_root->name}</a> >
|
||||
{else}
|
||||
<a href="{$currentIndex}&id_category={$category_root->id_category}&token={$token}"><img src="../img/admin/home.gif" alt="" /> {$category_root->name}</a> >
|
||||
{/if}
|
||||
|
||||
{foreach $categories_tree key=key item=category}
|
||||
{if $key == 0}
|
||||
|
||||
@@ -291,6 +291,8 @@
|
||||
{include file='helper/assoshop.tpl' input=$input fields_value=$fields_value}
|
||||
{elseif $input.type == 'categories'}
|
||||
{include file='helper/form/form_category.tpl' categories=$input.values}
|
||||
{elseif $input.type == 'categories_select'}
|
||||
{$input.category_tree}
|
||||
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
|
||||
{$asso_shop}
|
||||
{elseif $input.type == 'color'}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
var use_radio = {if $categories.use_radio}1{else}0{/if};
|
||||
var selectedCat = '{implode value=$categories.selected_cat}';
|
||||
var selectedLabel = '{$categories.trads.selected}';
|
||||
var home = '{$categories.trads.Home}';
|
||||
var home = '{$categories.trads.Root.name}';
|
||||
var use_radio = {if $categories.use_radio}1{else}0{/if};
|
||||
$(document).ready(function(){
|
||||
buildTreeView();
|
||||
@@ -60,13 +60,13 @@
|
||||
|
||||
{foreach $categories.selected_cat AS $cat}
|
||||
{if is_array($cat)}
|
||||
{if $cat.id_category != 1}
|
||||
{if $cat.id_category != $categories.trads.Root.id_category}
|
||||
<input {if in_array($cat.id_category, $categories.disabled_categories)}disabled="disabled"{/if} type="hidden" name="{$categories.input_name}" value="{$cat.id_category}" >
|
||||
{else}
|
||||
{assign var=home_is_selected value=true}
|
||||
{/if}
|
||||
{else}
|
||||
{if $cat != 1}
|
||||
{if $cat != $categories.trads.Root.id_category}
|
||||
<input {if in_array($cat, $categories.disabled_categories)}disabled="disabled"{/if} type="hidden" name="{$categories.input_name}" value="{$cat}" >
|
||||
{else}
|
||||
{assign var=home_is_selected value=true}
|
||||
@@ -74,14 +74,14 @@
|
||||
{/if}
|
||||
{/foreach}
|
||||
<ul id="categories-treeview" class="filetree">
|
||||
<li id="1" class="hasChildren">
|
||||
<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="1"
|
||||
value="$categories.trads.Root.id_category"
|
||||
{if $home_is_selected}checked{/if}
|
||||
onclick="clickOnCategoryBox($(this));" />
|
||||
{$categories.trads.Home}
|
||||
{$categories.trads.Root.name}
|
||||
</span>
|
||||
<ul>
|
||||
<li><span class="placeholder"> </span></li>
|
||||
|
||||
@@ -39,7 +39,25 @@
|
||||
|
||||
{block name="start_field_block"}
|
||||
<div class="margin-form">
|
||||
{if $input.type == 'theme'}
|
||||
{if $input.type == 'select' && $input.name == 'id_category'}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$("#id_category").change(function(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url : "{$current}",
|
||||
async: true,
|
||||
dataType: "html",
|
||||
data : "ajax=true&id_category="+$(this).val()+"&use_shop_context=false&getCategoriesFromRootCategory=true&token={$token}",
|
||||
success : function(res)
|
||||
{
|
||||
$('#categories-treeview').parent().html(res);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{else if $input.type == 'theme'}
|
||||
{foreach $input.values as $theme}
|
||||
<div class="select_theme {if $theme->id == $fields_value.id_theme_checked}select_theme_choice{/if}" onclick="$(this).find('input').attr('checked', true); $('.select_theme').removeClass('select_theme_choice'); $(this).toggleClass('select_theme_choice');">
|
||||
{$theme->name}<br />
|
||||
|
||||
Reference in New Issue
Block a user