2

Im using Drupal 7.x Merci, views, panels, chaos tools, rules, etc. I am working on a equipment checkout system, and I have a view that lists all the reservations made. In that view I would like to not only show the fields from the Content Type:Reservation, but also the picture from the Content Type:Customer. I know that I need some kind of reference field so that I get the correct picture next to the correct reservation, so they have several fields in common, Customer Name and L#. I would prefer to use L# but i'm not sure what reference I need to use (entity reference, node reference, field reference) I already have the view built displaying the reservations. Any help would be great, there are lots of questions around about this but I haven't found one that touches on this.

Thanks in advance :)

2
  • Hi, can you show the view you've built? that's the view where you want to show the picture of the customer right? entity reference is enough as long as there is some field that connects the two content type.
    – Danz
    Apr 22, 2015 at 2:31
  • Here is a screenshot of the view Im working with. drive.google.com/file/d/0B6eRtugQRxaQNkctbzRXbEE4U28/… Do I need entity reference in both content types?
    – Maruska
    Apr 23, 2015 at 17:44

1 Answer 1

0

Depending in the setup, the person who makes the reservation might also be referenced via the author field in views, but I don't know how your reservation system works.

Properties of other entities can be embedded in a view via the relations in the advanced section. There has to be a common field such as an entity reference linking the two content types together, but author, tags and several other properties can be used as well.

After adding such a relation, New fields will become available in the fields, filter and sorting sections.

UPDATE

I believe there is some misunderstanding about the modules. An entity reference (or any other reference in Drupal) uses the user id (uid) not a custom field #L. So when you add such a reference to a content type, you can only find users by username (or common name if realname module is installed). Since you said you have the customer name this should not be a problem as you select the users by name, but their uid is stored in the database.

Make sure there is only one relation on the content type that is created on the desk (registration). Adding an entity reference on the user (or both content types) makes no sense; a registration is made for one or more users, user's don't own one or more registrations.

Create a view listing fields of the main content type you want to display (registration). Then add a views relationship to the user object via the entity reference field. Finally you can add all fields of the user object to your list of fields.

The only filters you will need are filters for limiting the set of registrations (you could add contextual filters to list registrations per user), but I'd leave out all registrations to start with. You can always add them later.

6
  • We have a local user who makes all reservations and handles the system. When a student comes to the window the attendant pulls up the customer account then makes reservation from there. Each student has an id# called L# that is unique to them. When I add the relationship, I assume I need to choose the entity reference I added in the customer content type?
    – Maruska
    Apr 23, 2015 at 19:26
  • Yes, you need to select the entity reference from the relations, and then the other entities properties become available as fields. Apr 24, 2015 at 8:41
  • I set the Relationship to the entity reference from my Customer account. I think the contextual filter needs to be set to L# since it is how the view will know what image to put with what reservation. Is that right?
    – Maruska
    Apr 27, 2015 at 18:29
  • Hard to tell without seeing the structure. But sounds ok. Apr 27, 2015 at 21:31
  • Im still not able to see the image? Whats the next step? I think I need to set Filter Criteria to show the Reservation type AND the Customer Type. is that right?
    – Maruska
    May 7, 2015 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.