-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathplaceorder.php
More file actions
33 lines (26 loc) · 800 Bytes
/
placeorder.php
File metadata and controls
33 lines (26 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* @author kem parson
* @copyright 2016
*/
$customer=$_REQUEST['custid'];
require_once ($_SERVER['DOCUMENT_ROOT'] .'/app/Mage.php');
require_once ('config.php');
Mage::app();
Mage::app()->getTranslator()->init('frontend');
Mage::getSingleton('core/session', array('name' => 'frontend'));
$cust = Mage::getModel('customer/customer')->load($customer);
$quote = Mage::getModel('sales/quote')->loadByCustomer($cust);
$qid=$quote->getId();
$proxy = new SoapClient(Mage::getBaseUrl().'/api/v2_soap/?wsdl');
$sessionId = $proxy->login(APIUSER, APIKEY);
try{
$orderId = $proxy->shoppingCartOrder($sessionId, $qid, null, null);
$ret['order']= $orderId;
}
catch (Exception $e) {
$message = $e->getMessage();
return $ret['error']=$message ;
}
echo json_encode($ret);
?>