Jump to content
xiverisx

[Solved] Generate PDF invoices - bank wire payment

Recommended Posts

Hi everyone, all day i searched everywhere but couldn't to solve my problem.

I am using Prestashop 1.4.3 with bank wire payment.

Problem: In Default prestashop PDF invoices are generated only then page admin, changes order status to: payment accepted. When customer or admin can download that PDF file with such link:
http://example.com/pdf-invoice.php?id_order=7

I need to configure Prestashop so: When the order is confirmed generate PDF invoice and attach it to email sent to customer automaticaly.

So the question is what files and how i should edit and change, that customer could see his PDF invoice without page admin changing status to: Payment Accepted.

At default prestashop visiting page:
http://example.com/pdf-invoice.php?id_order=7
Gives you error: Invoice not found

Share this post


Link to post
Share on other sites

Hello

You say "Solved" but do not say how you solved it.

I'm facing a similar problem : I want my bank wire descriptions to show the invoice number, not the order number, and found out after a full afternoon of code exploring that the invoice number is not available because there is no invoice yet !

I want the invoice to be generated for a bankwire. How do one achieves this ?

Thanks

Share this post


Link to post
Share on other sites

Yes, by default prestashop generates PDF only when page admin changes order status to: payment accepted when in the customer orders list appears link to generated PDF. (By the way i was using prestashop 1.4.3.)

So steps which i made that shop customer will see PDF invoice in his order list page was:

1) open history.tpl and find:

                {if (isset($order.invoice) && $order.invoice && isset($order.invoice_number) && $order.invoice_number) && isset($invoiceAllowed) && $invoiceAllowed == true}
getPageLink('pdf-invoice.php', true)}?id_order={$order.id_order|intval}" title="{l s='Invoice'}">
getPageLink('pdf-invoice.php', true)}?id_order={$order.id_order|intval}" title="{l s='Invoice'}">{l s='PDF'}
               {else}-{/if}



when change it to:


getPageLink('pdf-invoice.php', true)}?id_order={$order.id_order|intval}" title="{l s='Invoice'}">
getPageLink('pdf-invoice.php', true)}?id_order={$order.id_order|intval}" title="{l s='Invoice'}">{l s='PDF'}



2) open class file OrderState.php

   static public function invoiceAvailable($id_order_state)
   {
       $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
       SELECT `invoice` AS ok
       FROM `'._DB_PREFIX_.'order_state`
       WHERE `id_order_state` = '.(int)($id_order_state));
               return $result['ok'];
   }



and change to:

   static public function invoiceAvailable($id_order_state)
   {
       $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
       SELECT `invoice` AS ok
       FROM `'._DB_PREFIX_.'order_state`
       WHERE `id_order_state` = '.(int)($id_order_state));
       return true;
   }

Share this post


Link to post
Share on other sites

Thank you !

Actually, I realized later on that the fact that the PDF was generated or not was irrelevant to my problem. The invoice exists already, even though its pdf is not created.

My problem was that I wanted to display the invoice number in the bankwire mail.

The only thing I had to do, to be able to use a {invoice_number} tag in the mail template, was to add this line

$data['{invoice_number}'] = $order->invoice_number;

juste after the
$order = new Order((int)($this->id_order));
line

to the addWithemail function in classes/OrderHistory.php

This simple piece of code took me several hours to dig out :)

Share this post


Link to post
Share on other sites

Is it possible to do this on PS 1.6 ? Generate the PDF invoice when bank wire is chosed and NOT when paiment is accepted ?

Thanks.

Share this post


Link to post
Share on other sites

Is it possible to do this on PS 1.6 ? Generate the PDF invoice when bank wire is chosed and NOT when paiment is accepted ?

Thanks.

Sure, in Prestashop 1.5 and 1.6 it's just a matter of how you configure the order statuses in BO. Go for instance to

Orders --> Status --> Processing in progress

Check both options

 

- Allow a customer a customer to view pdf versions of his/her invoices.

- Hide this status in all customer orders.(optional)

 

From this moment on the button is active directly after you received an order and you can generate the invoice, whatever payment mehod your customer chose.

 

As far as I know in Prestashop 1.4 btw you can also do it the same way, without any code changes.

Share this post


Link to post
Share on other sites

Hi, mate,[/size]
1. I see an error in the invoice from payments with Bank Transfer.. in this invoice the bank fields are empty while it should be completed..[/size]

2. In the invoice with cash on delivery paymants is presente the bank fields.. is possible to delete only in this invoice cash on delivery paymants?[/size]


thank you very much[/size]
 
32470925411_0899a3d48a_b.jpg[/size]

Edited by attila729 (see edit history)

Share this post


Link to post
Share on other sites

1. I see an error in the invoice from payments with Bank Transfer.. in this invoice the bank fields are empty while it should be completed..[/size]

Hi,

 

I came across a similar issue. Apparently this has something to doe with old code for PrestaShop 1.4 in a PayPal module.

 

You can get rid of the Bank account table at the bottom of your invoice by commenting out some code. Please check this post:

https://www.prestashop.com/forums/topic/560290-upgrade-1617-problem-with-invoice-pdf-template/

 

I assume you can also change the code in a way that you can actually use the table.

Share this post


Link to post
Share on other sites

Hi,

 

I came across a similar issue. Apparently this has something to doe with old code for PrestaShop 1.4 in a PayPal module.

 

You can get rid of the Bank account table at the bottom of your invoice by commenting out some code. Please check this post:

https://www.prestashop.com/forums/topic/560290-upgrade-1617-problem-with-invoice-pdf-template/

 

I assume you can also change the code in a way that you can actually use the table.

Hi mate, i see that topic but i want this data bank field with data bank complete exemple:

 

Banca: HSBC

Titolare : Company

IBAN: UK......xxxxxxxxxxxx

 

etc....

 

what i to do it?

 

thx

Share this post


Link to post
Share on other sites

Hi mates,

first of all the best solution to remove that box is to unHook the Module.

  • Go to Modules and Services > Positions
  • Search for displayPDFInvoice hook and remove the PayPal Module

If you want, instead to change that box content, i suggest you to override your invoice template and put static info inside.

Otherwise I think I will develop a simple module that grabs information from Bank Wire module and put them automatically in the invoice.

It will be ready in a week.

 

Cheers.

Manfredi

Share this post


Link to post
Share on other sites

Hi mates,

first of all the best solution to remove that box is to unHook the Module.

  • Go to Modules and Services > Positions
  • Search for displayPDFInvoice hook and remove the PayPal Module

If you want, instead to change that box content, i suggest you to override your invoice template and put static info inside.

Otherwise I think I will develop a simple module that grabs information from Bank Wire module and put them automatically in the invoice.

It will be ready in a week.

 

Cheers.

Manfredi

Im using the Invoice payment module for my B2B customers and need my bank details on invoices and this would solve my problem, have you made this module? and is it available?

Share this post


Link to post
Share on other sites

Here we go,

you may download the module here:

 

It prints bank information on the invoices, when BankWire module is installed and configured.

 

Enjoy and ...share it!

 

Manfredi

  • Like 1

Share this post


Link to post
Share on other sites

Here we go,

you may download the module here:

 

It prints bank information on the invoices, when BankWire module is installed and configured.

 

Enjoy and ...share it!

 

Manfredi

Works great thank you, it solved mye problem:)

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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