I've managed to create an Observer to automatically create a shipment when an invoice is created.
The problem I have is with the final part of the code to send the email once the shipment has been created.
I wanted to ask if anyone can notice what is wrong with the $sendEmail
call in my code.
Here's my Observer code for _saveShipment()
protected function _saveShipment(Mage_Sales_Model_Order_Shipment $shipment, Mage_Sales_Model_Order $order, $customerEmailComments = '')
{
$shipment->getOrder()->setIsInProcess(true);
Mage::log($shipment->debug(),Zend_Log::INFO,'shipment.log',true);
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($shipment)
->addObject($order)
->save();
$emailSentStatus = $shipment->getData('email_sent');
if($emailSentStatus)
Mage::log("Email has been sent",Zend_Log::INFO,'email.log',true);
else
Mage::log("IS FALSE",Zend_Log::INFO,'email.log',true);
// Mage::log($customerEmailComments,Zend_Log::INFO,'email.log',true);
if (!is_null($customerEmail) && !$emailSentStatus) {
$shipment->setEmailSent(true);
$shipment->sendEmail(true, $customerEmailComments);
}
return $this;
}
Thanks for you time...
if
clause is actually true?2014-08-04T13:52:33+00:00 INFO (6): IS FALSE
$customerEmail
define inif (!is_null($customerEmail)..
?