2011-10-18 60 views
3

我已经看到了类似的问题,但我没有发现有一个答案: How can I get my custom backend Magento Customer Checkbox Attribute to save my selection?Magento的 - 属性“输入型”复选框

$installer->addAttribute('catalog_product', 'tip', array(
    'group'   => 'ISM', 
    'input'   => 'checkbox', 
    'type'   => 'int', 
    'label'   => 'TIP', 
    'visible'  => 1, 
    'source'  => 'eav/entity_attribute_source_boolean', 
    'required'  => 0, 
    'user_defined' => 1, 
    'searchable' => 0, 
    'filterable' => 0, 
    'comparable' => 0, 
    'visible_on_front' => 0, 
    'visible_in_advanced_search' => 0, 
    'is_html_allowed_on_front' => 0, 
    'global'  => 1, 
    'used_in_product_listing' => 0, 
    'is_html_allowed_on_front' => 1 
)); 

我已经创建了一个属性,但它不保存价值当我编辑保存或创建保存产品时。

+1

''source'=>'eav/entity_attribute_source_boolean'只能用于''input'=>'select''。 – Zyava

+0

'input'=>'checkbox'有什么用? – ForceMan

+0

我不知道。你从哪里得到''input'=>'checkbox'?我找不到这种输入类型的任何产品/类别/客户属性。 – Zyava

回答

0

使用'输入'作为int,因为您总是存储复选框'0'或'1'的值。对于源代码,您已经使用核心选项布尔值为0或1.