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

标签 php magento attributes module

我已经为这个答案搜索了很多,但未能找到我需要的确切设置。我正在联系,看看是否有人可以提供帮助。

我正在编写一个 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
));

...
?>

最佳答案

设置is_filterable属性设置为“可过滤(无结果)”,您的配置数组应该有 filterable设置为 2 .

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

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

关于php - Magento 通过扩展安装添加带有可过滤选项(无结果)的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8313753/

相关文章:

php - 在 codeigniter 上实现 SSL 时如何摆脱控制台错误

php - MySql ORDER BY 多列 IF AND

magento - 在 Magento admin 的网格中添加产品类型过滤器

Magento 管理员 404

php - Magento 重新索引单个项目和相关组产品的正确方法

ios - 等同于 Realm 中的 attributesByName 核心数据方法/获取 RLMObject 的属性/属性

html - alt 与 alt =""相同吗?

php - ^ 在 PHP 中是什么意思?

javascript - php/js - 当我的计时器设置为 00 :00 时触发按钮

css - 如何仅当标题为 "revealed" polymer 时才具有背景颜色