Magento 1.9 – Get Attribute Label by Attribute Code Without Product ID

attributeslabelsmagento-1.9

Is it possible to get the attribute label (depending on the storeview) only by the attribute code?
I don't want to enter any product or product id.

This is my code to get the attribute label:

<?php $_attribute = $_product->getResource()->getAttribute($attribute_name); ?>
<?php $attribute_label = $_attribute->getStoreLabel(Mage::app()->getStore()->getName()); ?>

I want to get rid of the $_product.

Best Answer

Using function getStoreLabel() of class Mage_Eav_Model_Entity_Attribute,You can get store Label of a store view

$attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product','attrbute_code');
//print_r($attributeModel);
echo $attributeModel->getStoreLabel('Store_id');
Related Topic