Jump to content

PDF Invoice Customization 1.5.4.1


neetupahwa

Recommended Posts

I am trying to add Order number & Order Date under the Invoice number in header.tpl file.

 

How can I access the order number and order date variable?

 

I copied the order number and order date code from invoice.tpl, but its not working. 

 

Please help.

 

Here is the code in header.tpl:

        <tr>
            	<td style="font-size: 14pt; color: #9E9F9E"> {$order->getUniqReference()}</td>
			</tr>
Link to comment
Share on other sites

Thanks eleazar for helping me, but it is still not working. :(

 

When I add {$order->getUniqReference()} to the header.php, the invoice does not open up in pdf, instead it displays only invoice date and invoice number in new browser window and everything is blank under that. When I tried running it only with the {$order->date_add|date_format:"%Y-%m-%d %H:%M"}, it opens up pdf, but does not displays order number; other invoice information (billing address, invoice items etc) are visible.

 

 

Here is the code (header.tpl):

<table style="width: 100%">
<tr>
	<td style="width: 50%">
		{if $logo_path}
      
			<img src="#" width="150px" />
          
		{/if}
	</td>
	<td style="width: 50%; text-align: right;">
		<table style="width: 100%">
        
		
            
			<tr>
				<td style="font-size: 14pt; color: #9E9F9E;">Date: {$date|escape:'htmlall':'UTF-8'}</td>
			</tr>
			<tr>
				<td style="font-size: 14pt; color: #9E9F9E">{$title|escape:'htmlall':'UTF-8'}</td>
			</tr>
           
			<tr>
				<td style="font-weight: bold; font-size: 14pt; color: #444; width: 100%">Order Number: {$order->getUniqReference()}</td>
			</tr>
			
			<tr>
				<td style="font-weight: bold; font-size: 14pt; color: #444; width: 100%">Order Date: {$order->date_add|date_format:"%Y-%m-%d %H:%M"}</td>
			</tr>
           
		</table>
	</td>
</tr>
</table>

Following is the output of the above code, which is displayed in browser window not pdf; it doesn't displays other invoice information as well. Please help.

Date: 28-09-2013 
Invoice #000003 
Order Number:
Edited by neetupahwa (see edit history)
Link to comment
Share on other sites

There are DEFAULT_FONT and $font_by_lang settings in the /classes/pdf/PDFGenerator.php file.

 

Try to use centurygothic there.

 

Changed the font in PDFGenerator.php, but it displays error.

const DEFAULT_FONT = 'centurygothic';

Error: TCPDF ERROR: Could not include font definition file: centurygothic

 

Do I need to add the font somewhere before using it?

Link to comment
Share on other sites

From the /tools/tcpdf/tcpdf.php file:

 

* It is necessary to generate a font definition file first (read /fonts/utils/README.TXT).
* The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by K_PATH_FONTS if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.

Link to comment
Share on other sites

Hi tuk66  :)

 

Could you please explain a little bit easier and a a bit more detailed? I don't have utils directory, so i can't read readme.txt file. I just don't understand what to do to be honest   :(

 

I'm using PS 1.5.4.1 and i'd like to add a custom font too.

 

How do i generate it? Through the backoffice? Where exactly should i put my custom font files?

 

Regards,

Housy

 

From the /tools/tcpdf/tcpdf.php file:

 

* It is necessary to generate a font definition file first (read /fonts/utils/README.TXT).
* The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by K_PATH_FONTS if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.

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

These two sentences are from the tcpdf.php file. The README.TXT file is probably only in full TCPDF package, not included in the /tools/tcpdf folder in PrestaShop.

 

It was just hints. TCPDF is not in my scope. In general, you should have a definition and fonts. Some other hints should be in this forum or on the web.

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