سؤال

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.

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top