Jump to content

[solved]: Add Terms of Service in the Invoice upon Order placement


yashman

Recommended Posts

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 by yashman (see edit history)
Link to comment
Share on other sites

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

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

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 by yashman (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...