2

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.

2
  • Are talking about attribute Label or option label?
    – Amit Bera
    Commented Jan 2, 2016 at 10:26
  • Attribute Label
    – Reinsch
    Commented Jan 2, 2016 at 11:12

1 Answer 1

5

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');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.