Developer forum

Forum » Rapido » CartAddress JSON template returns State as null

CartAddress JSON template returns State as null

Mafalda Correa
Mafalda Correa
Reply

Hi,

I'm working with American customers, so I want to show a state field in the Shipping address in Step Two, but even though there's a state set in the choosen address, the feed returns null.

I made a video showing the issue:

https://www.screencast.com/t/sKCVMbzH4Tj

Regards


Replies

 
Mafalda Correa
Mafalda Correa
Reply

Bump?

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Mafalda

I am sorry for the later answer. I have investigated the issue as far as I could. Just to clear everything out, I think you are on the Rapido 3.2 (US) Beta release. State/Regions are not a part of the previous releases. And you are right, there is a bug here that we should get fixed.  

The code we are interested in, is in Templates/Designs/Rapido/Json/eCom7/CartV2/Step/CartAddresses.cshml line 68

As far as I can see the state loop was not properly implemented thoughout this template. It was only available for not selected addresses. 

Can you give my updated attached template a try?
 


Best regards
Karsten Thuen

 
Mafalda Correa
Mafalda Correa
Reply

Hi Karsten,

I found the same problem in Rapido 3.1 too, where State field on the JSON template is showing as null when the State field is populated in the Customer Center.

I used the template you passed me and there's two issues I found - after correcting those it worked like a charm:

1. stateObject.id is getting the wrong tag to populate the JSON template

                    stateObject.id = state.GetString("Ecom:DeliveryRegion.Value")
                    stateObject.id = state.GetString("Ecom:DeliveryRegion.RegionCode");

2. Many times States are passed as the ID/RegionCode, so this should be comparing the Ecom:Order.Delivery.Region to state.GetString("Ecom:DeliveryRegion.RegionCode") as well.

                    string selected = GetString("Ecom:Order.Delivery.Region").ToLower() == state.GetString("Ecom:DeliveryRegion.Name").ToLower() ? "selected" : "";

Regards

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Mafalda

Thanks for the corrections. I have made bug #69056 And we will include this fix in the next release.

 

Best regards
Karsten Thuen

 

You must be logged in to post in the forum