Jump to content

State Abbreviations


Guest maolaun

Recommended Posts

Guest maolaun

I am running into an issue with grabbing the state abbreviation using this code

$this->_basket['billing_address']['state_abbrev']




If I run through the checkout process with a new user, the full state name will be submitted to the payment gateway. However, if I go back and edit the billing address and change the state name, and continue with the checkout process, the state abbreviation will be submited properly to the gateway. Is there somewhere other than 
$this->_basket['billing_address']['state_abbrev']

I should be pulling the state code from?

Your help is greatly appreciated!

Link to comment
Share on other sites

  • 4 weeks later...

Try this, found it in one of the payment modules (sagepay) whilst having a look around...

if($this->_basket['delivery_address']['country_iso']=="US") {

        if(strlen($this->_basket['billing_address']['state_abbrev']) > 2) {

                $this->_basket['billing_address']['state_abbrev'] = getStateFormat($this->_basket['billing_address']['state_abbrev'], 'name', 'abbrev');

        }

}

If they are making this check then it would seem you are not the only one getting state codes that are longer than 2 chars.

The getStateFormat function is defined in includes/functions.inc.php

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...