0

I'm trying to recall in my configurable product the value of the 'color' attribute of the products associated with the foreach method:

foreach($simple_collection as $simple_product){ echo "$simple_product->getAttributeText('color')"; }

But with this method it shows the value of the attribute in its current language and not of the admin. I attach a picture for this.

enter image description here

How can i do? Thanks

0
$simple_product->getData('color')

Will give you option_id, then you can retrieve Admin label, for instance, this way...

$option = Mage::getResourceModel('eav/entity_attribute_option_collection')
    ->setStoreFilter(0)
    ->setIdFilter($optionId);

You can do print_r($option->getData()) to see available data. Don't remember right now, but I think just "label" will give you what you want, as collection is filtered by Admin store

  • With my foreach I directly pull out the value of the color attribute that assigned to a product. This method in my foreach unfortunately is not good. Exist another way? – Gabriel91 Jan 7 at 13:31

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.