Jump to content

Email Template Variables For Modified Templates


Recommended Posts

Hey everyone, 

 

I have been setting up a new store and have been pulling my hair out over the variables used in the mailalert modules. 

 

I have modified the templates for

account.html - This template works perfectly as I haven't added any new variables to the html. 

Variables used

{email} - Works
{passwd} - Works
{shop_name} - Works

order_conf.html 

{firstname} - Works
{lastname} - Works
{email} - Works
{date} - Works
{payment} - Works
{products} - Changed from {items} and now works
{total_products} - Works
{total_discounts} - Works
{total_wrapping} - Works
{total_shipping} - Works
{total_tax_paid} - Works
{total_paid} - Works
{carrier} - Works 
{delivery_block_html} - Works
{invoice_block_html} - Works
{message} - Not working
{shop_name} - Works

payment.html 

{payment} - Not working
{order_name} - Working
{date} - Not working
{payment} - Not working
{total_paid} - Working
{delivery_block_html} - Not working
{invoice_block_html} - Not working

preparartion.html  

{firstname} - Working
{lastname} - Working 
{order_name} - Working
{date} - Not working
{delivery_block_html} - Not working 
{invoice_block_html} - Not working

refund.html 

{firstname} - Working
{lastname} - Working
{order_name} - Working
{date} - Not working
{payment} - Not working
{total_paid} - Working

shipped.html

{firstname} - Works
{lastname} - Works
{order_name} - Works
{date} - Not working
{payment} - Not working
{total_paid} - Working
{items} - Not working
{total_products} - Not working
{total_discounts} - Not working
{total_wrapping} - Not working
{total_shipping} - Not working
{total_tax_paid} - Not working
{total_paid} - Works
{carrier} - Not working
{shipping_number} - Not working
{followup} - Not working
{delivery_block_html} - Not working
{invoice_block_html} - Not working
{message} - Not working
{shop_name} - Works

When I went to test I found the above results, so I've done a lot of searching, but the only real result I have come up with is creating a mail.php override, but then I have no idea how to add all the above variables to it.

 

I know it's a tall order, but if someone could help me out that would be amazing. 

 

I'm using 1.5.6.2

 

Thank you. 

 

 

Link to comment
Share on other sites

  • 2 months later...
  • 2 years later...

It's the validateOrder function in classes/PaymentModule.php that sends the order confirmation email and the changeIdOrderState function in classes/order/OrderHistory.php that sends all other emails.

 

Each of these functions has a $data array that contains all the variables available to the email templates. If you want to add extra variables, you should add them there. For example:

            'shop_name' => Configuration::get('PS_SHOP_NAME'),
            'shop_email' => Configuration::get('PS_SHOP_EMAIL'),
            'shop_registration' => Configuration::get('PS_SHOP_DETAILS'),
            'shop_address1' => Configuration::get('PS_SHOP_ADDR1'),
            'shop_address2' => Configuration::get('PS_SHOP_ADDR2'),
            'shop_postcode' => Configuration::get('PS_SHOP_CODE'),
            'shop_city' => Configuration::get('PS_SHOP_CITY'),
            'shop_country' => Country::getNameById((int)$order->id_lang, (int)Configuration::get('PS_SHOP_COUNTRY_ID')),
            'shop_state' => State::getNameById((int)Configuration::get('PS_SHOP_STATE_ID')),
            'shop_phone' => Configuration::get('PS_SHOP_PHONE'),
            'shop_fax' => Configuration::get('PS_SHOP_FAX'),
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...