Search the Community
Showing results for tags 'relationships'.
-
Hey, I haven't actually started with ProcessWire yet. I came across it via a Smashing Magazine article and it has piqued my interest. I've been working in WordPress for about a 2 years. I have intermediate HTML5, CSS3 skills, and have been furiously teaching myself PHP/Javascript for the past couple of months, since I want to dig more into wordpress and develop skills on other platforms. At the moment I have a project involving a niche movie/TV database, with associated review system. I have already built a custom solution in WordPress involving custom post types, custom fields, custom categories, and user access levels. The site will be highly relational, as it has Movies, TV shows, Actors, Directors, Producers, Cinematographers, Studios, Production Companies etc. The complexity of the relations comes in when you consider that an Actor can be a director and producer too, and can be attached to movies in multiple ways. Movies have multiple producers and sometimes multiple directors. So using wordpress custom post types and custom fields I have implemented many to many relationships via intermediaries, given the limitation that each child can only have one parent of each type, but a parent can have many children of a given type. I used a custom types and display plugin for this. Just looking at the Movies and Actors/Directors/Producers situation. I created Movies and People as Parent post types. I created groupings of custom intermediaries to join the parent post types: Actors-In-Movies, Directors-of-Movies, Producers-of-Movies. So now a Person can be linked to a movie in multiple ways, and to multiple movies in the same way etc. Which was great but complicated, but it allows me to display the required fields via their many to many relationships. An example of a problem I came up against that required digging deep was: On a page(post) showing an actor, listing all the movies that he has been involved in is easy. I can list them by role, and display information from those linked posts, such as the title of the move, year etc. But because this a wp_query of the child post, displaying some information from it's other parent, the problem comes about when trying to order that information by a field pulled from another parent e.g: Person1 Acting Roles Movie 1 - Character Name - 1972 (movie release date - from other parent) Movie 2 - Character Name - 1971 Movie 3 - Character Name - 1973 Production Roles Movie x - Producer - 1995 Movie y - Executive Producer - 1983 The information being displayed is from querying the intermediary post, some directly (such as charcter name) while other information is being pulled from the other parent (movie name, movie release date). The table of information is easily sorted by fields from the linked child, ie it would be easy to sort them, alphabetically, by character name or production role. However in such a table it is more usual to sort them by the release date of the movie, either chronologically or reverse chronologically. But in Wordpress this was difficult, because I am trying to order the information of a query of a child post by information not included on that child post, but by information queried from another parent of that post. A solution was to duplicate inputting of information from the movie release date field in the movie parent post, into a movie release date field in the child intermediaries... An anathema of process. I identified 2 solutions (with help). 1. Since users won't be accessing the WP Admin directly as I have implemented a user account system that keeps them in a designed user area front end, with forms to submit data. On those forms I have a system that writes data to both posts. So when a user submits a movie, the year of that movie is written into movie year fields in both the movie post movie year db entry and the intermediate (actor-in-movie/director-in-movie/producer-in-movie) post movie year db entry upon submission. It leads to complications when people don't already exist in the DB etc 2. When the DB is queried, use custom code to manipulate the list of intermediate posts after it has been retrieved and change the sort order. Not writing to the DB as above, but doing it on the fly before display by looping through the posts, retrieving the id of the corresponding movie, retrieving the year custom field from the post meta of the associated movie, adding that as an entry in the posts array for the current post, and then after having looped through each of the posts so that they now also have a year entry, sorting the posts array based on the year field, and then replacing the posts array which is part of $query with the sorted posts array. ... I do enjoy overcoming these hurdles, but since I have been reading great things about ProcessWire I am interested in tackling this same problem. Does ProcessWire deal with relationships in a similar way, I have come across mention of one-to-one and one-to-many relationships. I would therefore surmise that you can create many-to-many in much the same way, or is there an easier way? Does anyone have any pointers? Thanks for any advice in advance.
-
We are currently looking at building a custom administration area with the basic outlined functionality. Users will be able to login and see their horses, their events and their payments. Admins will be able to login and see all users, horses, events, payments. Data structure below. Questions 1) Would this make sense to build as a single frontend with different 'admin' levels' rather than customising the backend of PW? Ultimately the PW install will be running a full frontend website (showing Horses for Sale, Events and other misc content) so users will need to login to update content. 2) How does PW handle database relationships? Could this structure be built? Users ------ ID Email Horses - one user can own many horses ------- ID UserID Membership Level (payment) Events - one horse can enter many events ------- ID HorseID Required Membership Level Payments ----- ID TransactionID Payment Items - one payment can have many payment items ---- ID PaymentID Order Type - Horse Registration/Donation/Event ItemID - HorseID, DonationID, EventID Cost VAT Many thanks Pete
- 9 replies
-
- database
- relationships
-
(and 2 more)
Tagged with:
-
Hi, I have listings (listing template) that I am now adding a field to called Listing Broker. I made a role, listing_broker, and set the field to page field type, select input type, from users parent, user template, with roles=listing_broker. So the test_broker user appears just fine. But when I try to save, I get this: Page 1100 is the user test_broker. Can we not relate page fields to users? There must be a way. I just thought it was that easy. Apparently not quite?
-
I am starting to use processwire and really liking it but having one issue which i wanted to ask help for. i am working on a directory type of site that consists of two types of information groups for now: Organizations (different types of organizations in different industries) People (different types of people who are in most cases affiliated with the organizations above) I want to create a relationship between the two types so i can list different people that are (or were) part of the organization and was initially able to do this simply by doing a page (lookup) field which i included in one of the above templates/pages to look up the other group. E.g. lookup people in the organization page. However this was too simple for my needs and i also wanted to be able to put related information (e.g. the person's title at the organization, when they started, when they left etc). So an intermediate type of place would be needed to store this which i was not sure how to do. So it would have to be a many-to-many relationship where more attributes about the relationship can be added. I also wanted an easy way to add more relationships (e.g. from the organization page, i want to be able to add more people that work or worked for the organization and also add more details like the title they have in the organization etc). Similarly also under a person's profile, i want to list the organizations he/she is (or was affiliated with). I know this is possible in PW, if someone could please point a novoice like me in the right direction on how to do this or please let me know if more information is needed. Thanks, Binit