magento :: change orders from pending to complete

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

3 thoughts on “magento :: change orders from pending to complete”

  1. <?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";
    

    ?>

  2. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *