【问题标题】:Magento - attribute "input-type" checkboxMagento - 属性“输入类型”复选框
【发布时间】:2011-12-10 08:40:39
【问题描述】:

我看过一个类似的问题,但我没有在那里找到答案: 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
));

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

【问题讨论】:

  • 'source' => 'eav/entity_attribute_source_boolean' 只能与'input' => 'select' 一起使用。
  • 'input' => 'checkbox' 有什么用?
  • 我不知道。你从哪里得到'input' => 'checkbox'?我找不到任何具有这种输入类型的产品/类别/客户属性。

标签: magento input attributes checkbox


【解决方案1】:

使用“输入”作为int,因为您始终存储复选框“0”或“1”的值。对于源,您已经在使用 0 或 1 的核心选项布尔值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-25
    • 1970-01-01
    • 2015-06-03
    • 1970-01-01
    • 2018-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多