Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6033673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:31:04+00:00 2026-05-23T05:31:04+00:00

Currently in my /etc/system.xml file I can use this to pull through a complete

  • 0

Currently in my /etc/system.xml file I can use this to pull through a complete list of regions that are stored in Magento and display them as a multiselect. This works fine, however I would prefer to only pull through the regions for one country, e.g. the UK counties or US states:

                    <counties translate="label">
                        <label>Counties</label>
                        <frontend_type>multiselect</frontend_type>
                        <sort_order>10</sort_order>
                        <source_model>adminhtml/system_config_source_allregion</source_model>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </counties>

The reason for this is that I have added a lot of regions/states/counties on the system and it is now not a very user friendly multi-select box.

UPDATE:

After not immediately acting on the solutions provided below I revisited this problem some time later to put together my own solution inspired by the answers provided.

I copied app/code/core/Mage/Adminhtml/Model/System/Config/Source/Allregion.php to app/code/core/Mage/Adminhtml/Model/System/Config/Source/Ukregion.php

Then I changed the class definition to Mage_Adminhtml_Model_System_Config_Source_Ukregion.

Then I changed:

        $regionsCollection = Mage::getResourceModel('directory/region_collection')->load();

to include a country filter:

        $regionsCollection = Mage::getResourceModel('directory/region_collection')->addCountryFilter('GB')->load();

I now get the counties for the UK (which I had to edit myself but that is a different story-style-magento-problem).

Finally I changed my system.xml:

                    <counties translate="label">
                        <label>Counties</label>
                        <frontend_type>multiselect</frontend_type>
                        <sort_order>10</sort_order>
                        <source_model>adminhtml/system_config_source_ukregion</source_model>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </counties>

The use of ‘UK’ instead of ‘GB’ is entirely deliberate – GB does not include the NI counties it is just used for ‘legacy reasons’. ‘UK’ does include Northern Ireland, as does my county list.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:31:04+00:00Added an answer on May 23, 2026 at 5:31 am

    Take a look at the page System > Configuration > Shipping Settings, you can recreate how it’s regions are adjusted to match the selected country.

    Now look at the file app/code/core/Mage/Shipping/etc/system.xml. The country and region fields look like this:

    <country_id translate="label">
        <label>Country</label>
        <frontend_type>select</frontend_type>
        <frontend_class>countries</frontend_class>
        <source_model>adminhtml/system_config_source_country</source_model>
        <sort_order>10</sort_order>
        <show_in_default>1</show_in_default>
        <show_in_website>1</show_in_website>
        <show_in_store>0</show_in_store>
    </country_id>
    <region_id translate="label">
        <label>Region/State</label>
        <frontend_type>text</frontend_type>
        <sort_order>20</sort_order>
        <show_in_default>1</show_in_default>
        <show_in_website>1</show_in_website>
        <show_in_store>0</show_in_store>
    </region_id>
    

    The important parts are:

    • The country has a class of countries and an ID of country_id.
    • The region has an ID of region_id.
    • The region is not a select and doesn’t have a source model.

    The javascript is already in place for config pages. It finds elements with a class of countries and uses it’s ID to find a similarly named element (the region). When the first element changes the second is updated by AJAX.

    When using this in the past I sometimes had trouble when there is more than one country/region pair on a page so it’s best to avoid that situation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently we have thousands of Microsoft Word files, Excel files, PDF's, images etc stored
I'm currently in the early stages of designing a system that will end up
I am completely lost on this one-- I have a .Rpt file that runs
I'm currently building a username/password/session-management/etc. system for a website I've been working on. I've
I'm a java developer, currently starting developing a hospital management system that will server
I am currently looking into color manipulation / selection etc and have come across
I currently have the following objects persisting successfully: Person first name, etc. Exams title,
I want to get the currently selected item (text, image, etc) and display in
I have an application that stores large amount of files (XML and binary) in
We are currently using a custom queueing system where a table in a SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.