[英]Magento Order creation sales_flat_quote_item not being made
I have a module that takes a feed from another site and then imports the orders into magento. 我有一个模块,该模块从另一个站点获取提要,然后将订单导入magento。 The problem is that despite the orders being created properly and appering in Magento they don't show up in the Products Ordered report.
问题在于,尽管正确创建了订单并在Magento中执行了订单,但这些订单仍未显示在“已订购的产品”报告中。
The reason seems to be that this report looks at the sales_flat_quote_item table to produce its results but there is no entry for my sale items. 原因似乎是此报告查看sales_flat_quote_item表以产生其结果,但是我的销售商品没有条目。 They do however appear correctly in sales_flat _order_item.
但是,它们确实正确显示在sales_flat _order_item中。
Below is a shortened version of the code. 下面是该代码的简化版本。
Any suggestions as to why im not getting an entry in flat_quote_item? 关于为何我无法在flat_quote_item中获得条目的任何建议?
Why does the Magento model used by the Ordered Products report use the quote table and not the order table? 为什么“订购产品”报告使用的Magento模型使用报价表而不使用订单表?
$quote = Mage::getModel('sales/quote')->setStoreId((string) $dataArray->StoreviewId);
if (is_object($product)) {
$product->setPrice(((string) $orderitem->Price) / $reverseRate);
$item = Mage::getModel('sales/quote_item');
$item->setQuote($quote)->setProduct($product);
$item->setData('qty', (string) $orderitem->Quantity);
$item->setCustomPrice((string) $orderitem->Price);
$item->setOriginalCustomPrice((string) $orderitem->Price);
$quote->addItem($item);
}
此代码未显示对$item->save
或$quote->save
任何调用,因此可能是您没有保存quote
对象。
Why does the Magento model used by the Ordered Products report use the quote table and not the order table?
为什么“订购产品”报告使用的Magento模型使用报价表而不使用订单表?
Because you could have an order, which wasn't paid or was canceled and thus the product wasn't delivered. 因为您可能有未付款或已取消的订单,因此未交付产品。 You still have an order in the system, it just wasn't executed.
您在系统中仍然有一个订单,只是没有执行。 My guess is, that the specific report should only contain successful order, where the products were shipped or at least the quote was sent.
我的猜测是,特定的报告应仅包含成功订购的订单,产品已发货或至少已发送报价的地方。
Any suggestions as to why im not getting an entry in flat_quote_item?
关于为何我无法在flat_quote_item中获得条目的任何建议?
You need to generate the quote, which isn't done automatically on saving an order. 您需要生成报价,但在保存订单时不会自动完成报价。
See the following forums thread to get hints on how to generate the quote: http://www.magentocommerce.com/boards/viewthread/28426/P30/ 请参阅以下论坛主题以获取有关如何生成报价的提示: http : //www.magentocommerce.com/boards/viewthread/28426/P30/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.