diff --git a/app/code/community/TIG/MyParcel2014/Helper/Data.php b/app/code/community/TIG/MyParcel2014/Helper/Data.php index 7fd9c393..39f56270 100644 --- a/app/code/community/TIG/MyParcel2014/Helper/Data.php +++ b/app/code/community/TIG/MyParcel2014/Helper/Data.php @@ -1020,12 +1020,21 @@ public function sendBarcodeEmail($barcode='', $myParcelShipment) $shippingAddress = $myParcelShipment->getShippingAddress(); $barcodeUrl = $this->getBarcodeUrl($barcode,$shippingAddress); + + // Set pakjegemak + foreach ($order->getAddressesCollection() as $address) { + if ($address->getAddressType() == 'pakje_gemak' && !$address->isDeleted()) { + $myParcelShipment->setShippingAddress($address); + $order->setShippingAddress($address); + } + } + $templateVariables = array( - 'tracktrace_url' => $barcodeUrl, - 'order' => $order, - 'shipment' => $myParcelShipment->getShipment(), - 'billing' => $order->getBillingAddress(), - 'payment_html' => $paymentBlockHtml, + 'tracktrace_url' => $barcodeUrl, + 'order' => $order, + 'shipment' => $myParcelShipment->getShipment(), + 'billing' => $order->getBillingAddress(), + 'payment_html' => $paymentBlockHtml, ); try { @@ -1041,6 +1050,7 @@ public function sendBarcodeEmail($barcode='', $myParcelShipment) $mailer->setTemplateId($templateId); $mailer->setTemplateParams($templateVariables); + $mailer->send(); }catch(Exception $e) { $this->logException($e); diff --git a/app/code/community/TIG/MyParcel2014/Model/Sales/Order.php b/app/code/community/TIG/MyParcel2014/Model/Sales/Order.php index cd07935a..25d1dca1 100644 --- a/app/code/community/TIG/MyParcel2014/Model/Sales/Order.php +++ b/app/code/community/TIG/MyParcel2014/Model/Sales/Order.php @@ -27,11 +27,15 @@ public function getShippingAddress() { 'renderView', // Detail page customer & Detail page order 'printAction', // print invoice 'printPackingSlipAction', // print packing slip + 'emailAction', // Send email + 'submitAll', // Submit order ); $parentFunctions = debug_backtrace(); - $parentFunction = $parentFunctions[3]['function']; - if (!in_array($parentFunction, $usePgAddressIn)) { + if ( + !in_array($parentFunctions[3]['function'], $usePgAddressIn) && + !in_array($parentFunctions[11]['function'], $usePgAddressIn)) + { $usePgAddress = false; }