我正在使用模块设置脚本来添加新的属性组、属性集和属性。我能够创建属性集、属性组并将产品添加到组/集。但我很难设置is_filterable、is_visible、is_visible_on_front和is_html_allowed_on_front参数。
$installer->addAttribute('catalog_product', 'offer_type', array(
        'backend'       => '',
        'frontend'      => '',
        'class' => '',
        'default'       => '',
        'label' => 'Offer type',
        'input' => 'text',
        'type'  => 'int',
        'source'        => '',
        'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
        'visible'       => 1,
        'required'      => 1,
        'searchable'    => 0,
        'filterable'    => 1,
        'unique'        => 0,
        'comparable'    => 0,
        'visible_on_front' => 1,
        'is_html_allowed_on_front' => 1,
        'user_defined'  => 1,
));
$installer->addAttributeToSet('catalog_product', $sSetId, $groupName, 'offer_type');
我看到 offer_type 被添加到 Magento 和属性集($sSetID)和组($groupname)。虽然当我从 magento 管理 UI(目录->属性->管理属性)查看属性时,我看到 is_filterable、is_visible、is_visible_on_front 和 is_html_allowed_on_front 参数设置为否。我尝试了各种组合但没有运气。我正在使用 Magento CE 1.7.0.2。我不确定我的安装脚本中缺少什么。为此,我参考了http://blog.chapagain.com.np/magento-adding-attribute-from-mysql-setup-file/。我错过了什么吗?提前致谢。