2012-07-18 68 views
5

我有一个模块,从另一个网站获取订阅源,然后将订单导入到magento。问题是,尽管订单在Magento中正确创建,并且没有显示在“产品已订购”报告中。Magento订单创建sales_flat_quote_item没有生成

原因似乎是,此报告查看sales_flat_quote_item表以生成其结果,但没有我的销售物品的条目。但是,它们在sales_flat _order_item中正确显示。

下面是代码的缩写版本。

任何建议,为什么我没有得到在flat_quote_item条目?

为什么订购产品报告使用的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); 
      } 

回答

2

为什么订购产品报告使用的Magento模型使用报价表而不是订单表?

因为您可以下订单,该订单未付款或被取消,因此产品未交付。您仍然在系统中订购,它只是没有执行。 我的猜测是,特定的报告应该只包含成功的订单,产品已发货或至少发送了报价。

任何建议,为什么我没有得到在flat_quote_item条目?

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

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

3

这段代码并不显示到$item->save$quote->save任何电话,所以它可能是你没有保存quote对象。