Expand my Community achievements bar.

SOLVED

Multiple addresses in customer address book implmentation

Avatar

Level 4

Hi All,

i want to have multiple addresses for a customer. And customer can set one of the addresses as 'default address'. other addresses can be shipping address,billing address etc.

Please provide me a solution and best practice to achieve this. A demo would be really helpful.

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 10

You need to read the JCR data modelling considerations that I listed above. Setup the JCR to handle your data as described in David N article. Its a must read for your use case.

View solution in original post

8 Replies

Avatar

Level 10

You need to build one. You might look at [1] which is kind of todo application where you can add/delete/remove etc..

[1]   https://github.com/Adobe-Marketing-Cloud/aem-sightly-sample-todomvc

Avatar

Level 10

Are you looking to persist customer info in the AEM JCR. The closest community article we have for this use case is here.

http://helpx.adobe.com/experience-manager/using/querying-experience-manager-data-using1.html

It covers persisting and querying sample cust data. You can use the JCR API to persist cust data in the JCR. You can define node props to store cust attributes. The JCR API can be used with an AEM service, as shown in this article. This article will get you started.

Avatar

Level 10

Of course, if you are interested in persisting cust data in a relational database, you can write an AEM service as well. In this case, refer to

http://helpx.adobe.com/experience-manager/using/querying-persisting-cq-data-mysql.html

Avatar

Level 4

i want a customer to go to his/her account where all the links are available. i want to create address book of the customer and order history where an 'Oder id' will be a primary link for the order details. Please refere the attached screenshots.

[img]myAccountlinks.png[/img]

[img]order-history.png[/img]

Though the above demos are good but of no use to me. Thanks for on time responding.

Avatar

Level 10

The above demos are to show how to write services within AEM to persist data in either MySQL or the JCR. You use these articles when you have no idea on how to write AEM services to persist data in the JCR or a relational db. After you know how to perform these tasks, move on to modelling data.

In your use case, you need to model data in more depth than shown in these articles. I recommend you read

http://docs.adobe.com/docs/en/cq/current/developing/chap_data_modelling.html

This covers data modelling considerations. Look at Rule #5: References considered harmful

Avatar

Level 10

You can also develop your solution  in a relational database.

http://www.princeton.edu/~achaney/tmve/wiki100k/docs/Database_normalization.html

In that case normalize your model as talked about in this link. For instance, store order history in a separate table.

Avatar

Level 4

As i am working on CQ-Hybris integration, the addresses and orders of the customer will be stored in Hybris server. i am fetching it and displaying to customer. for better performance i will fetch it once and store it in user properties. Consider me as a new AEM developer, can u suggest me how to create the following address book.[img]addressesDesign.png[/img]

Avatar

Correct answer by
Level 10

You need to read the JCR data modelling considerations that I listed above. Setup the JCR to handle your data as described in David N article. Its a must read for your use case.