'; } } } if (html) { this.show(); } else { this.hide(); } $(this.element).siblings('ul.dropdown-menu').html(html); } }; $.fn.autocomplete1 = function(option) { return this.each(function() { var data = $(this).data('autocomplete'); if (!data) { data = new Autocomplete1(this, option); $(this).data('autocomplete', data); } }); } })(window.jQuery); $(document).ready(function() { var selector = '#search0'; var total = 0; var show_image = true; var show_price = true; var search_sub_category = true; var search_description = true; var width = 102; var height = 102; $(selector).find('input[name=\'search\']').autocomplete1({ delay: 500, source: function(request, response) { var category_id = $(".category_filter select[name=\"category_id\"]").first().val(); if(typeof(category_id) == 'undefined') category_id = 0; var limit = 5; var search_sub_category = search_sub_category?'&sub_category=true':''; var search_description = search_description?'&description=true':''; $.ajax({ url: 'index.php?route=module/pavautosearch/autocomplete&filter_category_id='+category_id+'&width='+width+'&height='+height+'&limit='+limit+search_sub_category+search_description+'&filter_name='+encodeURIComponent(request), dataType: 'json', success: function(json) {	response($.map(json, function(item) { if($('.pavautosearch_result')){ $('.pavautosearch_result').first().html(""); } total = 0; if(item.total){ total = item.total; } return { price: item.price, speical: item.special, tax: item.tax, label: item.name, image: item.image, link: item.link, value: item.product_id, sprice: show_price, simage: show_image, } })); } }); }, }); // End Autocomplete });// End document.ready