Jacek Posted August 29, 2018 Share Posted August 29, 2018 I need some help with my project. I'm trying to create a site dedicated to board games. It will be in a part a recommendation system, a directory and an exchange platform. I want every user to have ability to create custom lists of games. I've got a page called board games. Its children are singular games. Now I don't know how to implement this many to many relations. These are my constraints: 1. Each user can create a custom list (similar to a common wish list) of games listed in the catalogue. Each list will have a title of his choosing and a status (punblic/private) . For example: My favorite 10 strategy games. 2. Some lists must be hard-coded, predefined, and common to all of the users without any ability for users to edit or delete them (editable field) 3. Each game on the user's list needs to have some additional fields of various types. For example: my comments, my rating... 4. I want to have an ability to display: *each list a game is listed on *all lists of a given user 5. Each user can place every game from the directory on multiple lists. If it was a database, I think I would create one table for users yet another one for games. I would implement many-to-many relation using another table containing user and game ids with additional fields: list name, comment, rating etc How can I reflect this structure best in PW? Link to comment Share on other sites More sharing options...
elabx Posted August 29, 2018 Share Posted August 29, 2018 38 minutes ago, Jacek said: 1. Each user can create a custom list (similar to a common wish list) of games listed in the catalogue. Each list will have a title of his choosing and a status (punblic/private) . For example: My favorite 10 strategy games. Make the user page have a page reference field that lets you create new lists. This would let you either creat all lists in the website under a central page, or with a little hook work have each list of lists living under the user. 38 minutes ago, Jacek said: 2. Some lists must be hard-coded, predefined, and common to all of the users without any ability for users to edit or delete them (editable field) Let the page reference field include this pages through the selector that return the selectable pages. 38 minutes ago, Jacek said: 3. Each game on the user's list needs to have some additional fields of various types. For example: my comments, my rating... My first though would be to use another page that relates each list-game with the extra info, you could probably add a hook that automatically adds a page somwhere which holds all this extra fields. Could be something like: - User -- Lists --- List 1 (holds a page reference field to all games) ---- Game 1 (for each game in the list parent field, a page here exists, holding extra fields that can be custom for this particular user) ---- Game 2 38 minutes ago, Jacek said: 4. I want to have an ability to display: *each list a game is listed on *all lists of a given user All possible with selectors and i think the owner selectro could help here: http://processwire.com/blog/posts/processwire-3.0.95-core-updates/ 38 minutes ago, Jacek said: 5. Each user can place every game from the directory on multiple lists. Doable out of the box with the page reference fields. This are just my first thoughts, maybe someone has a more elaborate solution or sees an error in my conception. 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now