mpdas108 Posted August 25, 2015 Share Posted August 25, 2015 (edited) So after two days of searching I have created a OrderHistory.php that you can place in your overrides directory that will allow you to use all of the default order_conf variables in any email template. Just place the attached file in your PRESTASHOP_HOME/override/classes/order/ directory. If you find any bug or mistakes in the code please let me know. Also if you have your own code that adds other variables to OrderHistory.php, then please merge with this one and post in this thread, Im sure it will be useful for other people. List of variables that are added for use with this file: {lastname} {firstname} {id_order} {order_name} {delivery_block_txt} {invoice_block_txt} {delivery_block_html} {invoice_block_html} {delivery_company} {delivery_firstname} {delivery_lastname} {delivery_address1} {delivery_address2} {delivery_city} {delivery_postal_code} {delivery_country} {delivery_state} {delivery_phone} {delivery_other} {invoice_company} {invoice_vat_number} {invoice_firstname} {invoice_lastname} {invoice_address2} {invoice_address1} {invoice_city} {invoice_postal_code} {invoice_country} {invoice_state} {invoice_phone} {invoice_other} {order_name} {date} {carrier} {payment} {products} {total_paid} {total_products} {total_discounts} {total_shipping} {total_wrapping} {total_tax_paid} This is tested and working on 1.6.0.14. Any other versions you can try on your own. OrderHistory.php Edited September 15, 2015 by mpdas108 (see edit history) 9 Link to comment Share on other sites More sharing options...
clint Posted August 27, 2015 Share Posted August 27, 2015 (edited) Works a treat on 1.6.0.14, thanks. This is the final piece of the puzzle for my review system Clint **Edit** But doesn't work on 1.6.1 Edited September 22, 2015 by clint (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 28, 2015 Share Posted August 28, 2015 for what ps version you created it? Link to comment Share on other sites More sharing options...
mpdas108 Posted August 28, 2015 Author Share Posted August 28, 2015 I am using 1.6.0.14. So I know it works for that version. I don't have any other versions of Prestashop to test it on. Perhaps anyone willing to try on other versions can see if it works. Link to comment Share on other sites More sharing options...
vekia Posted August 30, 2015 Share Posted August 30, 2015 there are differencies between controllers, this is why im asking about that :-) Link to comment Share on other sites More sharing options...
Vitalij Kazakevic Posted September 15, 2015 Share Posted September 15, 2015 Hi, I would like to thank you for the work done.I noticed one error:after adding the file will not work button "Resend email" in orders. [PS 1.6.1.1] Link to comment Share on other sites More sharing options...
mpdas108 Posted September 15, 2015 Author Share Posted September 15, 2015 (edited) I don't even have a "Resend Email" button, I'm using 1.6.0.14. Maybe it is a new feature in 1.6.1.1 EDIT: I just checked the revision history: [*] BO : #PSCSX-2149 Add the possibility to re-send the order emails So this "Resend Email" is a new feature, along with many other features and bug fixes with version 1.6.1.0 and 1.6.1.1 Im not running the latest version, so if you want to check it out and see what has changed to cause this issue, you would perhaps help other people. Edited September 15, 2015 by mpdas108 (see edit history) Link to comment Share on other sites More sharing options...
tinybibiya Posted September 25, 2015 Share Posted September 25, 2015 Can I put the {invoice_block_html} variables via BO-> translation -> email template? Can work for 'in transit'? Cuz i tried cannot work. I'm using own theme. What is the method? Link to comment Share on other sites More sharing options...
mpdas108 Posted September 26, 2015 Author Share Posted September 26, 2015 Using {invoice_block_html}, works for me. Im using 1.6.0.14 Link to comment Share on other sites More sharing options...
tinybibiya Posted October 6, 2015 Share Posted October 6, 2015 Using {invoice_block_html}, works for me. Im using 1.6.0.14 It doesn't work for 'in_transit' Tried for 'preparation'.. that worked. Link to comment Share on other sites More sharing options...
clint Posted October 14, 2015 Share Posted October 14, 2015 If you change status whilst in "All Shops" then the links will send you to the default store rather than the store the item was ordered from (in the case of {products}). I've modified this to use the store rather than the context and attached the file Link to comment Share on other sites More sharing options...
ottojack Posted December 24, 2015 Share Posted December 24, 2015 Hello, i'm trying to add some variables to my emails but dosent works. If i take for exemple the valaue {date} from order_conf.html and place it into payment.html, when i try to send the email i recieve a mail with {date} into the body test of my email. Anyone can help me? i'm running PS 1.6.1.3 (last update). I've tryed with translations, with overraie and i'm going crazy... Thnaks G.F. Link to comment Share on other sites More sharing options...
Kaper Posted September 6, 2016 Share Posted September 6, 2016 Finally working solution for 1.6.1.0. Thank you so much. (The resend button was not working even with defaultOrderHistory.php ) Link to comment Share on other sites More sharing options...
destrosvet Posted December 8, 2016 Share Posted December 8, 2016 Hello, Is it possible to rewrite this for 1.6.1.7 ? - it seems that OrderHistory was updated and it doesn't work.Thank you Link to comment Share on other sites More sharing options...
iljabos Posted January 25, 2017 Share Posted January 25, 2017 Is there someone who knows how to add variables in 1.6.1.10 mails. I can't get the above solution working in changing the new OrderHistory... Link to comment Share on other sites More sharing options...
viaadequos Posted March 9, 2017 Share Posted March 9, 2017 (edited) I could work out a solution that works in 1.6.11. One thing I didn't check is if the product-attributes are correct. There could be other problems, too - but it works fine for me so far! I slightly changed my file berfore attaching (so it works with any email-template, as I use a if-clause that it works only on specific email-templates for speed reasons) - I hope I didn't make a mistake . All variables used in the 'orderconf'-template should be in there now. I hope you can use this file! Have fun! OrderHistory.php Edited March 9, 2017 by viaadequos (see edit history) Link to comment Share on other sites More sharing options...
viaadequos Posted March 9, 2017 Share Posted March 9, 2017 oops... found some bugs: The carrier name didn't work and furthermore all the single delivery/invoice-fields... I updated the file and left my if-clause in there commented out. So if you want, you just can use the if-clause in line 420 for you email-templates and bring back the 'else-block' on line 523-530. Link to comment Share on other sites More sharing options...
Manu-41 Posted March 23, 2017 Share Posted March 23, 2017 Bonjour, ne fonctionne pas sur la 1.6.1.11, quelqu'un as une mise à jour du fichier? Link to comment Share on other sites More sharing options...
Manu-41 Posted March 23, 2017 Share Posted March 23, 2017 I could work out a solution that works in 1.6.11. One thing I didn't check is if the product-attributes are correct. There could be other problems, too - but it works fine for me so far! I slightly changed my file berfore attaching (so it works with any email-template, as I use a if-clause that it works only on specific email-templates for speed reasons) - I hope I didn't make a mistake . All variables used in the 'orderconf'-template should be in there now. I hope you can use this file! Have fun! Hello, dispo pour 1.6.1.11 ? Link to comment Share on other sites More sharing options...
Manu-41 Posted March 23, 2017 Share Posted March 23, 2017 So after two days of searching I have created a OrderHistory.php that you can place in your overrides directory that will allow you to use all of the default order_conf variables in any email template. Just place the attached file in your PRESTASHOP_HOME/override/classes/order/ directory. If you find any bug or mistakes in the code please let me know. Also if you have your own code that adds other variables to OrderHistory.php, then please merge with this one and post in this thread, Im sure it will be useful for other people. List of variables that are added for use with this file: {lastname} {firstname} {id_order} {order_name} {delivery_block_txt} {invoice_block_txt} {delivery_block_html} {invoice_block_html} {delivery_company} {delivery_firstname} {delivery_lastname} {delivery_address1} {delivery_address2} {delivery_city} {delivery_postal_code} {delivery_country} {delivery_state} {delivery_phone} {delivery_other} {invoice_company} {invoice_vat_number} {invoice_firstname} {invoice_lastname} {invoice_address2} {invoice_address1} {invoice_city} {invoice_postal_code} {invoice_country} {invoice_state} {invoice_phone} {invoice_other} {order_name} {date} {carrier} {payment} {products} {total_paid} {total_products} {total_discounts} {total_shipping} {total_wrapping} {total_tax_paid} This is tested and working on 1.6.0.14. Any other versions you can try on your own. The file does not work on the 1.6.1.11, anyone have a solution? Link to comment Share on other sites More sharing options...
viaadequos Posted March 23, 2017 Share Posted March 23, 2017 I didn't start the thread. So for 1.6.11 use the file I posted on 09 March 2017 - 02:29 PMand read my two posts. This file will work in 1.6.11! Link to comment Share on other sites More sharing options...
Manu-41 Posted March 23, 2017 Share Posted March 23, 2017 I didn't start the thread. So for 1.6.11 use the file I posted on09 March 2017 - 02:29 PMand read my two posts. This file will work in 1.6.11! Well I installed the file in the ovride, but this does not work, emails are not sent Link to comment Share on other sites More sharing options...
Manu-41 Posted March 24, 2017 Share Posted March 24, 2017 I didn't start the thread. So for 1.6.11 use the file I posted on09 March 2017 - 02:29 PMand read my two posts. This file will work in 1.6.11! The send mail button (from a command) does not work. So I can not test this file. Have you updated it? Link to comment Share on other sites More sharing options...
viaadequos Posted March 24, 2017 Share Posted March 24, 2017 This is strange... it works perfectly on my installation of 1.6.11 Has anybody else here tested the file? Link to comment Share on other sites More sharing options...
Manu-41 Posted March 24, 2017 Share Posted March 24, 2017 This is strange... it works perfectly on my installation of 1.6.11 Has anybody else here tested the file? It is the button of send back(dismiss) of e-mail which does not work any more (in the commands(orders)). The file does not work with this problem. Prestashop 1.6.1.11 Link to comment Share on other sites More sharing options...
reinoplantae Posted April 12, 2017 Share Posted April 12, 2017 I just want to make the variable {date} works in bankwire.html but can't figure out how do to that. Any idea? Link to comment Share on other sites More sharing options...
franckisys Posted June 7, 2017 Share Posted June 7, 2017 Don't works with 1.7 Link to comment Share on other sites More sharing options...
hakeryk2 Posted June 8, 2017 Share Posted June 8, 2017 Can You provide an override version of this file? I assume that is only public function addWithemail is changed so we don't need to override all class. Am I right? Link to comment Share on other sites More sharing options...
anandbag Posted July 11, 2017 Share Posted July 11, 2017 Hi, This looks like a great tool for adding variables ! Can we use these variables in the Invoice PDF as well ? The variables in the PDF look different than these. I would like to add the "Tax Name" like UK VAT from the Taxes List. Also, i would like to add "Total Tax Amount" for each row in the products tab. Currently it only shows Tax Label as the Tax%. Please help. i am on PS 1.6.1.0 Thanks ! - Anand Link to comment Share on other sites More sharing options...
Ionut Ac Posted July 13, 2017 Share Posted July 13, 2017 (edited) Hy, I manage to make it to work for 1.6.1.11 and 1.6.1.15 Just download the OrderHistory.php and upload it to: /prestashop_folder/override/classes/order/ Then go to: /prestashop_folder/cache/ and delete: class_index.php After this you will be able to use all the order_conf variable ( the ones posted on the first post ) OrderHistory.php This is strange... it works perfectly on my installation of 1.6.11Has anybody else here tested the file? Yes I test it but it was not working since you have added some custom code not related to the propose.The email was send only if the status of the order was waiting bank wire and you also have commented a few more lines Edited July 13, 2017 by Ionut Ac (see edit history) 3 1 Link to comment Share on other sites More sharing options...
editorstefan Posted July 27, 2017 Share Posted July 27, 2017 Hello, I'm using Prestashop 1.6.1.13 and cant get his to work. I want to display price for shiping excl. tax. '{total_shipping_tax_excl}' => Tools::displayPrice($order->total_shipping_tax_excl, $this->context->currency, false), Is not working, any idea what i should do? Link to comment Share on other sites More sharing options...
sandrayin Posted August 26, 2017 Share Posted August 26, 2017 Greetings, I am using PS1.6.1.16 and I have developed a proper override for OrderHistory.php for this topic purpose. This override should be able you to use variables that you see in customer confirmation email (not all, see below why). This override will not work with PS1.6.0 as it is not using the sendEmail function, rather it is using addWithemail function. You can change the function name to this and try. Put this code into override/classes/order/OrderHistory.php. If you already have a file, simply copy the function "public function sendEmail" { } and paste into your existing php. <?php class OrderHistory extends OrderHistoryCore { public function sendEmail($order, $template_vars = false) { $invoice = new Address((int)$order->id_address_invoice); $delivery = new Address((int)$order->id_address_delivery); $delivery_state = $delivery->id_state ? new State((int)$delivery->id_state) : false; $invoice_state = $invoice->id_state ? new State((int)$invoice->id_state) : false; $carrier = new Carrier((int)$order->id_carrier); $data = array( '{delivery_block_txt}' => AddressFormat::generateAddress($delivery, array('avoid' => array()), "\n", ' '), '{invoice_block_txt}' => AddressFormat::generateAddress($invoice, array('avoid' => array()), "\n", ' '), '{delivery_block_html}' => AddressFormat::generateAddress($delivery, array('avoid' => array()), '<br />', ' ', array( 'firstname' => '<span style="font-weight:bold;">%s</span>', 'lastname' => '<span style="font-weight:bold;">%s</span>' )), '{invoice_block_html}' => AddressFormat::generateAddress($invoice, array('avoid' => array()), '<br />', ' ', array( 'firstname' => '<span style="font-weight:bold;">%s</span>', 'lastname' => '<span style="font-weight:bold;">%s</span>' )), '{delivery_company}' => $delivery->company, '{delivery_firstname}' => $delivery->firstname, '{delivery_lastname}' => $delivery->lastname, '{delivery_address1}' => $delivery->address1, '{delivery_address2}' => $delivery->address2, '{delivery_city}' => $delivery->city, '{delivery_postal_code}' => $delivery->postcode, '{delivery_country}' => $delivery->country, '{delivery_state}' => $delivery->id_state ? $delivery_state->name : '', '{delivery_phone}' => ($delivery->phone) ? $delivery->phone : $delivery->phone_mobile, '{delivery_other}' => $delivery->other, '{invoice_company}' => $invoice->company, '{invoice_vat_number}' => $invoice->vat_number, '{invoice_firstname}' => $invoice->firstname, '{invoice_lastname}' => $invoice->lastname, '{invoice_address2}' => $invoice->address2, '{invoice_address1}' => $invoice->address1, '{invoice_city}' => $invoice->city, '{invoice_postal_code}' => $invoice->postcode, '{invoice_country}' => $invoice->country, '{invoice_state}' => $invoice->id_state ? $invoice_state->name : '', '{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile, '{invoice_other}' => $invoice->other, '{order_name}' => $order->getUniqReference(), '{date}' => Tools::displayDate(date('Y-m-d H:i:s'), null, 1), '{carrier}' => $carrier->name, '{payment}' => Tools::substr($order->payment, 0, 32), '{shipping_number}' => $order->shipping_number, //'{products}' => $product_list_html, //'{products_txt}' => $product_list_txt, //'{discounts}' => $cart_rules_list_html, //'{discounts_txt}' => $cart_rules_list_txt, '{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false), '{total_products}' => Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $order->total_products : $order->total_products_wt, $this->context->currency, false), '{total_discounts}' => Tools::displayPrice($order->total_discounts, $this->context->currency, false), '{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false), '{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false), '{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false) ); if ($template_vars) { $data = array_merge($data, $template_vars); } return parent::sendEmail($order, $data); } } For variable {products}, {discounts} will not work because I have not figure out the proper way to grab the values, as I am not using this variable for my other email templates. Usable variables: {delivery_block_txt}{invoice_block_txt}{delivery_block_html}{invoice_block_html}{delivery_company}{delivery_firstname}{delivery_lastname}{delivery_address1}{delivery_address2}{delivery_city}{delivery_postal_code}{delivery_country}{delivery_state}{delivery_phone}{delivery_other}{invoice_company}{invoice_vat_number}{invoice_firstname}{invoice_lastname}{invoice_address2}{invoice_address1}{invoice_city}{invoice_postal_code}{invoice_country}{invoice_state}{invoice_phone}{invoice_other}{order_name}{date}{carrier}{payment}{shipping_number}{total_paid}{total_products}{total_discounts}{total_shipping}{total_wrapping}{total_tax_paid} Hello,I'm using Prestashop 1.6.1.13 and cant get his to work. I want to display price for shiping excl. tax. '{total_shipping_tax_excl}' => Tools::displayPrice($order->total_shipping_tax_excl, $this->context->currency, false),Is not working, any idea what i should do? The variable that you want to add should be working using this override code. Add it in between the lines. Make sure the last variable does not have a comma. '{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false), '{total_products}' => Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $order->total_products : $order->total_products_wt, $this->context->currency, false), '{total_discounts}' => Tools::displayPrice($order->total_discounts, $this->context->currency, false), '{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false), '{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false), '{total_shipping_tax_excl}' => Tools::displayPrice($order->total_shipping_tax_excl, $this->context->currency, false), '{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false) 1 Link to comment Share on other sites More sharing options...
sandrayin Posted August 26, 2017 Share Posted August 26, 2017 Can You provide an override version of this file? I assume that is only public function addWithemail is changed so we don't need to override all class. Am I right? Override sendEmail for PS1.6.1 Override addWithemail for PS1.6.0 See my override code above. Link to comment Share on other sites More sharing options...
William K. Posted September 19, 2017 Share Posted September 19, 2017 Hello, thank you for providing a solution for us to use order_conf variables in any email template because I realy need to implement this in my shop. Still I can't seem to make it work in my 1.6.1 version. I might be missing something but I don't see what. The actions I did : - Copying Sandrayin code into a php file named OrderHistory.php and placing it into override/classes/order. - Creating the mail template I need with the variables {date} / {carrier} / {items} / {total_discounts} / {total_shipping} / {total_taxe_paid} and many more. - Setting this email template for when the state change in the BO. Doing test orders to try the status, the mail are not taking the variables ( they are shown has in the template, ie "{total_shipping}"). Do you have any idea what I can do to troubleshot and fix this to have the intended behaviour ? Link to comment Share on other sites More sharing options...
Ionut Ac Posted September 19, 2017 Share Posted September 19, 2017 Hello, thank you for providing a solution for us to use order_conf variables in any email template because I realy need to implement this in my shop. Still I can't seem to make it work in my 1.6.1 version. I might be missing something but I don't see what. The actions I did : - Copying Sandrayin code into a php file named OrderHistory.php and placing it into override/classes/order. - Creating the mail template I need with the variables {date} / {carrier} / {items} / {total_discounts} / {total_shipping} / {total_taxe_paid} and many more. - Setting this email template for when the state change in the BO. Doing test orders to try the status, the mail are not taking the variables ( they are shown has in the template, ie "{total_shipping}"). Do you have any idea what I can do to troubleshot and fix this to have the intended behaviour ? Follow my instruction and it will work: https://www.prestashop.com/forums/topic/465115-solution-how-to-use-order-conf-variables-in-any-email-template/?p=2583804 Just download the file and follow the instructions. Link to comment Share on other sites More sharing options...
William K. Posted September 19, 2017 Share Posted September 19, 2017 I was about post to say that I did the suppression of "class_index.php" and it now works, very sorry for the bothering. Now I just need to find a way to had the product list .... Link to comment Share on other sites More sharing options...
ietax Posted September 23, 2017 Share Posted September 23, 2017 HiI would like to take our internal reference number and add it to the mailalert as a Barcode.I can insert into PDF invoice, with this code by haylau <tr> <td style="width: 17%"></td> <td style="width: 83%"> {assign var=black value=[0,0,0]}{assign var=white value=[255,255,255]} {assign var=stuff value=['position'=>'S', 'border'=>false, 'padding'=>4, 'fgcolor'=>$black, 'bgcolor'=>$white, 'text'=>false, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4]} {assign var=params value=TCPDF::serializeTCPDFtagParameters(array($order->getUniqReference(), 'C39', '', '', 40, 15, 0.4, $stuff, 'N'))} <tcpdf method="write1DBarcode" params="{$params}" /> </td> </tr> but i'd like to insert inside order confirmation mails.thanks Link to comment Share on other sites More sharing options...
Andrea Giannini Posted October 30, 2017 Share Posted October 30, 2017 Hi, I placed the file "orderhistory" in the right directory, I deleted the "classes_index" file but the variable {id_order} still not working in the order_conf!! please help me! Thanks, Andrea Link to comment Share on other sites More sharing options...
MaciejRuminski Posted December 9, 2017 Share Posted December 9, 2017 Hello, is there solution for 1.6.1.5 version? Link to comment Share on other sites More sharing options...
jcuenin Posted July 4, 2018 Share Posted July 4, 2018 Thanks, that worked great! Link to comment Share on other sites More sharing options...
thehurricane Posted October 18, 2018 Share Posted October 18, 2018 any solution for PS 1.7? Link to comment Share on other sites More sharing options...
laurentm44 Posted October 24, 2018 Share Posted October 24, 2018 I'm very interested in the version for PS 1.7 too Link to comment Share on other sites More sharing options...
Yves Posted February 6, 2019 Share Posted February 6, 2019 Me too 🤔 Link to comment Share on other sites More sharing options...
havita Posted March 1, 2019 Share Posted March 1, 2019 On 7/13/2017 at 9:45 PM, Ionut Ac said: Hy, I manage to make it to work for 1.6.1.11 and 1.6.1.15 Just download the OrderHistory.php and upload it to: /prestashop_folder/override/classes/order/ Then go to: /prestashop_folder/cache/ and delete: class_index.php After this you will be able to use all the order_conf variable ( the ones posted on the first post ) OrderHistory.php Yes I test it but it was not working since you have added some custom code not related to the propose. The email was send only if the status of the order was waiting bank wire and you also have commented a few more lines Hello, it works for me. Thanks so much. Link to comment Share on other sites More sharing options...
feinkost Posted March 7, 2019 Share Posted March 7, 2019 Is there any solution to provide the order data variables for all the email templates with Prestashop 1.7.5.1? Link to comment Share on other sites More sharing options...
cosmoll Posted March 24, 2019 Share Posted March 24, 2019 (edited) On 10/24/2018 at 1:08 PM, laurentm44 said: I'm very interested in the version for PS 1.7 too On 2/6/2019 at 4:18 AM, Yves said: Me too 🤔 On 10/18/2018 at 3:44 PM, thehurricane said: any solution for PS 1.7? On 3/7/2019 at 3:54 PM, feinkost said: Is there any solution to provide the order data variables for all the email templates with Prestashop 1.7.5.1? I found this solution - https://stackoverflow.com/questions/53057852/prestashop-1-7-4-x-missing-variables-values-when-using-order-conf-as-new-email but it not work for me (prestashop 1.7.5.1) maybe someone found a working solution....?? Edited March 24, 2019 by cosmoll (see edit history) Link to comment Share on other sites More sharing options...
pujionodk Posted May 5, 2019 Share Posted May 5, 2019 (edited) On 3/24/2019 at 2:53 PM, cosmoll said: I found this solution - https://stackoverflow.com/questions/53057852/prestashop-1-7-4-x-missing-variables-values-when-using-order-conf-as-new-email but it not work for me (prestashop 1.7.5.1) maybe someone found a working solution....?? Thank you The solution works for me. I'm using presta 1.7.5.1 but I use my own code only to get order date_add 1. I copy OrderHistory.php to /override/classes/order Then I add {TanggalJT} into $data array which get from $results fields public function sendEmail($order, $template_vars = false) { // I added query for date_add column in orders table $result = Db::getInstance()->getRow(' SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`, os.`pdf_invoice`, os.`pdf_delivery`, o.`date_add` FROM `' . _DB_PREFIX_ . 'order_history` oh LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON oh.`id_order` = o.`id_order` LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON o.`id_customer` = c.`id_customer` LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON oh.`id_order_state` = os.`id_order_state` LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = o.`id_lang`) WHERE oh.`id_order_history` = ' . (int) $this->id . ' AND os.`send_email` = 1'); if (isset($result['template']) && Validate::isEmail($result['email'])) { ShopUrl::cacheMainDomainForShop($order->id_shop); $topic = $result['osname']; $data = array( '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int) $this->id_order, '{order_name}' => $order->getUniqReference(), '{TanggalJT}' => date('d M Y H:i:s', strtotime($result['date_add']. ' + 1 days')) // this I use date_add column for query ); 2. Then I insert {tanggalJT} to bankwire.html email template, it works Edited May 5, 2019 by pujionodk (see edit history) Link to comment Share on other sites More sharing options...
taniacr Posted May 13, 2019 Share Posted May 13, 2019 Any news on a solution to 1.7.5.x ? Link to comment Share on other sites More sharing options...
DanielaPetkova Posted June 15, 2019 Share Posted June 15, 2019 (edited) Hi there, At 1.7.3.3 it is working. I'm attaching mine OrderHirstory.php file. Basically opened the original file that i had and just inserted the new functionality developed by the author. After that deleted /app/cache/dev/class_index.php and /app/cache/prod/class_index.php , deleted the cache and tested it with shipped.html with many variables like delivery address , produts , etc.... and all are working. Some bugs are possible since i haven't test it much. Right now i'm looking for a solution for order_changed.html to add those variables there. I think is generated from a different place. Thank you all for the great community that we have. D. OrderHistory.php Edited May 19, 2020 by DanielaPetkova (see edit history) 2 1 Link to comment Share on other sites More sharing options...
coalman Posted May 5, 2020 Share Posted May 5, 2020 Does anybody know the solution for 1.7.6.0? All solutions described here don't work... I am trzing to add a "variable" customer message {message} into order_conf email template. Thank you 1 Link to comment Share on other sites More sharing options...
rachel01 Posted September 15, 2020 Share Posted September 15, 2020 Do you found a solution for 1.7.6 ? Link to comment Share on other sites More sharing options...
way1 Posted February 25, 2021 Share Posted February 25, 2021 What about 1.7.7.2 version? Any solution? Also it seems that missing {message} variable for a customer message. Link to comment Share on other sites More sharing options...
thisisfine Posted March 18, 2021 Share Posted March 18, 2021 On 7/13/2017 at 9:45 PM, Ionut Ac said: Hy, I manage to make it to work for 1.6.1.11 and 1.6.1.15 Just download the OrderHistory.php and upload it to: /prestashop_folder/override/classes/order/ Then go to: /prestashop_folder/cache/ and delete: class_index.php After this you will be able to use all the order_conf variable ( the ones posted on the first post ) OrderHistory.php Yes I test it but it was not working since you have added some custom code not related to the propose. The email was send only if the status of the order was waiting bank wire and you also have commented a few more lines It works very well on PS 1.6.1.4 Thank you! Link to comment Share on other sites More sharing options...
PouletMiel Posted March 18, 2021 Share Posted March 18, 2021 Hello, did someone find a solution for 1.7.6 version ? 1 Link to comment Share on other sites More sharing options...
markinhos3 Posted June 29, 2021 Share Posted June 29, 2021 (edited) On 6/15/2019 at 1:29 PM, DanielaPetkova said: Hi there, At 1.7.3.3 it is working. I'm attaching mine OrderHirstory.php file. Basically opened the original file that i had and just inserted the new functionality developed by the author. After that deleted /app/cache/dev/class_index.php and /app/cache/prod/class_index.php , deleted the cache and tested it with shipped.html with many variables like delivery address , produts , etc.... and all are working. Some bugs are possible since i haven't test it much. Right now i'm looking for a solution for order_changed.html to add those variables there. I think is generated from a different place. Thank you all for the great community that we have. D. OrderHistory.php 35.65 kB · 87 downloads Today (June 2021) it works for me on PS 1.7.7.1 thanks to your file and my modifications. I managed to perfectly display all variables in all email templates. If anyone needs help, please reply to this comment. @DanielaPetkova thank you very much for your file, was fundamental!! ☺️ Edited June 29, 2021 by markinhos3 (see edit history) Link to comment Share on other sites More sharing options...
way1 Posted June 29, 2021 Share Posted June 29, 2021 (edited) 8 hours ago, markinhos3 said: Today (June 2021) it works for me on PS 1.7.7.1 thanks to your file and my modifications. I managed to perfectly display all variables in all email templates. If anyone needs help, please reply to this comment. @DanielaPetkova thank you very much for your file, was fundamental!! ☺️ Could you briefly step-by-step write here what namely was made and changed for 1.7.7.1 by you? Maybe attach also readymade files? Thank you! Edited June 29, 2021 by way1 (see edit history) Link to comment Share on other sites More sharing options...
Facundo13 Posted July 7, 2021 Share Posted July 7, 2021 On 6/29/2021 at 4:48 PM, way1 said: Could you briefly step-by-step write here what namely was made and changed for 1.7.7.1 by you? Maybe attach also readymade files? Thank you! Hello way1, I have version 1.7.7.4, what I did was: 1 - Create an override of the OrderHistory.php file in override / classes / order 2 - Then in the sendEmail function, add the variable, both in the SQL query and in the $data array. I show you an example of what I did to be able to show the customer ID in the mail. (added variable $ id_customer) public function sendEmail($order, $template_vars = false) { $result = Db::getInstance()->getRow(' SELECT osl.`template`, c.`lastname`, c.`firstname`, c.`id_customer`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`, os.`pdf_invoice`, os.`pdf_delivery` FROM `' . _DB_PREFIX_ . 'order_history` oh LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON oh.`id_order` = o.`id_order` LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON o.`id_customer` = c.`id_customer` LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON oh.`id_order_state` = os.`id_order_state` LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = o.`id_lang`) WHERE oh.`id_order_history` = ' . (int) $this->id . ' AND os.`send_email` = 1'); if (isset($result['template']) && Validate::isEmail($result['email'])) { ShopUrl::cacheMainDomainForShop($order->id_shop); $topic = $result['osname']; $carrierUrl = ''; if (Validate::isLoadedObject($carrier = new Carrier((int) $order->id_carrier, $order->id_lang))) { $carrierUrl = $carrier->url; } $data = [ '{id_customer}' => $result['id_customer'], '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int) $this->id_order, '{order_name}' => $order->getUniqReference(), '{followup}' => str_replace('@', $order->getWsShippingNumber(), $carrierUrl), '{shipping_number}' => $order->getWsShippingNumber(), ]; 2 Link to comment Share on other sites More sharing options...
Borgas Posted November 16, 2022 Share Posted November 16, 2022 (edited) Hello Any solution for 1.7.8? On 7/7/2021 at 5:52 PM, Facundo13 said: Hello way1, I have version 1.7.7.4, what I did was: 1 - Create an override of the OrderHistory.php file in override / classes / order 2 - Then in the sendEmail function, add the variable, both in the SQL query and in the $data array. I show you an example of what I did to be able to show the customer ID in the mail. (added variable $ id_customer) public function sendEmail($order, $template_vars = false) { $result = Db::getInstance()->getRow(' SELECT osl.`template`, c.`lastname`, c.`firstname`, c.`id_customer`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`, os.`pdf_invoice`, os.`pdf_delivery` FROM `' . _DB_PREFIX_ . 'order_history` oh LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON oh.`id_order` = o.`id_order` LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON o.`id_customer` = c.`id_customer` LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON oh.`id_order_state` = os.`id_order_state` LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = o.`id_lang`) WHERE oh.`id_order_history` = ' . (int) $this->id . ' AND os.`send_email` = 1'); if (isset($result['template']) && Validate::isEmail($result['email'])) { ShopUrl::cacheMainDomainForShop($order->id_shop); $topic = $result['osname']; $carrierUrl = ''; if (Validate::isLoadedObject($carrier = new Carrier((int) $order->id_carrier, $order->id_lang))) { $carrierUrl = $carrier->url; } $data = [ '{id_customer}' => $result['id_customer'], '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int) $this->id_order, '{order_name}' => $order->getUniqReference(), '{followup}' => str_replace('@', $order->getWsShippingNumber(), $carrierUrl), '{shipping_number}' => $order->getWsShippingNumber(), ]; Hello Already create the Orderhistory.php overide Can you point where is the sendemail function? I would like to send email with products that customer bought with a link I have {products} in modern theme, but is not showing nothing PS 1.7.8 Edited November 16, 2022 by Borgas (see edit history) Link to comment Share on other sites More sharing options...
pShark Posted November 22, 2022 Share Posted November 22, 2022 (edited) Hello, any solution for version 1.7.8? Thanks! I have the same problem with {products}, not showing the products. Edited November 22, 2022 by pShark (see edit history) Link to comment Share on other sites More sharing options...
pShark Posted November 22, 2022 Share Posted November 22, 2022 On 11/16/2022 at 2:42 PM, Borgas said: Hello Any solution for 1.7.8? Hello Already create the Orderhistory.php overide Can you point where is the sendemail function? I would like to send email with products that customer bought with a link I have {products} in modern theme, but is not showing nothing PS 1.7.8 Hi, I have managed to solve it for ps 1.7.8, I do not know if it will work for all cases, at least in mine if (I use the warehouse template). In my template the files were missing: order_conf_product_list.tpl and order_conf_product_list.txt, they were in the ps folder /mails/_partials and I copied them to /themes/warehouse/mails/es/ and it worked. I hope this solution works for someone, at least it worked perfectly for me. Link to comment Share on other sites More sharing options...
Borgas Posted November 22, 2022 Share Posted November 22, 2022 19 minutes ago, pShark said: Hi, I have managed to solve it for ps 1.7.8, I do not know if it will work for all cases, at least in mine if (I use the warehouse template). In my template the files were missing: order_conf_product_list.tpl and order_conf_product_list.txt, they were in the ps folder /mails/_partials and I copied them to /themes/warehouse/mails/es/ and it worked. I hope this solution works for someone, at least it worked perfectly for me. Works like a charm Just copy mails/_partials to YOURTHEME/MAILS/LANGUAGES Edit as you wich Link to comment Share on other sites More sharing options...
***didi*** Posted July 7, 2023 Share Posted July 7, 2023 Am 22.11.2022 um 1:35 PM schrieb pShark: Hi, I have managed to solve it for ps 1.7.8, I do not know if it will work for all cases, at least in mine if (I use the warehouse template). In my template the files were missing: order_conf_product_list.tpl and order_conf_product_list.txt, they were in the ps folder /mails/_partials and I copied them to /themes/warehouse/mails/es/ and it worked. I hope this solution works for someone, at least it worked perfectly for me. Hi! It works for 1.7.6.9 too. Thanks 🙂 But the files are in /mails/en folder in my case 😉 Link to comment Share on other sites More sharing options...
reinoplantae Posted Friday at 04:23 PM Share Posted Friday at 04:23 PM Not working in PS 8.1.5 for "in_transit" email. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now