2
Magento 2:-将选择属性添加到类别
我想将select / dropdown属性添加到类别并在后端显示它,以便商店所有者选择它。经过一番研究,我发现以下几点: 通过Setupscript创建属性 通过UI组件声明包括它 这就是我所做的: public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var $eavSetup \Magento\Eav\Setup\EavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); $eavSetup->addAttribute( \Magento\Catalog\Model\Category::ENTITY, 'attribute_code', [ 'type' => 'int', 'label' => 'Top Navigation CMS Block', 'input' => 'select', 'source' => 'Magento\Catalog\Model\Category\Attribute\Source\Page', 'required' => false, 'sort_order' => 10, 'global' => …