magento2 创建了自定义产品属性但在批量更新中丢失
magento2 created custom product attribute but missing in mass update
我已经像这样以编程方式创建了一个属性
$eavSetup->addAttribute(
Product::ENTITY,
self::mpn,
[
'type' => 'text',
'backend' => '',
'frontend' => '',
'label' => 'mpn',
'input' => '',
'class' => '',
'source' => '',
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => '',
]
);
然而,当我尝试 select 多个产品并批量更新此属性时,它没有显示。
当我从后端重新创建它时,它出现了。
任何人都可以让我知道我缺少什么选项以便它显示正确以对其执行批量更新吗?
当我测试它时,这发生在 Magento 2.2.6、2.2.7 和 2.3 中。
我发现你的问题是因为你缺少输入类型。
请更改:
'input' => ''
任何特定类型。示例:
'input' => 'text'
此致
我已经像这样以编程方式创建了一个属性
$eavSetup->addAttribute(
Product::ENTITY,
self::mpn,
[
'type' => 'text',
'backend' => '',
'frontend' => '',
'label' => 'mpn',
'input' => '',
'class' => '',
'source' => '',
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => '',
]
);
然而,当我尝试 select 多个产品并批量更新此属性时,它没有显示。
当我从后端重新创建它时,它出现了。
任何人都可以让我知道我缺少什么选项以便它显示正确以对其执行批量更新吗?
当我测试它时,这发生在 Magento 2.2.6、2.2.7 和 2.3 中。
我发现你的问题是因为你缺少输入类型。
请更改:
'input' => ''
任何特定类型。示例:
'input' => 'text'
此致