Not sure if this should be a bug report or a feature request ...
I am trying to build a custom view using the views ui to show existing bookings, but I want to count the number of rooms booked for a each order (my use case is similar to a hostel, where the rooms_unit is actually just one bed), so this will show the number of beds booked in an order.
On my test site, I can use views aggregation on dummy content (nodes created with devel generate), but the same thing does not work for Bookings. see screenshots attached
1st screenshot is the dialog when setting aggregation settings for a view if type content (regular nodes)
2nd screenshot is the same dialog for a view of type Bookings
I can see that there are views_hooks scattered through the rooms project code, but I'm not sure exactly which hooks need to be used to enable views aggregation on Bookings.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | bookings_summary_exported_view.txt | 5.08 KB | 1an_m |
| screenshot.order_id.jpg | 40.46 KB | 1an_m | |
| screenshot.content.jpg | 77.69 KB | 1an_m |
Comments
Comment #1
ronald_istos commentedsetting it as a feature request to help us sort through stuff to do :-) But will look into it.
Comment #2
1an_m commentedI found a way to enable aggregation on booking fields on the view I was trying to create. [Custom view showing Name associated with a booking, number of rooms (in my case this represents beds) booked, and start and finish dates for each booking.]
I first tried using a view of Bookings, but as outlined above this does not seem to work. However all the relevant fields are in the commerce line items, so I made a view of commerce line items instead, grouped by order_id (hidden in the view, since I do not need to display this). Count of line items gives the number of rooms for each order. Adding a relationship to the view (Entity Reference to rooms_booking_reference) makes the Booking Name and Start and End dates available for display as well.
I would like to show this on a calendar, but googling around the topic suggests that currently there are issues doing this (using either Calendar module, or Fullcalendar module), so for now I am displaying the results as a table. I have attached the exported view to this post, in case it helps anyone else trying to do something similar.