2013-04-11 41 views
2

我想从magento 1.12.0.2结帐(onestepcheckout)页面删除某些州/省(如“美属萨摩亚”) 我试图更改Data.php文件中的“/ app/code /本地/法师/目录/”从magento结帐中删除某些州/省

public function getRegionJson() 
    { 
     $exclude_regions = array ('AS','FM'); 
     Varien_Profiler::start('TEST: '.__METHOD__); 
     if (!$this->_regionJson) 
     { 
      $cacheKey = 'DIRECTORY_REGIONS_JSON_STORE'.Mage::app()->getStore()->getId(); 
      if (Mage::app()->useCache('config')) { 
      $json = Mage::app()->loadCache($cacheKey); 
     } 
     if (empty($json)) 
     { 
      $countryIds = array(); 
      foreach ($this->getCountryCollection() as $country) 
      { 
      $countryIds[] = $country->getCountryId(); 
      } 
     $collection = Mage::getModel('directory/region')->getResourceCollection() 
     ->addCountryFilter($countryIds) 
     ->load(); 
     $regions = array(); 
     foreach ($collection as $region) { 
     $rg = $region->getCode(); 
     //if ($rg!='AL'){ 
     if(!in_array($rg, $exclude_regions)) { 
     if (!$region->getRegionId()) { 
     continue; 
     } 
     $regions[$region->getCountryId()][$region->getRegionId()] = array(
     'code' => $region->getCode(), 
     //'name' => $region->getName() 
     'name' => $this->__($region->getName()) 
     ); 
     } 
     } 
     $json = Mage::helper('core')->jsonEncode($regions); 
     if (Mage::app()->useCache('config')) { 
     Mage::app()->saveCache($json, $cacheKey, array('config')); 
     } 
     } 
     $this->_regionJson = $json; 
     } 
     Varien_Profiler::stop('TEST: '.__METHOD__); 
     return $this->_regionJson; 
    } 

,但没有任何运气,任何帮助将大大如何做到这一点

预先感谢您

回答

0

上面的代码工作正常赞赏,我只需要刷新Magento缓存存储。