/** * Retrieve Attribute Id Data By Id or Code * * @param mixed * @param int * @return int */ public function getAttributeId($id, $entityTypeId = NULL) { if ($entityTypeId == NULL) { $entityTypeId = Mage::getModel('catalog/product')->getResource()->getEntityType()->getId(); } $installer = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('core_setup'); if (!is_numeric($id)) { $id = $installer->getAttribute($entityTypeId, $id, 'attribute_id'); } if (!is_numeric($id)) { //throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Wrong attribute ID.')); return FALSE; } return $id; }