1/* global $ */ 2$(document).ready(function () { 3 var $searchWidget = $('#search_widget'); 4 var $searchBox = $searchWidget.find('input[type=text]'); 5 var searchURL = $searchWidget.attr('data-search-controller-url'); 6 7 $.widget('prestashop.psBlockSearchAutocomplete', $.ui.autocomplete, { 8 _renderItem: function (ul, product) { 9 return $("<li>") 10 11 .append($("<a>") 12 13 .append($("<span>").addClass("search_left") 14 .append($('<img />').attr('src',product.cover.small.url)) 15 ) 16 17 .append($("<span>").addClass("search_right") 18 .append($("<span>").html(product.manufacturer_name).addClass("search_brand")) 19 .append($("<span>").html(product.name).addClass("search_name")) 20 .append($("<span>").html(product.price).addClass("search_price")) 21 ) 22 23 .append($("<span>").addClass("clearfix")) 24 25 ).appendTo(ul) 26 ; 27 } 28 }); 29 30 $searchBox.psBlockSearchAutocomplete({ 31 source: function (query, response) { 32 $.post(searchURL, { 33 s: query.term, 34 resultsPerPage: 10 35 }, null, 'json') 36 .then(function (resp) { 37 response(resp.products); 38 }) 39 .fail(response); 40 }, 41 select: function (event, ui) { 42 var url = ui.item.url; 43 window.location.href = url; 44 }, 45 }); 46});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.