Magento uses attribute_id as a foreign key from many tables to make
relationship with the eav_attribute table. Because the attribute ID is
auto increment and it will be different from many Magento databases and
you only know the attribute code, so you want to retrieve the attribute
ID from attribute code?
Table eav_attribute
There is a way to get attribute_id of an attribute from its code.
E.g. you want to get attribute id by an attribute code “manufacturer”
|
$eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
$code = $eavAttribute ->getIdByCode( 'catalog_product' , 'manufacturer' );
|
Checked at
No comments:
Post a Comment