Hello master ...
i want to custom email by order status. There are 3 custom email for it. order status Canceled, Complete, Pending. When admin send status with order status canceled, the email will send with format email content canceled email,,, same with complete and pending. those email will send accordance with the order status ...
Anyone can help me for this
Thank you master and friends here ... ...
regard
r3born ...
In catalog/model/checkout/order.php you will use what is already given to you. In this function:
Just use $order_status_id to set up your conditional.
Example with using SWITCH to pull different email templates:
* You will change the numbers to match the different order status ID's. You can find those in PHPmyAdmin. In your database there is a table called "order_status". Notice that in each case you are pulling a different TPL as well. Just duplicate/rename mail/order.tpl over and over and add your own customizations to make each template unique. If you DON"T want the default information to show on all templates such as products orderes or total then you need to put all of these things within each CASE. Otherwise they apply to all. This example is for "adding" new information to the actual TPL's. Find this codeAnd replace it with this:
Code: Select all
public function confirm($order_id, $order_status_id, $comment = '', $notify = false) {
Example with using SWITCH to pull different email templates:
* You will change the numbers to match the different order status ID's. You can find those in PHPmyAdmin. In your database there is a table called "order_status". Notice that in each case you are pulling a different TPL as well. Just duplicate/rename mail/order.tpl over and over and add your own customizations to make each template unique. If you DON"T want the default information to show on all templates such as products orderes or total then you need to put all of these things within each CASE. Otherwise they apply to all. This example is for "adding" new information to the actual TPL's. Find this code
Code: Select all
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/order.tpl');
} else {
$html = $template->fetch('default/template/mail/order.tpl');
}
Code: Select all
switch($order_status_id){
case 1:
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/order.tpl');
} else {
$html = $template->fetch('default/template/mail/order.tpl');
}
break;
case 5:
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order2.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/order2.tpl');
} else {
$html = $template->fetch('default/template/mail/order2.tpl');
}
break;
case 3:
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order3.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/order3.tpl');
} else {
$html = $template->fetch('default/template/mail/order2.tpl');
}
break;
//this executes if all other cases fail.
default:
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/order.tpl');
} else {
$html = $template->fetch('default/template/mail/order.tpl');
}
}
thanks for your help ...
I have change code as you say above like this ....
switch($order_status_id){
case 1: // i change number 1 with order_status ID table in phpmyadmin.
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/pending.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/pending.tpl');
} else {
$html = $template->fetch('default/template/mail/pending.tpl');
}
break;
case 2: // i change number 2 with order_status ID table in phpmyadmin.
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/processing.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/processing.tpl');
} else {
$html = $template->fetch('default/template/mail/processing.tpl');
}
break;
case 5: // i change number 5 with order_status ID table in phpmyadmin.
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/complete.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/complete.tpl');
} else {
$html = $template->fetch('default/template/mail/complete.tpl');
}
break;
//this executes if all other cases fail.
default:
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/order.tpl');
} else {
$html = $template->fetch('default/template/mail/order.tpl');
}
}
and admin area ... i go to sales - order - order history and change status order pending to process .. there are no send custom email processing.tpl .... I probably made a mistake xD ...
still send email normal ...
"Order ID: 36
Date Ordered: 13/05/2012
Your order has been updated to the following status:
Processed
To view your order click on the link below:"
I have change code as you say above like this ....
switch($order_status_id){
case 1: // i change number 1 with order_status ID table in phpmyadmin.
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/pending.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/pending.tpl');
} else {
$html = $template->fetch('default/template/mail/pending.tpl');
}
break;
case 2: // i change number 2 with order_status ID table in phpmyadmin.
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/processing.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/processing.tpl');
} else {
$html = $template->fetch('default/template/mail/processing.tpl');
}
break;
case 5: // i change number 5 with order_status ID table in phpmyadmin.
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/complete.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/complete.tpl');
} else {
$html = $template->fetch('default/template/mail/complete.tpl');
}
break;
//this executes if all other cases fail.
default:
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/order.tpl');
} else {
$html = $template->fetch('default/template/mail/order.tpl');
}
}
and admin area ... i go to sales - order - order history and change status order pending to process .. there are no send custom email processing.tpl .... I probably made a mistake xD ...
still send email normal ...
"Order ID: 36
Date Ordered: 13/05/2012
Your order has been updated to the following status:
Processed
To view your order click on the link below:"
I make a bump on this one, i also want to see this working, have been trying but it doesn't work
Webbutveckling, Sökmotoroptimering, E-handel, Mobilskal, Tillbehör för surfplattor och tillbehör för mobiler
Who is online
Users browsing this forum: Semrush [Bot] and 25 guests