Page 1 of 2

Using list service to build favorite products page

Posted: Sat Jul 26, 2014 4:36 pm
by kabrams

Hello I'm trying to build a 'favorite product' page. I have two collections. One with the products and their ids. The other is a favorites collection with user ids and product ids. I have both collections populated. Now I'm trying to get the page to show, for a particular user, the products they favorited. I have already figured out how to send the products to the favorite collection.

I created a list service for product fav collection, requested userid and sent response to local storage variable.

Next for the products collection, I created a list service and requested the local storage variable fav id and responded with mapping to product variables.

My current output continues to be every record in the products collection. Can u help? What am I doing wrong?


Using list service to build favorite products page

Posted: Sat Jul 26, 2014 10:39 pm
by kabrams

Wow! is anyone there?


Using list service to build favorite products page

Posted: Sat Jul 26, 2014 11:55 pm
by kabrams

7 hours and no response...still waiting...patiently


Using list service to build favorite products page

Posted: Sun Jul 27, 2014 12:01 am
by Alena Prykhodko

Hello,

Sorry for delay, we need more time to give a solution.


Using list service to build favorite products page

Posted: Sun Jul 27, 2014 12:26 pm
by kabrams

Hello! good morning! any word?


Using list service to build favorite products page

Posted: Sun Jul 27, 2014 1:23 pm
by obullei

Hello!
We are working on it.
I will let you know when have more information from developers team.


Using list service to build favorite products page

Posted: Sun Jul 27, 2014 4:55 pm
by kabrams

Do you understand the problem? It doesn't seem to be such a huge problem. BTW, I met Max at a meeting in Atlanta a couple of weeks ago and he seemed so helpful. This experience is not so much.


Using list service to build favorite products page

Posted: Sun Jul 27, 2014 8:36 pm
by kabrams

Are you guys deliberately ignoring my request?


Using list service to build favorite products page

Posted: Sun Jul 27, 2014 9:59 pm
by Yurii Orishchuk

Hi Kabrams,

Sorry for the delay,

You have two solutions:

pre

1 Change your favorite collection with following way:
1.1 delete userId and productId fields.
1.2 add field "user" with type pointer to user.
1.3 add field "product" with type pointer to product.
1.4 repopulate this collection.
1.5 add to your "list" service "include" field and populate it with value "user,product"
1.6 use your "favorites" list service to create UI you need.

/pre

pre

2 Two sequentional list requests:
2.1 invoke "favorites" list service.
2.2 in "success" event handler get all product ids.
2.3 invoke "product" query service and pass ids from 2.2 to where field using "$in". See details how to do it: http://devcenter.appery.io/documentation/backendservices/database/#Query_constraints
2.4 use your "product" query service to create UI you need.

/pre

Regards.


Using list service to build favorite products page

Posted: Sun Jul 27, 2014 10:19 pm
by kabrams

Thank you. I will try this.