Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Select an option attribute in a collection
 
tozzy
Jr. Member
 
Total Posts:  6
Joined:  2009-06-17
 

Hey guys,

I’m using the product collection to display all my products.
One of my attribute is “size” which is composed of predefined options (XS, S, M, L, XL...)

When I do :

$collection Mage::getModel('catalog/product')->getCollection()
                ->
addAttributeToSelect('size')

The returned value is the option ID and not the value : is there an existing function to directly select the value ?

Thanks :o)

 
Magento Community Magento Community
Magento Community
Magento Community
 
tozzy
Jr. Member
 
Total Posts:  6
Joined:  2009-06-17
 

Thank dd_gi, but I want to use directly the collection for the grid widget, so I need to select the correct value and can’t do the job after.
I hope I was clear.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tozzy
Jr. Member
 
Total Posts:  6
Joined:  2009-06-17
 

That’s the way to display the text on the front office for example, but what I want to do is different. I created a grid, the grid uses a collection and with the different selected fields, you can display the columns in the grid.
So I can’t do the getAttributeText() method, I need to select the value and not the ID directly in the query.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top