I need to retrieve all values of some multiselect attributes that each of my products have. I found related posts but none of them seems to solve my problem.

For example I found the code

echo $_product->getResource()->getAttribute('car_options')->getFrontend()->getValue($_product);

But I don't know where should I get $_product from. I guess it's a simple task, but I am pretty new to Magento and I'm still discovering how it works.

I am using Magento 1.7. Any help is much appreciated :-)

  • On which page you want to show your options? Commented Mar 27, 2017 at 7:23
  • I don't need to show them, I just need them as inputs of a recommender system that I am designing. A PHP file returning them as a matrix for example or an array would do the work, if it's a possible way
    – LeCodeur
    Commented Mar 27, 2017 at 7:27

1 Answer 1


You can use below code,

$productMultiSelectData = array();
$collection = Mage::getModel('catalog/product')->getCollection()
foreach($collection as $_product){
    $productMultiSelectData[$_product->getId()] = $_product->getResource()->getAttribute('car_options')->getFrontend()->getValue($_product);
echo "<pre>";

It will give you output like this, here key is product Id and value is your attribute option data.

[1] => 'Option 1, Option2',
[2] => 'Option 1, Option2, Option3',
[3] => 'Option 1, Option5',
[4] => 'Option 3, Option6'
  • Works perfectly, thank you so much. (If anyone ever looks at the solution, remember to change car_options by the name of your attribute.
    – LeCodeur
    Commented Mar 27, 2017 at 7:49

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.