User choose "ACCEPTED" from dropdown menu and click submit button, after that test.php of these path plus given below function must execute. How i will able to do this?
用户从下拉菜单中选择“ACCEPTED”并单击“提交”按钮,之后测试。这些路径加上下面给出的函数必须执行。我怎么能这样做?
Path:
/var/www/html/demo/courier/test.php
Here is the function:
这是功能:
if($testcodPayment->getMethodInstance()->getTitle() == 'Cash On Delivery' && $status == $statusAccepted && ($checkTrack12[0]['number']=='') && $selectCourier == 'couriername'){
include '/var/www/html/demo/courier/test.php' ;
$awbNumbercouriername = $hlp->couriernameawbgenerate('couriername',$id);
$title = Mage::getStoreConfig('carriers/'.$method[0].'/title', $store);
$track = Mage::getModel('sales/order_shipment_track')
->setNumber($awbNumbercouriername)
->setCarrierCode($method[0])
->setCourierName('couriername')
->setTitle('couriername');
$shipment->addTrack($track);
Mage::helper('shipmenty')->addShipmentComment(
$shipment,
$this->__('%s addeddd tracking ID %s', $vendor->getVendorName(), $awbNumbercouriername)
);
$session->addSuccess($this->__('Tracking ID has been added. Please take three printouts of each manifest and keep one copy of airway bill signed by courier boy with you as proof of pick up. '));
$highlight['tracking'] = true;
$customerMessage = 'Your order has been shipped. Tracking Details.Shipment#: '.$_shipmentId.' , Track Number: '.$awbNumberFedex.'Courier Partner : www.fedex.com - Craftsvilla.com (Customercare email: customercare@craftsvilla.com)';
$_customerSmsUrl = $_smsServerUrl."username=".$_smsUserName."&password=".$_smsPassowrd."&type=0&dlr=0&destination=".$customerTelephone."&source=".$_smsSource."&message=".urlencode($customerMessage);
$parse_url = file($_customerSmsUrl);
$shipment->save();
}
2 个解决方案
#1
Use the require() command within your function and it should do the trick.
在函数中使用require()命令,它应该可以解决问题。
require('/var/www/html/demo/courier/test.php');
#2
You can use either include
or the require
commands.
您可以使用include或require命令。
Suppose you want to execute test.php
before your function.
假设您想在函数之前执行test.php。
Then, use
<?php
include '/var/www/html/demo/courier/test.php';
yourFnction();
?>
You can also use require
. The difference is that, if the file is not found, the script execution dies. Whereas, if you use include
, even if the file is not found, the script will continue executing yourFunction()
您也可以使用require。不同之处在于,如果找不到该文件,则脚本执行将死亡。然而,如果你使用include,即使找不到文件,脚本也会继续执行你的函数()
<?php
include '/var/www/html/demo/courier/test.php';
yourFunction();
?>
You can even call include
inside the function
你甚至可以在函数内部调用include
<?php
function yourFunction(){
echo "a";
include '/var/www/html/demo/courier/test.php';
echo "b";
}
?>
#1
Use the require() command within your function and it should do the trick.
在函数中使用require()命令,它应该可以解决问题。
require('/var/www/html/demo/courier/test.php');
#2
You can use either include
or the require
commands.
您可以使用include或require命令。
Suppose you want to execute test.php
before your function.
假设您想在函数之前执行test.php。
Then, use
<?php
include '/var/www/html/demo/courier/test.php';
yourFnction();
?>
You can also use require
. The difference is that, if the file is not found, the script execution dies. Whereas, if you use include
, even if the file is not found, the script will continue executing yourFunction()
您也可以使用require。不同之处在于,如果找不到该文件,则脚本执行将死亡。然而,如果你使用include,即使找不到文件,脚本也会继续执行你的函数()
<?php
include '/var/www/html/demo/courier/test.php';
yourFunction();
?>
You can even call include
inside the function
你甚至可以在函数内部调用include
<?php
function yourFunction(){
echo "a";
include '/var/www/html/demo/courier/test.php';
echo "b";
}
?>