我正在使用模块设置脚本添加新的属性组,属性集和属性。我能够创建属性集,属性组和添加产品到组/集。但我有很难设定is_filterable,is_visible,is_visible_on_front和is_html_allowed_on_front参数。使用安装脚本在Magento中添加自定义产品属性
$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)和组($组名)。虽然当我从magento管理界面(目录 - >属性 - >管理属性)查看属性时,我看到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/。我错过了什么? 在此先感谢。
谢谢!问题解决了。 – sukkad
任何想法如何设置is_visible_on_front?尽管我在addAttribute调用中将其设置为1('is_visible_on_front'=> 1,但我没有看到它在DB/admin中被更改。 – sukkad