【发布时间】:2014-08-11 10:09:25
【问题描述】:
这是我以编程方式添加的属性的代码:
<?php
/** @var $installer Welance_DBSetup_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
//NJ add product attributes
$attributeId = $installer->getAttributeId('catalog_product','otb_verpackungseinheit');
if($attributeId){
$installer->removeAttribute('catalog_product',$attributeId);
}
$installer->addAttribute('catalog_product', 'otb_verpackungseinheit', array(
'is_global' => '1',
'frontend_input' => 'text',
'label' => 'Verpackungseinheit',
'is_visible_on_front' => '1',
'used_in_product_listing' => 'true',
'default_value_text' => '',
'default_value_yesno' => '0',
'default_value_date' => '',
'default_value_textarea' => '',
'is_unique' => '0',
'is_required' => '0',
'frontend_class' => '',
'is_searchable' => '1',
'is_visible_in_advanced_search' => '1',
'is_comparable' => '1',
'is_html_allowed_on_front' => '1',
'is_used_for_promo_rules' => '0',
'used_for_sort_by' => '0',
'is_configurable' => '0',
'is_filterable' => '0',
'is_filterable_in_search' => '0',
'backend_type' => 'varchar',
'default_value' => '',
)
);
$installer->updateAttribute('catalog_product', 'otb_verpackungseinheit', 'apply_to', 'configurable,simple,grouped,bundle,virtual,downloadable');
$installer->endSetup();
属性出现,这些值设置正确:
'is_global' => '1',
'frontend_input' => 'text',
'label' => 'Verpackungseinheit',
但是当我在后端查找属性时,这些值仍然为 0:
'is_visible_on_front' => '1',
'is_searchable' => '1',
'is_visible_in_advanced_search' => '1',
'is_comparable' => '1',
'is_html_allowed_on_front' => '1',
有人有想法吗?
【问题讨论】:
标签: php magento attributes