I'm gonna make an example of a problem that I'm having.
We're building an e-shop. In this e-shop you got a shopping-cart (cartModel), categories (categoryModel) and item-list (itemModel).
It looks like this:
- categoryModel & itemModel:
- outdoor (id, name)
- jacket (id, name, price) - - boots (id, name, price)
- - ...
- indoor (id, name) - - blanket (id, name, price)
- - tv (id, name, price)
- - ...
- - snow (id, name)
- - hat (id, name, price)
- - ...
- ...
Then you have the cartModel. (this has some saved previous selections:
- cartModel:
- John: (id, name, ...)
- - outdoor:
- - jacket
All of this model is rendered with ejs.
In this form-topic I've read that the categoryModel-instance is put in a store.
And here comes my problem. If my cartModel is filled. It has an instance of the categoryModel. This categoryModel-instance is put into the model Store.
If I then load this same category. (in this example outdoor) Then it will fill the categoryInstance in my CartModel with all the items.
Then it looks like John has bought all the outdoor items.
How can I avoid this. I want to keep those two categoryModel-instances with the same ID separated.
I hope this is clear. Else ask for more information?
Thnx!
- itemModel