By LAC Webadmin on Wednesday, 20 May 2015
Replies 9
Likes 0
Views 1K
Votes 0
Hi There!

We're trying to sync ES with our CRM DB user's profile, we did this before with one text field and it has been running perfectly fine for almost a year now using:


read:
$myUser->getFieldValue( $this->params->get( 'crm_id' ) );

write:
$myUser->setFieldValue( $this->params->get( 'crm_id' ), $crm_id );


Since ES Address has multiple data in it like Address1, Address2... etc. How do I read from and write back to ES custom fields?

Thanks,

Jackson
Hello Jackson,

I am sorry for the delayed response.

Perhaps you can take a look at your /media/com_easysocial/apps/fields/user/address/address.php on how the address value is fetch.
·
Wednesday, 20 May 2015 18:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Ezrul,

Thanks for path. Can you do me a favor please? I know I am asking too much can you point me to a file or something that would give me a hint how do I save the address values to ES address fields please?

I followed setFieldValue($key, $value) method and the $value checks if the values being passed is an array or object. From that, I'm wondering is this will work?


$myUser->setFieldValue( 'ADDRESS', array('address1'=>'1000 My Address', 'address2'=>'Apartment 2', 'city'=>'Pasadena','state'=>'California','zip'=>'91101','country'=>'United States'));


Thanks,

Jackson
·
Friday, 22 May 2015 05:31
·
0 Likes
·
0 Votes
·
0 Comments
·
Anyone ES Team please? We just have a deadline to meet with our integration project.

I have tried several variation of the array above by looking at the fields model setValue() method but it does not work. The date are being saved to Addres1 only or in a longitude field and in JSON format.

Can you help me figure it out please!

Thanks,

Jackson
·
Saturday, 23 May 2015 02:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Wow! Am I being ignored? Mark?
·
Sunday, 24 May 2015 09:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Jackson,

I am sorry for the delay of this reply as it weekend for all of us here.

To be honest I myself don't quite understand how the address field value is stored since I'm not a programmer that build the system. I want to ask our lead developer, Mark but he is not around as he went to China for the Joomla Day event. I will get back to you as soon he is coming back to the office and I will ask him directly. I hope you understand the situation currently.

In the meantime, perhaps you can try go to the /components/com_easysocial/models/fields.php and search for the function setValue so that you can have a better idea on how the storing works.
·
Monday, 25 May 2015 13:07
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Ezrul,

Any news regarding this issue? I assume Mark and team is back in Malaysia?


In the meantime, perhaps you can try go to the /components/com_easysocial/models/fields.php and search for the function setValue so that you can have a better idea on how the storing works.


That's the method I've looked at and regardless of parameter variation I did with the array it's not saving the data properly.

Thanks,

Jackson
·
Tuesday, 02 June 2015 01:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Jackson,

I am sorry for the delayed response as I'm digging through all the codes in order to find out how the saving works. It might be a little complicated for me to explain but I will try my best to make it simple.

Based on how the default custom fields saving works during profile editing, the saving begins in the /components/com_easysocial/controllers/profile.php under function "save" and the code that responsible for this is as following, $my->bindCustomFields($data); where $data is the custom fields data value. Then it will trigger bindCustomFields function which is located at /administrator/components/com_easysocial/includes/user/user.php where it will goes through $field->saveData() function under the /administrator/components/com_easysocial/tables/field.php

Inside the saveData() function it will process the array value passed in the address field and store it accordingly in the database. You can try to refer the above workflow on how to save the address value for your custom work.

I am sorry I am not able to call Mark here as he is very busy with the ES 1.4 development task currently. Hope you understand.
·
Wednesday, 03 June 2015 13:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Ezrul,

No worries, I got it. I figured it out from the setValue() method in fields model. I just created my own method based on setValue() by adding a new key for sub-items in address.

But I hope, the developers will add a method that updates Address field in the future.

Thanks,

Jackson
·
Thursday, 04 June 2015 07:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for your suggestion Jackson.
·
Friday, 05 June 2015 00:40
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post