Close

GetAddProductToCartAjaxButton ajax calls slows down page load

bubli
11 years ago
#2199 Quote
Avatar
  • 12
Hi,
I noticed that page load time with Nop Ajax Cart enabled is much longer then it was before so I did some investigation. I found out that the reason is calling GetAddProductToCartAjaxButton action method through AJAX for every product listed on the page. One call takes ~80ms and is performed in serial for all products, resulting in ~1 sec page load lag for catalog page with 12 products (my default).
Result of this call is pretty simple HTML with few input tags, so I'm assuming it can be called using Html.Action (thus saving client <-> server roundtrips) or even better rendered using Html.Partial (saving also ASP.NET MVC request overhead).

Exactly the same problem appears in product details page with multiple variants - NopAjaxCart/GetAddProductVariantToCartAjaxButton action method is called count_of_variants_times

This can give us major performance and UX gain ;-)

Thanks!
Marek

IvanStoyanov
11 years ago
#2200 Quote
Avatar
  • 269
bubli wrote:
Hi,
I noticed that page load time with Nop Ajax Cart enabled is much longer then it was before so I did some investigation. I found out that the reason is calling GetAddProductToCartAjaxButton action method through AJAX for every product listed on the page. One call takes ~80ms and is performed in serial for all products, resulting in ~1 sec page load lag for catalog page with 12 products (my default).
Result of this call is pretty simple HTML with few input tags, so I'm assuming it can be called using Html.Action (thus saving client <-> server roundtrips) or even better rendered using Html.Partial (saving also ASP.NET MVC request overhead).

Exactly the same problem appears in product details page with multiple variants - NopAjaxCart/GetAddProductVariantToCartAjaxButton action method is called count_of_variants_times

This can give us major performance and UX gain ;-)

Thanks!
Marek



Hi bubli,

Can you send us an email to support (at) nop-temolates.com. We have made the ajax call that is replacing the buttons to be async, so there should not be page load lag. We will send you the new .js file.

Due to the widget integration of the Nop Ajax Cart plugin, it is not possible to use Html.Action. And because the Nop Ajax Cart is making some calculations before replacing the default "Add to cart" button it is not possible to use Html.Partial.

Ivan Stoyanov
Thank you for choosing our products! Your feedback is important to us!
bubli
11 years ago
#2201 Quote
Avatar
  • 12
I didn't realize that, thanks for explanation. And also thanks for such a fast response!

Marek
PS: Mail has just been sent ;-)