title: Remove unwanted states from dropdown list in Magento
body: <p>I am new to magento and I am not able to make out how one can remove the unwanted states from dropdown list in magento. I tried to edit my below function as per this link <strong><a href="http://doejo.com/blog/magento-how-to-remove-certain-states-from-state-region-list-at-checkout-or-registration/" rel="nofollow">http://doejo.com/blog/magento-how-to-remove-certain-states-from-state-region-list-at-checkout-or-registration/</a></strong> but it did not work. Below i sthe code for removing unwanted states but when I add to my class in local folder, not getting any results.</p>
  
  <pre>
  
      $excludeRegions = array('AE','AA');
              foreach ($collection as $region) {
                  if (!$region->getRegionId()) {
                      continue;
                  }
                  ***//Here is the code from the link given
                   //BOF Custom Logic Here***
                  $regionCode = $region->getCode();
                  $this->_select->from(array('region'=>$this->_regionTable),
                  array('region_id'=>'region_id', 'country_id'=>'country_id', 'code'=>'code', 'default_name'=>'default_name')
                  )->where('code NOT IN (?)', $exclude_regions);
  
  </pre>
  
  <p><em><code>_getRegions</code> function edited as per above code and link respectively.</em></p>
  
  <pre>
  protected function _getRegions($storeId)
      {
          $countryIds = array();
  
          $countryCollection = $this->getCountryCollection()->loadByStore($storeId);
          foreach ($countryCollection as $country) {
              $countryIds[] = $country->getCountryId();
          }
  
          /** @var $regionModel Mage_Directory_Model_Region */
          $regionModel = $this->_factory->getModel('directory/region');
          /** @var $collection Mage_Directory_Model_Resource_Region_Collection */
          $collection = $regionModel->getResourceCollection()
              ->addCountryFilter($countryIds)
              ->load();
  
          $regions = array(
              'config' => array(
                  'show_all_regions' => $this->getShowNonRequiredState(),
                  'regions_required' => $this->getCountriesWithStatesRequired()
              )
          );
          $excludeRegions = array('AE','AA');
          foreach ($collection as $region) {
              if (!$region->getRegionId()) {
                  continue;
              }
              ***//Here is the code from the link given
               //BOF Custom Logic Here***
              $regionCode = $region->getCode();
              $this->_select->from(array('region'=>$this->_regionTable),
              array('region_id'=>'region_id', 'country_id'=>'country_id', 'code'=>'code', 'default_name'=>'default_name')
              )->where('code NOT IN (?)', $exclude_regions);
  
              //EOF Custom Logic Here
              $regions[$region->getCountryId()][$region->getRegionId()] = array(
                  'code' => $region->getCode(),
                  'name' => $this->__($region->getName())
              );
          }
          return $regions;
      }
  </pre>
  
  <p>After making the above changes, I tried below steps as my code is in <strong>/app/code/core/Mage/Directory/Helper/Data.php</strong></p>
  
  <ol>
  <li>Create a module <code>Vids_Directory</code> in pool <code>local</code> like <code>app/code/local/Vids/Directory</code></li>
  <li>Create <code>app/etc/modules/Vids_Directory.xml</code></li>
  <li>Create <code>app/code/local/Vids/Directory/etc/config.xml</code></li>
  <li>create <code>app/code/local/Vids/Helper/Data.php</code></li>
  </ol>