Jump to content

[Guide] Modifying Prestashop 1.5/1.6 Invoice Template.


Supremacy2k

Recommended Posts

After copy the code in my invoice.tpl i became this error:

 

Warning: Division by zero in /www/htdocs/....../....../....../....../tools/tcpdf/tcpdf.php on line 23203

 

Warning: array_fill() [function.array-fill]: Number of elements must be positive in /www/htdocs/....../....../....../....../tools/tcpdf/tcpdf.phpon line 23205

 

Warning: Invalid argument supplied for foreach() in /www/htdocs/....../....../....../....../tools/tcpdf/tcpdf.php on line 24618

 

Warning: Invalid argument supplied for foreach() in /www/htdocs/....../....../....../....../tools/tcpdf/tcpdf.php on line 24650

TCPDF ERROR: Some data has already been output, can't send PDF file

Edited by m3442a (see edit history)
Link to comment
Share on other sites

Well then its at 1.4 upgraded to 1.5, because 1.5 do not have a "tools" folder.

 

And in that case I'm not sure what your problem is, because I'm not getting any errors on my shop, which is live. :/

 

Edit: I can see you get your error in the .php file, and not the tpl file.

Edited by Supremacy2k (see edit history)
Link to comment
Share on other sites

very nice guide, thanks for sharing!

 

v1.5 does indeed include a tools folder, which is where all the plugins and 3rd party libraries are stored. The error is occuring in the writeHTML function of tcpdf.php. Most likely something in the invoice.tpl is not correct or conflicting with the users specific installation. It would need to be debugged further to understand the problem.

Link to comment
Share on other sites

Okey I'm blind.

I totally missed the "tools" folder, hehe.

 

Anyways.

 

On line 23.203 i have the following:

} else {

on 23.205 i have this:

}

On 24.618 this:

$this->y += $this->getHTMLUnitToUnits($table_el['attribute']['cellspacing'], 1, 'px');

and on 24.650 this

if (isset($this->theadMargins['top'])) {

 

m3442a .. can you post your lines from 24203 to 24205 and from 24618 to 24650 ?

Link to comment
Share on other sites

how can I change {$invoice_address} and {$delivery_address} format.

 

 

Company name (bold) or font size 18

firstname lastname (small)

address1, address2

city, country

 

actually I need this format on every document

 

To be honest I'm not quite sure where address text is generated.

I havent looked into it, and might go beyond my skills for now. :(

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I made some alterations to my invoice also. But at the reference number/order number I can't make that show.

I tried inseting

{$order_detail.product_reference}

but on the PDF I see only a blank space and then I looked at your guide and tried with

{$order_detail.product_ean13}

.

 

The result is the same. I don't understand what I did wrong with the invoice template because all the other cells and data in them are shown properly.

 

Can anybody give me some pointers to what should I try next?

 

Thanks

Link to comment
Share on other sites

Hi

 

I have the same problem with EAN codes - it is blank. All other fields are fine. Latest stable PrestShop.

Hi,

 

I made some alterations to my invoice also. But at the reference number/order number I can't make that show.

I tried inseting

{$order_detail.product_reference}

but on the PDF I see only a blank space and then I looked at your guide and tried with

{$order_detail.product_ean13}

.

 

The result is the same. I don't understand what I did wrong with the invoice template because all the other cells and data in them are shown properly.

 

Can anybody give me some pointers to what should I try next?

 

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

Found a similar solution in the french forum:

http://www.prestasho...-prestashop-15/

 

This version contains a section for display weight, carrier and tracking ID I used just as option for my own slightly modified invoice.tpl, which is attached as pdf.

(Full coding you find here: http://www.prestasho...36#entry1117036 )

 

<!-- Optional display of weight, carrier and tracking ID -->

{foreach from=$order->getShipping() item=shipping name=shippingsLoop}
<table style="width: 100%; text-align: center; border: 1px solid #CCC; font-size: 9pt;">
 <tr>
  <td colspan = "3" style="background-color: #CCC; color: #000;">
	<b>{l s='Paket Nr. ' pdf='true'}{$smarty.foreach.shippingsLoop.iteration}</b>
  </td>
 </tr>
 <tr>
  <td style="width: 33%; background-color: #EEE; color: #000;">
	<b>{l s='Gewicht:' pdf='true'}</b>
  </td>
  <td style="width: 33%; background-color: #EEE; color: #000;">
	<b>{l s='Versanddienst:' pdf='true'}</b>
  </td>
  <td style="width: 34%; background-color: #EEE; color: #000;">
	<b>{l s='Tracking-Nr.:' pdf='true'}</b>
  </td>
 </tr>
 <tr>
  <td style="width: 33%;">
	{$shipping.weight|string_format:"%.3f"} Kg
  </td>
  <td style="width: 33%;">
	{$shipping.state_name}
  </td>
  <td style="width: 34%;">
	{$shipping.tracking_number}
  </td>
 </tr>
</table>
{/foreach}

 

For printouts on own business paper I recommend just to deactivate line 73 and 74 in /classes/pdf/pdf.php with /* ... */:

 

$this->pdf_renderer->createHeader($template->getHeader());
$this->pdf_renderer->createFooter($template->getFooter());

 

If the billing address doesn't fit, either change the margins in /classes/pdf/PDFgenerator.php or

adjust table width from 100% to about 92%, which matches about 1in for left margin.

 

Anyhow, as our tax laws in Germany are very complicated, I got an urgent request too:

Does anybody know how to display the tax rate for each product in every line of the invoice's products section?

 

It's jinxed, but I just can't manage it. I really have no idea.

Edited by eleazar (see edit history)
  • Like 2
Link to comment
Share on other sites

Anyhow, as our tax laws in Germany are very complicated, I got an urgent request too:

Does anybody know how to display the tax rate for each product in every line of the invoice's products section?

 

It's jinxed, but I just can't manage it. I really have no idea.

 

you could have a look into the template of ps1.4 (if nobody changed the name of the methods/functions for 1.5)

Edited by andrep (see edit history)
Link to comment
Share on other sites

Why not? If you're desperate to include the reference to any particular style in the invoice.tpl, it should work.

 

Maybe even with a separate css file if you activate option Smart Cache for CSS. This forces PrestaShop to conbine all css files into a single file.

 

didn't try with smart cache for CSS (I already started coding the template without it), but without didn't work

Link to comment
Share on other sites

With the modifications explained in the OP, this removes the content from the header.tpl file and inserts it into the invoice.tpl file.

That's fine, however the invoice then has a large gap at the top where the header should be, since the header file is now empty.

 

Is there any way to move the invoice.tpl content higher to the top of the page, i.e. reduce the height of the header.tpl allowance within the PDF?

Link to comment
Share on other sites

I'll been fighting with this my self.

 

The reason why i chose to move the header content into the main document, was because the header.tpl don't have access to all variables used with this invoice template.

 

The major factor was the order number.

 

How to either remove the header.tpl from this template or reduces it's occupied space on the pdf, i don't know. :(

Link to comment
Share on other sites

@cammo & Supremacy2k

 

Is there any way to move the invoice.tpl content higher to the top of the page, i.e. reduce the height of the header.tpl allowance within the PDF?

 

How to either remove the header.tpl from this template or reduces it's occupied space on the pdf, i don't know

 

So once again what JohnJohn already posted on page 2 of this thread:

 

You may reduce space for header or footer in lines 153 and 154 of /classes/pdf/PDFgenerator.php:

 

 * Write a PDF page
 */
public function writePage()
{
 $this->SetHeaderMargin(5);
 $this->SetFooterMargin(18);
 $this->setMargins(10, 40, 10);
 $this->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);

 $this->AddPage();

 $this->writeHTML($this->content, true, false, true, false, '');
}

  • Like 2
Link to comment
Share on other sites

No, don't just duplicate the file! You need to replace

 

class PDFGeneratorCore extends TCPDF

 

with this line already written in the overrrides file:

 

class PDFGenerator extends PDFGeneratorCore

 

With this modifications you may copy the whole file to /overrides/pdf.

 

Or you just modify the funktion with an overrides file containing just the function with your range modification like shown below:

 

<?
class PDFGenerator extends PDFGeneratorCore
{
* Write a PDF page
 */
public function writePage()
{
 $this->SetHeaderMargin(5);
 $this->SetFooterMargin(18);
 $this->setMargins(10, 40, 10);
 $this->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
 $this->AddPage();
 $this->writeHTML($this->content, true, false, true, false, '');
}
}

 

Full modified copy does work, in case of the second I'm not quite sure. Normally I use the full mode.

Edited by eleazar (see edit history)
Link to comment
Share on other sites

@ Supremacy2k: Thanks a lot for this guide, it made my day. :-)

 

A related question: Does anyone know how I can add the customers phone number to the pdf invoice? I'm using v. 1.5.3.1

 

I have tried editing the address format in "cuntries" but it doesn't seem to do anything.

Link to comment
Share on other sites

@dklap3

 

Sounds weird.

 

I think you should

  • either delete the smarty cache in \cache\smarty\cache and \cache\smarty\compile
  • or switch for one time to Force compile in Advanced Parameters second menu item in section Smarty.
    (Then switch back to normal mode. Slows down your shop system)

 

Then your modifications should work.

Link to comment
Share on other sites

@ eleazer: thank you for the reply. I think I found the problem.

 

In "country", when trying to add the phone, I clicked "Address" > "phone_mobile" which added a "Address:phone_mobile" to the format field. This didn't show up on my invoice. However, deleting the first part and just writing "phone_mobile" made it show up..not sure why but a bit confusing. Anyway it works now. :)

 

On last thing: Do you also know if I can possibly add a little "(Tlf)", or any other text, after or before the phone number? My adress format includes 2 things with 8 numbers (phone and tax nr.) and I would like to add such a little text next to them to avoid confusion.

Link to comment
Share on other sites

Nope, inserting other text isn't allowed here. Just the field names. And in future you should better klick on the button "Apply standard" or something like that (sorry, but my buttons are in German) displayed below the field as second one. This forces PrestaShop to dislplay all valid field names and you avoid misspelling.

 

Anyhow, it should be possible to add some text to the billing or delivery address, but that's a bit tricky because you have to modify the core file where the address formats are generated.

PDFs in PrestaShop just display these elsewhere generated address formats.

Link to comment
Share on other sites

Thank you again for the answer eleazar.

 

I might try to modify the core files later, but for now I found another more simple solution.

 

For my new invoice (based on the example in this thread), I have just added the text manually in the <td> next to the address. All the fields in the address are mandatory, so I'm sure it will be the same fields used every time.

 

It's in Danish, but you'll probably get it:

 

faktura.jpg

Link to comment
Share on other sites

  • 2 weeks later...

Great post. Learned a lot today... Even though still a newbie managed to fit the adresses to work with my peel of labels and did some other design changes. Although the one thing I can not seam to find and modify is the the table with total tax under the product table? I see something called {$tax_tab} but not sure how to modify. I primarily would like to adjust the background for the titles and potentially move it.

A perfect continuation of this guide/post would be some guidence how to modify the delivery slip as well? Although after this guide I feel confident enough to have a look at least... :)

Link to comment
Share on other sites

  • 3 weeks later...

Great Info here! I learned so much!

 

Quick question:

 

Anyone know how to create seperate invoices for different countries and have the system recognize this? I would be interested in having two seperate types of invoices, one for my clients in Switz and the others for Germany/ france.

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

I have found this post very useful. Currently when I upgrade Prestashop, I keep a folder on my local drive that includes the modified .tpl files to upload into the PDF directory after an upgrade. I was wondering if it would be possible to create a PDF directory in my custom theme directory that inludes the .tpl files, then have an Override file in override/classes/pdf that would force the PDF generation to pickup the modified template files in my custom theme? That would simplify upgrading for everyone.

 

Anybody care to take this on, or suggest a similar approach so that autoupgrade doesn't overwrite the customized PDF files?

Link to comment
Share on other sites

Hi Rhapsody,

why so complicated. ;)

It's totally simple. Just create the pdf directory in your custom themes directory.

The files you put here will automatically override the default PDF files. That's all. No additional change necessary.

 

Same solution possible for the mails directory, if you apply some modifications here, too.

  • Like 1
Link to comment
Share on other sites

Okey I'm blind.

I totally missed the "tools" folder, hehe.

 

Anyways.

 

On line 23.203 i have the following:

} else {

on 23.205 i have this:

}

On 24.618 this:

$this->y += $this->getHTMLUnitToUnits($table_el['attribute']['cellspacing'], 1, 'px');

and on 24.650 this

if (isset($this->theadMargins['top'])) {

 

m3442a .. can you post your lines from 24203 to 24205 and from 24618 to 24650 ?

this error is normal when there is a typo in your invoice.txt

<table style="width: 100%;">
<tr>
 <td style="width: 17%"></td>
  <td style="width: 66%">{if $available_in_your_account}{l s='An electronic version of this invoice is available in your account. To access it, log in to our website using your e-mail address and password (which you created when placing your first order).' pdf='true'}{/if}</td>
 </td style="width: 17%"></td>
</tr>
</table>  

You have a closing td instead of an opening td in the last td rule ;)

Link to comment
Share on other sites

Does anybody know of you guys how I manage to add the gender to both invoice and delivery address, so that you get something like

 

Mrs

Ronda Nuttleback

,,,

 

in invoice.tpl

This really drives me mad because I don't know how to solve this problem and in Germany a personalized address format is the normal case.

Link to comment
Share on other sites

I have some custom fields defined in the ps_customer table. In the old 1.4 PS I was able to include these in the PDF.php override file to have them display on the PDF invoice. Can I do similar using just the template files with 1.5? For example - the custom field names in the ps_customer table are member and spouse. If the customer purchase products with ID 6, 10, 15, 17 or 26 then display a section on the invoice that includes the custom fields.

 

Bellini helped me with this as on override for my custom invoice in PS 1.4. I'm doing other shop mods and getting ready to upgrade a shop from 1.4.10.0 to 1.5. The customized invoice is the last item I need to make work.

 

What I want to do is check if certain products were purchased, and if they were, display a section with the custom field names.

Link to comment
Share on other sites

Hi, ramesh90,

just logo or complete header?

 

How-to for removing the complete header I already posted here:

http://www.prestashop.com/forums/index.php?/topic/213664-guide-modifying-prestashop-15-invoice-template/page__view__findpost__p__1119146

 

To remove just the logo you have to open /pdf/header.tpl and disable line 28-30 like this:

 

{*
{if $logo_path}
  <img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" />
 {/if}
*}

Link to comment
Share on other sites

guys how do i remove the top space from my invoice, that's the exact space for the old header which i removed

 

Hi desudura,

 

I guess you just deactivated the header printout in /classes/pdf/pdf.php by disabling the line

 

$this->pdf_renderer->createHeader($template->getHeader());

 

But by doing this a white space is the only result.

 

You need to modify function writePage() in /classes/pdf/PDFgenerator.php. Looks like this:

 

public function writePage()
{
 $this->SetHeaderMargin(5);
 $this->SetFooterMargin(18);
 $this->setMargins(10, 40, 10);
 $this->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
 $this->AddPage();
 $this->writeHTML($this->content, true, false, true, false, '');
}

 

Measures are in mm. You have to modify line 183 (v 1.5.3.x) or line 153 (v 1.5.4.x) to

 

$this->SetHeaderMargin(5);

 

if your measure is mm here. Search forfunction __construct. There must be a line like this:

 

parent::__construct('P', 'mm', 'A4', true, 'UTF-8', $use_cache, false);

 

If, as I don't know, your linear measurement is different, you got to modify this entry too.

 

If all this doesn't help I would guess that you didn't insert the framed text and logo of you header to header.tpl (where it belongs) but to invoice.tpl. If so, then move this complete table to header.tpl and replace the code in this file with your own header code.

Edited by eleazar (see edit history)
  • Like 1
Link to comment
Share on other sites

Okey I'm blind.

I totally missed the "tools" folder, hehe.

 

Anyways.

 

On line 23.203 i have the following:

} else {

on 23.205 i have this:

}

On 24.618 this:

$this->y += $this->getHTMLUnitToUnits($table_el['attribute']['cellspacing'], 1, 'px');

and on 24.650 this

if (isset($this->theadMargins['top'])) {

 

m3442a .. can you post your lines from 24203 to 24205 and from 24618 to 24650 ?

I have the same error.

Since m3442a haven't posted the lines, I would be happy to do it, if you're still are willing to help?

Link to comment
Share on other sites

I have a strange problem, i've been using a really good looking invoice template cardscapital created and shared here but for some reason, it shows two carriers when i only have one carrier from back office.

 

It still shows "my carrier" first and below that my actual carrier..any ideas?

Link to comment
Share on other sites

  • 2 weeks later...

I have now customized my 1.5.4.1 invoice and added the special "logic" for the membership cards I wanted to include for printing when membership is purchased.

 

Has anyone figured out how to modify the display of product attributes? Currently it is a run on string with the attribute name, followed by a colon, then the attribute. I would like to display each attribute and value on a separate line, similar to the way product customizations are displayed.

Link to comment
Share on other sites

[solved] How to make product attributes and groups (combinations in the BO for products) display on separate lines of the PDF invoice.

...

Has anyone figured out how to modify the display of product attributes? Currently it is a run on string with the attribute name, followed by a colon, then the attribute. I would like to display each attribute and value on a separate line, similar to the way product customizations are displayed.

I figured it out. The following can be put in the invoice.tpl file as a modification:

Search for:

<td style="text-align: left; width: 45%">{$order_detail.product_name}</td>

and replace with the following

<td style="text-align: left; width: 45%">{$order_detail.product_name|replace:', ':'<br>'|replace:' - ':'<br>'}</td>

This has the effect of making the product description display like this:

This is the product description with the assigned attributes

Attribute1 : Value 1

Attribute2 : Value2

Attribute3 : Value3

Attribute4 : Value4

 

instead of displaying like this:

This is the product description with the assigned attributes - Attribute1 : Value 1,

Attribute2 : Value2, Attribute3 : Value3, Attribute4 : Value4

Edited by Rhapsody (see edit history)
Link to comment
Share on other sites

I'm trying to save on ink and want to lighten the black bars for Product/Reference and Tax Detail. I'd be happy just using a white background and having regular black lettering. Can some [spam-filter] tell me what fields to change if it's that easy? Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Solved: How can customer messages be displayed in the pdf invoice?

Jump to the bottom of this post for the solution - thanks to pointers from Bellini13!

 

I'm looking for the method to display messages on the pdf invoice that are displayed in the order history and the BO order display. In the front office when a customer selects order history in the "My Account" block, the messages are displayed when they click on "details" in the order history table. This lead me to look at the code in order-details.tpl that displays the data on the screen. Below is that code that I tried to paste in the invoice.tpl file, but it didn't work. Any ideas how to make the messages display in the pdf invoice?

{if count($messages)}
<h3>{l s='Messages'}</h3>
<div class="table_block">
 <table class="detail_step_by_step std">
  <thead>
<tr>
 <th class="first_item" style="width:150px;">{l s='From'}</th>
 <th class="last_item">{l s='Message'}</th>
</tr>
  </thead>
  <tbody>
  {foreach from=$messages item=message name="messageList"}
<tr class="{if $smarty.foreach.messageList.first}first_item{elseif $smarty.foreach.messageList.last}last_item{/if} {if $smarty.foreach.messageList.index % 2}alternate_item{else}item{/if}">
 <td>
  {if isset($message.elastname) && $message.elastname}
   {$message.efirstname|escape:'htmlall':'UTF-8'} {$message.elastname|escape:'htmlall':'UTF-8'}
  {elseif $message.clastname}
   {$message.cfirstname|escape:'htmlall':'UTF-8'} {$message.clastname|escape:'htmlall':'UTF-8'}
  {else}
   <b>{$shop_name|escape:'htmlall':'UTF-8'}</b>
  {/if}
  <br />
  {dateFormat date=$message.date_add full=1}
 </td>
 <td>{$message.message|escape:'htmlall':'UTF-8'|nl2br}</td>
</tr>
  {/foreach}
  </tbody>
 </table>
</div>
{/if}


The solution:

1. Override the HTMLTemplateInvoice.php using the code below to place the customer messages in Smarty. This will lookup the messages, place assign them into smarty, and then return the standard invoice getContent. The file should be placed in the override/classes/pdf directory.

<?php
/*
* Override for 1.5.4.1 HTMLTemplateInvoice.php to get order messages so they can be displayed in pdf invoice
*/

class HTMLTemplateInvoice extends HTMLTemplateInvoiceCore
{
public function getContent()
   {
	 $this->smarty->assign(array(
	 'order' => $this->order,
			    'messages' => CustomerMessage::getMessagesByOrderId((int)($this->order->id), false),
	 ));
	    return parent::getContent();
  }
}

2. Insert the following code in the theme/pdf/invoice.tpl file. The location depends where you want the comments to display. For my invoice the code was inserted just before

</table>
<!-- / PRODUCTS TAB -->

so the comments were displayed as the last item after the other sections of the invoice.

<!-- / CUSTOMER MESSAGES -->
  <tbody>
  {if $messages} <b>Order Messages</b>
  {foreach from=$messages item=message name="messageList"}
   <tr class="{if $smarty.foreach.messageList.first}first_item{elseif $smarty.foreach.messageList.last}last_item{/if} {if $smarty.foreach.messageList.index % 2}alternate_item{else}item{/if}">
  <hr><td>
  {if isset($message.elastname) && $message.elastname}
   {$message.efirstname|escape:'htmlall':'UTF-8'} {$message.elastname|escape:'htmlall':'UTF-8'}
  {elseif $message.clastname}
   {$message.cfirstname|escape:'htmlall':'UTF-8'} {$message.clastname|escape:'htmlall':'UTF-8'}
  {else}
   <b>{$shop_name|escape:'htmlall':'UTF-8'}</b>
  {/if}
  <br />
  {dateFormat date=$message.date_add full=1}
 </td>
 <td>{$message.message|escape:'htmlall':'UTF-8'|nl2br}</td>
   </tr>
  {/foreach}
  {/if}
  </tbody>
<!-- / CUSTOMER MESSAGES -->

Edited by Rhapsody (see edit history)
  • Like 6
Link to comment
Share on other sites

Is there a way to show the attributes below the product name?

Or is there a smarty available to show the attributes separate?

 

Right now in invoice.tpl it's using: {$order_detail.product_name} and the product name and attributes are all in 1 line (very ugly)

Link to comment
Share on other sites

Is there a way to show the attributes below the product name?

Or is there a smarty available to show the attributes separate?

 

Right now in invoice.tpl it's using: {$order_detail.product_name} and the product name and attributes are all in 1 line (very ugly)

 

see my post #78 in this thread with the solution.

Link to comment
Share on other sites

Hi guys,

Does anyone know how to display the time next to date in the default invoice?

 

i tried to change

{dateFormat date=$order->date_add full=0}

into

{dateFormat date=$order->date_add|date_format:"%d-%m-%Y %H:%M"}

 

in invoice.tpl but it is not working

Link to comment
Share on other sites

Hi guys,

Does anyone know how to display the time next to date in the default invoice?

 

i tried to change

{dateFormat date=$order->date_add full=0}

into

{dateFormat date=$order->date_add|date_format:"%d-%m-%Y %H:%M"}

 

in invoice.tpl but it is not working

 

Have you tried?

{dateFormat date=$order->date_add full=1}

 

with full=1

Edited by tuk66 (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

how can I change {$invoice_address} and {$delivery_address} format.

 

 

Company name (bold) or font size 18

firstname lastname (small)

address1, address2

city, country

 

actually I need this format on every document

 

 

I was Successful in doing that by Editing

Line 25 : <div style="font-size: 8pt; color: #444">

 

to <div style="font-size: 12pt; color: #444">

 

But this not only changed the font of the address but also the font of prices :(

Link to comment
Share on other sites

  • 2 weeks later...

Nice tutorial. I'm trying to apply changes given in this post by Supremacy2k, but I'm stuck at the invoice information at the top right of the page. First I would like to remove the word "Invoice" before the "#" (already translated it), to leave just the number, while adding the line "Invoice number:" to the previous <td>.

 

And another issue is right below, the payment method is not showing. In my pdf shows blank.

 

post-366130-0-40092800-1377703631_thumb.jpg

 

 

Any solution? help? idea?

 

it would be awesome and save me tons of work. Yes of course I'm not programmer, only designer.

 

Thanks!

 

--

 

I edit to add that I was testing with an old order, after testing with newer orders it is working ok. Don't know why that difference. But now is working ok. Dismiss my question

Edited by Vank (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Vank,

 

in invoice.tpl, change the code that displays the order number to the following

<tr>
<td style="width: 50%; text-align: right">Invoice Number :</td>
<td style="text-align: left">{$title|replace:'Invoice  #':'':'htmlall':'UTF-8'}</td>
</tr>

and notice that between Invoice and the # there are 2 spaces... this caused me some headaches too :/

Link to comment
Share on other sites

Im having trouble getting the customer messages to show on the invoice.

 

I have followed the instructions from Rhapsody but they still don't show.

 

If I comment out the {if $messages} and {/if} then the "Order Messages" does show on the invoice, so that code is in the right place... but no comments show.

 

Im assuming these messages are the "Special instructions" the customer can leave during checkout.

 

I have cleared smart cache, forced compile and even added the code inside of the main HTMLTemplateInvoice.php file.

 

Any help is appreciated.

 

Ray

Link to comment
Share on other sites

MerseyRay, thanks for the help, but seems is not working. 

 

I replaced the complete <tr> for the code you just posted,  and below is what I get (I'm working on pdf from the theme's folder)

 

post-366130-0-62686400-1378476515_thumb.jpg

 

 

It is very weird, but anything I try on that line is not changed, but everything else does.  :wacko:

 

 

 

About the messages from the customers, I also applied the change by Rhapsody, but no results. 

 

 

Link to comment
Share on other sites

Vank, try the following....

<tr>
<td style="width: 50%; text-align: right">Invoice Number :</td>
<td style="text-align: left">{$title|replace:'Invoice':'':'htmlall':'UTF-8'}</td>
</tr>

(just Invoice, without spaces and #)

 

See if that removes the word "Invoice".. that's where I started

 

The alignment on your image seems a bit off, maybe try pasting my whole code that im using for that table.

<table style="width: 100%">
			<tr>
			 <td style="width: 50%; text-align: right">
			  {l s='Order Date:' pdf='true'} : 
			 </td>
			 <td style="text-align: left">
			  {$order->date_add|date_format:"%d-%m-%Y %H:%M"}
			 </td>
			</tr>
			<tr>
			 <td style="width: 50%; text-align: right">			  
			  Invoice Number : 
			 </td>
			 <td style="text-align: left">
			   {$title|replace:'Invoice  #':'':'htmlall':'UTF-8'}
			 </td>
			</tr>
			<tr>
			 <td style="width: 50%; text-align: right">
			  {l s='Order Number:' pdf='true'} : 
			 </td>
			 <td style="text-align: left">
			  {$order->getUniqReference()}
			 </td>
			</tr>
		</table>
Edited by MerseyRay (see edit history)
Link to comment
Share on other sites

  •  eleazar changed the title to [Guide] Modifying Prestashop 1.5/1.6 Invoice Template.

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...