如何从属性集中获取magento 2中的产品属性组。我想通过使用组在列表页面上显示属性,以便将来可以添加更多属性
您只需按以下方式获取所有产品属性 $product->getAttributes();
$productAttributes=$product->getAttributes();
$group_id=9;
$attributeSetId=4;
foreach ($productAttributes as $attribute) {
if ($attribute->isInGroup($attributeSetId, $group_id)) {
echo $attribute->getFrontendLabel().' : '.$attribute->getFrontend()->getValue($product).'<br />';
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句