Magento在订单确认和发货时发送短信,我们有以下PHP代码:
<?php
$ch = curl_init();
$user="**@bindaaslo.com:**";
$receipientno="98910***";
$senderID="TEST SMS";
$msgtxt="this is test message , test"; curl_setopt($ch,CURLOPT_URL, "http://api.mVaayoo.com/mvaayooapi/MessageCompose"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&senderID=$senderID&receipientno=$receipientno&msgtxt=$msgtxt"); $buffer = curl_exec($ch); if(empty ($buffer)) { echo " buffer is empty "; } else { echo $buffer; } curl_close($ch);
?>
答案 0 :(得分:0)
打开文件[magento]\app\code\core\Mage\Adminhtml\controllers\Sales\Order\ShipmentController.php
找到saveAction()并在其中添加代码
public function saveAction()
{
......................
$ch = curl_init();
$user="**@bindaaslo.com:**";
$receipientno="98910***";
$senderID="TEST SMS";
$msgtxt="this is test message , test"; curl_setopt($ch,CURLOPT_URL, "http://api.mVaayoo.com/mvaayooapi/MessageCompose"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&senderID=$senderID&receipientno=$receipientno&msgtxt=$msgtxt"); $buffer = curl_exec($ch); if(empty ($buffer)) { echo " buffer is empty "; } else { echo $buffer; } curl_close($ch);
......................
}
注意:不要直接更改核心文件而不是覆盖控制器。
或强>
您可以通过观察者
实现相同目标某些链接可帮助您为sales_order_shipment_save_before事件创建观察者