2011-11-29 58 views
4

我已经搜索了相当多的这个答案,并没有能够追查到我需要的确切设置。我伸出手去看看有没有人能帮忙。Magento通过扩展安装添加选项可过滤属性(无结果)

我正在写一个Magento扩展,为我的安装添加一些属性。一切都很好,除了一个复杂的例外。我无法将属性的“在分层导航中使用”属性设置为“可筛选(无结果)”。

我可以使用我的安装程序文件(下面)中的属性数组中的值将该属性设置为“否”(0值)或“可过滤(带结果)”(1值)但不是没有结果。

任何人有一个属性的建议我可能会丢失或在我的数组中设置不正确?

非常感谢!

<?php 
... 

    // Add the mm_framestyle attr. (filterable, non-super attr.) 
$setup->addAttribute('catalog_product', 'mm_framestyle', array(
      'backend'   => 'eav/entity_attribute_backend_array', 
      'visible'   => true, 
      'required'   => false, 
      'user_defined'  => true, 
      'searchable'  => true, 
      'filterable'  => true, 
      'comparable'  => true, 
      'label'    => 'Frame Types', 
      'group'    => 'MyMaui Attributes', 
      'type'    => 'varchar', 
      'input'    => 'select', 
      'global'   => false, 
      'option'   => array (
              'value' => array('maui_flex' => array('MAUI FLEX'), 
                  'full_frame_metal' => array('FULL FRAME'), 
                  'rimless_metal' => array('RIMLESS'), 
                  'shields' => array('SHIELDS'), 
                  ) 
             ), 
      'visible_on_front' => true, 
      'unique'   => false 
)); 

... 
?> 
+0

http://magento.stackexchange.com/questions/38223/how-can -i-create-an-attribute-as-not-configurable-from-an-install-script – zhartaunik

回答

7

要设置is_filterable属性设置为“过滤的(无结果)”,你的配置阵列应该有filterable设置为2

如果您希望使用更新脚本来更改先前建立的设置,语法如下:

$setup->updateAttribute('catalog_product', 'mm_framestyle', 'is_filterable', 2); 
+0

这非常奏效。非常感谢你! –