cancel
Showing results for 
Search instead for 
Did you mean: 

Add Attribute dropdown value and get its list of options

Add Attribute dropdown value and get its list of options

Hi! I have to add attribute dropdown value and if the value exists i want its option id which i will use to add it against the product.

Following is the code i used to get attribute info with attribute code.

 

$attribute = $this->objectManager->create('Magento\Eav\Model\Entity\Attribute');
$attributeId = $attribute->getIdByCode('catalog_product','manufacturer');
$model = $this->objectManager->create('Magento\Catalog\Model\ResourceModel\Eav\Attribute');
$attr = $model->load($attributeId);
print_r($model->getFrontendLabel());

 can anybody help me with this?