1

I just created a custom payment method and I would like that when the invoice is generated to change the status of the order. What function do i rewrite.

thanks

1
  • This question is too broad. Please add some information what you have already implemented or tried. Commented Nov 10, 2014 at 11:50

2 Answers 2

1

You could create and event/observer see Run method after capturing invoice

singleton [Company]_[Name]_Model_Observer changeOrderStatus

in observer

class <Company>_<Name>_Model_Observer
{

    public function changeOrderStatus($observer)
    {
         $this->_invoice = $observer->getEvent()->getInvoice();
         $order = $invoice->getOrder();
         $order->setStatus(  ... );
         $order->save();
1
  • thanks.it works.i add it: public function invoiceSaveAfter(Varien_Event_Observer $observer)
    – strauss
    Commented Nov 10, 2014 at 14:09
1

Take a look at Is it safe to change order status before save?

Assuming that your payment is set to authorize and capture

Once an invoice is generated then the status should be processing because you should already receive payment (take a look at cash/check payment method once you invoice balance due become zero)

But if you still want to make it “pending payement”

in system.xml you need to either create a new source_model or find one that has pending payment status, the set it as default in system config your payment method

<order_status translate="label">
  <label>New order status</label>
  <frontend_type>select</frontend_type>
  <source_model>adminhtml/system_config_source_order_status_processing</source_model>
  <sort_order>4</sort_order>
  <show_in_default>1</show_in_default>
  <show_in_website>1</show_in_website>
  <show_in_store>0</show_in_store>

3
  • in fact when the order is placed I have the "processing" status what is fine but when the invoice is created I do not capture the payment so it would have to pass in order status "pending payment". Is it possible?
    – strauss
    Commented Nov 10, 2014 at 12:00
  • What is your payment processing type set to? Commented Nov 10, 2014 at 12:03
  • it is a payment slip
    – strauss
    Commented Nov 10, 2014 at 12:10

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