Problemi su una vista
Ciao a tutti, ho un problema relativo ad una vista.
Ho alcuni prodotti che sono associati a più vocabolari di tassonomia (nell'esempio della vista ad una famiglia e ad una categoria) e deve essere visualizzata una vista che filtri i prodotti prima per la famiglia e poi per la categoria associata a quella famiglia in cui siano presenti dei prodotti. Aggiungo un'immagine per rappresentare al meglio al mia problematica e la parte che sono riuscito a raggiungere al momento
L'esportazione della vista è questa:
$view = new view();
$view->name = 'collection_products';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'search_api_index_product_display';
$view->human_name = 'Collection products';
$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['use_more_text'] = 'altro';
$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['exposed_form']['options']['submit_button'] = 'Applica';
$handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Ripristina';
$handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Ordina per';
$handler->display->display_options['exposed_form']['options']['sort_desc_label'] = 'Disc';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'list';
$handler->display->display_options['style_options']['grouping'] = array(
0 => array(
'field' => 'name',
'rendered' => 1,
'rendered_strip' => 0,
),
);
$handler->display->display_options['style_options']['class'] = 'products-per-collection';
$handler->display->display_options['row_plugin'] = 'fields';
/* Intestazione: Globale: Area della vista */
$handler->display->display_options['header']['view']['id'] = 'view';
$handler->display->display_options['header']['view']['table'] = 'views';
$handler->display->display_options['header']['view']['field'] = 'view';
$handler->display->display_options['header']['view']['view_to_insert'] = 'collection_products:block_1';
$handler->display->display_options['header']['view']['inherit_arguments'] = TRUE;
/* Relazione: Category */
$handler->display->display_options['relationships']['field_category']['id'] = 'field_category';
$handler->display->display_options['relationships']['field_category']['table'] = 'search_api_index_product_display';
$handler->display->display_options['relationships']['field_category']['field'] = 'field_category';
$handler->display->display_options['relationships']['field_category']['ui_name'] = 'Category';
$handler->display->display_options['relationships']['field_category']['label'] = 'Categoria';
/* Campo: Termine della tassonomia: Nome */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'entity_taxonomy_term';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['relationship'] = 'field_category';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['exclude'] = TRUE;
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['name']['link_to_entity'] = 0;
/* Campo: Contenuto: Rendered Nodo */
$handler->display->display_options['fields']['rendered_entity']['id'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['table'] = 'views_entity_node';
$handler->display->display_options['fields']['rendered_entity']['field'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['label'] = '';
$handler->display->display_options['fields']['rendered_entity']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['rendered_entity']['link_to_entity'] = 1;
$handler->display->display_options['fields']['rendered_entity']['display'] = 'view';
$handler->display->display_options['fields']['rendered_entity']['view_mode'] = 'product_list';
/* Criterio di ordinamento: Category: Nome (indexed) */
$handler->display->display_options['sorts']['field_category_name']['id'] = 'field_category_name';
$handler->display->display_options['sorts']['field_category_name']['table'] = 'search_api_index_product_display';
$handler->display->display_options['sorts']['field_category_name']['field'] = 'field_category_name';
/* Filtro contestuale: Indexed Nodo: 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']['exception']['title'] = 'Tutti';
$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']['summary_options']['grouping'] = array(
0 => array(
'field' => 'name',
'rendered' => 1,
'rendered_strip' => 0,
),
);
$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;
/* Criterio del filtro: Indexed Nodo: Stato */
$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',
);
$handler->display->display_options['filters']['status']['group'] = 1;
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = '%1';
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Campo: Termine della tassonomia: Nome */
$handler->display->display_options['fields']['name_1']['id'] = 'name_1';
$handler->display->display_options['fields']['name_1']['table'] = 'entity_taxonomy_term';
$handler->display->display_options['fields']['name_1']['field'] = 'name';
$handler->display->display_options['fields']['name_1']['relationship'] = 'field_category';
$handler->display->display_options['fields']['name_1']['label'] = '';
$handler->display->display_options['fields']['name_1']['exclude'] = TRUE;
$handler->display->display_options['fields']['name_1']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['name_1']['link_to_entity'] = 0;
$handler->display->display_options['fields']['name_1']['replace_spaces'] = TRUE;
/* Campo: Termine della tassonomia: Nome */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'entity_taxonomy_term';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['relationship'] = 'field_category';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['exclude'] = TRUE;
$handler->display->display_options['fields']['name']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['name']['alter']['text'] = '
[name]
';
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['name']['link_to_entity'] = 0;
/* Campo: Contenuto: Rendered Nodo */
$handler->display->display_options['fields']['rendered_entity']['id'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['table'] = 'views_entity_node';
$handler->display->display_options['fields']['rendered_entity']['field'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['label'] = '';
$handler->display->display_options['fields']['rendered_entity']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['rendered_entity']['link_to_entity'] = 0;
$handler->display->display_options['fields']['rendered_entity']['display'] = 'view';
$handler->display->display_options['fields']['rendered_entity']['view_mode'] = 'product_list';
/* Campo: Termine della tassonomia: Conteggio dei nodi */
$handler->display->display_options['fields']['node_count']['id'] = 'node_count';
$handler->display->display_options['fields']['node_count']['table'] = 'entity_taxonomy_term';
$handler->display->display_options['fields']['node_count']['field'] = 'node_count';
$handler->display->display_options['fields']['node_count']['relationship'] = 'field_category';
$handler->display->display_options['fields']['node_count']['link_to_entity'] = 0;
$handler->display->display_options['path'] = 'collection/%';
/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['defaults']['css_class'] = FALSE;
$handler->display->display_options['css_class'] = 'collection-terms';
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'list';
$handler->display->display_options['style_options']['grouping'] = array(
0 => array(
'field' => 'name_1',
'rendered' => 0,
'rendered_strip' => 0,
),
);
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['header'] = FALSE;
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Campo: Termine della tassonomia: Nome */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'entity_taxonomy_term';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['relationship'] = 'field_category';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['exclude'] = TRUE;
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['name']['link_to_entity'] = 0;
$handler->display->display_options['fields']['name']['replace_spaces'] = TRUE;
/* Campo: Termine della tassonomia: Nome */
$handler->display->display_options['fields']['name_1']['id'] = 'name_1';
$handler->display->display_options['fields']['name_1']['table'] = 'entity_taxonomy_term';
$handler->display->display_options['fields']['name_1']['field'] = 'name';
$handler->display->display_options['fields']['name_1']['relationship'] = 'field_category';
$handler->display->display_options['fields']['name_1']['label'] = '';
$handler->display->display_options['fields']['name_1']['exclude'] = TRUE;
$handler->display->display_options['fields']['name_1']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['name_1']['alter']['text'] = '[name_1]';
$handler->display->display_options['fields']['name_1']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['name_1']['link_to_entity'] = 0;
/* Campo: Globale: Testo personalizzato */
$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']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['nothing']['hide_empty'] = TRUE;
$translatables['collection_products'] = array(
t('Master'),
t('%1'),
t('altro'),
t('Applica'),
t('Ripristina'),
t('Ordina per'),
t('Asc'),
t('Disc'),
t('Categoria'),
t('Tutti'),
t('Page'),
t('
[name]
'),
t('Conteggio dei nodi'),
t('.'),
t(','),
t('Block'),
t('[name_1]'),
);
La modifica da effettuare sarebbe la seguente , filtrare solo i primi 4 prodotti ( Select top 4 * ) associati alla categoria in modo random ( order by NewId() ) in modo da poter , in modo retorico, dare almeno 1 possibilità di visualizzazione ad ogni prodotto.
Grazie mille
Allegato | Dimensione |
---|---|
Vista.jpg | 59.86 KB |