How to filter by MarkAsNewProduct field in product category page without page refresh in nopcommerce 4.2

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 anos atrás
I want to filter markasnewproduct field in product category page by checkbox click event without page refresh in nopcommerce 4.2.

For more clear let see the image of it


Now as the image display there is a checkbox named MarkAsNewProduct in that if anyone click on it then show the product which is new else old.

I done the code bt in that I am getting the page refresh so from that checkbox is uncheck bydefault.

Here is my code

<input type="checkbox" id="chb_markasnewproduct" onclick="setLocation('@Url.RouteUrl("Vendor", new { vendorId = Model.Id, categoryId = Model.CategoryId, isWholeSaler = "$('#chb_markasnewproduct').is(':checked')" })')" /> MarkAsNewProduct
4 anos atrás
Hi,

The setLocation is changing the current page so it will always refresh the page.

You can use AJAX request to get the product items matching the Marked as new filter and replace the current products with the new one. That way the page won't be refreshed and the products will be replaced dynamically.

If the problem is only the checkbox is not checked after refreshing the page you can add a parameter to the URL and check/uncheck the button based on this parameter.

Regards,
Stoyan
4 anos atrás
If I do ajax then in the success function what I want to call. Because from ajax json is return not the model view. So, how can I call the product category view in ajax success region?
4 anos atrás
If I do ajax then in the success function what I want to call. Because from ajax json is return not the model view. So, how can I call the product category view in ajax success region?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.