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.

  • Are talking about attribute Label or option label? – Amit Bera Jan 2 '16 at 10:26
  • Attribute Label – Reinsch Jan 2 '16 at 11:12
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');
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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