Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento: Convert Quote to Order

Tags:

magento

What would be the steps involved in converting a quote object in magento to an order.

Say i have the following:

$quote = Mage::getModel('sales/quote')->load(100);

There is no order yet and this quote object is still active.

How do I go from here to completing that quote and making an order from it.

I have tried:

$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();

This creates an order but doesnt complete the quote. Also, the order is in a pending status and not processing i.e. it has not been invoiced.

like image 983
Marty Wallace Avatar asked Aug 29 '12 09:08

Marty Wallace


1 Answers

Have you tried the Mage_Sales_Model_Convert_Quote - toOrder method?

    /**
     * Convert quote model to order model
     *
     * @param   Mage_Sales_Model_Quote $quote
     * @return  Mage_Sales_Model_Order
     */
    public function toOrder(Mage_Sales_Model_Quote $quote, $order=null)

Example:

$quote = Mage::getModel('sales/quote')->load(100);
$order = Mage::getSingleton('sales/convert_quote')->toOrder($quote);
like image 132
B00MER Avatar answered Oct 01 '22 12:10

B00MER