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
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
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();
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>