Thread Starter
Justin
(@azyrus_pok)
Hey ILLID,
I’m hoping to add:
if ( ( typeof response.cats !== 'undefined' ) && response.cats.length > 0 ) {
$.each(response.cats, function (i, result) {
html += '<li class="aws_result_item aws_result_cat">';
html += '<a class="aws_result_link" href="' + result.link + '" >';
html += '<span class="aws_result_content">';
html += '<span class="aws_result_title">';
html += result.name;
html += '<span class="aws_result_count"> (' + result.count + ')</span>';
html += '</span>';
html += '</span>';
html += '<a href="http://www.website.com/cart/?add-to-cart= (' + result.id + ')">Add To Cart</a>'
html += '</a>';
html += '</li>';
});
}
How do you propose I pull the $post_ID into the common.js result.id variable?
Thanks!
Plugin Author
ILLID
(@mihail-barinov)
Hi,
Find loop
$.each(response.products, function (i, result) {
.............
}
and inside it you can call
result.post_data.ID
to get product ID.
-
This reply was modified 8 years ago by
ILLID.
Did this work? do you have a demo?
Thread Starter
Justin
(@azyrus_pok)
Hey Wayne,
if result on sale starts at line 176. (advanced woo search > assets > common.js)
if ( result.on_sale ) {
html += '<span class="aws_result_sale">';
html += '<span class="aws_onsale">' + translate.sale + '</span>';
html += '</span>';
}
html += '</a>';
html += '<a href="http://www.website.com/cart/?add-to-cart= (' + result.post_data.ID + ')" style="float:right;">Add To Cart</a>'
html += '</li>';
That did work, unfortunately I can’t provide a demo.
Good luck!