Q:

Change Order Status

How do I change the order status? I do orders that are sometimes picked up and delivered (not just shipped) so I need to change the order statuses to "picked up" and "delivered"
How do I do that? I already created these statuses in the config area.

A:

Below are the status's you can use
const STATE_NEW             = 'new';
const STATE_PENDING_PAYMENT = 'pending_payment';
const STATE_PROCESSING      = 'processing';
const STATE_CLOSED          = 'closed';
const STATE_CANCELED        = 'canceled';
const STATE_HOLDED          = 'holded';
const STATE_PAYMENT_REVIEW  = 'payment_review';

Code for updating the status.
$order = Mage::getModel('sales/order')->load($orderid, 'increment_id');
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
$order->save();

Above code will update all the status's except COMPLETE Status. As Order becomes complete only when invoice and shipment is created. Once invoice and shipment is created order will automatically changed to Complete.
so for that you can use below code.
Create Invoice
$invoice = $order->prepareInvoice()
                 ->setTransactionId($order->getId())
                 ->addComment($comment)
                 ->register()
                 ->pay();

$transaction_save = Mage::getModel('core/resource_transaction')
                 ->addObject($invoice)
                 ->addObject($invoice->getOrder());
$transaction_save->save();

create shipmnet
$itemQty =  $order->getItemsCollection()->count();
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
$shipmentId = $shipment->create($orderId);

A:

Rather than give you code I prefer to handle this from the admin panel:

Log into the admin panel and navigate to the order in question: Sales > Orders
Scroll down to the bottom of the order detail and take note of the order comments box:

The dropdown displays statuses that are applicable to the current order state. To input new available statuses edit the status/state association in the configuration panel: System > Order Statuses.
Input a comment with a new status and click "Submit Comment" - the order status will change to the selected status. 

