Jump to content

bankwire aditional email veriables


it's me

Recommended Posts

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

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

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

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

  • 1 year later...
  • 11 months later...

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