// Default category was not selected

This commit is contained in:
Jerome Nadaud
2013-11-25 16:05:18 +01:00
parent d30e376354
commit b2cee0426a
2 changed files with 45 additions and 5 deletions
@@ -38,6 +38,14 @@
function()
{
$(this).prop("checked", true);
$('select#id_category_default').append('<option value="'+$(this).val()+'">'+($(this).val() !=1 ? $(this).parent().find('label').html() : home)+'</option>');
if ($('select#id_category_default option').length > 0)
{
$('select#id_category_default').closest('.form-group').show();
$('#no_default_category').hide();
}
$(this).parent().addClass("tree-selected");
}
);
@@ -49,6 +57,14 @@
function()
{
$(this).prop("checked", false);
$('select#id_category_default option[value='+$(this).val()+']').remove();
if ($('select#id_category_default option').length == 0)
{
$('select#id_category_default').closest('.form-group').hide();
$('#no_default_category').show();
}
$(this).parent().removeClass("tree-selected");
}
);
@@ -112,5 +128,29 @@
}
);
{/if}
$("#{$id}").find(":input[type=checkbox]").click(
function()
{
if ($(this).prop("checked"))
{
$('select#id_category_default').append('<option value="'+$(this).val()+'">'+($(this).val() !=1 ? $(this).parent().find('label').html() : home)+'</option>');
if ($('select#id_category_default option').length > 0)
{
$('select#id_category_default').closest('.form-group').show();
$('#no_default_category').hide();
}
}
else
{
$('select#id_category_default option[value='+$(this).val()+']').remove();
if ($('select#id_category_default option').length == 0)
{
$('select#id_category_default').closest('.form-group').hide();
$('#no_default_category').show();
}
}
}
);
});
</script>
@@ -23,9 +23,9 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<li class="tree-item{if isset($node['disabled']) && $node['disabled'] == true} tree-item-disable{/if}">
<label class="tree-item-name">
<input type="checkbox" name="categoryBox[]" value="{$node['id_category']}"{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} />
<i class="tree-dot"></i>
{$node['name']}
</label>
<span class="tree-item-name{if isset($node['disabled']) && $node['disabled'] == true} tree-item-name-disable{/if}">
<input type="checkbox" name="categoryBox[]" value="{$node['id_category']}"{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} />
<i class="tree-dot"></i>
<label class="tree-toggler">{$node['name']}</label>
</span>
</li>