Created
September 6, 2016 08:55
-
-
Save Nav-Appaiya/892d759c1749fb9241ce169afe213f68 to your computer and use it in GitHub Desktop.
Magento 2 get all attributes from the default products attribute set (id: 4)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** @var $coll \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection */ | |
$coll = $this->_objectManager->create(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::class); | |
// add filter by entity type to get product attributes only | |
// '4' is the default type ID for 'catalog_product' entity - see 'eav_entity_type' table) | |
// or skip the next line to get all attributes for all types of entities | |
$coll->addFieldToFilter(\Magento\Eav\Model\Entity\Attribute\Set::KEY_ENTITY_TYPE_ID, 4); | |
$attrAll = $coll->load()->getItems(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What if I need to fetch the attributes that are not included in the default attribute set?