Show State/Province code in address Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How to skip onepage checkout shipping information?How to get shipping amount when it is not set in shipping addressReceived order from a “blocked” countryAddress regions synchronize with an external APIWrong Shipping and billing AddressesMagento 2 : How to Add address attribute in billing address form and convert that value in order addressHow do you make the Place Order button disabled until after the address update button is pushed?Magento 2 checkout shipping address not showing countryMagento 2: How to get default address as an array?Magento 2 for logged In customer need to add shipping address every time i place a new order?
Can an alien society believe that their star system is the universe?
Fundamental Solution of the Pell Equation
Why do we bend a book to keep it straight?
Can a new player join a group only when a new campaign starts?
How come Sam didn't become Lord of Horn Hill?
Extracting terms with certain heads in a function
Denied boarding although I have proper visa and documentation. To whom should I make a complaint?
Quick way to create a symlink?
How to compare two different files line by line in unix?
Irreducible of finite Krull dimension implies quasi-compact?
Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
Wu formula for manifolds with boundary
What's the meaning of "fortified infraction restraint"?
How to show element name in portuguese using elements package?
Do wooden building fires get hotter than 600°C?
Can you use the Shield Master feat to shove someone before you make an attack by using a Readied action?
When a candle burns, why does the top of wick glow if bottom of flame is hottest?
What are the out-of-universe reasons for the references to Toby Maguire-era Spider-Man in ITSV
Why are both D and D# fitting into my E minor key?
Would "destroying" Wurmcoil Engine prevent its tokens from being created?
How can I use the Python library networkx from Mathematica?
Should I use a zero-interest credit card for a large one-time purchase?
Trademark violation for app?
Show State/Province code in address
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How to skip onepage checkout shipping information?How to get shipping amount when it is not set in shipping addressReceived order from a “blocked” countryAddress regions synchronize with an external APIWrong Shipping and billing AddressesMagento 2 : How to Add address attribute in billing address form and convert that value in order addressHow do you make the Place Order button disabled until after the address update button is pushed?Magento 2 checkout shipping address not showing countryMagento 2: How to get default address as an array?Magento 2 for logged In customer need to add shipping address every time i place a new order?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
When a customer make an order, in the shipping and billing address appears the extended Province name (for example "Lecce"). Is it possible to show the Region code "LE" instead of the Region name "Lecce"?
Here there is the DB structure:
Country ID > IT
Code (Region code) > LE
Default_name (Region name) > Lecce
I don't want to modify directly this table "directory_country_region" in the DB.
shipping-address ce-1.9.2.4 code country-regions regions
bumped to the homepage by Community♦ 7 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
When a customer make an order, in the shipping and billing address appears the extended Province name (for example "Lecce"). Is it possible to show the Region code "LE" instead of the Region name "Lecce"?
Here there is the DB structure:
Country ID > IT
Code (Region code) > LE
Default_name (Region name) > Lecce
I don't want to modify directly this table "directory_country_region" in the DB.
shipping-address ce-1.9.2.4 code country-regions regions
bumped to the homepage by Community♦ 7 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Where do you want to show this ? In admin side or in customer account section ?
– Rajeev K Tomy
Aug 3 '16 at 12:10
add a comment |
When a customer make an order, in the shipping and billing address appears the extended Province name (for example "Lecce"). Is it possible to show the Region code "LE" instead of the Region name "Lecce"?
Here there is the DB structure:
Country ID > IT
Code (Region code) > LE
Default_name (Region name) > Lecce
I don't want to modify directly this table "directory_country_region" in the DB.
shipping-address ce-1.9.2.4 code country-regions regions
When a customer make an order, in the shipping and billing address appears the extended Province name (for example "Lecce"). Is it possible to show the Region code "LE" instead of the Region name "Lecce"?
Here there is the DB structure:
Country ID > IT
Code (Region code) > LE
Default_name (Region name) > Lecce
I don't want to modify directly this table "directory_country_region" in the DB.
shipping-address ce-1.9.2.4 code country-regions regions
shipping-address ce-1.9.2.4 code country-regions regions
asked Aug 3 '16 at 9:45
stsnowstsnow
11410
11410
bumped to the homepage by Community♦ 7 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 7 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Where do you want to show this ? In admin side or in customer account section ?
– Rajeev K Tomy
Aug 3 '16 at 12:10
add a comment |
Where do you want to show this ? In admin side or in customer account section ?
– Rajeev K Tomy
Aug 3 '16 at 12:10
Where do you want to show this ? In admin side or in customer account section ?
– Rajeev K Tomy
Aug 3 '16 at 12:10
Where do you want to show this ? In admin side or in customer account section ?
– Rajeev K Tomy
Aug 3 '16 at 12:10
add a comment |
1 Answer
1
active
oldest
votes
You can do this at-least in two ways.
1. Observer way - Recommending Way
If you want to see this change in admin side, then you can observe to the event customer_address_format
and define following observer method within it.
public function changeRegionText(Varien_Event_Observer $observer)
$address = $observer->getAddress();
//makes sure change apply to only billing and shipping address types
if ($address->getAddressType()=='shipping'
As you can see, I am just grabbing region code from address entity and then forcefully set it as region.
You can also listen to a 'broader event' sales_order_address_collection_load_after
and do the same thing by looping through the collection. ie.
public function changeRegionText(Varien_Event_Observer $observer)
$collection = $observer->getOrderAddressCollection();
foreach ($collection as $address) $address->getAddressType()=='billing')
$code = $address->getRegionCode();
$address->setRegion($code);
return $this;
This broader way allows to give your change permanently everywhere in your instance.
2. Rewrite Way - Easy Nasty Way
If you want to do the change in admin side, then you need to rewrite block class Mage_Customer_Block_Address_Renderer_Default
through your module and customize render()
method.
This is because this class what actually responsible for rendering billing & shipping address in admin side. You need to replace below code line
$data['region'] = Mage::helper('directory')->__($address->getRegion());
with
$data['region'] = Mage::helper('directory')->__($address->getRegionCode());
which you can find inside render()
method.
which files have I to modify?
– stsnow
Aug 3 '16 at 12:41
you need to create a module in this case to do both case 1 and 2. I
– Rajeev K Tomy
Aug 3 '16 at 13:25
What should be the file config.xml?
– stsnow
Aug 3 '16 at 14:53
@stsnow In order to create a module, multiple files are involving in it. You should know how to create a stand alone module in Magento in order to understand and implement idea which I shared above.
– Rajeev K Tomy
Aug 4 '16 at 4:22
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f128722%2fshow-state-province-code-in-address%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can do this at-least in two ways.
1. Observer way - Recommending Way
If you want to see this change in admin side, then you can observe to the event customer_address_format
and define following observer method within it.
public function changeRegionText(Varien_Event_Observer $observer)
$address = $observer->getAddress();
//makes sure change apply to only billing and shipping address types
if ($address->getAddressType()=='shipping'
As you can see, I am just grabbing region code from address entity and then forcefully set it as region.
You can also listen to a 'broader event' sales_order_address_collection_load_after
and do the same thing by looping through the collection. ie.
public function changeRegionText(Varien_Event_Observer $observer)
$collection = $observer->getOrderAddressCollection();
foreach ($collection as $address) $address->getAddressType()=='billing')
$code = $address->getRegionCode();
$address->setRegion($code);
return $this;
This broader way allows to give your change permanently everywhere in your instance.
2. Rewrite Way - Easy Nasty Way
If you want to do the change in admin side, then you need to rewrite block class Mage_Customer_Block_Address_Renderer_Default
through your module and customize render()
method.
This is because this class what actually responsible for rendering billing & shipping address in admin side. You need to replace below code line
$data['region'] = Mage::helper('directory')->__($address->getRegion());
with
$data['region'] = Mage::helper('directory')->__($address->getRegionCode());
which you can find inside render()
method.
which files have I to modify?
– stsnow
Aug 3 '16 at 12:41
you need to create a module in this case to do both case 1 and 2. I
– Rajeev K Tomy
Aug 3 '16 at 13:25
What should be the file config.xml?
– stsnow
Aug 3 '16 at 14:53
@stsnow In order to create a module, multiple files are involving in it. You should know how to create a stand alone module in Magento in order to understand and implement idea which I shared above.
– Rajeev K Tomy
Aug 4 '16 at 4:22
add a comment |
You can do this at-least in two ways.
1. Observer way - Recommending Way
If you want to see this change in admin side, then you can observe to the event customer_address_format
and define following observer method within it.
public function changeRegionText(Varien_Event_Observer $observer)
$address = $observer->getAddress();
//makes sure change apply to only billing and shipping address types
if ($address->getAddressType()=='shipping'
As you can see, I am just grabbing region code from address entity and then forcefully set it as region.
You can also listen to a 'broader event' sales_order_address_collection_load_after
and do the same thing by looping through the collection. ie.
public function changeRegionText(Varien_Event_Observer $observer)
$collection = $observer->getOrderAddressCollection();
foreach ($collection as $address) $address->getAddressType()=='billing')
$code = $address->getRegionCode();
$address->setRegion($code);
return $this;
This broader way allows to give your change permanently everywhere in your instance.
2. Rewrite Way - Easy Nasty Way
If you want to do the change in admin side, then you need to rewrite block class Mage_Customer_Block_Address_Renderer_Default
through your module and customize render()
method.
This is because this class what actually responsible for rendering billing & shipping address in admin side. You need to replace below code line
$data['region'] = Mage::helper('directory')->__($address->getRegion());
with
$data['region'] = Mage::helper('directory')->__($address->getRegionCode());
which you can find inside render()
method.
which files have I to modify?
– stsnow
Aug 3 '16 at 12:41
you need to create a module in this case to do both case 1 and 2. I
– Rajeev K Tomy
Aug 3 '16 at 13:25
What should be the file config.xml?
– stsnow
Aug 3 '16 at 14:53
@stsnow In order to create a module, multiple files are involving in it. You should know how to create a stand alone module in Magento in order to understand and implement idea which I shared above.
– Rajeev K Tomy
Aug 4 '16 at 4:22
add a comment |
You can do this at-least in two ways.
1. Observer way - Recommending Way
If you want to see this change in admin side, then you can observe to the event customer_address_format
and define following observer method within it.
public function changeRegionText(Varien_Event_Observer $observer)
$address = $observer->getAddress();
//makes sure change apply to only billing and shipping address types
if ($address->getAddressType()=='shipping'
As you can see, I am just grabbing region code from address entity and then forcefully set it as region.
You can also listen to a 'broader event' sales_order_address_collection_load_after
and do the same thing by looping through the collection. ie.
public function changeRegionText(Varien_Event_Observer $observer)
$collection = $observer->getOrderAddressCollection();
foreach ($collection as $address) $address->getAddressType()=='billing')
$code = $address->getRegionCode();
$address->setRegion($code);
return $this;
This broader way allows to give your change permanently everywhere in your instance.
2. Rewrite Way - Easy Nasty Way
If you want to do the change in admin side, then you need to rewrite block class Mage_Customer_Block_Address_Renderer_Default
through your module and customize render()
method.
This is because this class what actually responsible for rendering billing & shipping address in admin side. You need to replace below code line
$data['region'] = Mage::helper('directory')->__($address->getRegion());
with
$data['region'] = Mage::helper('directory')->__($address->getRegionCode());
which you can find inside render()
method.
You can do this at-least in two ways.
1. Observer way - Recommending Way
If you want to see this change in admin side, then you can observe to the event customer_address_format
and define following observer method within it.
public function changeRegionText(Varien_Event_Observer $observer)
$address = $observer->getAddress();
//makes sure change apply to only billing and shipping address types
if ($address->getAddressType()=='shipping'
As you can see, I am just grabbing region code from address entity and then forcefully set it as region.
You can also listen to a 'broader event' sales_order_address_collection_load_after
and do the same thing by looping through the collection. ie.
public function changeRegionText(Varien_Event_Observer $observer)
$collection = $observer->getOrderAddressCollection();
foreach ($collection as $address) $address->getAddressType()=='billing')
$code = $address->getRegionCode();
$address->setRegion($code);
return $this;
This broader way allows to give your change permanently everywhere in your instance.
2. Rewrite Way - Easy Nasty Way
If you want to do the change in admin side, then you need to rewrite block class Mage_Customer_Block_Address_Renderer_Default
through your module and customize render()
method.
This is because this class what actually responsible for rendering billing & shipping address in admin side. You need to replace below code line
$data['region'] = Mage::helper('directory')->__($address->getRegion());
with
$data['region'] = Mage::helper('directory')->__($address->getRegionCode());
which you can find inside render()
method.
answered Aug 3 '16 at 12:24
Rajeev K TomyRajeev K Tomy
14.7k54589
14.7k54589
which files have I to modify?
– stsnow
Aug 3 '16 at 12:41
you need to create a module in this case to do both case 1 and 2. I
– Rajeev K Tomy
Aug 3 '16 at 13:25
What should be the file config.xml?
– stsnow
Aug 3 '16 at 14:53
@stsnow In order to create a module, multiple files are involving in it. You should know how to create a stand alone module in Magento in order to understand and implement idea which I shared above.
– Rajeev K Tomy
Aug 4 '16 at 4:22
add a comment |
which files have I to modify?
– stsnow
Aug 3 '16 at 12:41
you need to create a module in this case to do both case 1 and 2. I
– Rajeev K Tomy
Aug 3 '16 at 13:25
What should be the file config.xml?
– stsnow
Aug 3 '16 at 14:53
@stsnow In order to create a module, multiple files are involving in it. You should know how to create a stand alone module in Magento in order to understand and implement idea which I shared above.
– Rajeev K Tomy
Aug 4 '16 at 4:22
which files have I to modify?
– stsnow
Aug 3 '16 at 12:41
which files have I to modify?
– stsnow
Aug 3 '16 at 12:41
you need to create a module in this case to do both case 1 and 2. I
– Rajeev K Tomy
Aug 3 '16 at 13:25
you need to create a module in this case to do both case 1 and 2. I
– Rajeev K Tomy
Aug 3 '16 at 13:25
What should be the file config.xml?
– stsnow
Aug 3 '16 at 14:53
What should be the file config.xml?
– stsnow
Aug 3 '16 at 14:53
@stsnow In order to create a module, multiple files are involving in it. You should know how to create a stand alone module in Magento in order to understand and implement idea which I shared above.
– Rajeev K Tomy
Aug 4 '16 at 4:22
@stsnow In order to create a module, multiple files are involving in it. You should know how to create a stand alone module in Magento in order to understand and implement idea which I shared above.
– Rajeev K Tomy
Aug 4 '16 at 4:22
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f128722%2fshow-state-province-code-in-address%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Where do you want to show this ? In admin side or in customer account section ?
– Rajeev K Tomy
Aug 3 '16 at 12:10