Try the Demo

Magento Forum

   
Page 1 of 4
Disable state/province option in the backend
 
Jurjen de Vries
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2009-01-08
Utrecht, Netherlands
 

As an European (Netherlands) country I like to disable the state/province field in the admin backend. It is’nt needed for The Netherlands and most other European countrys.

As you can read in http://www.magentocommerce.com/boards/viewthread/26030/ & http://www.magentocommerce.com/boards/viewthread/9439/ more people like to have it removed by the same reason. We can’t find out how this is possible with code hacking.

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
laProbeta
Member
 
Total Posts:  35
Joined:  2008-10-21
 

We vote for this! We were planning to sell to all Europe and didn’t think of it.-

 Signature 

Follow theTestTube on Twitter
Seguir a laProbeta en Twitter

 
Magento Community Magento Community
Magento Community
Magento Community
 
The Tankgirl
Sr. Member
 
Total Posts:  87
Joined:  2008-11-27
 

You’ve got my vote!
I also live in The Netherlands b.t.w.

 
Magento Community Magento Community
Magento Community
Magento Community
 
porridgefactor
Jr. Member
 
Total Posts:  3
Joined:  2009-03-10
 

another vote here.  The state / province would be very nice to get rid of.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Netcrawle
Jr. Member
 
Total Posts:  11
Joined:  2008-08-31
 

Comming from Norway, and that beeing our main target-area i also second / vote for this! smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
RolandG
Member
 
Total Posts:  75
Joined:  2008-05-16
 

Need this also. We don’t need State / Province in Switzerland.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Magent O)))
Jr. Member
 
Total Posts:  16
Joined:  2009-01-19
Leipzig / Germany
 

Hi,

I found a solution for the problem (It’s not the Backend-Solution - but perhaps someone can use this, to build a plugin..):

You have to edit 4 files:
- .../checkout/onepage/shipping.phtml
- .../checkout/onepage/billing.phtml
- .../core/Mage/Customer/Model/Adress/Abstract.php
- /skin/frontend/default/default (or your skin)/js/opcheckout.js

billing.phtml:
Comment out this Part:

<div class="input-box">
                <
label for="billing:region"><?php echo $this->__('State/Province'?> <span class="required">*</span></label><br/>
                <
select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none">
                    <
option value=""><?php echo $this->__('Please select region, state or province'?></option>
                </
select>
                <
script type="text/javascript">
                    $(
'billing:region_id').setAttribute('defaultValue',  "<?php echo $this->getAddress()->getRegionId() ?>");
                
</script>
                
<input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>"  title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none" />
                </
div>

shipping.phtml
The same:

<div class="input-box">
            <
label for="shipping:region_id"><?php echo $this->__('State/Province'?> <span class="required">*</span></label><br />
            <
select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none">
                <
option value=""><?php echo $this->__('Please select region, state or province'?></option>
            </
select>
            <
script type="text/javascript">
                $(
'shipping:region_id').setAttribute('defaultValue',  "<?php echo $this->getAddress()->getRegionId() ?>");
            
</script>
            
<input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none" /></div>

Abstract.php
Comment out:

if ($this->getCountryModel()->getRegionCollection()->getSize()
               && !
Zend_Validate::is($this->getRegionId(), 'NotEmpty')) {
            $errors[] 
$helper->__('Please enter state/province.');
}

opcheckout.js
There are a few code-blocks you have to comment out.

Around line 330:

if (window.billingRegionUpdater{
        billingRegionUpdater
.update();
}

Around line 440:

shippingRegionUpdater.update();
$(
'shipping:region_id').value = $('billing:region_id').value;
$(
'shipping:region').value = $('billing:region').value;
//shippingForm.elementChildLoad($('shipping:country_id'), this.setRegionValue.bind(this));

Around line 450:

setRegionValue: function(){
        
$('shipping:region').value = $('billing:region').value;
},

Around line 490:

if (window.shippingRegionUpdater{
           shippingRegionUpdater
.update();
}

Works for me with version 1.2.1.2

Happy coding…
Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
back2007
Member
 
Total Posts:  59
Joined:  2009-03-30
 

1) May be it’s better to change stete/province to <input type="hidden" value="">, so you don’t need to modify javascript
2) as for /core/Mage/Customer/Model/Adress/Abstract.php you can create custom file in code/local/ folder and configure Magento to use your’s file.
Because it’s unsafe to modify core files - they might have changed in future.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Magent O)))
Jr. Member
 
Total Posts:  16
Joined:  2009-01-19
Leipzig / Germany
 

I guess, only changing the type of the input-field wouldn’t work, because the validation of the entries is already active.

I’m using the local-folder for my customized core-files too - I only pointed to the core-file directly, because the searching is easier : )

Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
knuthansen
Jr. Member
 
Total Posts:  4
Joined:  2009-01-26
Köln
 

Hey there,

we’d also love to see that there is a disable function for regions - we don’t need them either!

Is there any hint in which version this fantastic feature is planned?

knut

 Signature 

--
http://www.mindshape.de

 
Magento Community Magento Community
Magento Community
Magento Community
 
bluecos
Member
 
Total Posts:  37
Joined:  2009-02-17
 

yes we are also happy to have this function or e option so is not Required field

 
Magento Community Magento Community
Magento Community
Magento Community
 
back2007
Member
 
Total Posts:  59
Joined:  2009-03-30
 

Attached is the extension that allows to remove state/province for one page checkout.

Feel free to further develop it and modify for your needs.

File Attachments
state-province.zip  (File Size: 16KB - Downloads: 1540)
 
Magento Community Magento Community
Magento Community
Magento Community
 
GrG
Member
 
Total Posts:  41
Joined:  2008-11-12
 

back2007, I wanted to thank you for your module. Very useful !

Thanks again

 
Magento Community Magento Community
Magento Community
Magento Community
 
benak
Jr. Member
 
Avatar
Total Posts:  22
Joined:  2009-04-02
 

Hello guys,
Thanks for this extension, but i have a bug using it.

When i fill in the adress (without state) and i select to use the same address for shipping the next tab does not show.
I got this javascript error in Firebug :

this.regionSelectEl is null
initialize
()("billing:country_id""billing:region""billing:region_id"Object US=Object CA=Object DE=Object AT=Object CH=Objectundefined)index.ph...n/weee.js (line 9047)
klass()index.ph...n/weee.js (line 51)
(?)()
onepage (line 266)
[Break on this error] if (this.regionSelectEl.options.length<=1{
index
.ph...n/weee.js (line 9047)

Does this happen only to me ?

Thanks for your help

 Signature 

Webincolor - Agence Web Ecommerce Spécialiste Magento & Prestashop

 
Magento Community Magento Community
Magento Community
Magento Community
 
Adjustware
Guru
 
Avatar
Total Posts:  654
Joined:  2009-05-11
 

Hi,
we tested the mod only with the 1.3.0 and only with the ‘default’ theme.

 Signature 

AITOC Mods for Magento
Join AITOC on Facebook for exclusive deals

 
Magento Community Magento Community
Magento Community
Magento Community
 
erenaud
Sr. Member
 
Total Posts:  220
Joined:  2009-01-05
Minden, Germany
 
benak - 26 May 2009 06:27 AM

Hello guys,
Thanks for this extension, but i have a bug using it.

When i fill in the adress (without state) and i select to use the same address for shipping the next tab does not show.
I got this javascript error in Firebug :

this.regionSelectEl is null
initialize
()("billing:country_id""billing:region""billing:region_id"Object US=Object CA=Object DE=Object AT=Object CH=Objectundefined)index.ph...n/weee.js (line 9047)
klass()index.ph...n/weee.js (line 51)
(?)()
onepage (line 266)
[Break on this error] if (this.regionSelectEl.options.length<=1{
index
.ph...n/weee.js (line 9047)

Does this happen only to me ?

Thanks for your help

I have the same bug. took me a while to figure out that it was due to that module, but it’s definitely this module.

I am using Magento 1.3.1 with a custom template.

attached is a screenshot. looks like it’s an ajax/javascript issue.

Image Attachments
problemcheckout.gif
 Signature 

http://www.looxis.de - Mach Dein Foto einzigartig!

http://www.fantastischegeschenke.de

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 4