Search ‘ + ” + ‘
${ data.Name }
‘ + ‘
# var price = “”; if (data.ProductPrice.Price) { price = data.ProductPrice.Price } # #= price #
‘ + ‘
# var sku = “”; if (data.CustomProperties.Sku != null) { sku = “SKU: ” + data.CustomProperties.Sku } # #= sku #
‘ + ” + ”,
dataSource: new kendo.data.DataSource({
serverFiltering: true,
requestStart: function(e) {
$(“#small-searchterms”).addClass(“instant-search-busy”);
},
change: function(e) {
$(“#small-searchterms”).removeClass(“instant-search-busy”);
},
transport: {
read: “https://www.noveltylights.com/InstantSearch/InstantSearchFor”,
parameterMap: function(data) {
return { q: $(“#small-searchterms”).val(), categoryId: $(“#instant-search-categories”).val() };
}
}
}
),
change: function(e) {
var selected = $(“.k-list”).find(“.k-state-selected”);
var url = selected.find(‘.instant-search-item’).attr(‘data-url’);
if (typeof url === “undefined”) {
// do nothing as the value has probably been changed from the onblur event handler rather than from dropdown selection
} else {
// navigate to the searched product
setLocation(url);
}
},
dataBound: function() {
$(“.k-animation-container”).addClass(“instantSearch”);
}
});
if (“True” == “False”) {
$(“.search-box form”).on(“keydown”, function(e) {
if (e.keyCode === 13) {
$(this).submit();
}
});
}
$(“.search-box form”).submit(function(e) {
var selectedCategory = $(“#instant-search-categories”).val() || 0;
var searchedTerm = $(“#small-searchterms”).val();
if (searchedTerm && searchedTerm != “”) {
window.location.href = “/” + “search?as=true&cid=” + selectedCategory + “&q=” + encodeURIComponent(searchedTerm) + “&Sid=False&Isc=true”;
}
e.preventDefault();
});
});