@@ -56,11 +56,13 @@ public function getCustomer($args)
5656 {
5757 $ this ->load ->model ('common/customer ' );
5858 $ customer_info = $ this ->get ($ args ['id ' ]);
59+
5960 return array (
6061 'id ' => $ customer_info ['id ' ],
6162 'firstName ' => $ customer_info ['firstName ' ],
6263 'lastName ' => $ customer_info ['lastName ' ],
6364 'email ' => $ customer_info ['email ' ],
65+ 'phone ' => $ customer_info ['phone ' ]
6466 );
6567 }
6668
@@ -135,15 +137,21 @@ public function register($args)
135137 $ customer ->firstname = $ customerData ['firstName ' ];
136138 $ customer ->lastname = $ customerData ['lastName ' ];
137139 $ customer ->email = $ customerData ['email ' ];
138-
140+
139141 if (_PS_VERSION_ > '1.7.0.0 ' ) {
140142 $ crypto = ServiceLocator::get ('\\PrestaShop \\PrestaShop \\Core \\Crypto \\Hashing ' );
141143 $ customer ->passwd = $ crypto ->hash ($ customerData ['password ' ]);
142144 } else {
143145 $ customer ->passwd = Tools::encrypt ($ customerData ['password ' ]);
144146 }
145-
147+
146148 $ customer ->save ();
149+
150+ $ this ->load ->model ('common/customer ' );
151+
152+ $ this ->model_common_customer ->updateCustomerData ($ customer ->id , [
153+ 'phone ' => $ args ['phone ' ]
154+ ]);
147155 $ this ->load ->model ('common/vuefront ' );
148156 $ this ->model_common_vuefront ->pushEvent ('create_customer ' , array (
149157 'customer_id ' => $ customer ->id ,
@@ -162,6 +170,12 @@ public function edit($args)
162170 $ this ->context ->customer ->firstname = $ customerData ['firstName ' ];
163171 $ this ->context ->customer ->lastname = $ customerData ['lastName ' ];
164172
173+ $ this ->load ->model ('common/customer ' );
174+
175+ $ this ->model_common_customer ->updateCustomerData ($ this ->context ->cookie ->id_customer , [
176+ 'phone ' => $ customerData ['phone ' ]
177+ ]);
178+
165179 if (!$ this ->context ->customer ->save ()) {
166180 throw new Exception ("Update failed " );
167181 }
@@ -190,18 +204,23 @@ public function get($user_id)
190204 {
191205 $ customer = new Customer ($ user_id );
192206
207+ $ this ->load ->model ('common/customer ' );
208+
209+ $ customerData = $ this ->model_common_customer ->getCustomerData ($ customer ->id );
210+
193211 return array (
194212 'id ' => $ customer ->id ,
195213 'email ' => $ customer ->email ,
196214 'firstName ' => $ customer ->firstname ,
197- 'lastName ' => $ customer ->lastname
215+ 'lastName ' => $ customer ->lastname ,
216+ 'phone ' => $ customerData ['phone ' ]
198217 );
199218 }
200219
201220 public function isLogged ()
202221 {
203222 $ customer = array ();
204-
223+
205224 if ($ this ->context ->cookie ->isLogged ()) {
206225 $ customer = $ this ->get ($ this ->context ->cookie ->id_customer );
207226 }
@@ -241,7 +260,7 @@ public function address($args)
241260 public function addressList ()
242261 {
243262 $ address = array ();
244-
263+
245264 $ result = $ this ->context ->customer ->getAddresses ($ this ->context ->cookie ->id_lang );
246265
247266 foreach ($ result as $ value ) {
0 commit comments