Skip to content

Commit

Permalink
Pakjegemak location on invoice (#79) (#80) (#81)
Browse files Browse the repository at this point in the history
* gitignore

* no beta

* use pakjegemak in mail

* in invoice
  • Loading branch information
Reindert authored Jun 12, 2016
1 parent 790d7b5 commit b223ca0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
20 changes: 15 additions & 5 deletions app/code/community/TIG/MyParcel2014/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -1041,6 +1050,7 @@ public function sendBarcodeEmail($barcode='', $myParcelShipment)
$mailer->setTemplateId($templateId);
$mailer->setTemplateParams($templateVariables);


$mailer->send();
}catch(Exception $e) {
$this->logException($e);
Expand Down
8 changes: 6 additions & 2 deletions app/code/community/TIG/MyParcel2014/Model/Sales/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b223ca0

Please sign in to comment.