Magento - 属性 "input-type"复选框

标签 magento input attributes checkbox

我看过一个类似的问题,但我没有在那里找到答案:
How can I get my custom backend Magento Customer Checkbox Attribute to save my selection?

$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
));

我创建了一个属性,但是当我编辑保存或创建保存产品时它没有保存值。

最佳答案

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

关于Magento - 属性 "input-type"复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7812163/

相关文章:

python - 'unicode' 对象没有属性 'value1'

attributes - weka 标称属性不能有重复的标签

mysql - 安装 magento,出现数据库连接错误。

email - 如何在 Magento 中禁用通知电子邮件?

c++ - 如何输入某个文件,同时将某些部分分配到不同的变量中

css - 输入类型 ="text": displaying right part of content without rtl

java - JSP 属性和参数之间的区别

magento - 通过属性组获取属性 Magento

php - Magento 订单电子邮件未发送给客户

java.util.NoSuchElementException - 扫描器读取用户输入