Discussions

How to do Taxonomy pages header like Collection pages layout

Hi all

Afeter solved the problem about allows the view "Collection Taxonomy" to display both "collection" and "taxonomy" (solving Taxonomy Menu issue) , now i'd like to obtain this result:

Collection (product list) has an image background on view header, and it's rendered by
view "Header->Global View:Area" and

<?php if ($header): ?>
  <div class="view-header" <?php if (isset($collection_image_url) && !empty($collection_image_url)): print 'style="background-image: url(' . $collection_image_url . ');"'; endif; ?>>
    <?php print $header; ?>

in the "views-view--collection-taxonomy-term--page-1.tpl.php" file

I wish to have background image also in Taxonomy pages (each item with own image) . Do you think will be possible?

And if , how to ?
Thanks to all

Posted: Sep 11, 2012

Comments

bigode on April 11, 2013

Para corrigir basta fazer um hook no template.php

<?php
/**
 * Implements hook_preprocess_views_view().
 *
 * Add collection term as view header.
 */
function omega_kickstart_preprocess_views_view(&$vars) {
 
$view = $vars['view'];
  if (
$view->name == 'collection_products') {
    if (
$view->current_display == 'page') {
     
// Keep the previous theming.
     
$vars['classes_array'][] = 'view-collection-taxonomy-term';
     
$tid = $view->args['0'];
     
$term = taxonomy_term_load($tid);
     
$vars['collection_title'] = $term->name;
     
$vars['collection_image_url'] = NULL;
      if (!empty(
$term->field_imagem) && !empty($term->field_imagem[LANGUAGE_NONE][0]['uri'])) {
       
$vars['collection_image_url'] = file_create_url($term->field_imagem[LANGUAGE_NONE][0]['uri']);
      }
    }
  }
}
?>

colocar o nome correto do campo que foi criado na taxonomia.

Valeuuu!!!!!!!!!!!!!