我正在为magento商店运行api以连接到经济学:请查看该链接以获取该API:https://github.com/tkjaergaard/Economic-PHP-SDK?_e_pi_=7%2CPAGE_ID10%2C1957533932
我只是将文件夹粘贴到根目录中并通过
获取订单$orderId= Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order= Mage::getSingleton('sales/order')->loadByIncrementId($orderId);
我的问题是我需要在root director / vendor / autoload.php文件中包含api文件夹以连接我的扩展.... 因此,当我的商店下新订单时,总订单详细信息将自动添加到经济学API ...
对此有任何想法......提前感谢。
创建新订单此方法允许您为特定的Debtor.Theadd方法创建newOrder.linehead注意接受包含产品线信息的数组。该数组接受以下元素: .Product:product number.required .Description:line description.optional * .Price:line.optional的单价* .Qty:数量line.optional * .Unit:要使用的单位号.optional
<?php
require(Mage::getBaseDir().DS.'Economic-PHP-SDK-master'.DS.'vendor'.DS.'autoload.php');
use tkj\Economics\Client;
use tkj\Economics\Order\Order;
$client = new Client($agreementNumber,$userID, $password);
$order = new Order($client);
$debtorNumber = 101;
$newOrder =$order->create($debtorNumber, function($line)
{
$data = array(
"product" => 301,
"description" => "Description of line.",
"price" => 825.00,
"qty" => 5,
"unit" => 2);
$line->add($data);
});
class EconomicAPI_Model_Observer {
public function ordermigrate($observer) {
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order = Mage::getSingleton('sales/order')->loadByIncrementId($orderId);
// echo "order subtotal: ".$order->getSubtotal()."<br>";
// echo "shipping: ".$order->getShippingAmount()."<br>";
// echo "discount: ".$order->getDiscountAmount()."<br>";
// echo "tax: ".$order->getTaxAmount()."<br>";
// echo "grand total".$order->getGrandTotal()."<br><br><br>";
$to = 'karthickica@gmail.com';
$subject = 'Mail before Sale order place.';
$message = $orderId ;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $message, $headers );
}
}