5

我有一个模块,它从另一个站点获取提要,然后将订单导入 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);
            }
4

2 回答 2

3

$item->save此代码未显示对or的任何调用$quote->save,因此可能是您没有保存quote对象。

于 2012-07-19T12:10:16.083 回答
2

为什么 Ordered Products 报告使用的 Magento 模型使用报价表而不是订单表?

因为您可能有一个未付款或被取消的订单,因此产品未交付。系统中仍有订单,只是没有执行。我的猜测是,具体的报告应该只包含成功的订单,产品的发货地点或至少报价的发送地点。

关于为什么我没有在 flat_quote_item 中获得条目的任何建议?

您需要生成报价,这在保存订单时不会自动完成。

请参阅以下论坛主题以获取有关如何生成报价的提示:http: //www.magentocommerce.com/boards/viewthread/28426/P30/

于 2012-07-19T12:31:20.667 回答