Jump to content

Editing 'Shipped' Email to include 'Order Details'


Recommended Posts

Hi

 

I'm trying to edit the 'Shipped' Email to show similar information to the 'Order Details' email. e.g. reference/product/unit price/Quantity/Total Price/etc.

 

(This is so if we need to edit an order to remove items which have become out of stock since the order has been placed the customer will receive their final shipped email showing the actual products shipped)

 

 

I've tried copying over the html from the order_conf email in localization>translations which displays correctly but the {tags} don't display the data (see attached screengrab)

 

Strangely the {total_paid} does work, not the others

Can anyone shed any light on this?

 

Cheers

C

post-1292801-0-56984100-1488540729_thumb.png

Link to comment
Share on other sites

You can't just copy variables from the order confirmation to other templates, since that template uses variables that aren't available in the other templates. It is the OrderHistory::sendEmail function that is used when sending the "Shipping" email. It only has {lastname}, {firstname}, {id_order}, {order_name} and {total_paid} available to it. You'd have to override the function to add all the order confirmation variables, then they'll be available in all templates. Unfortunately, that requires copying a lot of code from the PaymentModule::validateOrder function.

Link to comment
Share on other sites

Thanks for that.

 

- Could you give me more of a pointer on which files over ftp to copy the code from and to?

 

- The other way to fo it would be to edit the order and then to resend the initial Order Confirmation/Order Details email. The only way I can see to do this is a module. e.g. https://addons.prestashop.com/en/emails-notifications/26238-resend-order-confirmation-email.html

Cheers

C

Link to comment
Share on other sites

Look for the following at about line 451 of classes/PaymentModule.php:
                    // Construct order detail table for the email

Copy all the code from there to just above line 626:

                    // Specify order id for message

and also the code starting from line 695:

                    // Order is reloaded because the status just changed

down to just above line 761:

                        // Join PDF invoice

You can also copy the code below that if you want the PDF invoice attached to the email too.

Link to comment
Share on other sites

You should replace the following code on line 424 of classes/OrderHistory.php:

            $data = array(
                '{lastname}' => $result['lastname'],
                '{firstname}' => $result['firstname'],
                '{id_order}' => (int)$this->id_order,
                '{order_name}' => $order->getUniqReference()
            );

Oh, you'll also need to copy _getTxtFormatedAddress and _getFormatedAddress functions on line 845 of classes/PaymentModule.php.

 

Hopefully, that's enough. You'll need to try it to see if there's errors that need to be fixed.

Link to comment
Share on other sites

  • 3 weeks later...

After trying the above:

 

The order is placed and the retailer receives the confirmation email but the website then stalls for the customer with a blank page at ...../module/invoicepayment/validation and no further emails are sent.

 

C

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