Question

Assume that you are going to add a product which has custom options. So when you add that product to the shopping cart, where will the magento save those custom option's values persistently?

Any suggestions will be appreciated.

Was it helpful?

Solution

The selected options are stored in the table:

sales_flat_quote_item_option

When the quote is converted to an order the info_buyRequest data is transferred to the field product_options in the sales_flat_order_item table.

OTHER TIPS

Further to the answer provided by Vladimir Kerkhoff,

Example code to retrieve the information:

if ($item instanceof Mage_Sales_Model_Quote_Item) {
            $infoBuyRequest = $item->getOptionByCode('info_buyRequest');
            $buyRequest = new Varien_Object(unserialize($infoBuyRequest->getValue()));
        } else if ($item instanceof Mage_Sales_Model_Order_Item) {
            $buyRequest = new Varien_Object($item->getProductOptions());
}

You can then access the data via the $buyRequest object created.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top