Developer forum

Forum » Ecommerce - Standard features » Preselect country in checkout flow

Preselect country in checkout flow

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

What's the proper way to preselect the country for an order inside a loop for the countries? We're trying something like this:

<select name="EcomOrderCustomerCountry" id="EcomOrderCustomerCountry" class="input-xlarge">
<!--@LoopStart(Countries)-->
  <option value="<!--@Ecom:Country.Code2-->" <!--@If(Ecom:Country.Code2==Ecom:Order.Customer.Country.Code)-->selected="selected"<!--@EndIf-->> 
    <!--@Ecom:Country.Name-->
  </option>
<!--@LoopEnd(Countries)-->
</select>

However, this does not select the country. When we output <!--@Ecom:Order.Customer.Country.Code--> we do get the proper value.

In the Industry Solutions set I see Ecom:Country.Code2==Server:Request.ecomordercustomercountry but ecomordercustomercountry  is empty in our case.

Any suggestions? This should be supported out of the box, shouldn't it? I don't want to go the "JavaScript way" and preselect the item with some code.

Thanks,

Imar


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Bump. Any suggestions for this?

Imar

 
Anders Ebdrup
Reply

Hi Imar,

 

I can see that we are using a loop like this:

<!--@LoopStart(Countries)-->
  <option value="<!--@Ecom:Country.Code2-->"
    <!--@If(Ecom:Country.Code2==Server:Request.ecomordercustomercountry)-->selected="selected"<!--@EndIf--><!--@If Not Defined(Server:Request.ecomordercustomercountry)--><!--@If(Ecom:Country.Code2==Global:Area.Culture.CountryCode)-->selected="selected"<!--@EndIf--><!--@EndIf(Server:Request.ecomordercustomercountry)-->>
     <!--@Ecom:Country.Name-->
   </option>
<!--@LoopEnd(Countries)-->

 

Mayby it can help you?

 

Best regards, Anders

 

You must be logged in to post in the forum