Reputation: 71
I'm looking for a snippet to display attribute value id of a product on a products list page, I already use this piece of code to display attributes values but I need to get their ID number:
$attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('icontags');
Example:
Attribute: Color
Value: red
Value Id: 580
Upvotes: 5
Views: 8884
Reputation: 4980
Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('color');
// will return selected value
// if you want to get option id
$attribute=Mage::getModel('catalog/product')->getResource()->getAttribute("color");
Upvotes: 1
Reputation: 6186
I'm guessing you are referring to the option_id, which can simply be got with getData
$attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getData('icontags');
Upvotes: 5