Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. $attributeSetId = 20;//your_attributeSetId
  2. $attributeSet = $this->objectManager->create('MagentoEavApiAttributeSetRepositoryInterface');
  3. $attributeSetRepository = $attributeSet->get($attributeSetId);
  4. $attribute_set_name = $attributeSetRepository->getAttributeSetName();
  5. $attributeGroupCollection = $this->objectManager->get ( 'MagentoEavModelEntityAttributeGroup' )->getCollection ();
  6. $attributeGroupCollection->addFieldToFilter ( 'attribute_group_name', $attribute_set_name );
  7. $attributeGroupCollection->addFieldToFilter ( 'attribute_set_id', $attributeSetId );
  8. $attributeGroupId = '';
  9. foreach ( $attributeGroupCollection as $attributeGroup ) {
  10. $attributeGroupId = $attributeGroup->getId ();
  11. break;
  12. }
  13. $attributeCollection = $this->objectManager->get ( 'MagentoEavModelEntityAttribute' )->getCollection ();
  14. $attributeCollection->setAttributeSetFilter ( $attributeSetId );
  15. $attributeCollection->setAttributeGroupFilter ( $attributeGroupId );
  16.  
  17. echo "<pre>";
  18. print_r($attributeCollection->getData());
  19.  
  20. $attributeSetId = 20;//your_attributeSetId
  21. $productAttributesManagement = $this->objectManager->create('MagentoCatalogApiProductAttributeManagementInterface');
  22. $productAttributes = $productAttributesManagement->getAttributes($attributeSetId);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement