Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Magento 2中获取前端属性列表_Magento_Magento2 - Fatal编程技术网

如何在Magento 2中获取前端属性列表

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

我使用的是Magento 2,当我尝试在后端添加产品时,在“配置”选项卡中,我创建了配置,并看到了三个属性

如何在前端的模块中获取它们

我看到它们存储在eav_属性表中,但我不知道哪个SQL可以这样做,因为它没有条件列


非常感谢

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);