Magento添加属性选项可过滤(无结果)通过扩展安装


Magento adding attribute with option filterable (no results) through extension installation

我已经搜索了相当多的这个答案,并没有能够追踪到我需要的确切设置。我想看看有没有人能帮上忙。

我正在写一个Magento扩展来添加一些属性到我的安装。一切都很好,除了一个复杂的问题。我不能设置属性的"Use In Layered Navigation"属性为"Filterable (no results)"。

我可以使用属性数组中的值在我的安装文件(下面)设置该属性为"No"(0值)或"Filterable(有结果)"(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
));
...
?>

要将is_filterable属性设置为"Filterable (no results)",您的配置数组应该将filterable设置为2

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

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