it's me Posted May 12, 2016 Share Posted May 12, 2016 Hi, I have prestashop 1.6 and i need to add some aditional(customer address) variable to bankwire email template. This is a section of root/modules/bankwire/validation.php that i'm trying to modify I have added some code that, currently is not working. $customer = new Customer($cart->id_customer); if (!Validate::isLoadedObject($customer)) Tools::redirect('index.php?controller=order&step=1'); $order = new Order((int)$order->id); $delivery = new Address((int)$order->id_address_delivery); $currency = $this->context->currency; $total = (float)$cart->getOrderTotal(true, Cart::BOTH); $mailVars = array( '{bankwire_delivery_address1}' => $customer->address1, '{bankwire_delivery_address2}' => $delivery->address2, '{bankwire_delivery_postal_code}' => $delivery->postcode, '{bankwire_delivery_city}' => $delivery->city, '{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'), '{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')), '{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS')) ); Variables like {bankwire_delivery_address1} currently are not showing anything. I would appreciate any help. Link to comment Share on other sites More sharing options...
erouvier29 Posted May 13, 2016 Share Posted May 13, 2016 It seems you didn't edit the right file. In /modules/bankwire/controllers/front/validation.php, change from line 56 (module version 1.1.1): $currency = $this->context->currency; $total = (float)$cart->getOrderTotal(true, Cart::BOTH); $mailVars = array( '{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'), '{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')), '{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS')) ); by $currency = $this->context->currency; $total = (float)$cart->getOrderTotal(true, Cart::BOTH); $delivery = new Address((int)$cart->id_address_delivery); $mailVars = array( '{bankwire_delivery_address1}' => $delivery->address1, // etc... '{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'), '{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')), '{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS')) ); and it should work. Link to comment Share on other sites More sharing options...
it's me Posted May 13, 2016 Author Share Posted May 13, 2016 Thanx erouvier29, your example worked. Can you please correct the code down bellow, currently all of the variables bankwire_invoice_ and vairable bankwire_order_id, does not create output. $currency = $this->context->currency; $total = (float)$cart->getOrderTotal(true, Cart::BOTH); $invoice = new Address((int)$order->id_address_invoice); $mailVars = array( '{bankwire_invoice_firstname}' => $invoice->firstname, '{bankwire_invoice_lastname}' => $invoice->lastname, '{bankwire_invoice_address2}' => $invoice->address2, '{bankwire_invoice_address1}' => $invoice->address1, '{bankwire_invoice_city}' => $invoice->city, '{bankwire_invoice_postal_code}' => $invoice->postcode, '{bankwire_order_id}' => $order->id, '{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'), '{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')), '{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS')) ); Link to comment Share on other sites More sharing options...
erouvier29 Posted May 14, 2016 Share Posted May 14, 2016 At the moment your code is executed, the order doesn't exist yet. Then, to get invoice address details, use $invoice = new Address((int)$cart->id_address_invoice); About order identifier, use {id_order} in your template as it is set by the core before sending this email. Cf. /classes/order/OrderHistory.php, method sendEmail (from line 410 if PS 1.6.1.5). If you need additional information from the order that just have been placed, you can extend/override this method. Link to comment Share on other sites More sharing options...
it's me Posted May 14, 2016 Author Share Posted May 14, 2016 erouvier29 thank you, now it works. Link to comment Share on other sites More sharing options...
nisfize Posted May 18, 2017 Share Posted May 18, 2017 how to add detail product variable? {product} like in order_con.html help me please Link to comment Share on other sites More sharing options...
PrestaRob Posted May 14, 2018 Share Posted May 14, 2018 Hello, you can maybe try the other way around - create custom mail template with needed address fields and add bankwire details to the new template. Please see here: Link to post with Solution link 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