Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. The problem is that despite the orders being created properly and appering in Magento they don't show up in the Products Ordered report.

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. They do however appear correctly in 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?

Why does the Magento model used by the Ordered Products report use the quote table and not the order table?

$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);
            }
like image 800
Matthew Avatar asked Jul 18 '12 10:07

Matthew


1 Answers

This code doesn't show any calls to $item->save or $quote->save, so it could be that you aren't saving the quote object.

like image 148
johnorourke Avatar answered Oct 06 '22 00:10

johnorourke