2

I'm trying to change an order status in controller. After execute "addStatusToHistory" and "->save()", it save the comment and status that I've specified. But after that it apply a new status to order, just in case, the first status in status list for comments. Does anyone know something about it?

$_order = Mage::getModel('sales/order')->load($idOrder);
$history = $_order->addStatusToHistory('etiqueta_impressa','Etiqueta impressa via Ferramentas > SIGEP em: '.date("d/m/Y H:i:s"),false);
$history->setIsCustomerNotified(false);
$_order->save();
1

Have a state related to status etiqueta_impressa?

Try set status and add history comment separately, and search for observers after save order.

$_order = Mage::getModel('sales/order')->load($idOrder);

$_order->setStatus('etiqueta_impressa');

$comment = 'Etiqueta impressa via Ferramentas > SIGEP em: '.date("d/m/Y H:i:s");
$history = $_order->addStatusHistoryComment($comment, false);
$history->setIsCustomerNotified($isCustomerNotified);

$_order->save();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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