【发布时间】:2012-08-14 22:54:13
【问题描述】:
有没有办法通过设置文件和资源文件使自定义 magento 产品属性可过滤?
我可以创建属性,我什至可以设置它进入的组,但是没有手动进入管理员并调整属性上的可过滤选项,我无法将其设置为可过滤(尤其是可过滤- 我试过 w/true/false 和 0,1,2)。我已经尝试调整每个有意义的选项。
即:
app/code/local/Company/Module/Model/Resource/Eav/Mysql4/Setup.php
public function getDefaultEntities()
{
return array(
'catalog_product' => array(
'entity_model' => 'catalog/product',
'attribute_model' => 'catalog/resource_eav_attribute',
'table' => 'catalog/product',
'additional_attribute_table' => 'catalog/eav_attribute',
'entity_attribute_collection' => 'catalog/product_attribute
'attributes' => array(
'attribute_name' => array(
'group' => 'Attribute Set Group',
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Attribute Label',
'input' => 'select',
'class' => '',
'source' => 'eav/entity_attribu
'global' => Mage_Catalog_Model_
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => false,
'searchable' => true,
'filterable' => 1,
'comparable' => false,
'visible_on_front' => true,
'visible_in_advanced_search' => true,
'used_in_product_listing' => true,
'used_for_sort_by' => true,
'unique' => false,
),
),
),
);
}
app/code/local/Company/Module/Model/sql/module_setup/mysql4-install-0.1.0.php
$this->installEntities();
【问题讨论】:
-
是否应该有一个
option键来使该属性使用多选? -
为了确定,创建后清除缓存并重建索引?
-
不需要
option标签-它不是多选,我已经清除了缓存并重新索引了所需的内容。但是,我可以保证索引不是使其可过滤的问题。当我运行更新时,属性设置会留下catalog_eav_attribute表记录和is_filterable = 0。要解决这个问题,我需要将$this->updateAttribute('catalog_product', 'attribute_name', 'is_fiterable', 1);添加到我的资源文件中。现在我只是好奇是否可以在 Setup.php 文件中执行此操作?感觉调整可过滤选项应该可以工作。 -
Afaik 分层导航过滤器必须为下拉、多选或价格输入类型。这就是我要求
option密钥的原因。