Bigcommerce: 给已完成购买的客户发送一封产品评论邮件,让客户直接进行产品评论

需求说明:进入后台的Order列表,更新订单状态:Awaiting Pickup后,就会给客户发送一封希望他们能进行评论的邮件。在邮件中展示该订单下的所有产品,每个产品都有一个评论的跳转链接,点击后直接跳到产品页面,并定位到产品的评论表单,方便客户直接操作。





具体开发步骤:

第一步:修改config/config.php配置文件,这里是对Order的状态是否要发送邮件进行控制
$GLOBALS['ISC_CFG']['OrderStatusNotifications'] = '11,9,2,5,4';
改成:
$GLOBALS['ISC_CFG']['OrderStatusNotifications'] = '11,9,8,2,5,4';


第二步:修改lib/orders.php      

查找:if (empty($GLOBALS['SNIPPETS']['CartItems'])) {
$emailTemplate->SetTemplate("order_status_email");
} else {
$emailTemplate->SetTemplate("order_status_downloads_email");
}
改为:
if (empty($GLOBALS['SNIPPETS']['CartItems'])) {

   //arlinger info 2013-6-15
if ($status == 8) {

  $query1 = "
SELECT *
FROM [|PREFIX|]order_products
WHERE orderorderid ='".$orderId."'";
$result1 = $GLOBALS['ISC_CLASS_DB']->Query($query1);

$GLOBALS['AllLi']="";  
while ($product_row1 = $GLOBALS['ISC_CLASS_DB']->Fetch($result1)) {
$GLOBALS['AllLi'].=" <li style='list-style:none;float:left;padding:15px 3% 5px 3%;88%;margin:10px 3% 0 3%;background:#f0f0f0;border:1px solid #e7e7e7;'><a style='color:#0074ff;text-decoration:none;font-family:Arial;' href='".prodLink(isc_html_escape($product_row1['ordprodname']))."'>".isc_html_escape($product_row1['ordprodname'])." </a>
<div style='float:left;100%;margin:15px 0;display:inline;'>
<a href='".prodLink(isc_html_escape($product_row1['ordprodname']))."?Reviews=ON' style='float:left;margin:0 5% 0 0;47%;padding:15px 0 0 0;border:1px solid #678ca8;background:#fff;height:35px;line-height:18px;text-align:center;text-decoration:none;color:#6e93af;font-size:13px;font-weight:600;'>Review this product</a>
<a  href='https://www.resellerratings.com/store/SecurityCamera2000' style='float:left;padding:15px 0 0 0;margin:0;47%;border:1px solid #678ca8;background:#fff;height:35px;line-height:18px;text-align:center;text-decoration:none;color:#6e93af;font-size:13px;font-weight:600;'>Feedback to Resellerratings</a></div>
</li> " ;  

}

$GLOBALS['OrderReviewdHi'] = isc_html_escape($customer['custconfirstname']);
  
 $emailTemplate->SetTemplate("order_status_email_PL");
 
  
}else{
  $emailTemplate->SetTemplate("order_status_email");
}


第三步:添加了文件:/includes/classes/class.reviewpl.php和根目录下的:postreviewpl.php


/templates/__emails/下面添加了:order_status_email_PL.html,内容如下:


<html><body style="font-family: Arial; font-size: 12px;">
<div style="padding: 0 20px 0 20px;font-family:Tahoma;">       
<div style="color:#6b9dba;margin:10px 0 15px 0;text-align:center;font-size:14px;"><span style="color:#969696;font-weight:500;">Hi &nbsp;</span>%%GLOBAL_OrderReviewdHi%%<span style="color:#969696;font-size:500;">,</span></div>
<p  style="border-bottom: 1px dashed #d9d9d9;color:#656565;font-size:0.95em;margin:0 0 0 5%;padding:0 0 15px 0;line-height:20px;text-align:center;">how did this item meet your expectation? We would love your honest feedback on each of the items you purchased.</p>

        <ul class="OrderItemList">
        %%GLOBAL_AllLi%%
        </ul>

</div>
</body>
</html>



PS:
1.邮件服务器会屏蔽js内容,没有查询到相关结果
2.没有验证码,产品评论不成功!?tab=ProductReviews
3.评论表单的功能修改PHP文件为:/includes/classes/class.reviewpl.php和根目录下的:postreviewpl.php


原文地址:https://www.cnblogs.com/dyllove98/p/3155327.html