Discussions

Strange Problem on Taxonomy View

Hy,

i have a really strange problem on the taxonomy product view. I cloned the standard taxonomy page and adjusted it. But when i try to set "Sort criteria"
the complete website gives out a white page of death...

I created a page--taxonomy--term--myterm.tpl.php, could that cause any problems, as it has the same url maybe?

I uploaded my settings from my taxonomy view, maybe someone knows how to fix that!!!

Posted: May 2, 2013

Comments

sammyfm on May 3, 2013

Of course, here is my view that creates the pages for all products related to the same "collection" type. Could the problem be the "paged view" as drupal maybe not know on a random order how to view the other pages?

......................................

Error log:

PHP Fatal error: Call to undefined method SearchApiViewsQuery::add_orderby() in /home/XXX/profiles/commerce_kickstart/modules/contrib/views/handlers/views_handler_sort_random.inc on line 15, referer: http://www.xxx/xxx/xxx

......................................

View:

$view = new view();
$view->name = 'display_products_by_taxonomy';
$view->description = 'Display all the products that are available, using Search API';
$view->tag = 'default';
$view->base_table = 'search_api_index_product_display';
$view->human_name = 'Display Products by Taxonomy';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = '%1';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '24';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['pager']['options']['expose']['items_per_page_label'] = 'Elemente pro Seite';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options'] = '24, 100';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options_all_label'] = '- Alle -';
$handler->display->display_options['pager']['options']['tags']['first'] = '« erste Seite';
$handler->display->display_options['pager']['options']['tags']['previous'] = '‹ vorherige Seite';
$handler->display->display_options['pager']['options']['tags']['next'] = 'nächste Seite ›';
$handler->display->display_options['pager']['options']['tags']['last'] = 'letzte Seite »';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['style_options']['row_class'] = 'product-list four columns mobile-four';
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['inline'] = array(
'field_images' => 'field_images',
'title' => 'title',
'commerce_price' => 'commerce_price',
);
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['area']['id'] = 'area';
$handler->display->display_options['empty']['area']['table'] = 'views';
$handler->display->display_options['empty']['area']['field'] = 'area';
$handler->display->display_options['empty']['area']['content'] = 'No results found for your search.
Check your spelling or try another term.';
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
/* Relationship: Indexed Node: Product */
$handler->display->display_options['relationships']['field_product']['id'] = 'field_product';
$handler->display->display_options['relationships']['field_product']['table'] = 'search_api_index_product_display';
$handler->display->display_options['relationships']['field_product']['field'] = 'field_product';
/* Field: Commerce Product: field_images */
$handler->display->display_options['fields']['field_images']['id'] = 'field_images';
$handler->display->display_options['fields']['field_images']['table'] = 'entity_commerce_product';
$handler->display->display_options['fields']['field_images']['field'] = 'field_images';
$handler->display->display_options['fields']['field_images']['relationship'] = 'field_product';
$handler->display->display_options['fields']['field_images']['label'] = '';
$handler->display->display_options['fields']['field_images']['exclude'] = TRUE;
$handler->display->display_options['fields']['field_images']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_images']['element_default_classes'] = FALSE;
$handler->display->display_options['fields']['field_images']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_images']['type'] = 'image_delta';
$handler->display->display_options['fields']['field_images']['settings'] = array(
'deltas' => '0',
'deltas_reversed' => 0,
'image_style' => 'product_medium',
'image_link' => '',
);
$handler->display->display_options['fields']['field_images']['delta_offset'] = '0';
/* Field: Indexed Node: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'search_api_index_product_display';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['exclude'] = TRUE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['link_to_entity'] = 0;
/* Field: Commerce Product: Price */
$handler->display->display_options['fields']['commerce_price']['id'] = 'commerce_price';
$handler->display->display_options['fields']['commerce_price']['table'] = 'entity_commerce_product';
$handler->display->display_options['fields']['commerce_price']['field'] = 'commerce_price';
$handler->display->display_options['fields']['commerce_price']['relationship'] = 'field_product';
$handler->display->display_options['fields']['commerce_price']['label'] = '';
$handler->display->display_options['fields']['commerce_price']['exclude'] = TRUE;
$handler->display->display_options['fields']['commerce_price']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['commerce_price']['click_sort_column'] = 'amount';
$handler->display->display_options['fields']['commerce_price']['type'] = 'commerce_price_formatted_amount';
$handler->display->display_options['fields']['commerce_price']['settings'] = array(
'calculation' => '0',
);
/* Field: Indexed Node: URL */
$handler->display->display_options['fields']['url']['id'] = 'url';
$handler->display->display_options['fields']['url']['table'] = 'search_api_index_product_display';
$handler->display->display_options['fields']['url']['field'] = 'url';
$handler->display->display_options['fields']['url']['label'] = '';
$handler->display->display_options['fields']['url']['exclude'] = TRUE;
$handler->display->display_options['fields']['url']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['url']['display_as_link'] = FALSE;
$handler->display->display_options['fields']['url']['link_to_entity'] = 0;
/* Field: Global: Custom text */
$handler->display->display_options['fields']['nothing']['id'] = 'nothing';
$handler->display->display_options['fields']['nothing']['table'] = 'views';
$handler->display->display_options['fields']['nothing']['field'] = 'nothing';
$handler->display->display_options['fields']['nothing']['label'] = '';
$handler->display->display_options['fields']['nothing']['alter']['text'] = '
[field_images]
[title]
[commerce_price]
';
$handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
/* Contextual filter: Indexed Node: Collection */
$handler->display->display_options['arguments']['field_collection']['id'] = 'field_collection';
$handler->display->display_options['arguments']['field_collection']['table'] = 'search_api_index_product_display';
$handler->display->display_options['arguments']['field_collection']['field'] = 'field_collection';
$handler->display->display_options['arguments']['field_collection']['default_action'] = 'not found';
$handler->display->display_options['arguments']['field_collection']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['field_collection']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['field_collection']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['field_collection']['validate']['type'] = 'taxonomy_term';
$handler->display->display_options['arguments']['field_collection']['validate_options']['vocabularies'] = array(
'collection' => 'collection',
);
$handler->display->display_options['arguments']['field_collection']['break_phrase'] = 0;
/* Filter criterion: Indexed Node: Item language */
$handler->display->display_options['filters']['search_api_language']['id'] = 'search_api_language';
$handler->display->display_options['filters']['search_api_language']['table'] = 'search_api_index_product_display';
$handler->display->display_options['filters']['search_api_language']['field'] = 'search_api_language';
$handler->display->display_options['filters']['search_api_language']['value'] = array(
'current' => 'current',
);
/* Filter criterion: Indexed Node: Status */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'search_api_index_product_display';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = array(
1 => '1',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['path'] = 'taxonomy/term/%';
$handler->display->display_options['menu']['title'] = 'All products';
$handler->display->display_options['menu']['weight'] = '50';
$handler->display->display_options['menu']['name'] = 'main-menu';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['tab_options']['weight'] = '0';
$translatables['display_products_by_taxonomy'] = array(
t('Master'),
t('%1'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Elemente pro Seite'),
t('- Alle -'),
t('Offset'),
t('« erste Seite'),
t('‹ vorherige Seite'),
t('nächste Seite ›'),
t('letzte Seite »'),
t('No results found for your search.
Check your spelling or try another term.'),
t('Product'),
t('
[field_images]
[title]
[commerce_price]
'),
t('All'),
t('Page'),
);

sammyfm on May 3, 2013

So this is the code that´s causing the problem:

In line 15 of views_handler_sort_random.inc
...........................

$this->query->add_orderby('rand');

...........................

sammyfm on May 3, 2013

Ok, making my way through the things i tried the following:

1. Set up a "content" view that gets all products

vs.

2. Set up a "product display" view that get´s all products.

In case 1 the random function works perfect BUT i noticed the facet-api is missing. In case 2 the random version still does not work.
I think this is a problem of facet-api that seems to crash that habit. Could that be?