我想从magento 1.12.0.2 checkout(onestepcheckout)页面删除某些州/省,例如“American Samoa” 我尝试更改“/ 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;
}
但没有任何运气,任何帮助将非常感谢如何做到这一点
提前谢谢
答案 0 :(得分:0)
上面的代码工作正常,我只需要刷新Magento缓存存储。