AbleCommerce Forums
	 » 
	AbleCommerce
	 » 
	AbleCommerce 9 Bug Reports
	 » 
	9.0.4 product review form throws exception on bad product id
	 
	
        
            
            
    | 
	Rank: Member
 Groups: Developers, Registered, HelpDeskJoined: 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.
 | 
|  | 
    | 
             | 
            
         | 
    |  | 
        
        
        
            
        
            
            
    | 
	Rank: Member
 Groups: Developers, Registered, HelpDeskJoined: 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. | 
|  | 
    | 
             | 
            
         | 
    |  | 
        
        
        
    
        
            
            
    | 
	Rank: Advanced Member
 Groups: System, Administrators, Developers, Registered, HelpDeskJoined: 10/29/2018(UTC)
 Posts: 501
 
 Thanks: 4 timesWas thanked: 36 time(s) in 35 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
 | 
    | 
             | 
            
         | 
    |  | 
        
        
        
            
        
            
            
    | 
	Rank: Advanced Member
 Groups: Administrators, Developers, Registered, HelpDesk, Authorized User, AdminJoined: 10/11/2018(UTC)
 Posts: 110
 
 Thanks: 19 timesWas 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 | 
    | 
             | 
            
         | 
    |  | 
        
        
        
    
                           
	AbleCommerce Forums
	 » 
	AbleCommerce
	 » 
	AbleCommerce 9 Bug Reports
	 » 
	9.0.4 product review form throws exception on bad product id
	 
	
    
        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