Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the id number of an attribute value on Magento list product page?

Tags:

php

magento

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

like image 238
27nov Avatar asked Oct 10 '22 01:10

27nov


1 Answers

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');
like image 59
Peter O'Callaghan Avatar answered Oct 18 '22 08:10

Peter O'Callaghan