var categories = '{$categories|@json_encode}';
categories = JSON.parse(categories);
+
$('#rvManufacturers').on("change", function(){
var _ = $(this);
} else {
$("#rvManufacturers").prev().prev().prop("disabled",false);
}
- // var data = {
- // action: 'glm_members_admin_ajax',
- // glm_action: 'filterSearch',
-
- // console.log(response);
- // }
- // });
-//
-// });
-// }
-// $('#rvManufacturers').manufacturer_brand();
-// $('#brands').manufacturer_brand();
-
});
$('#manufacturer-form').submit(function(e){
if( $('#brands').prev().children('li').length > 0 ){
}
});
-// var cat_ids = [];
-// $.fn.manufacturer_brand = function(){
-//
-// $(this).on("change", function(){
-// var _ = $(this);
-//
-// var cat_names = [];
-// var cat_id = _.val();
-// var el_id = _.attr('id');
-// var cats = _.prev().find('span');
-//
-// cat_ids.push(cat_id);
-//
-// cats.each(function(){
-// cat_names.push(_.text());
-// });
-//
-// var data = {
-// action: 'glm_members_admin_ajax',
-// glm_action: 'filterSearch',
-// cat_ids: cat_ids,
-// el_id: el_id,
-// cat_names: cat_names,
-// };
-// $.ajax({
-// type: 'POST',
-// url: '{$ajaxUrl}',
-// data: data,
-// success: function(response){
-// console.log(response);
-// }
-// });
-//
-// });
-// }
-// $('#rvManufacturers').manufacturer_brand();
-// $('#brands').manufacturer_brand();
+
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);
+
+ });
+
+ $('#brands').prev().prev().remove();
+ $('#brands').prev().remove();
+ jQuery('#brands').asmSelect();
+
+ }
+
+
// Show search filters box
{if $settings.list_show_search}