@@ -56,11 +56,13 @@ public function getCustomer($args)
56
56
{
57
57
$ this ->load ->model ('common/customer ' );
58
58
$ customer_info = $ this ->get ($ args ['id ' ]);
59
+
59
60
return array (
60
61
'id ' => $ customer_info ['id ' ],
61
62
'firstName ' => $ customer_info ['firstName ' ],
62
63
'lastName ' => $ customer_info ['lastName ' ],
63
64
'email ' => $ customer_info ['email ' ],
65
+ 'phone ' => $ customer_info ['phone ' ]
64
66
);
65
67
}
66
68
@@ -135,15 +137,21 @@ public function register($args)
135
137
$ customer ->firstname = $ customerData ['firstName ' ];
136
138
$ customer ->lastname = $ customerData ['lastName ' ];
137
139
$ customer ->email = $ customerData ['email ' ];
138
-
140
+
139
141
if (_PS_VERSION_ > '1.7.0.0 ' ) {
140
142
$ crypto = ServiceLocator::get ('\\PrestaShop \\PrestaShop \\Core \\Crypto \\Hashing ' );
141
143
$ customer ->passwd = $ crypto ->hash ($ customerData ['password ' ]);
142
144
} else {
143
145
$ customer ->passwd = Tools::encrypt ($ customerData ['password ' ]);
144
146
}
145
-
147
+
146
148
$ customer ->save ();
149
+
150
+ $ this ->load ->model ('common/customer ' );
151
+
152
+ $ this ->model_common_customer ->updateCustomerData ($ customer ->id , [
153
+ 'phone ' => $ args ['phone ' ]
154
+ ]);
147
155
$ this ->load ->model ('common/vuefront ' );
148
156
$ this ->model_common_vuefront ->pushEvent ('create_customer ' , array (
149
157
'customer_id ' => $ customer ->id ,
@@ -162,6 +170,12 @@ public function edit($args)
162
170
$ this ->context ->customer ->firstname = $ customerData ['firstName ' ];
163
171
$ this ->context ->customer ->lastname = $ customerData ['lastName ' ];
164
172
173
+ $ this ->load ->model ('common/customer ' );
174
+
175
+ $ this ->model_common_customer ->updateCustomerData ($ this ->context ->cookie ->id_customer , [
176
+ 'phone ' => $ customerData ['phone ' ]
177
+ ]);
178
+
165
179
if (!$ this ->context ->customer ->save ()) {
166
180
throw new Exception ("Update failed " );
167
181
}
@@ -190,18 +204,23 @@ public function get($user_id)
190
204
{
191
205
$ customer = new Customer ($ user_id );
192
206
207
+ $ this ->load ->model ('common/customer ' );
208
+
209
+ $ customerData = $ this ->model_common_customer ->getCustomerData ($ customer ->id );
210
+
193
211
return array (
194
212
'id ' => $ customer ->id ,
195
213
'email ' => $ customer ->email ,
196
214
'firstName ' => $ customer ->firstname ,
197
- 'lastName ' => $ customer ->lastname
215
+ 'lastName ' => $ customer ->lastname ,
216
+ 'phone ' => $ customerData ['phone ' ]
198
217
);
199
218
}
200
219
201
220
public function isLogged ()
202
221
{
203
222
$ customer = array ();
204
-
223
+
205
224
if ($ this ->context ->cookie ->isLogged ()) {
206
225
$ customer = $ this ->get ($ this ->context ->cookie ->id_customer );
207
226
}
@@ -241,7 +260,7 @@ public function address($args)
241
260
public function addressList ()
242
261
{
243
262
$ address = array ();
244
-
263
+
245
264
$ result = $ this ->context ->customer ->getAddresses ($ this ->context ->cookie ->id_lang );
246
265
247
266
foreach ($ result as $ value ) {
0 commit comments