How I got to this problem: I have a content type Event that contains two field collections Schedule and Price. I am upgrading from D6 to D7 and am using the same structure that I had with CCK-Multigroup. In D6 I was able to have Views print the values in the price field while being grouped by date at the same time. In the Following Structure:

  • Date 1
    • Price 1
    • Price 2
  • Date 2
    • Price 1
    • Price 2

What happens: Even with grouping turned on the Field Collection in which I am using to group is repeated Such that it appears in this structure:

  • Date 1
    • Price 1
  • Date 1
    • Price 2
  • Date 2
    • Price 1
  • Date 2
    • Price 2

What should happen: When setting a field group as an item from a field collection it should simply group by that field and not create duplicate groups.

Challenges: I don't think Field Collection Views can help me with this because I need each price item to appear associated with a date so that I can use that base structure to theme a Paypal button that includes variables with date and price and there doesn't seem to be a way to pass the date variable to the Field Collection View from the base View.

Discussion: This seems to be part of a greater problem with Field Collection relationships preventing Views from grouping content properly. I posted an issue similar to this in the Views queue for a different issue I was having. Though it doesn't speak to this particular issue, it does mention difficulty creating groups in views when Field Collection relationships are involved. #1923676: Aggregation Forces Body to Display Full Unrendered HTML

Comments

rbrownell’s picture

Issue summary: View changes

Minor corrections

rbrownell’s picture

Issue summary: View changes

Adding Detail

rbrownell’s picture

Issue summary: View changes

Adding detail...

rbrownell’s picture

Issue summary: View changes

Adding Detail....

rbrownell’s picture

Bump? Any insights anyone?

rbrownell’s picture

Status: Active » Fixed

There is a module called Views Distinct which may assist with this... I overcame the problem awhile ago but I am not quite sure how I fixed it.

EDIT: Now I remember. I ended up using Drupal Commerce for sales instead of creating a view tpl.php template with a paypal form built in. I ended up creating a rule that had a nested loop that would go over each date and price and generate Drupal Commerce product entities so the view I created didn't have to reference two separate field collection entities... The old method described in this issue's summary however works for Drupal 6 using CCK Multigroups.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Jean Gionet’s picture

Status: Closed (fixed) » Active

does anybody have a working solution for cases like these? I'm looking around and find multiple suggestions, however none seem to work. I don't want to keep on installing additional modules if its now required! :)

Here's what I posted in another thread:

-------------------------------------------------------------------
I keep on getting multiple rows for each item in my field collection.

example:
===========
Content Type: Task
Field: Date
Field: Title
Field: Description
Field: Field Collection - Products (links to field collection bellow)

Field Collection - Products
Field: Due Date
Field: Name
Field: Description

I created a new "Task" node with these values:
=============
Date: Oct 2
Title: Test Task
Description: this is a test
Products - (linked to field collection Products):
- Web Page
- Report
- Orders

I created a relationship to my "Products (field collection)".
I selected the "Products: Name" field as a FIELD to display in Views.
Results listed in VIEWS (table style)
=========
DATE | TITLE | DESCRIPTION | PRODUCT NAME
--------------------------------------------------------
Oct 2 | Test Task | this is a test | Web Page
Oct 2 | Test Task | this is a test | Report
Oct 2 | Test Task | this is a test | Orders

I want all my PRODUCT NAMES to be grouped in one line of results.
Something like:
DATE | TITLE | DESCRIPTION | PRODUCT NAME
--------------------------------------------------------
Oct 2 | Test Task | this is a test | Web Page, Report, Orders

Jean Gionet’s picture

Issue summary: View changes

Added Spacing....

dmsmidt’s picture

Exactly what I'm searching for ... any smart ideas?

Obliveon’s picture

Bonjour Jean,

I know this is old... I had the exact problem you had and stumbled here after a couple of searches...
I was able to solve this using the Views merge rows module

https://www.drupal.org/project/views_merge_rows