2011-11-29 57 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

這非常奏效。非常感謝你! –