如何在Magento 2中获取前端属性列表
我使用的是Magento 2,当我尝试在后端添加产品时,在“配置”选项卡中,我创建了配置,并看到了三个属性 如何在前端的模块中获取它们 我看到它们存储在eav_属性表中,但我不知道哪个SQL可以这样做,因为它没有条件列如何在Magento 2中获取前端属性列表,magento,magento2,Magento,Magento2,我使用的是Magento 2,当我尝试在后端添加产品时,在“配置”选项卡中,我创建了配置,并看到了三个属性 如何在前端的模块中获取它们 我看到它们存储在eav_属性表中,但我不知道哪个SQL可以这样做,因为它没有条件列 非常感谢 Use可以使用下面的代码来获取模块前端中的属性 $attribute = $objectManager->create('\Magento\Eav\Model\Config')->getAttribute('catalog_product', 'colo
非常感谢 Use可以使用下面的代码来获取模块前端中的属性
$attribute = $objectManager->create('\Magento\Eav\Model\Config')->getAttribute('catalog_product', 'color');
$colorAttributeId= $attribute->getAttributeId();
foreach ($attribute->getSource()->getAllOptions(true) as $option) {
$colors[$option['value']] = strtolower($option['label']);
}
print_r($colors);