我正在使用prestashop 1.6。 在文件夹类中,我修改了文件Paymentmodule.php,注释了这一行
// if (Validate::isEmail($this->context->customer->email)) {
// Mail::Send(
// (int)$order->id_lang,
// 'order_conf',
// Mail::l('Order confirmation', (int)$order->id_lang),
// $data,
// $this->context->customer->email,
// $this->context->customer->firstname.' '.$this->context->customer->lastname,
// null,
// null,
// $file_attachement,
// null, _PS_MAIL_DIR_, false, (int)$order->id_shop
// );
// }
所以prestashop不会在每次购买后向注册客户发送订单确认电子邮件。 有没有办法将这封邮件(称为order_conf)发送给一组客户?也许在paymentmodule.php中编写一些代码或者使用模块编写代码?
我正在寻找的是在购买产品后向特定群组的客户发送确认邮件的最简单方法。不需要是order_conf。 有任何想法吗? 谢谢你的时间 再见
答案 0 :(得分:0)
条件1 :
如果您要将邮件发送给特定群组的客户,并且该特定群组是您要向其发送邮件的客户的默认群组。
/** Here assuming you want to send mails to client of group "group 1" **/
$default_group = $this->context->customer->id_default_group;
$groups = Group::searchByName("group 1");
if($default_group == $groups['id_group']) {
// Send mail code
}
条件2 :
如果您要向特定群组的客户发送邮件,并且该特定群组不是您要向其发送邮件的客户的默认群组。
/** Here assuming you want to send mails to client of group "group 2" no matter what is default group of client. **/
$groups=$this->context->customer->getGroups();
$mail_group=Group::searchByName("group 2");
foreach ($groups as $key=>$group){
if($group=$mail_group['id_group']){
//send mail code
}
}
答案 1 :(得分:0)
所以代替“第2组”,我把组的名字对我来说是“Grossisti”而不是'id_group'我把那组是'6'的组(我在prestashop中找到的)后台在同一行,其中有组的名称)。 因此,通过这种方式,我每次购买后都会向Grossisti集团的所有人发送邮件。一切都正确吗?
$groups=$this->context->customer->getGroups();
$mail_group=Group::searchByName("Grossisti");
foreach ($groups as $key=>$group){
if($group=$mail_group['6']){
//send mail code
}
}
如果我想在邮件中发送一些文字,例如“已下订单”,我该怎么做?
Ps:对不起,如果我应该评论而不是回答,但我需要格式化代码。