diff --git a/classes/pdf/HTMLTemplate.php b/classes/pdf/HTMLTemplate.php index 993d04e8a..bffb28ec6 100755 --- a/classes/pdf/HTMLTemplate.php +++ b/classes/pdf/HTMLTemplate.php @@ -33,9 +33,9 @@ abstract class HTMLTemplateCore { public $title; public $date; - public $address; public $available_in_your_account = true; public $smarty; + public $shop; /** * Returns the template's HTML header @@ -49,7 +49,7 @@ abstract class HTMLTemplateCore 'img_update_time' => Configuration::get('PS_IMG_UPDATE_TIME'), 'title' => $this->title, 'date' => $this->date, - 'shop_name' => Configuration::get('PS_SHOP_NAME') + 'shop_name' => $this->shop->name )); return $this->smarty->fetch(_PS_THEME_DIR_.'/pdf/header.tpl'); @@ -62,9 +62,13 @@ abstract class HTMLTemplateCore public function getFooter() { $shop_address = ''; - if (isset($this->address) && $this->address instanceof Address) - $shop_address = AddressFormat::generateAddress($this->address, array(), ' - ', ' '); - + if (Validate::isLoadedObject($this->shop)) + { + $shop_address_obj = $this->shop->getAddress(); + if (isset($shop_address_obj) && $shop_address_obj instanceof Address) + $shop_address = AddressFormat::generateAddress($shop_address_obj, array(), ' - ', ' '); + } + $this->smarty->assign(array( 'available_in_your_account' => $this->available_in_your_account, 'shop_address' => $shop_address, diff --git a/classes/pdf/HTMLTemplateDeliverySlip.php b/classes/pdf/HTMLTemplateDeliverySlip.php index 3767495d3..97e0d4bda 100755 --- a/classes/pdf/HTMLTemplateDeliverySlip.php +++ b/classes/pdf/HTMLTemplateDeliverySlip.php @@ -43,8 +43,7 @@ class HTMLTemplateDeliverySlipCore extends HTMLTemplate $this->title = self::l('Delivery').' #'.Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id).sprintf('%06d', $this->order_invoice->delivery_number); // footer informations - $shop = new Shop((int)$this->order->id_shop); - $this->address = $shop->getAddress(); + $this->shop = new Shop((int)$this->order->id_shop); } /** diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index 92264d8a2..6c5de48ea 100755 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -45,8 +45,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $this->title = self::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).sprintf('%06d', $order_invoice->number); // footer informations - $shop = new Shop((int)$this->order->id_shop); - $this->address = $shop->getAddress(); + $this->shop = new Shop((int)$this->order->id_shop); } /** diff --git a/classes/pdf/HTMLTemplateOrderReturn.php b/classes/pdf/HTMLTemplateOrderReturn.php index 1f9f38c71..df34f4f72 100755 --- a/classes/pdf/HTMLTemplateOrderReturn.php +++ b/classes/pdf/HTMLTemplateOrderReturn.php @@ -44,8 +44,7 @@ class HTMLTemplateOrderReturnCore extends HTMLTemplate $this->title = 'Order Return '.sprintf('%06d', $this->order_return->id); // TODO // footer informations - $shop = new Shop((int)$this->order->id_shop); - $this->address = $shop->getAddress(); + $this->shop = new Shop((int)$this->order->id_shop); } /** diff --git a/classes/pdf/HTMLTemplateOrderSlip.php b/classes/pdf/HTMLTemplateOrderSlip.php index 10594baab..98cf3d540 100644 --- a/classes/pdf/HTMLTemplateOrderSlip.php +++ b/classes/pdf/HTMLTemplateOrderSlip.php @@ -50,8 +50,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice $this->title = self::l('Slip #').sprintf('%06d', $this->order_slip->id); // footer informations - $shop = new Shop((int)$this->order->id_shop); - $this->address = $shop->getAddress(); + $this->shop = new Shop((int)$this->order->id_shop); } /**