I originally posted this in the post-installation forum, but it hasn't received any replies there, so I hope it's not inappropriate to re-post here in an effort to get relevant eyes on the problem.

I am using Views 2 to sort content in various ways. I didn't set this site up initially, but I believe the content comes from CCK fields. The sorting works great, but my designer has asked that the sorted content be grouped according to the sort key. Initially I thought I'd have to write some code to do this, but then I realized that Views provides grouping.

Once I added the sort field to the view's Fields list, I was able to choose it for grouping. The view style is "grid", row style "Fields". The live preview of this view looks perfect, but when I look at the page itself, grouping isn't done.

I've checked the obvious:

  • I saved the view
  • I am running the latest Views 2 code
  • The Theme Developer module is disabled
  • I looked for theme overrides that might be causing trouble
  • I switched to the Garland theme and the problem persists

What else should I look for?

Here's the exported view, if that might help:

$view = new view;
$view->name = 'product_yarn_by_manufacturer';
$view->description = 'Yarn sorted by manufacturer';
$view->tag = 'Products';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'field_product_image_fid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 1,
    'label_type' => 'none',
    'format' => 'product_thumb_linked',
    'multiple' => array(
      'group' => 1,
      'multiple_number' => '1',
      'multiple_from' => '0',
      'multiple_reversed' => 0,
    ),
    'exclude' => 0,
    'id' => 'field_product_image_fid',
    'table' => 'node_data_field_product_image',
    'field' => 'field_product_image_fid',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'name' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 1,
      'path' => 'products/[name]',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_taxonomy' => 0,
    'exclude' => 1,
    'id' => 'name',
    'table' => 'term_data',
    'field' => 'name',
    'relationship' => 'none',
  ),
  'field_product_manufacturer_value' => array(
    'label' => 'Manufacturer',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 1,
    'id' => 'field_product_manufacturer_value',
    'table' => 'node_data_field_product_manufacturer',
    'field' => 'field_product_manufacturer_value',
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'field_product_manufacturer_value' => array(
    'order' => 'ASC',
    'delta' => -1,
    'id' => 'field_product_manufacturer_value',
    'table' => 'node_data_field_product_manufacturer',
    'field' => 'field_product_manufacturer_value',
    'relationship' => 'none',
  ),
  'title' => array(
    'order' => 'ASC',
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => 1,
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'product' => 'product',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '1' => '1',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'select',
    'limit' => TRUE,
    'vid' => '1',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 0,
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
  'role' => array(),
  'perm' => '',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Products');
$handler->override_option('header_format', '2');
$handler->override_option('header_empty', 0);
$handler->override_option('items_per_page', 0);
$handler->override_option('use_pager', '0');
$handler->override_option('use_more', 1);
$handler->override_option('use_more_text', 'see more stuff');
$handler->override_option('style_plugin', 'grid');
$handler->override_option('style_options', array(
  'grouping' => 'field_product_manufacturer_value',
  'columns' => '6',
  'alignment' => 'horizontal',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'products/Yarn/by-manfacturer');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));

Comments

sjmadsen’s picture

Anyone have any ideas on this one? I'm happy to continue debugging it myself, but I could use a gentle push in the right direction.

oskar_calvo’s picture

We have the same problem.

We have a search with views, and when we try to groups the fields (image field with several images to upload) image in 1 image of all of them, it doesn't show nothing, if we don't try to group the image_field we get a search result for every image.

Oskar

tonyhrx’s picture

I'm having problems with grouping.

I'm grouping by a date field.

The display repeats the grouping header for each date - that is as if they were not grouped at all.

So I expected the display to be

Group date 1
Node 1 field
Node 2 field

Group date 2
Node 4 field
Node 6 field

Instead the display is

Group date 1
Node 1 field
Group date 1
Node 2 field

Group date 2
Node 4 field
Group date 2
Node 6 field...etc

Am I missing something?

tonyhrx’s picture

Yes I am missing something. Turn off Themer.

esmerel’s picture

Status: Active » Postponed (maintainer needs more info)

Did turning off themer help everyone, or is this still an issue?

esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)