Jump to content

Invoice sending


Recommended Posts

not quite sure whether I missed something but isn't this how it works out of the box? that a customer gets an email and no invoice sent attached? just wondering because I would love to send the invoice right away instead of having my customers download it themselves....

Link to comment
Share on other sites

  • 3 months later...

When something gets orderd it automatically sends order confirmations with pdf Invoice to the costumer

Not for every payment module. PDF invoice is not attached for Bankwire payment and even attached after changing the status to "Payment accepted".

Link to comment
Share on other sites

I haven't reached this part of the cart to customise yet - or tried anything with a test customer -- and as I've not used PS before, is an order able to be changed (eg to change shipping cost, or even remove shipping cost) before an invoice is sent -- like an amended invoice ?? sorry if I should know this :)

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

  • 1 month later...
  • 2 months later...

Hello,

 

I've solved this issue on Prestashop 1.4.9 You have to add the following on /classes/Mail.php on the function Send() just before the line with the comment: /* Send mail */ (in my file line 201):

 

if (strpos($template, 'payment')){
   $id_factura = $templateVars['{id_order}'];
   $orden = new Order($id_factura);
   $factura['content'] = PDF::invoice($orden, 'S');
   $factura['name'] = $id_factura.'.pdf';
   $factura['mime'] = 'application/pdf';
   $message->attach(new Swift_Message_Attachment($factura['content'], $factura['name'], $factura['mime']));
  }

 

This code attaches the invoice to 'Payment accepted' emails. If you want to attach the invoice to other emails just find the name of the template's mail and add it to the condition on the if statement. For example, if you want to attach the invoice too on the Shipped emails your code should look like this:

 

if (strpos($template, 'payment' || strpos($template, 'shipped')){
   $id_factura = $templateVars['{id_order}'];
   $orden = new Order($id_factura);
   $factura['content'] = PDF::invoice($orden, 'S');
   $factura['name'] = $id_factura.'.pdf';
   $factura['mime'] = 'application/pdf';
   $message->attach(new Swift_Message_Attachment($factura['content'], $factura['name'], $factura['mime']));
  }

 

I hope this help somebody, I googled around but I've found a lot of questions about this but no answer.

 

Ivan.

Link to comment
Share on other sites

  • 2 weeks later...

I have tried the above code on 1.5.4 but to no avail. :( I did notice that it uses $template_vars now instead of $templateVars though. Changed it but still no dice. Is there perhaps an update on this available somewhere? Some help would be greatly appreciated!

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