1

I'm having issues with overwriting the value of the billing and shipping region fields as they are taking on the default value set in the Region/Country area of the Store setup.

I am using Store with Zoo Visitor and I thought that, like all other fields, if the billing/shipping region fields had a value, that is what would be outputted. However, for me that is not the case, it is only outputting the default value even though the fields in the entry have values.

Can anyone shed some light on why this is?

Thanks, J

EDIT: The current code is:

<select name="billing_region" class="state billing_state customDrop"><option {if billing_region == ''}selected {/if}value="">--State--</option><option {if billing_region == 'ACT'}selected {/if}value="ACT">ACT</option><option {if billing_region == 'NSW'}selected {/if}value="NSW">NSW</option><option {if billing_region == 'QLD'}selected {/if}value="QLD">QLD</option><option {if billing_region == 'VIC'}selected {/if}value="VIC">VIC</option><option {if billing_region == 'TAS'}selected {/if}value="TAS">TAS</option><option {if billing_region == 'SA'}selected {/if}value="SA">SA</option><option {if billing_region == 'WA'}selected {/if}value="WA">WA</option><option {if billing_region == 'NT'}selected {/if}value="NT">NT</option></select>

However, {billing_region} is just outputting the default region. We have set a default country (AU, Australia) and the default region is set to nothing at the moment after trying to display the current region with and without a default.

6
  • Posting your template code would be helpful. Also what data are you storing in the country fields. By default Store uses the 2 digit country code to store it in the DB. Such as us, gb, uk, au Apr 16 '13 at 4:26
  • I have added in the current billing region code and a little more explanation. If you need any more info from me please let me know.
    – WDE-J
    Apr 16 '13 at 5:12
  • Have you tried using just {field:billing_region} instead of your current code? Apr 16 '13 at 9:24
  • Yep sure have - it just outputs the field with the default region as its value not the actual selected region.
    – WDE-J
    Apr 17 '13 at 0:08
  • Are you emptying the cart between each test? Once an existing cart has a region associated with it, it will not overwrite it. By emptying the cart you get a fresh session and can test your mapped member fields. Apr 17 '13 at 11:37
1

I found some interesting behaviour for example in some instances, if I were to print the value of the billing_region separately into a div rather than set the value in the dropdown, the correct region would be selected in the dropdown.

But I have since got it to work. I changed back the fields we were using to just plain text fields, rather than a select field. It shouldn't have affected anything since the values for the field were the same, and the select in the Admin CP was displaying the correctly selected value. It still doesn't explain why it wouldn't select the correct value in the select.

Nevertheless, I have my fields working correctly, and changing from a select to a text input is not a big deal for us for our project.

1

When you are testing the default country/region settings, be sure to clear your cart between each test.

As the fields only apply to new carts, the current value will remain in your cart until you click "Empty Cart" or delete all items from your cart.

In addition, make sure you don't have mapped member fields interfering with your default country/region. If you have mapped these fields to member fields, then the member's currently stored country/region will take priority over the site-wide default country/region.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.