[Skip to main content](#vessel-content)

#   2 letter US state code

##

- **[edocif](/forum/user/30739-edocif "View edocif's Profile")**
- [![edocif's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30739-edocif "View edocif's Profile") Topic Author
- [ Offline](/forum/user/30739-edocif)

Less More

- Posts: 13
- Thank you received: 0
-
-

10 years 8 months ago [\#231268](#231268) by [edocif](/forum/user/30739-edocif "View edocif's Profile")  *[2 letter US state code](/forum/4-how-to/882610-2-letter-us-state-code#231268 "-- HikaShop version -- : 2.6.1 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.5 -- Browser(s) name and version -- : google chorm  i am trying to alter the display of the adress for fax to EDI. two requirements is the 3 digit country code and the 2 digit state code.  I was able to do the country code with the code shown below  so naturally i tried  but that returned zero data so i reverted the code back to what was working  I need {address&#95;state} to change out to the address&#95;state&#95;code&#95;2 but need to know what the proper reference would be. Thank you in advance for your help")* was created by *[edocif](/forum/user/30739-edocif "View edocif's Profile")*

-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.5
-- Browser(s) name and version -- : google chorm

i am trying to alter the display of the adress for fax to EDI. two requirements is the 3 digit country code and the 2 digit state code.

I was able to do the country code with the code shown below
Code:

&lt;?php $address = $this-&gt;params-&gt;get('address'); echo $address-&gt;address_country_code_3; ?&gt;

so naturally i tried Code:

&lt;?php $address = $this-&gt;params-&gt;get('address'); echo $address-&gt;address_state_code_2; ?&gt;

but that returned zero data so i reverted the code back to what was working Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 2.6.0 * @author hikashop.com * @copyright (C) 2010-2015 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt; {address_company} {address_title} {address_firstname} {address_lastname} {address_street} {address_city} {address_state} {address_post_code} &lt;?php $address = $this-&gt;params-&gt;get('address'); echo $address-&gt;address_country_code_3; ?&gt; &lt;?php echo JText::sprintf('TELEPHONE_IN_ADDRESS','{address_telephone}');?&gt;

I need {address_state} to change out to the address_state_code_2 but need to know what the proper reference would be. Thank you in advance for your help

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg4MjYxMC0yLWxldHRlci11cy1zdGF0ZS1jb2RlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[edocif](/forum/user/30739-edocif "View edocif's Profile")**
- [![edocif's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30739-edocif "View edocif's Profile") Topic Author
- [ Offline](/forum/user/30739-edocif)

Less More

- Posts: 13
- Thank you received: 0
-
-

10 years 8 months ago [\#231271](#231271) by [edocif](/forum/user/30739-edocif "View edocif's Profile")  Replied by *[edocif](/forum/user/30739-edocif "View edocif's Profile")* on topic *[2 letter US state code](/forum/4-how-to/882610-2-letter-us-state-code#231271 "-- HikaShop version -- : 2.6.1 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.5 -- Browser(s) name and version -- : google chorm  i am trying to alter the display of the adress for fax to EDI. two requirements is the 3 digit country code and the 2 digit state code.  I was able to do the country code with the code shown below  so naturally i tried  but that returned zero data so i reverted the code back to what was working  I need {address&#95;state} to change out to the address&#95;state&#95;code&#95;2 but need to know what the proper reference would be. Thank you in advance for your help")*

figured it out in my case in the USA the state code was under code 3 letters so i just had to put address_state_code_3 and it worked like a charm. see my final address_template.php from Display &gt; Views (my custom template)
Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 2.6.0 * @author hikashop.com * @copyright (C) 2010-2015 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt; {address_company} {address_title} {address_firstname} {address_lastname} {address_street} {address_city} &lt;?php $address = $this-&gt;params-&gt;get('address'); echo $address-&gt;address_state_code_3; ?&gt; {address_post_code} &lt;?php $address = $this-&gt;params-&gt;get('address'); echo $address-&gt;address_country_code_3; ?&gt;{} &lt;?php echo JText::sprintf('TELEPHONE_IN_ADDRESS','{address_telephone}');?&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg4MjYxMC0yLWxldHRlci11cy1zdGF0ZS1jb2RlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[brentwilliams2](/forum/user/1200-brentwilliams2 "View brentwilliams2's Profile")**
- [![brentwilliams2's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1200-brentwilliams2 "View brentwilliams2's Profile")
- [ Offline](/forum/user/1200-brentwilliams2)

Less More

- Posts: 78
- Thank you received: 5
-
-

5 years 1 week ago [\#336673](#336673) by [brentwilliams2](/forum/user/1200-brentwilliams2 "View brentwilliams2's Profile")  Replied by *[brentwilliams2](/forum/user/1200-brentwilliams2 "View brentwilliams2's Profile")* on topic *[2 letter US state code](/forum/4-how-to/882610-2-letter-us-state-code#336673 "-- HikaShop version -- : 2.6.1 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.5 -- Browser(s) name and version -- : google chorm  i am trying to alter the display of the adress for fax to EDI. two requirements is the 3 digit country code and the 2 digit state code.  I was able to do the country code with the code shown below  so naturally i tried  but that returned zero data so i reverted the code back to what was working  I need {address&#95;state} to change out to the address&#95;state&#95;code&#95;2 but need to know what the proper reference would be. Thank you in advance for your help")*

BIG thank you for this!

And to add for others, you can use this in the admin area under System &gt; Configuration &gt; Checkout &gt; Address &amp; Shipping:
Code:

{address_firstname} {address_lastname} {address_street} {address_city}, &lt;?php $address = $this-&gt;params-&gt;get('address'); echo $address-&gt;address_state_code_3; ?&gt; {address_post_code}

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg4MjYxMC0yLWxldHRlci11cy1zdGF0ZS1jb2RlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.046 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
