This function not working because what i'm trying to achieve is if this invoice contain a product with sku "FBA" then assign this status.
Looking forward to hearing from you.
But it doesn't work as i'm getting this:
exception 'Varien_Exception' with message 'Invalid method Mage_Sales_Model_Order_Invoice::addStatusHistoryComment(Array ( [0] => Amazon FBA [1] => amazonfba )
public function changestatus2($event)
{
$_order = $event->getEvent()->getInvoice();
$_state = 'amazonfba';
foreach($_order->getAllItems() as $item) {
$sku = $item->getSku();
if (substr($sku,-4) == '_FBA') {
$_order->addStatusHistoryComment('Amazon FBA', $_state)
->setIsVisibleOnFront(false)
->setIsCustomerNotified(false)
->save();
break;
}
}
}
sales_order_payment_capture
instead.