From 491b209e9cf2d5d7f047c9ac699fb6dd33e187ff Mon Sep 17 00:00:00 2001 From: Michael Scheel Date: Mon, 29 Jun 2015 13:02:09 +0200 Subject: [PATCH 1/2] Added support for invoices with solely downloadable products --- .../community/FireGento/Pdf/Helper/Invoice.php | 18 +++++++++++------- .../FireGento/Pdf/Model/Engine/Abstract.php | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/app/code/community/FireGento/Pdf/Helper/Invoice.php b/src/app/code/community/FireGento/Pdf/Helper/Invoice.php index 321d44a..98dc9b1 100644 --- a/src/app/code/community/FireGento/Pdf/Helper/Invoice.php +++ b/src/app/code/community/FireGento/Pdf/Helper/Invoice.php @@ -38,17 +38,21 @@ class FireGento_Pdf_Helper_Invoice extends Mage_Core_Helper_Abstract */ public function getShippingCountryNotes(Mage_Sales_Model_Order $order) { - $shippingCountryId = $order->getShippingAddress()->getCountryId(); - $countryNotes = unserialize(Mage::getStoreConfig('sales_pdf/invoice/shipping_country_notes')); + if(!$order->getIsVirtual()){ + $shippingCountryId = $order->getShippingAddress()->getCountryId(); + $countryNotes = unserialize(Mage::getStoreConfig('sales_pdf/invoice/shipping_country_notes')); - $shippingCountryNotes = array(); - foreach ($countryNotes as $countryNote) { - if ($countryNote['country'] == $shippingCountryId) { - $shippingCountryNotes[] = $countryNote['note']; + $shippingCountryNotes = array(); + foreach ($countryNotes as $countryNote) { + if ($countryNote['country'] == $shippingCountryId) { + $shippingCountryNotes[] = $countryNote['note']; + } } + + return $shippingCountryNotes; } - return $shippingCountryNotes; + return array(); } } diff --git a/src/app/code/community/FireGento/Pdf/Model/Engine/Abstract.php b/src/app/code/community/FireGento/Pdf/Model/Engine/Abstract.php index a20aa67..6dec0b3 100644 --- a/src/app/code/community/FireGento/Pdf/Model/Engine/Abstract.php +++ b/src/app/code/community/FireGento/Pdf/Model/Engine/Abstract.php @@ -677,7 +677,7 @@ protected function insertHeader(&$page, $order, $document) || $mode == 'shipment' && Mage::getStoreConfig('sales_pdf/shipment/shipping_method_position') == FireGento_Pdf_Model_System_Config_Source_Shipping::POSITION_HEADER); - if ($putShippingMethod) { + if ($putShippingMethod && $order->getIsNotVirtual()) { $page->drawText( Mage::helper('firegento_pdf')->__('Shipping method:'), ($this->margin['right'] - $labelRightOffset), From 361124897188b738c56ece0dc56523645b124932 Mon Sep 17 00:00:00 2001 From: Michael Scheel Date: Mon, 29 Jun 2015 13:28:37 +0200 Subject: [PATCH 2/2] Formatting --- src/app/code/community/FireGento/Pdf/Helper/Invoice.php | 2 +- src/app/code/community/FireGento/Pdf/Model/Engine/Abstract.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/code/community/FireGento/Pdf/Helper/Invoice.php b/src/app/code/community/FireGento/Pdf/Helper/Invoice.php index 98dc9b1..694d345 100644 --- a/src/app/code/community/FireGento/Pdf/Helper/Invoice.php +++ b/src/app/code/community/FireGento/Pdf/Helper/Invoice.php @@ -38,7 +38,7 @@ class FireGento_Pdf_Helper_Invoice extends Mage_Core_Helper_Abstract */ public function getShippingCountryNotes(Mage_Sales_Model_Order $order) { - if(!$order->getIsVirtual()){ + if (!$order->getIsVirtual()) { $shippingCountryId = $order->getShippingAddress()->getCountryId(); $countryNotes = unserialize(Mage::getStoreConfig('sales_pdf/invoice/shipping_country_notes')); diff --git a/src/app/code/community/FireGento/Pdf/Model/Engine/Abstract.php b/src/app/code/community/FireGento/Pdf/Model/Engine/Abstract.php index 6dec0b3..a124661 100644 --- a/src/app/code/community/FireGento/Pdf/Model/Engine/Abstract.php +++ b/src/app/code/community/FireGento/Pdf/Model/Engine/Abstract.php @@ -677,6 +677,7 @@ protected function insertHeader(&$page, $order, $document) || $mode == 'shipment' && Mage::getStoreConfig('sales_pdf/shipment/shipping_method_position') == FireGento_Pdf_Model_System_Config_Source_Shipping::POSITION_HEADER); + if ($putShippingMethod && $order->getIsNotVirtual()) { $page->drawText( Mage::helper('firegento_pdf')->__('Shipping method:'),