brands.push(item);
}
});
- });
+ });
$.each(brands, function(index, item){
} else {
$("#rvManufacturers").prev().prev().prop("disabled",false);
}
- });
-
-// $('#manufacturer-form').submit(function(e){
-// if( $('#brands').prev().children('li').length > 0 ){
-// $('#rvManufacturers').removeAttr('name');
-// }
-//
-// });
-
-
- jQuery('select[multiple]').asmSelect();
-
-
-
-// if( $('#brands').prev().children('li').length > 0 ){
-// $("#rvManufacturers").prev().prev().prop("disabled","disabled");
-// }
-
- if( $('#rvManufacturers').prev().children('li').length > 0 ){
-
- $('#brands option').remove();
- var brands = [];
- var cat_id = $('#rvManufacturers').val();
-
- $.each(cat_id, function(index, item){
- var select_id = item;
- $.each(categories , function(index, item){
- if( parseInt(select_id) === item.parent_id ){
- brands.push(item);
- }
- });
- });
+ });
- $.each(brands, function(index, item){
- {literal} var option = $('<option>', {value: item.id, text: item.name}); {/literal}
- $('#brands').append(option);
+ if( $('#rvManufacturers').prev().children('li').length > 0 ){
+
+ var brand_ids = $('#brands').val();
+
+ $('#brands option').remove();
+
+ var brands = [];
+ var cat_id = $('#rvManufacturers').val();
+ $.each(cat_id, function(index, item){
+ var select_id = item;
+ $.each(categories , function(index, item){
+ if( parseInt(select_id) === item.parent_id ){
+ brands.push(item);
+ }
});
+ });
+ var searched_brand;
- $('#brands').prev().prev().remove();
- $('#brands').prev().remove();
- jQuery('#brands').asmSelect();
-
- }
+ $.each(brands, function(index, item){
+
+ if( $.inArray(item.id, brand_ids) === 0){
+ console.log("Test");
+ searched_brand = true;
+ } else {
+ console.log("test");
+ searched_brand = false;
+ }
+
+ {literal} var option = $('<option>', {selected: searched_brand, value: item.id, text: item.name}); {/literal}
+ $('#brands').append(option);
+ });
+ $('#brands').prev().prev().remove();
+ $('#brands').prev().remove();
+ }
+ jQuery('select[multiple]').asmSelect();
// Show search filters box
{if $settings.list_show_search}