为特定属性组中的属性添加新的输入文件-Magento 2.3
我在products部分创建了一个新的属性组“Features”。我需要创建两个新字段(复选框和文本字段),除了组“Features”中属性的可用选项之外。我是Magento的初学者,因此非常感谢您的帮助 注意:我只需要组“功能”中属性的那些额外字段 提前谢谢为特定属性组中的属性添加新的输入文件-Magento 2.3,magento,module,attributes,product,magento2,Magento,Module,Attributes,Product,Magento2,我在products部分创建了一个新的属性组“Features”。我需要创建两个新字段(复选框和文本字段),除了组“Features”中属性的可用选项之外。我是Magento的初学者,因此非常感谢您的帮助 注意:我只需要组“功能”中属性的那些额外字段 提前谢谢 您必须使用升级模式 class UpgradeSchema implements UpgradeSchemaInterface { public function upgrade(SchemaSetupInterface $set
您必须使用升级模式
class UpgradeSchema implements UpgradeSchemaInterface
{
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
if (version_compare($context->getVersion(), '1.0.1') < 0) {
$tableName = $setup->getTable('catalog_eav_attribute');
$connection = $setup->getConnection();
$connection->addColumn(
$tableName,
'field_1',
[
'type' => Table::TYPE_SMALLINT,
'unsigned' => true,
'nullable' => false,
'default' => '0',
'comment' => 'Label 1'
]
);
}
}
}
类UpgradeSchema实现UpgradeSchemaInterface
{
公共函数升级(SchemaSetupInterface$setup,ModuleContextInterface$context)
{
if(version\u compare($context->getVersion(),'1.0.1')<0){
$tableName=$setup->getTable('catalog\u eav\u属性');
$connection=$setup->getConnection();
$connection->addColumn(
$tableName,
“字段_1”,
[
'type'=>Table::type\u SMALLINT,
“unsigned”=>true,
“nullable'=>false,
“默认值”=>“0”,
'注释'=>'标签1'
]
);
}
}
}
您能再解释一下吗?