Multiple addresses in customer address book implmentation | Community
Skip to main content
Level 4
October 16, 2015
Solved

Multiple addresses in customer address book implmentation

  • October 16, 2015
  • 8 replies
  • 1519 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

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.

8 replies

Sham_HC
Level 10
October 16, 2015

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

smacdonald2008
Level 10
October 16, 2015

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.

smacdonald2008
Level 10
October 16, 2015

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

Level 4
October 16, 2015

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.

smacdonald2008
Level 10
October 16, 2015

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

smacdonald2008
Level 10
October 16, 2015

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.

Level 4
October 16, 2015

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]

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

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.