Jump to content

Edit History

ps8modules

ps8modules

Example of how to add the subject of the message to the template?

1. edit ./modules/contactform/contactform.php

2. find $var_list = [

$var_list = [
	'{firstname}' => '',
	'{lastname}' => '',
	'{order_name}' => '-',
	'{attached_file}' => '-',
	'{message}' => Tools::nl2br(Tools::htmlentitiesUTF8(Tools::stripslashes($message))),
	'{email}' =>  $from,
	'{product_name}' => '',
];

3. add after custom vars

$var_list = [
	'{firstname}' => '',
	'{lastname}' => '',
	'{order_name}' => '-',
	'{attached_file}' => '-',
	'{message}' => Tools::nl2br(Tools::htmlentitiesUTF8(Tools::stripslashes($message))),
	'{email}' =>  $from,
	'{product_name}' => '',
];

$subject = Db::getInstance()->getRow('SELECT * FROM '._DB_PREFIX_.'contact_lang WHERE id_lang = '.(int)$this->context->language->id.' AND id_subject = '.(int)$id_contact);

$var_list['{subject_name}'] = $subject['name'];
$var_list['{subject_description}'] = $subject['description'];

4. save

5. modify email template contact_form

6. add {subject_name} or {subject_description}

 

And this way you can play with the template and parameters indefinitely 😄

 

ps8modules

ps8modules

Example of how to add the subject of the message to the template?

1. edit ./modules/contactform/contactform.php

2. find $var_list = [

$var_list = [
	'{firstname}' => '',
	'{lastname}' => '',
	'{order_name}' => '-',
	'{attached_file}' => '-',
	'{message}' => Tools::nl2br(Tools::htmlentitiesUTF8(Tools::stripslashes($message))),
	'{email}' =>  $from,
	'{product_name}' => '',
];

3. add after custom vars

$var_list = [
	'{firstname}' => '',
	'{lastname}' => '',
	'{order_name}' => '-',
	'{attached_file}' => '-',
	'{message}' => Tools::nl2br(Tools::htmlentitiesUTF8(Tools::stripslashes($message))),
	'{email}' =>  $from,
	'{product_name}' => '',
];

$subject = Db::getInstance()->getRow('SELECT * FROM '._DB_PREFIX_.'contact_lang WHERE id_lang = '.(int)$this->context->language->id.' AND id_subject = '.(int)$id_contact);

$var_list['{subject_name}'] = $subject['name'];
$var_list['{subject_description}'] = $subject['description'];

4. save

5. modify email template contact_form

6. add {subject_name} or {subject_description}

×
×
  • Create New...