Jump to content

[CONTRIBUTION] Add customer ID and "Additional information" to PDF invoice


rocky
 Share

Recommended Posts

Hi,

This seems like a great contribution rocky!

I've been looking for something that would add the additional information field to order invoices... so that is great! And I guess the customer ID would just be a bonus.

Have you tested this on 1.4.2.5? Or are there any specific reasons why it would work on another 1.4.x version? I wouldn't imagine so, but it seems like you were very specific with the name of the file. I will try and test on our site soon and will report back if your not sure, but if you've already tested it on a older 1.4 version that would save some time.

In anycase... THANKS!

Share this post


Link to post
Share on other sites

This override is specifically for PrestaShop v1.4.3. It relies on the new address formats. I think they were added in PrestaShop v1.4.2, so it might work, assuming no code was added in v1.4.3 that would break in v1.4.2. It probably won't work in PrestaShop v1.4.1 or earlier.

Share this post


Link to post
Share on other sites

So from initial tests it seems like it works on PS v1.4.2.5 but it does NOT work on PS v1.4.1.

As you've said, it probably is due to the address format change that was added in 1.4.2.5.

I also compared the original PDF.php files from v1.4.2.5 and v1.4.3 and there are some minor differences but I don't think there were any major changes that would cause this override not to work in v1.4.2.5.

Anyways, I will keep it on and test further.

Rocky, got a quick question, let's say if there is a compatibility issue from this override, it would only affect our PDF's (invoices, delivery, and credit slips), right? Like it wouldn't cause any problems in other parts of the BO or FO, right?

When I tested it on PS v1.4.1 it seemed like everything else was working fine, except when I went to generate a PDF it just went to a blank page... however, on PS v1.4.2.5 it works and the 2 additional fields are visible. It seems to only override the /classes/PDF.php file so I just want to make sure it won't affect other classes or core files.

Thanks!! Great add by the way!

Share this post


Link to post
Share on other sites

Rocky,

I found this thread after I created a new thread that asks a similar question at this link: http://www.prestashop.com/forums/viewthread/118309/integration/modify_pdf_dot_php_to_customize_invoice_for_a_special_ordered_item

I believe I can modify what you posted above. Do you know how I can include the logic to generate the 2nd PDF page if a product is ordered with product_id = 2 or product_id = 4?

Thanks

Share this post


Link to post
Share on other sites

  • 2 months later...

in version 1.4.4.1 how can i add fields to the generated PDF invoice? is it in the PDF.php file? if so what should i add? any other files I would need to edit so that it is generated in the invoice please let me know thank!

Share this post


Link to post
Share on other sites

in version 1.4.4.1 how can i add fields to the generated PDF invoice? is it in the PDF.php file? if so what should i add? any other files I would need to edit so that it is generated in the invoice please let me know thank!

 

Yes, classes/PDF.php

The code to add depends what you want to add of course.

Share this post


Link to post
Share on other sites

  • 1 month later...

Hi rocky,

 

I hope you don't mind, but I slightly modified your contribution. I pretty much kept everything the same except I added the Customer ID to the delivery slip also. So this part is in line with your original code that was meant for v1.4.3.

 

Everytime I upgrade (like we recently did) I have to modify my PDF.php file so that the manufacturer name is shown before each product on both the invoice and delivery slips. So in hopes of not having to modify several lines of code, and thanks to this override I directly added my modified code from PS 1.4.5.1 that adds the manufacturers name.

 

I have attached my modified file here. The initial code was based on 1.4.3 and my manufacturer modification were based on 1.4.5.1; however, at the time of this posting I have not found any errors or conflict issues. It works.

 

HTH!

PDF.php

Share this post


Link to post
Share on other sites

  • 1 month later...

You should be able to test with the test order that is already present or any previous order for that matter. When you click the view invoice or delivery slip option it re-generates the slips so that means that you do not have to create a new order for each modification you make to the PDF.php class.

 

HTH!

  • Like 1

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Thanks for this contribution.

 

would be possible to add customer id to registration confirmation email?

 

in another post of yours Rocky, says it is a problem passing the variable id_customer. I can not make it work in 1.4. Can you help me?

 

I need see de ID_Customer in mail confirmation of registration.

 

 

Thanks.

Share this post


Link to post
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 1 month later...
  • 1 year later...
  • 3 months later...
  • 1 year later...

 

The Legal free text is already displayed in the invoice model (non-b2b). Add this code to the B2B model:

{$legal_free_text|escape:'html':'UTF-8'|nl2br}

 

 

hello,

 

add line in pdf/invoce.tpl and no work.

{*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2015 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

{$style_tab}
{$legal_free_text|escape:'html':'UTF-8'|nl2br}

<table width="100%" id="body" border="0" cellpadding="0" cellspacing="0" style="margin:0;">
	<!-- Invoicing -->
	<tr>
		<td colspan="12">

			{$addresses_tab}
						
					

		</td>
	</tr>

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More