Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Magento Programmatically Edit Order Payment
 
Nitroware
Jr. Member
 
Total Posts:  20
Joined:  2010-01-22
 

I need to make a change of payment method to an order after it is placed. I have the order ID ($orderID), the order object ($order), a proper payment object, etc.

$service->retrievePaymentType() Returns the payment in the form of Mage_Sales_Model_Order_Payment

All of this happens in an extension of Mage_Checkout_Model_Type_Onepage

Does anybody know how I would go about doing this?

$order Mage::getModel('sales/order')->load($orderID);

$service Mage::getModel('sales/service_quote'$this->getQuote());

// Update Saved Order Payment Method

// $order->getPaymentsCollection()->clear();

$order->setPayment($service->retrievePaymentType());

$order->getPaymentsCollection()->save();

$order->save();

The function

$service->retrievePaymentType()
from
Mage_Sales_Model_Service_Quote
just does the following:
return $this->_convertor->paymentToOrderPayment($quote->getPayment());

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nitroware
Jr. Member
 
Total Posts:  20
Joined:  2010-01-22
 

Any update on this?

The other option I have is to be able to not make payment necessary at checkout, so that I could add payment info later?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
matinict
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2012-07-26
Bangladesh
 

Programatically change order status magento

<?php
require_once \'app/Mage.php\';
umask(0);
Mage::app(\'default\');

/*
    const STATE_NEW             = \'new\';
    const STATE_PENDING_PAYMENT = \'pending_payment\';
    const STATE_PROCESSING      = \'processing\';
    const STATE_COMPLETE        = \'complete\';
    const STATE_CLOSED          = \'closed\';
    const STATE_CANCELED        = \'canceled\';
    const STATE_HOLDED          = \'holded\';
    const STATE_PAYMENT_REVIEW  = \'payment_review\';
 */
$orderId \'200000120\';
$order Mage::getModel(\'sales/order\')->loadByIncrementID($orderId);
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSINGtrue);
$order->save();

echo 
\"<br />Status Updated\";
?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top