I have two content types, order and order_detail, that have a one-to-many relationship. In the definition of order_detail I created a CCK field that is a node reference to the order type. So whenever an order detail is created the user selects the parent order from a select list widget that is bound to the CCK field.

I want to use views to create a table of orders and order_details. I created a view that displays order_details and through a relationship to the node reference CCK field I am able to include order attributes in the table. I can also group by order to get a reasonable looking report.

My question is whether this is the correct approach and whether there are better ways of linking the content types and using views to present the data?

Comments

merlinofchaos’s picture

This sounds like a good approach to me. Do you have reservations about it for some reason?

eft’s picture

Only that I would prefer to have all order related displayed above the order_detail rows instead of repeated with the order_detail rows.

BTW - I am in awe of your work with Views and Panels. Would like to contribute documentation but not sure how to:

  • complement your book,
  • keep up with the rapid evolution of the modules
dawehner’s picture

I think a good place to create / update the documentation is the advanced help docs in the module. This are basic html and is easy to write/ keep up to date.

dabblela’s picture

If you only need to display the order title, you can group by the title in your display output. Otherwise, see my issue here #615542: Including original node data as well as referenced nodes

merlinofchaos’s picture

There is definitely room for more tutorials / tips & tricks /etc in the advanced help.

FreddieK’s picture

I feel like I have a similar (/the same) problem. I have a CCK added node type with a node reference for a one to many relationships where one company has several products. Now I want to list the products with Views grouped by the company.

When I create an unordered list (or a table for that matter) with the Views Style options I get it on the form:

* Company 1
- Product 1
* Company 1
- Product 2
* Company 2
...

Is there any option I'm missing that makes it output the list as:

* Company 1
- Product 1
- Product 2
* Company 2
...

Edit:

Just found a solution. I had the 'Theme developer' module activated and for some reason that caused the output. Once I inactivated the module the list displayed correctly.

merlinofchaos’s picture

See the grouping find under the style options.

dawehner’s picture

Component: Miscellaneous » Documentation

Move to documentation, which is the state of the original issue.

iamjon’s picture

Assigned: Unassigned » iamjon

eft,
If you would like to contribute to documentation please provide instructions for what you did here http://drupal.org/node/322506, if you post it somewhere with screenshots and refer from the handbook that would be great too
I will gladly write up a patch for any relevant documentation you want to add to the advanced help

iamjon’s picture

Status: Active » Closed (won't fix)

Closing this from lack of activity.