Nop 4.10 - Issue is occurring with one page checkout (Nullable object must have a value

Posted: September 07, 2018 at 5:42 AM Quote #211643
"Nullable object must have a value." Error in alert box

Url: /onepagecheckout

How to reproduce:

1. when goes to checkout page as it is onepagecheckout page it have different tabs of
    Billing-address, shipping-address
    https://prnt.sc/krnrdm

2. Now entering the new Billing-address
      https://prntscr.com/krnrzn

3. After complete the Billing-address go to next tab
     https://prntscr.com/krnsbi

4. Go back so it again redirects to the Billing-address tab now try to continue there it gives the    
      error in alert with message as " Null-able object must have value"
      https://prntscr.com/krnta8


Can anyone help me on this

Thanks
This post/answer is useful
2
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Please vote for my comment if it is helpful for you.

Thank You
Ilyas Patel
Posted: September 07, 2018 at 5:59 AM Quote #211645
Yes seems to be a bit of a bug there
Add a new address then goto next step,
Then click back.
Something happens with Address 2: needs a value or otherwise gives the error above
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
www.SelectSystems.com.au
Select Systems International is a computer systems technology solution developer and integration service provider.
Posted: February 07, 2019 at 5:49 AM Quote #218699
Any update on this?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: February 12, 2019 at 4:00 AM Quote #218874
In my case problem was with province. I have disable it, but there was checked this field is 'required".  

I fix it in this way:

Go here:
https://.../Admin/Setting/CustomerUser

And now check all field in customer / shipping addres. Try enable all for a moment (without saving), and check do you have something disabled but required. If yes, uncheck it, and disable again not needed in your shop.

In my situation it's fix this problem.

But it's a bug in nopcommerce, to not ignore disabled field.
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Hmmm...
Posted: April 01, 2019 at 3:22 AM Quote #226874
In my case if i have a required address field, throw exception in AddressService -> "FindAddress" method . Any ideas ?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: April 05, 2019 at 12:43 AM Quote #227063
can you please put error log here that come into Log table?
so we can able to check that where is issue

Go to website.com/Admin/Log/List url for error log
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Pls up-vote the answer, if it helps you!

Thank's,
Sangeet Shah
====================================================
NopAdvance - nopCommerce Solution Partner
Website: https://nopadvance.com
Posted: June 27, 2019 at 4:57 AM Quote #240831
sangeetshah wrote:
can you please put error log here that come into Log table?
so we can able to check that where is issue

Go to website.com/Admin/Log/List url for error log


Log level  
Warning
Short message  
Nullable object must have a value.
Full message  
System.InvalidOperationException: Nullable object must have a value.
   at System.Nullable`1.get_Value()
   at Nop.Services.Common.AddressService.<>c__DisplayClass15_0.<FindAddress>b__0(Address a) in  Libraries\Nop.Services\Common\AddressService.cs:line 279
   at System.Collections.Generic.List`1.Find(Predicate`1 match)
   at Nop.Services.Common.AddressService.FindAddress(List`1 source, String firstName, String lastName, String phoneNumber, String email, String faxNumber, String company, String address1, String address2, String city, String county, Nullable`1 stateProvinceId, String zipPostalCode, Nullable`1 countryId, String customAttributes) in  Libraries\Nop.Services\Common\AddressService.cs:line 279
   at Nop.Web.Controllers.CheckoutController.OpcSaveBilling(CheckoutBillingAddressModel model) in  Presentation\Nop.Web\Controllers\CheckoutController.cs:line 1208

Page URL  
http://localhost:55390/checkout/OpcSaveBilling/
Referrer URL  
http://localhost:55390/onepagecheckout


steps:
1. Fill your information in checkout page.
2. Next until payment
4. Return to previous step billing from  back button
5. Choose new address
6. select country other than US
7. fill address and next (it will work for first time)
8. goto step 4 and hit next it will fail
Alert: Nullable object must have a value.
Note: if you change the name it will work but if you repeat the process again it fails
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
NopCommerce Developer
Skype: live:ugharejauttam
Posted: July 04, 2019 at 2:13 AM Quote #242151
While debugging, I found that there was null check issue with Country and stateProvinceId
in FindAddress method Libraries\Nop.Services\Common\AddressService.cs
I changed code as following and it started working

Line # 289: ((a.StateProvinceId == null && (stateProvinceId == null || stateProvinceId == 0)) || (a.StateProvinceId != null && a.StateProvinceId == stateProvinceId)) &&

Line # 291: ((a.CountryId == null && countryId == null) || (a.CountryId !=null && a.CountryId == countryId))
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
NopCommerce Developer
Skype: live:ugharejauttam
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.
eCommerce CONFERENCE 2019
Learn more