假设您将添加具有自定义选项的产品。因此,当您将该产品添加到购物车中时,Magento将在哪里保存这些自定义选项的值?

任何建议将不胜感激。

有帮助吗?

解决方案

所选选项存储在表中:

sales_flat_quote_item_option

当报价转换为订单时,info_buyrequest数据将传输到字段 product_options 在里面 sales_flat_order_item 桌子。

其他提示

再到弗拉基米尔·克尔科夫(Vladimir Kerkhoff)提供的答案,

检索信息的示例代码:

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());
}

然后,您可以通过创建的$ buyrequest对象访问数据。

许可以下: CC-BY-SA归因
scroll top