0

I think this is a simple question, but can't seem to find the answer.

I have used this code and it works fine:

<?php echo $_product->getAttributeText('my_attribute'); ?>

the only thing is, it is just showing the attribute value not the title. How can I add the attribute title to this code/

2 Answers 2

1

i think this helping you ..

get attribute collection

$attribute = $_product->getResource()->getAttribute('my_attribute');

get attribute type

$attribute->getAttributeType();

get attribute Label

$attribute->getFrontendLabel();

get attribute default value

$attribute->getDefaultValue();

check if the attribute is visible

$attribute->getIsVisible();

check if the attribute is required

$attribute->getIsRequired();

get attribute value

$attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getMyAttribute();
0

This solution should give you what you need:

$attribute->getFrontendLabel();

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.