<?php $proxy = new SoapClient('http://magento.finelink.com/api/v2_soap/?wsdl', array('trace' => 1)); $sessionId = $proxy->login('soaper', 'F!neline25'); $result = $proxy->salesOrderInvoiceList($sessionId); var_dump($result);
public function mamethodeAction() { echo "<pre>"; $baseDir = Mage::getBaseDir('code'); // include_once // $baseDir.'app/code/community/IWD/OrderManager/Model/Order/Edit.php'; // echo $baseDir.'<br>'; // Mage::log($baseDir,null, 'wms-api.log'); // echo $this->apiUrl. " == " .$this->apiUser. " == " // .$this->apiPassword; $date = date('Y-m-d h:i:s'); echo "Date is " . $date . "<br>"; /** * ##################################################################################### */ // Establish the connection to WMS api $proxy = new SoapClient($this->apiUrl); $sessionId = $proxy->login($this->apiUser, $this->apiPassword); echo $sessionId; // $order_increment_Id = "151020C-811018"; // $order_increment_Id = "20151019C-1992393"; /* * ComplexFilter For Order filter */ $complexFilterOrder = array('complex_filter' => array(array('key' => 'updated_at', 'value' => array('key' => 'from', 'value' => date('Y-m-d', strtotime("-6 days")) . " 00:00:00")), array('key' => 'updated_at', 'value' => array('key' => 'to', 'value' => date('Y-m-d') . " 00:02:00")))); /* * Get Updated Order list from the WMS */ $order_list = $proxy->salesOrderList($sessionId, $complexFilterOrder); $count = 1; /* * Loop through each Order from WMS to check for Invoices and Shipment */ foreach ($order_list as $order) { echo "<br>Order : " . $count . "<br>"; $count++; /* * Complex filter to filter out new Invoices and Shipment for the Corresponding OrderId Instead of the increment order ID */ $complexFilter = array('complex_filter' => array(array('key' => 'order_id', 'value' => array('key' => 'in', 'value' => $order->order_id)), array('key' => 'created_at', 'value' => array('key' => 'from', 'value' => date('Y-m-d', strtotime("-6 days")) . " 00:00:00")), array('key' => 'created_at', 'value' => array('key' => 'to', 'value' => date('Y-m-d') . " 00:02:00")))); // echo "<br>##########################################<br>"; echo "---------------" . $order->order_id . "---------------<br>"; // echo "<br><br>"; /* * Invoice list for the order. */ $invoice_list = $proxy->salesOrderInvoiceList($sessionId, $complexFilter); /* * shipment list for the order. */ $shipment_list = $proxy->salesOrderShipmentList($sessionId, $complexFilter); /* * If there is no invoice or shipment continu with next Order */ if (count($invoice_list) < 1 && count($shipment_list) < 1) { echo "NO Invoice and Shipment<br>"; continue; } var_dump($invoice_list); var_dump($shipment_list); echo "<br>##########################################<br>"; /* * $invoice_list = * $proxy->salesOrderInvoiceList($sessionId,$complexFilter); * $shipment_list = * $proxy->salesOrderShipmentList($sessionId,$complexFilter); * var_dump($invoice_list); * var_dump($shipment_list); */ /* * For each invoice in the invoice list */ foreach ($invoice_list as $invoice) { $invoice_info = $proxy->salesOrderInvoiceInfo($sessionId, $invoice->increment_id); // var_dump($invoice_info); //var_dump(get_class($invoice_info)); $this->addInvoiceFromWMS($invoice_info, $order->order_id); } /* * foreach shipment in the shipment list */ foreach ($shipment_list as $shipment) { $shipment_info = $proxy->salesOrderShipmentInfo($sessionId, $shipment->increment_id); //var_dump(get_class($shipment_info)); // var_dump($shipping_info->order_increment_id); $this->addShipmentFromWMS($shipment_info, $order->order_id); } } $proxy->endSession($sessionId); echo "</pre>"; }