AbleCommerce Forums
»
AbleCommerce
»
AbleCommerce 9 Bug Reports
»
9.0.4 BuyProductDialog breaks product page with large variant lists
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
Some of our products have extremely large variant lists. We can easily have 30,000+ variant combinations spread across 5 dropdowns on a single product. This routine in ProductController.cs: Code:
[HttpPost]
[Code.BuyProductDialog.GetChoiceSelections]
[Code.BuyProductDialog.PrepareBuyProductDialogData]
[Code.BuyProductDialog.AddToCartValidation]
public ActionResult BuyProductDialog(BuyProductDialogParams parameters, int quantity, string addToCart, string addToWishlist, string subscribe, RestockNotificationSignup signup, decimal? price, bool? autoDeliver, short? deliveryInterval)
returns a Controller.Json() response. However the JSON response size is limited internally. It does not respect the JSON response size in web.config. The result is any partial postback made when selecting variant dropdown choices (for large variant lists) throws an exception: Quote:Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. The only solution I found in StackOverflow is here: https://stackoverflow.co...jsonlength-in-web-configHowever the accepted fix didn't work because this isn't a web service. Further down you'll see the working solution for a controller action method is to rewrite the method's final return statement. Change it from: Code:return Json(new { status = "HTML", html = RenderRazorViewToString("_BuyProductDialog", model)});
to: Code:
return new JsonResult()
{
Data = new { status = "HTML", html = RenderRazorViewToString("_BuyProductDialog", model) },
JsonRequestBehavior = JsonRequestBehavior.DenyGet,
MaxJsonLength = int.MaxValue
};
I suggest you make the same change as the product page will be broken for products with a large list of variant choices. I'll continue to do more testing to be sure this resolves the issue and post here if I find new information. Ideally the variants list choices should be pulled individually via separate ajax requests to provide better scalability in larger stores. But I get why it's nice having everything loaded up in one call too.
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
Thanks for pointing this out. I am registering this as an improvement.
|
|
|
|
AbleCommerce Forums
»
AbleCommerce
»
AbleCommerce 9 Bug Reports
»
9.0.4 BuyProductDialog breaks product page with large variant lists
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close