Post by asia » Tue Mar 28, 2017 9:01 pm

I am using Advanced Professional Email Template, and i am sending an email from catelog account/customer page for auto reward notification. How could i set the template here.



Tue Mar 28, 2017 8:52 pm

Post by opencart-templates » Fri Mar 31, 2017 12:55 am

Let me know what code you have so far to send the email but here's an example.

1. Load template

Code: Select all

$load_data = array(
  'emailtemplate_key' => 'order.customer',
  'language_id' => $order_info['language_id'],
  'store_id' => $order_info['store_id']
$template = $this->model_extension_mail_template->load($load_data);
2. Add data (can be used as shortcodes e.g {$foo})

Code: Select all

$template->data['foo']  = 'test';
// Or pass full array
3. Attach html template to mail object. Calling hook method to merge mail properties and sets html template.

Code: Select all

$mail = new Mail();
$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
$mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
$mail = $template->hook($mail);
4. Called after email is sent. Cleans up attachments and other sent tasks

Code: Select all


User avatar
Active Member


Mon May 16, 2011 7:24 pm
Location - UK
Who is online

Users browsing this forum: No registered users and 14 guests