logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
Joe Payne @ Solunar  
#1 Posted : Monday, February 14, 2022 2:28:46 PM(UTC)
Joe Payne @ Solunar

Rank: Member

Groups: Developers, Registered, HelpDesk
Joined: 11/7/2018(UTC)
Posts: 23

Thanks: 5 times
Look at /Controllers/ProductController.cs and find the ProductReviewForm() method.

Notice at the top, the code (sort of) checks to make sure a valid product object is decided before continuing with the actual work to be done inside the if (product != null)

But the view model is built outside the if (product != null) check, so a null product passed to the method throws an exception trying to grab the product url.
Joe Payne, AbleMods Hosting LLC
https://www.ablemodshosting.com

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

Joe Payne @ Solunar  
#2 Posted : Monday, February 14, 2022 2:31:50 PM(UTC)
Joe Payne @ Solunar

Rank: Member

Groups: Developers, Registered, HelpDesk
Joined: 11/7/2018(UTC)
Posts: 23

Thanks: 5 times
Also I'm pretty sure if product reviews are disabled in the store settings, a null product object will also happen by the time the code tries to build the view model.
Joe Payne, AbleMods Hosting LLC
https://www.ablemodshosting.com
Katie S  
#3 Posted : Monday, February 14, 2022 6:00:30 PM(UTC)
Katie S

Rank: Advanced Member

Groups: System, Administrators, Developers, Registered, HelpDesk
Joined: 10/29/2018(UTC)
Posts: 428

Thanks: 4 times
Was thanked: 34 time(s) in 33 post(s)
Hi Joe,

I reported an issue with Product Reviews about a month ago. I'll have the team follow up and see if it's the same thing you are seeing.

REF. AC9-1912
Thanks for your support!

Katie
Secure eCommerce Software and Hosting
nadeem  
#4 Posted : Tuesday, February 15, 2022 5:59:17 AM(UTC)
nadeem

Rank: Advanced Member

Groups: Administrators, Developers, Registered, HelpDesk, Authorized User, Admin, System
Joined: 10/11/2018(UTC)
Posts: 109

Thanks: 17 times
Was thanked: 18 time(s) in 18 post(s)
Joe,
You are right about the null exception if product is null BUT I am wondering how a null product object can be passed to the ProductReviewForm action unless you explicitly pass ProductId = 0 or use the reviews widget on any other page except product page. In the normal scenario, the Reviews form will always be in the product context because it is being used on the product page.

Quote:
Also I'm pretty sure if product reviews are disabled in the store settings, a null product object will also happen by the time the code tries to build the view model.


The ProductReviewForm action can never be called if the product reviews are disabled. This action only called when you click the WRITE A REVIEW button.

Any ways, we will improve the code to be null safe as you suggested. Thank you!

Edited by user Tuesday, February 15, 2022 6:33:00 AM(UTC)  | Reason: Not specified

Users browsing this topic
Guest
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.