-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdasboard.php
More file actions
83 lines (64 loc) · 2.26 KB
/
dasboard.php
File metadata and controls
83 lines (64 loc) · 2.26 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* @author kem parson
* @copyright 2016
*/
//ini_set('display_errors','On');
//error_reporting(E_ALL);
$id=$_POST['id'];
$email=$_POST['email'];
require_once ($_SERVER['DOCUMENT_ROOT'] .'/app/Mage.php');
Mage::app('default');
umask(0);
Mage::init();
Mage::getSingleton('core/session', array('name' =>'frontend'));
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
$customer->loadByEmail($email);
$mage_id=$customer->getId();
if($mage_id==$id){
$img="customerpic/$mage_id.jpg";
if(file_exists($img)):
$imagelocaton=Mage::getBaseUrl()."/mob_api/$img";
else:
$imagelocaton='no image found';
endif;
$ret['info']['firstname'] = $customer->getFirstname();
$ret['info']['lastname'] = $customer->getFirstname();
$ret['info']['email'] = $customer->getEmail();
$ret['info']['image'] = $imagelocaton;
$billing = $customer->getDefaultBillingAddress();
if (!empty($billing)) {
$ret['billing']['prefix'] =$billing->getFirstname() ;
$ret['billing']['firstname'] =$billing->getFirstname() ;
$ret['billing']['middlename'] = $billing->getMiddlename();
$ret['billing']['company'] = $billing->getCompany();
$ret['billing']['street'] = $billing->getStreet();
$ret['billing']['city'] = $billing->getCity();
;
$ret['billing']['country'] = $billing->getCountry();
$ret['billing']['postcode'] = $billing->getPostcode();
$ret['billing']['telephone'] = $billing->getTelephone();
$ret['billing']['fax'] =$billing->getFax() ;
}
if (!empty($shipping)) {
$shipping = $customer->getDefaultShipping();
$ret['shipping']['prefix'] =$shipping->getFirstname() ;
$ret['shipping']['firstname'] =$shipping->getFirstname() ;
$ret['shipping']['middlename'] = $shipping->getMiddlename();
$ret['shipping']['company'] = $shipping->getCompany();
$ret['shipping']['street'] = $shipping->getStreet();
$ret['shipping']['city'] = $shipping->getCity();
;
$ret['shipping']['country'] = $shipping->getCountry();
$ret['shipping']['postcode'] = $shipping->getPostcode();
$ret['shipping']['telephone'] = $shipping->getTelephone();
$ret['shipping']['fax'] =$shipping->getFax() ;
}
}
else{
$ret['error']="Id and Email do not match please to login customer";
}
$result=json_encode($ret) ;
echo $result;
?>