As you said ,you want to send shipment mail after create Invoice.
For this ,you need change the event from sales_order_save_after
to sales_order_invoice_register
which is better ...
See more at
https://stackoverflow.com/questions/7661455/whats-the-event-name-when-you-create-a-new-invoice-in-magento
Run method after capturing invoice
Also Some issue in config.xml
<class>Namespace_Invoicer_Model_Observer</class>
Should be from Namespace_Invoicer_Model_Observer
to invoicer/observer
Also Observer file implementOrderStatus() , $Order have wrong parameter
public function implementOrderStatus ($Observer)
{
$order =$Observer->getEvent()->getOrder ();
if ($this->_getPaymentMethod ($order) == 'ccsave') {
$this->_processOrderStatus ($order->getIncrementId());
return $this;
}
For Doing shipment on Order all items try below code ,so processOrderStatus() code should be
public function processOrderStatus($orderIncrementId){
$itemsQty = array();
$comment = null;
$email = true;
$includeComment = false;
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
if ($order->canShip()){
$itemsQty = array();
foreach ($order->getAllItems() as $item) {
$itemsQty[$item->getId()] = $item->getQtyOrdered();
}
$shipment = $order->prepareShipment($itemsQty);
}
$shipment = $order->prepareShipment($itemsQty);
if ($shipment) {
$shipment->register();
$shipment->addComment($comment, $email && $includeComment);
if ($email) {
$shipment->setEmailSent(true);
}
$shipment->getOrder()->setIsInProcess(true);
try {
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($shipment)
->addObject($shipment->getOrder())
->save();
$shipment->sendEmail($email, ($includeComment ? $comment : ''));
} catch (Mage_Core_Exception $e) {
var_dump( $e->getMessage());
}
echo $shipment->getIncrementId();
}
}
In Magento invoices are created once you have received payment. So if you are using an automatic payment gateway and have it set to authorize and capture it will automatically create an invoice. However, if you set it to only authorize the payment you will manually have to capture the payment hence manually create an invoice.
Best Answer
I'd go the route of creating an event-observer for
sales_order_shipment_save_after
:So in
app/code/local/Namespace/Module/etc/config.xml
:and in
app/code/local/Namespace/Module/Model/Observer.php
:Then you should be all set.