1

i am creating a module and i need the default order status for invoice.
i know the default status is processing but i don't want to hard code it.
i am already creating the invoice but the order status is not changing.
how can i get that any help will be appreciated.

this is how i generate invoice

 $order=Mage::getModel('sales/order')->load($orderid);
     try {
           if(!$order->canInvoice())
           {
              $error=true;
              $ids[]=$order->getIncrementId();
           }else {

           $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();

           if (!$invoice->getTotalQty()) {
           Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
           }

           $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
           $invoice->register();
           $transactionSave = Mage::getModel('core/resource_transaction')
           ->addObject($invoice)
           ->addObject($invoice->getOrder());

           $transactionSave->save();
           $sucess=true;
           $i++;
           }
        }
     catch (Mage_Core_Exception $e) {

        }


     }

1 Answer 1

2

You can add the following line, it will change the order to the default processing state:

$invoice->getOrder()->setIsInProcess(true);

You will have to add a line like this though, it will not change automatically as far as I know.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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