${prod_title}
${prod_price}
`);
}
});
$(data).find(‘.product-list–collection .signings_item’).each(function() {
var prod_img = $(this).find(‘img’).attr(‘data-src’);
var prod_link = $(this).find(‘a’).attr(‘href’);
var prod_title = $(this).find(‘.product-details .title’).html();
var prod_price = $(this).find(‘.product-details .price .money’).html();
if (prod_title !== ‘Payment Processing Fee’ && (typeof prod_price !== ‘undefined’ && prod_price !== null)) {
resultsContainer.append(` ${prod_title}
${prod_price}
`);
}
});
var searchResultsHeight = $(‘.custom_result_item’).height();
if (typeof searchResultsHeight == ‘undefined’) {
$(‘.search_results_here’).html(`
No Items found
`);
}
}
});
}, 300));
$(‘.search__button_custom’).on(‘click’, function () {
var query_2 = $(this).parent().find(‘.search-input__’).val();
$(‘.search-input_hidden__’).val(query_2);
var new_val = $(‘.search-input_hidden__’).val();
console.log(`${query_2}: ${new_val}`);
setTimeout(function() {
$(‘.search__button_main’).trigger(‘click’);
}, 500);
});
$(document).on(‘click’, ‘.custom_result_cart_wrapper’, function(event) {
event.preventDefault();
var cartWrapper = $(this); // Store a reference to $(this)
var items = [];
var selected_id = cartWrapper.attr(‘product-id_’);
items.push({ id: selected_id, quantity: 1 });
var data = {
items: items
};
$.ajax({
type: ‘POST’,
url: ‘/cart/add.js’,
dataType: ‘json’,
data: data,
success: function() {
updateCartDrawer()
cartWrapper.html(“);
setTimeout(function() {
cartWrapper.html(“);
}, 1500);
},
error: function(xhr, status, error) {
alert(‘Something went wrong’);
}
});
});
$(document).click(function(event) {
if (!$(event.target).closest(‘.search-bar-container’).length) {
$(‘.search_results_here’).hide();
$(‘.search-input__’).val(”);
}
});
function updateCartDrawer() {
$.ajax({
type: ‘GET’,
url: ‘/’,
dataType: ‘html’,
success: function(data) {
var cartCount = $(data).find(‘.cart_count’).html();
$(‘.cart_count’).empty();
$(‘.cart_count’).html(cartCount);
},
error: function(xhr, status, error) {
console.error(‘Error fetching updated cart content:’, error);
}
});
}
});
2024-02-06 10:54:21
#Page