-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcustomeralladdress.php
More file actions
48 lines (43 loc) · 1.27 KB
/
customeralladdress.php
File metadata and controls
48 lines (43 loc) · 1.27 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* @author Extalionez
* @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'));
$proxy = new SoapClient(Mage::getBaseUrl().'/api/v2_soap/?wsdl');
$sessionId = $proxy->login(APIUSER, APIKEY);
try
{
$result = $proxy->customerAddressList($sessionId, $customer);
$i=0;
foreach ($result as $address):
$ret[$i]['id']=$address->customer_address_id;
$ret[$i]['firstname']= $address->firstname;
$ret[$i] ['lastname']=$address->lastname;
$ret[$i] ['company']=$address->company;
$ret [$i]['street']=$address->street;
$ret[$i]['city']=$address->city;
$ret[$i]['region_id ']=$address->region_id ;
$ret[$i]['region']=$address->region;
$ret[$i]['postcode']=$address->postcode;
$ret[$i]['country_id']=$address->country_id;
$ret[$i]['telephone']=$address->telephone;
$ret[$i]['fax']=$address->fax;
$ret[$i]['defaultbilling']=$address->is_default_billing ;
$ret[$i]['defaulshiping']=$address->is_default_shipping;
$i++;
endforeach;
$ret=array_values($ret);
}
catch (Exception $e) {
$message = $e->getMessage();
$errors="true" ;
$ret['error']=$message ;
}
echo json_encode($ret);
?>