yashman Posted February 16, 2015 Share Posted February 16, 2015 (edited) Hi, I need some help with regards to adding the Terms and Conditions (only some clauses as mentioned below) in the Invoice once the order is placed by the customer. These instructions needs to be attached after the Order details. Terms and Conditions Sections that I want to insert in the Invoice template are (these are the 3 different CMS pages and are hidden for Front-End display) 1. General Agreement Section 2. Delivery Policy 3. Pricing Policy Appreciate. Edited February 16, 2015 by yashman (see edit history) Link to comment Share on other sites More sharing options...
fred-vinapresta Posted February 16, 2015 Share Posted February 16, 2015 Hi which version of Prestashop do you use? Link to comment Share on other sites More sharing options...
yashman Posted February 16, 2015 Author Share Posted February 16, 2015 (edited) Sorry forgot to mention it while creating the post. I am using PS 1.6.0.11 with custom theme (copied the default theme and changed the coloring the width of the shop) Edited February 16, 2015 by yashman (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted February 16, 2015 Share Posted February 16, 2015 I believe you have 3 options 1) create a new module that uses the pdfinvoice hook. that allows you to add content to the bottom of the invoice 2) do not create a new module, but instead just change the /pdf/invoice.tpl file directly to add your content 3) use an existing module that allows you to customize your invoices. something like this http://addons.prestashop.com/en/billing-invoicing-prestashop-modules/2011-m4-pdf-extensions.html Link to comment Share on other sites More sharing options...
yashman Posted February 16, 2015 Author Share Posted February 16, 2015 (edited) thanks bellini13. I have already modified the existing template but I am not sure how to hook the CMS pages inside the Invoice (after the items table) Edited February 16, 2015 by yashman (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted February 16, 2015 Share Posted February 16, 2015 you will need to edit or override the Invoice class (/classes/pdf/HTMLTemplateInvoice.php). This has a function called getContent. In this function, you would add logic to obtain the CMS content, and place that content into a smarty variable. Then in your invoice.tpl you would display the smarty variable. Link to comment Share on other sites More sharing options...
yashman Posted February 16, 2015 Author Share Posted February 16, 2015 (edited) Thanks bellini, thanks for the tip. I have used the one below in HTMLTemplateInvoice.php - added $cmspage and in $data array public function getContent() { $invoice_address = new Address((int)$this->order->id_address_invoice); $country = new Country((int)$invoice_address->id_country); $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' '); $formatted_delivery_address = ''; if ($this->order->id_address_delivery != $this->order->id_address_invoice) { $delivery_address = new Address((int)$this->order->id_address_delivery); $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' '); } $customer = new Customer((int)$this->order->id_customer); $cmspage = new CMS(1, $this->context->language->id); $data = array( 'order' => $this->order, 'order_details' => $this->order_invoice->getProducts(), 'cart_rules' => $this->order->getCartRules($this->order_invoice->id), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'tax_excluded_display' => Group::getPriceDisplayMethod($customer->id_default_group), 'tax_tab' => $this->getTaxTabContent(), 'customer' => $customer, 'cms_page' => $cmspage ); if (Tools::getValue('debug')) die(json_encode($data)); $this->smarty->assign($data); return $this->smarty->fetch($this->getTemplateByCountry($country->iso_code)); } In invoice.tpl file, I am calling this {$cms_page->content} but the output returned is "Array" as a value. Is there anything that I am doing wrong. Edited February 16, 2015 by yashman (see edit history) Link to comment Share on other sites More sharing options...
yashman Posted February 16, 2015 Author Share Posted February 16, 2015 Thanks bellini, I found the solution which is very simple. The solution is listed here http://nik.chankov.net/2012/06/05/prestashop-adding-text-blocks-in-the-template/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now