我有一个模块,它从另一个站点获取提要,然后将订单导入 magento。问题是,尽管订单已正确创建并出现在 Magento 中,但它们并未显示在“已订购产品”报告中。
原因似乎是该报告查看了 sales_flat_quote_item 表以产生结果,但我的销售项目没有条目。然而,它们确实正确地出现在 sales_flat _order_item 中。
下面是代码的缩短版本。
关于为什么我没有在 flat_quote_item 中获得条目的任何建议?
为什么 Ordered Products 报告使用的 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);
}