2

我想从magento 1.12.0.2结帐(onestepcheckout)页面中删除某些州/省,例如“美属萨摩亚”我尝试更改“/app/code/local/Mage/Directory/”中的Data.php文件

    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;
    }

但没有任何运气,任何帮助将不胜感激如何做到这一点

先感谢您

4

1 回答 1

0

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

于 2013-04-12T18:25:14.320 回答