I want to create order from quote id . I am using this code but order is not getting created

$quote = Mage::getModel('sales/quote')->load(94251);
$convertQuote = Mage::getSingleton('sales/convert_quote'); 
$order = $convertQuote->toOrder($quote);

I get error that Credit card number mismatch with credit card type. payment method already store in quote. payment method is authnetcim.

  • pls try my answer and let me know it works or not. – Nikunj Vadariya Oct 20 '16 at 11:28
  • Anyone have solution for this?? – Jigs Parmar Oct 30 '17 at 3:22

Try something like below :

$store = Mage::getSingleton('core/store')->load(1);

$quote = Mage::getModel('sales/quote')->setStore($store)->load(94251);


$convert = Mage::getModel('sales/convert_quote');
$order = $convert->toOrder($quote)

foreach ($quote->getAllItems() as $quoteItem) {
    $orderItem = $convert->itemToOrderItem($quoteItem);
    if ($quoteItem->getParentItem()) {

  • it not works. no any order createa – Jigs Parmar Oct 20 '16 at 12:05
  • and i not want to store any static information when create order – Jigs Parmar Oct 20 '16 at 12:05

Here is the script:

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

$convert = Mage::getModel('sales/convert_quote');

$order = $convert->toOrder($quote);

foreach($quote->getAllItems() as $item){
    $orderItem = $convert->itemToOrderItem($item);
    if ($item->getParentItem()) {


$payment = $quote->getPayment();

$payment = $convert->paymentToOrderPayment($quote->getPayment());


$message = '[Notice] - Order converted from quote manually';
$order->addStatusToHistory($order->getStatus(), $message);


Other solution:-

Have you tried the toOrder Method?



$convertQuote = Mage::getSingleton('sales/convert_quote'); $order = $convertQuote->toOrder($quote);
  • in quote there is all information store already. so no any static info store. – Jigs Parmar Oct 21 '16 at 3:35
  • Your "other solution" is just the beginning bit of your main solution. It's also the same as what jigs tried already, as shown in his question. – Doug McLean Dec 7 '17 at 15:23
  • And where does $data come from in the line $payment->importData($data);? – Doug McLean Dec 7 '17 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.