Mat*_*hew 5 php zend-framework magento
我有一个模块从另一个站点获取一个源,然后将订单导入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);
}
Run Code Online (Sandbox Code Playgroud)
为什么订购产品报告使用的 Magento 模型使用报价表而不是订单表?
因为您可能有一个订单未付款或被取消,因此产品未交付。您的系统中仍然有订单,只是尚未执行。我的猜测是,特定报告应该只包含成功的订单,产品已发货或至少发送了报价。
关于为什么我没有在 flat_quote_item 中获得条目有什么建议吗?
您需要生成报价,这不会在保存订单时自动完成。
请参阅以下论坛主题以获得有关如何生成报价的提示:http://www.magentocommerce.com/boards/viewthread/28426/P30/