/**
* AxonCreator - Website Builder
*
* NOTICE OF LICENSE
*
* @author axonvip.com <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bfcccacfcfd0cdcbffdec7d0d1c9d6cf91dcd0d2">[email protected]</a>>
* @copyright 2021 axonvip.com
* @license You can not resell or redistribute this software.
*
* https://www.gnu.org/licenses/gpl-3.0.html
*/
var AxpsSearchModule;
!(function (d) {
"use strict";
AxpsSearchModule = {
init: function () {
this.mdCategoryDropdown(), this.mdSearch();
},
mdSearch: function () {
d("body").on("shown.bs.modal", "#search-popup", function () {
var e,
a,
i = d("#search-popup").find("input[name=s]").val();
d("#search-popup").find("input[name=s]").val("").focus().val(i),
d(window).width() < 768 ||
((a = (e = d("#search-popup").find(".category-dropdown-inner")).innerWidth() + e.closest("form").find(".search-submit").innerWidth() + 17),
(i = "padding-right"),
d("form.has-ajax-search").each(function () {
var a,
e,
i,
n,
r,
s,
t,
o,
c = d(this);
c.hasClass("fs-initialized") ||
(c.addClass("fs-initialized"),
(a = '<div class="view-all-results view-all-products"><span>' + opSearch.all_results_product + "</span></div>"),
(e = c.attr("action")),
(i = parseInt(opSearch.count)),
(n = c.find('[name="c"]')),
(r = "cart_default"),
(s = c.closest(".search-wrapper").find(".search-results")),
c.removeClass("has-ajax-search"),
void 0 !== opSearch.imageType && "" != opSearch.imageType && (r = opSearch.imageType),
0 != opSearch.search_string && c.find("input[name=s]").val(opSearch.search_string),
c.find("input[name=s]").click(function () {
3 <= c.find("input[name=s]").val().length && "" !== s.find(".autocomplete-suggestions").html() && s.find(".autocomplete-suggestions").css({ display: "flex" });
}),
s.on("click", ".view-all-products", function () {
c.submit();
}),
c.find("input[name=s]").devbridgeAutocomplete({
serviceUrl: e,
appendTo: s,
type: "POST",
dataType: "json",
paramName: "s",
minChars: 3,
params: { c: n.val(), resultsPerPage: i },
onSelect: function (e) {
void 0 !== e.permalink && 0 < e.permalink.length
// Add conditional statement here to check if price is greater than 0
{
if(e.price > 0){
(d('.search-price').append('<td>'+ e.price+'</td>'))
}
},
;
},
mdCategoryDropdown: function () {
d(".category-dropdown-inner").each(function () {
var i,
n,
s,
r = d(this);
function t() {
r.removeClass("shown");
}
function o() {
var e, a;
d(window).width() < 768 ||
((e = r.innerWidth() + r.closest("form").find(".search-submit").innerWidth() + 17), (a = "padding-right"), d("body").hasClass("rtl") && (a = "padding-left"), r.closest("form").find("input[name=s]").css(a, e));
}
r.hasClass("cd-initialized") ||
(r.addClass("cd-initialized"),
(i = r.find("> a")),
(n = r.find("> input")),
(s = r.find("> .list-wrapper")),
opSearch.current_category_id &&
(s.find(".active-item").removeClass("active-item"),
s
.find("a[data-value=" + opSearch.current_category_id + "]")
.parent()
.addClass("active-item"),
i.text(s.find("a[data-value=" + opSearch.current_category_id + "]").text()),
n.val(opSearch.current_category_id),
s.find("ul:not(.children) > li:first-child").show()),
o(),
d("body").on("click", function (e) {
e = e.target;
if (r.hasClass("shown") && !d(e).is(".category-dropdown-inner") && !d(e).parents().is(".category-dropdown-inner")) return t(), !1;
}),
In the below code the e.price is the price of a product, I want to know how I can put an If conditional statement in this so that the price with zero price shall not be shown (no price), and if amount is greater than 0 then it will be shown. I tried `if(e.price == 0)` but I don't know how and in which line it should be written.
formatResult: function(e, a) {
var i = "(" + (a = "&" === a ? "&" : a).replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + ")",
a = "";
return (
e.divider && (a += ' <h5 class="search-divider-text">' + e.divider + "</h5>"),
e.thumbnail && (a += ' <div class="search-thumb">' + e.thumbnail + "</div>"),
e.value && (a += '<h4 class="search-title">' + e.value.replace(new RegExp(i, "gi"), "<strong>$1</strong>").replace(/<(\/?strong)>/g, "<$1>") + "</h4>"),
e.no_found && (a = '<div class="no-result">' + e.value + "</div>"),
e.view_all_products && (a = '<div class="view-all-products"></div>'),
e.sku && (a += ' <div class="search-sku">' + e.sku + "</div>"),
e.price &&
// Adjusted condition based on your requirement
(a += e.price > 0 ? ' <div class="search-price">' + e.price + '</div>' : ''),
a
);
},