magento - 使用admin属性

时间:2013-05-06 05:52:30

标签: php magento attributes

谁能帮帮我? 我有magento 1.6.2。

扩展程序将此代码用于我的分层导航:

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

此代码在分层导航中生成我的网址。 但是使用这段代码,它也会使用已翻译的标签......所以在荷兰语中用蓝色语言来表达... ...

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

我知道应该编辑这部分:

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

我尝试过管理标签......但这不起作用。任何人都可以帮我这个吗?

1 个答案:

答案 0 :(得分:2)

如果你可以在那里编辑代码,请尝试:

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