Reputation: 11812
i made a magento module to handle my bank vpc system, all good until now, i'm using Mage_Payment_Model_Method_Cc as a parent. the code is working 100% but now, when orders take place i see them in the admin panel with "pending" status, i want to mark the request as "complete" when a user submits the request. i tried everything i can think of with no hope.
thanks in advance
Upvotes: 1
Views: 4129
Reputation: 21
<?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 = '100000001';
$order = Mage::getModel('sales/order')->loadByIncrementID($orderId);
$order->setState (Mage_Sales_Model_Order::STATE_COMPLETE, true);
$order->save();
echo "<br />Status Updated";
?>
Upvotes: 2
Reputation: 353
In Magento ver. 1.12.0.2 if you try to force the order state to Complete, you get the following error:
The Order State "complete" must not be set manually.
Upvotes: 1
Reputation: 25966
Have a look at here:- Magento: How to change order status programmatically?
Hope it helps.
Upvotes: 2