2013-05-06 70 views
1

谁能帮助我? IK有magento 1.6.2。magento - 使用管理员属性

和扩展使用此代码为我的分层导航:

public function getAllFilterableOptionsAsHash() 
    { 
     if (is_null($this->_options)) 
     { 
      $hash = array(); 
      $attributes = Mage::getModel('catalog/layer')->getFilterableAttributes(); 
      foreach ($attributes as $a){ 
       $code  = $a->getAttributeCode(); 
       $hash[$code] = array(); 

       foreach ($a->getSource()->getAllOptions() as $o){ 
        if ($o['value']){ // skip first empty 
         $hash[$code][$this->createKey($o['label'])] = $o['value']; 
        } 
       } 
      } 
      $this->_options = $hash; 
     } 

     return $this->_options; 
    } 

此代码生成的分层导航我的网址。 但有了这个代码,它也将使用转换的标签......在荷兰这样blauw带蓝色的英文...

现在我想总是使用这个adminlabel ...

我知道这部分应该被编辑:

foreach ($a->getSource()->getAllOptions() as $o){ 
         if ($o['value']){ // skip first empty 
          $hash[$code][$this->createKey($o['label'])] = $o['value']; 

我试过adminlabel ...但那不起作用。谁能帮我这个?

+0

其实翻译功能工作视图部分。请将一些代码放在设计文件夹中的文件中。 – 2013-05-06 06:21:41

回答

2

嗯,如果你能有编辑代码,尽量做到:

foreach ($a->getSource()->getAllOptions(true, true /*get default admin values*/) as $o) { 
+0

Thnx ...那个伎俩。 – Ronny 2013-05-06 09:59:32