0

I think I can solve this with views, but can't find a good solution.

I have the nodes: vegetable, fruits..(one content type). Then I have different nodes of vegetables and fruits: carrot sort 1, carrot sort 2.../ salad sort 1, salad sort2.../ apple sort 1, apple sort 2...

The goal is this structure:

  1. node vegetable: -text- -headline 1: carrots- -list of different carrots-

-headline 2 salad - -list of different salads-

  1. node fruits -text- -headline 1: apples- -list of different apples-

-headline 2 berries- -list of different berries-

Have I built for carrots, salads, apples, berries... separate views? Maybe there is one better way? How can I collect this seperate views on the nodes "vegetable" and "fruits"? I tried it with eva, but (sure) I got on both of my nodes the same result with all fruit and vegetables together.

Any ideas? Thanks in advance

1

Yes, this is absolutely doable with one View.

What you are looking for is under Format: Unformatted list (or whatever your view style is) | Settings.

Click Settings and set a Grouping Field based on the field you would like to group - "content type" in this case.

  • Thank you. I didn't know the Grouping field function before. – ugura Oct 19 '13 at 10:27
0

This is a typical task for views.

Summary:

  1. Create a view of Content
  2. Create two pages in the view, fruits and vegetables, with filter criteria for the respective taxonomy term.
  3. In the Format settings, choose the taxonomy vocabulary that sets the sub-type for the fruits or vegetables as grouping field
  4. Add a header for each of the pages as rendered entity/content/nid

Details:

  1. Create a content type for your fruits and vegetables. I will call this content type now "catalog".
  2. Additionally to the fields describing each of the catalog items, create a taxonomy vocabulary "catalog_type" with the terms "fruit" and "vegetable".
  3. Add a second taxonomy vocabulary "catalog_detail" with terms "Carots", "Apples", "Salads", "Berries".

Now, you can create a view or content for the content type catalog.

  1. Create view: View of Content of type catalog. Check "Create a Page". Set the "Display Format" to "Table" or "Unformatted list" or whatever you prefer, and choose a generously high number of items to be displayed. Click "Continue and edit"
  2. Add fields: Add all fields you want to display (if you chose table), and also the catalog_detail taxonomy term.
  3. Add a filter criteria for the taxonomy vocabulary "catalog type" to be "vegetable".
  4. Click on Settings in "Format: xx(yourformat) | Settings" ; In Grouping Fields: Choose "catalog_detail" Click "Apply for all displays"

Now, you should have your vegetables grouped in the views preview, and need to add the general vegetable node to the header of the output:

  • Click "Header -> Add" (second column of the views form) Check "Entity: Rendered entity " Click "Apply - all displays" Choose "Entity type -> Content" Enter the node id of your general vegetable node (just the number) Click "Apply - all displays"

That should be your page for the vegetables. You can set your menu path, and title, etc. to your liking.

Now you can clone your page for the fruits:

  • On the views form, locate " Display name: Page " Go to the right side of the form, and click on the pull-down menu -> selection "Clone Page"

On this page, you need to change three things. Change those, and be careful to select on the forms "This display only", otherwise, you'll change the "vegetable" one as well.

  1. The filter criteria should be "fruits" now
  2. The header node id should get changed
  3. Title and path should be adjusted.

That should be it!

  • Thank you very much for your detaillied answer. I tried it, and it works fine. Thanks a lot. I'm really happy. – ugura Oct 19 '13 at 10:26
  • 1
    Great, glad it works. Maybe, the answer can be marked as correct. – Ursula Oct 19 '13 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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