Was working on my database and discovered I had a foreign Key error. No problems, fixed that. However, whilst I was working on the database, a website order came through.
The order shows up in the sales_flat_quote in the database. However, it is not in the following tables:
sales_flat_invoice
sales_flat_invoice_grid
sales_flat_order
sales_flat_order_grid
sales_flat_quote
sales_flat_shipment
sales_flat_shipment_grid
My question is, how can i take the information from the sales_flat_quote table and apply it to these other tables so that it shows up in the order section of the back end of my website? Can't seem to find any information on the process to achieve this.
I am currently running Magento 1.7.0.2
Thanks in advance hopefully :)
EDIT:
I need to convert the quote to an order. I have found this script (as I have all quote, quote items, quote payment and quote address). The order is valid, as the paypal invoice even has an order number. The foreign key error prevented the invoice from being created.
However, when I run the script, I get this error:
PHP Fatal error: Uncaught exception 'Mage_Core_Exception' with message 'Cannot retrieve payment method instance.' in /home/user/public_html/app/Mage.php:594 Stack trace: 0 /home/user/public_html/app/code/core/Mage/Payment/Model/Info.php(82): Mage::throwException('The requested P...')
Here is the script:
$quote = Mage::getModel('sales/quote')->load(5428); $convert = Mage::getModel('sales/convert_quote'); $order = $convert->toOrder($quote); $order->addressToOrder($quote->getAddress(),$order); foreach($quote->getAllItems() as $item){ $orderItem = $convert->itemToOrderItem($item); if ($item->getParentItem()) { $orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId())); } $order->addItem($orderItem); } $quote->getShippingAddress()->setPaymentMethod('paypal_express'); $quote->getShippingAddress()->setCollectShippingRates(true); $payment = $quote->getPayment(); $payment->importData($data); $quote->save(); $payment = $convert->paymentToOrderPayment($quote->getPayment()); $order->setPayment($quote->getPayment()); $message = '[Notice] - Order converted from quote manually'; $order->addStatusToHistory($order->getStatus(), $message); $order->place(); $order->save(); $quote->setIsActive(false)->save();
Hopefully someone can help......
sales_flat_quote
but tlater the same table is listed in the list of tables where the order does not appear. Which is is?