Jump to content

Send "in_transit" email after setting "shipping_number" via Webservice/API


Daaaaad

Recommended Posts

Hello,

 

My Prestashop website is synchronized with a custom ERP that sets the shipping_number via the Webservice/API when the package is shipped.

 

I would like the "in_transit" e-mail to be sent after the shipping_number is set (as done when you set the shipping_number via the Prestashop admin).

 

Any idea ?

 

Thank you  :)

Link to comment
Share on other sites

  • 2 months later...

Hi,

Sorry for bumping an old post, but I'm posting here to help others which might run into the same issue, and possibly if the original poster still needs a solution.

I ran into the same trouble today, and it seems like prestashop 1.7.1 has the functionality for this https://github.com/PrestaShop/PrestaShop/commit/53991dcdd94e761e9714d51eaa193ceb6a9d8497
What I did was backport the changes to OrderCarrier.php from that commit to work with Prestashop 1.6.X, and edit the PSWebServiceLibrary to support the "sendemail" parameter added.

Here are my versions of those two files, and a file (changeTrackingNumber.php) which acts as an example for how to use the new update.
NOTE: If you're running PrestaShop 1.7.1 you shouldn't need the OrderCarrier.php file.
https://gist.github.com/Rynoxx/34655702277b24eba16d7cb4e0271614
 

Link to comment
Share on other sites

  • 4 months later...

Hi @Rynoxx! I tried your solution but it is not work for me because I am using REST API not webservice and I am updating order shipping adres via XML through AJAX. Do you know how to trigger this email with maybe plain ajax or where I should look which function I should trigger or how to send email when updating via XML Ajax query?

Link to comment
Share on other sites

Hi @Rynoxx! I tried your solution but it is not work for me because I am using REST API not webservice and I am updating order shipping adres via XML through AJAX. Do you know how to trigger this email with maybe plain ajax or where I should look which function I should trigger or how to send email when updating via XML Ajax query?

 

Hi, @hakeryk2 using the OrderCarrier.php class I posted before and simply using the REST API to edit an OrderCarrier as usual should work, if you make sure that the query parameter sendemail is set to 1

Link to comment
Share on other sites

I was editing only Orders (and shipping_number which is depracated) by Rest API - not order_carriers so maybe that is the problem. This is kinda weird because updating only orders is also affecting order_carriers.

I will try and I'll give an edit to this message someday.

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