1

Inside an observer I've got instances of Mage_Sales_Model_Quote_Item_Option that are from a Mage_Sales_Model_Quote_Item via ::getOptions():

/** @var $item Mage_Sales_Model_Quote_Item */
$options = $item->getOptions();
foreach ($options as $index => $option) {
    $id    = $option->getId();
    $value = $option->getValue();
    $title = $option-> ??? ;
}

How can I retrieve the title of such an option represented by such Mage_Sales_Model_Quote_Item_Option?

1
  • So far I've learned that titles for these options aren't with these options but with the product having these options.
    – hakre
    Jul 28 '14 at 9:13
0

you use this:

$productModel = Mage::getModel('catalog/product');
$attr = $productModel->getResource()->getAttribute($option->getId());
if ($attr->usesSource()) {
    $title = $attr->getSource()->getOptionText($option->getValue());
}
1
  • I was not looking for product attributes but item options.
    – hakre
    Sep 20 '14 at 14:53

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.