How can I add rows to grouping in views? I have a view that lists terms from two different vocabularies (Product Categories, and Traits). The Product Categories vocabulary looks something like this:


Sweet Corn


Type 1
Type 2

Onions


Type 3
Type 4

Popcorn


Type 5
Type 6



Each of these parent categories also have specific traits that are identified in the Traits vocabulary that looks like this:


High Expansion
Augmented
Celebrate


High Expansion is a trait of Popcorn, Augmented is a trait of Sweet Corn, and Celebrate is a trait of Onions. Traits are different from Categories, and must be defined in a separate vocabulary due to other definitions and functionalities on the site. So, I can't just make them children of the above parent terms.

I have a view that is a main landing page for the product categories that displays the icons for all the Categories and Traits, that the user can click to see a filtered view of products within the category clicked. I am grouping the view results by Parent term, but also need to include the Traits in the appropriate groups.

On my landing page view, I need to list the Traits under the appropriate grouping, so my landing page view should look something like:


Sweet Corn


Type 1
Type 2
Augmented

Onions


Type 3
Type 4
Celebrate

Popcorn


Type 5
Type 6
High Expansion



Is there any way to accomplish this type of grouping?

Thank you for your help!
The views Format Settings has your answer.  There is a drop-down for "Grouping field Nr.1" that does exactly this.



As it is, you have one "row" showing for each unique set of values because this is what mysql returns.  By setting this field grouping, Views will match up the values from the selected field and use them as headers for sub sections of your results.

If this is not a good enough match to your issue, please provide details on how it doesn't work and I can update the answer.



Continued:

The view is a tool for making a mysql query and then theming the returned result.  With this in mind, you need to craft a set of data relations and filters to get the appropriate data linkages for the ratios you want in your display.  This means you want the database handing you a field table like:

Category parent | product | category | trait


Sweet Corn | corn product 1  | Type 1  |  Null
Sweet Corn | corn product 2  | Type 2  |  Null
Sweet Corn | generic corn product  |  Null | Augmented
Onions | onion product 1 | Type 3 | Null
Onions | onion product 3 | Null  | Celebrate


Then once you have the dataset you need, you work on the theming side of the views tool.  Use the above mentioned Grouping field setting on the Category Parent.  This will make the sections with the parent titles as indicated in your question, but it might look like 


Sweet Corn 


corn product 1  | Type 1  |  
generic corn product  | | Augmented  



Then use the "exclude from display" on the product field, or actually remove it from the fields list.  I have it included here because it is needed to show the data grouping as I understand it in your question.  Finally, configure the "category" field with the link you want it to have and exclude it from display; use the "No Results Behavior" rewrite option on Trait to put in the token for the Category field, something like [field_term_category].  You should be able to find this token in the list of "replacement patterns" available in the Rewrite Results area.

 

You should now have a list of parent categories showing the linked sub categories and traits where you want them.  The "trait" field will either have the category or the trait in there, as it shows trait when trait is present, and category when not.  Be sure to uncheck the "hide if empty".