I am trying to set up Glossary view. By default, it takes node titles and sort by them. OK, it works.

But, I need to sort (A, B, C...) by values from cck field. Views normaly sees this field, I add this field as argument, set it as normal glossary view. But it doesnt work.

It quiet works, but if Provide default argument - "a" is set, then it doesnt show anything.

Comments

esmerel’s picture

Status: Active » Postponed (maintainer needs more info)

Can you provide an export of the view?

eL’s picture

If Summary, sorted ascending is set, it works, but after clicking on letter in header, it shows list of nodes beginning with selected letter, but header with letters is not present now.

If Provide default argument is set, nothing is displayed.

$view = new view;
$view->name = 'test';
$view->description = 'A list of all content, by letter.';
$view->tag = 'default';
$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', 'test', 'default');
$handler->override_option('fields', array(
  'path' => array(
    'label' => 'Cesta',
    '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,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'absolute' => 1,
    'exclude' => 1,
    'id' => 'path',
    'table' => 'node',
    'field' => 'path',
    'relationship' => 'none',
  ),
  'field_jmeno_value' => array(
    'label' => '',
    '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,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'plain',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 1,
    'id' => 'field_jmeno_value',
    'table' => 'node_data_field_jmeno',
    'field' => 'field_jmeno_value',
    'relationship' => 'none',
  ),
  'field_prijmeni_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 1,
      'text' => '[field_prijmeni_value] [field_jmeno_value]',
      'make_link' => 1,
      'path' => '[path]',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'plain',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_prijmeni_value',
    'table' => 'node_data_field_prijmeni',
    'field' => 'field_prijmeni_value',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'field_prijmeni_value' => array(
    'default_action' => 'default',
    'style_plugin' => 'unformatted_summary',
    'style_options' => array(
      'count' => 1,
      'override' => 0,
      'items_per_page' => '25',
      'inline' => 1,
      'separator' => '',
    ),
    'wildcard' => 'all',
    'wildcard_substitution' => 'Vše',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'glossary' => 1,
    'limit' => '1',
    'case' => 'upper',
    'path_case' => 'lower',
    'transform_dash' => 0,
    'id' => 'field_prijmeni_value',
    'table' => 'node_data_field_prijmeni',
    'field' => 'field_prijmeni_value',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '3' => 0,
      '10' => 0,
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_fixed' => 'a',
    'default_argument_user' => 0,
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'webform' => 0,
      'faq' => 0,
      'quotes' => 0,
      'forum' => 0,
      'vzkaz' => 0,
      'vzkaz_druhemu' => 0,
      'page' => 0,
      'pozustalost' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_php' => '',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'vzkaz' => 'vzkaz',
      'vzkaz_druhemu' => 'vzkaz_druhemu',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
  'role' => array(),
  'perm' => '',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Test');
$handler->override_option('header', '<h3><a href="hrbitov">Online hřbitov</a></h3>');
$handler->override_option('header_format', '2');
$handler->override_option('header_empty', 0);
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 36);
$handler->override_option('use_pager', '1');
$handler->override_option('use_more', 1);
$handler->override_option('use_more_always', 0);
$handler->override_option('use_more_text', 'další');
$handler->override_option('link_display', 'page_1');
$handler->override_option('style_options', array(
  'grouping' => '',
));
$handler->override_option('row_options', array(
  'inline' => array(
    'field_jmeno_value' => 'field_jmeno_value',
  ),
  'separator' => '',
  'hide_empty' => 0,
));
$handler = $view->new_display('page', 'Stránka', 'page_1');
$handler->override_option('path', 'test');
$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,
  'name' => 'navigation',
));

esmerel’s picture

Status: Postponed (maintainer needs more info) » Active

When adding requested detail, please be sure to reset the issue to 'active'

iamjon’s picture

Hi eL,
Did you ever find a solution to your issue? If yes please update the post so others can benefit.
I tried importing your view but it didn't work.
What kind of cck fields are we talking about. Can you provide step by step replication instructions? (Try to make it as generic as possible.)

iamjon’s picture

Status: Active » Postponed (maintainer needs more info)

Changing status

eurekaloop’s picture

In addition to Drupal 6, when using the glossary view option on Drupal 7 and Views 7.x-3.x-dev, the view is automatically sorted by title (ascending), and setting any other sort functions do not affect/over-ride this. I tried sorting by both taxonomy and post date and both are over-ridden by the title sorting.

Not sure how to go about fixing this, but in the meantime I am linking to the view's page and appending "?order" to the URL and that seems to allow my selected sort options to display properly.

iamjon’s picture

eurekaloop,
you are a bit of off topic. el opened a specific support request. please feel free to open a new a thread.

eurekaloop’s picture

I apologize, but it sounded like the same issue to me.

El said, "But, I need to sort (A, B, C...) by values from cck field. Views normally sees this field, I add this field as argument, set it as normal glossary view. But it doesnt work. "

So it sounds like it will not allow him to sort by anything other than title when choosing a glossary view. He wanted it sorted by a CCK field, but it only sorted by title (if I read his entry correctly). In my case, I tried to sort by taxonomy term, or even post date, but it still retains the default sort-by-title. So it sounds like I am experiencing the same phenomenon, and it may have nothing to do with CCK fields but with the default title-sort.

Was I wrong in following up here? Would it be better to post the same problem in a separate request?

eL’s picture

Sorry, it´s a while and I am not sure now, how did it, but I did it. CCK field can be an argument. May be, it is needed, to be in Fields presented too.

eurekaloop’s picture

Thanks, eL - I'll try that and see if it works.
:)

varunity’s picture

Confirmed. It works great. I used it here: http://patwa.org for an alphabetical sort. In my case "Node Title" was the argument so that with the " Glossary mode" setting I was able to limit the length to 1 (meaning the views argument is essentially the starting letter for words, eg http://patwa.org/letter/a )

dawehner’s picture

Status: Postponed (maintainer needs more info) » Fixed

Mark as fixed based on #11

eurekaloop’s picture

Status: Fixed » Active

@varunity - Well, of course sorting by node title works - that's the default, as I had stated above. Its getting it to sort by other fields (such as CCK fields) that seems tricky. ;)

Since my last post, I have managed to get it to sort by the taxonomy term. However, where it still fails is if you try and sort by a CCK field that is based on a taxonomy term. Since the new version of Drupal doesn't let you associate nodes directly to a taxonomy term, we are required to choose an existing term using the "term reference" option for our custom content types. It is this "term reference" field that does not work with default sorting. Not sure why, but using the direct taxonomy term instead is working for me.

So, to narrow down this little quirk, trying to sort by a CCK term reference (rather than a standard CCK text field) is not working.

merlinofchaos’s picture

When you say sorting 'it' what do you mean exactly?

A glossary view is actually the composition of two views. There's the 'summary' view which represents the glossary, at the top, Summary views ignore the normal sort criteria and sort only by the field that they're summarizing. So in the normal case, that's node: title.

Then there's the primary view, which should sort normally. Unless you're using a table or something, in which case you could end up having the tablesort override the normal sorting.

Now, with this explained, can you be more precise in what is happening? Can you describe what it is you're getting versus what it is you're expecting (and why you're expecting it)?

merlinofchaos’s picture

Status: Active » Fixed

Oh, and I see that the glossary view, by default, is a table style, and it's using tablesort, and the default sort is by nid. Check the style configuration for your table. It's almost certainly set to override normal sorting if tablesorting is in use.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Version: 6.x-2.11 » 6.x-2.12

Creating a glossary based on a CCK field still doesn't work for me (version 6.x-2.12). When I break it down I see that the necessary JOIN to the content type table isn't present in the resulting query. The alias is used in the SELECT part of the query, resulting in a SQL error (watchdog) saying the field doens't exist.

Using hook_views_query_alter and adding the table that is needed, fixes this problem. But I think, correct me if I'm wrong, this is a bug in views?

Pav-2’s picture

I've got the same issue, using taxonomy term for now but would be good to see if anyone got this sorted.

Thanks

momeee_2’s picture

Status: Closed (fixed) » Active

I have the problem i have enabled the glossary module and add a filter for the specific node type but it doesn't work properly when I click on alphabets it doesn't show the node please check this http://dev.pajhwok.com/glossary

iamjon’s picture

Status: Active » Closed (fixed)

momeee_2,
please open a new issue and follow the issue guidelines. This issue has been fixed.
http://drupal.org/node/571990

varro’s picture

Version: 6.x-2.12 » 7.x-3.0-rc1
Assigned: Unassigned » varro
Category: support » task
Status: Closed (fixed) » Patch (to be ported)

I got it. I found a solution for this issue that can be found here http://foro.varro.es/viewtopic.php?f=25&t=66

dawehner’s picture

Status: Patch (to be ported) » Fixed

Update status.

Status: Fixed » Closed (fixed)

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