Slayer Birden Slayer Birden - 1 year ago 134
PHP Question

Magento Quote Item object - how can I load item's options?

While I know that I can just load Quote Item Options collection and filter it by item_id, I just can't wrap my mind around that Magento folks haven't added any

method to easily assign the options to an item, since there's already a

to provide some example of what I'm doing:

// updated (forgot to actually load object
$item = Mage::getModel('sales/quote_item')->load($itemId);
$buyRequest = $item->getBuyRequest(); // almost empty, only qty is set

I want to know if there's some
method... or other native way to load options into an item


What I want to do: I want to load item object and use some native way to add its options to this loaded object.

Answer Source

I ended up using next piece of code

/** @var Mage_Sales_Model_Resource_Quote_Item_Option_Collection $options */
$options = Mage::getResourceModel('sales/quote_item_option_collection');
foreach ($options as $option) {

While I understand that it doesn't answer my question directly, I think there's just no method of loading options inside quote item. So maybe someone will find the above piece of code useful.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download