2016-09-01 44 views
4

如何從屬性獲得產品屬性組在Magento 2獲得產品屬性的產品屬性組設置。 我想用一組這樣我就可以在未來在Magento 2

回答

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 />'; 
      } 

    } 
所有產品屬性