I am working on an Ubercart store with several products with a hierarchy of categories.

I'm wondering if it is possible to add a description at the top of the catalog page for each category?

I know that each category is a taxonomy term with which I can set its description, but I can't see any way of displaying that. I've also looked at the option of using a custom block and using a token in the block body but tokens don't seem to be recognised in the block's body.

Any ideas?

Thanks, Alan


In the catalog view, enable a Global:Text area in the Header, and set the input filter to PHP code.

The following code will print the term description and any associated taxonomy image in the view header.

$view = views_get_current_view();
$tid = $view->args[0];
$description = "";

if ( is_numeric( $tid ) ) {
  $term = taxonomy_term_load($tid);

  $description = $description . "<div class='term-description'>";

  if (isset($term->uc_catalog_image['und'][0]['uri'] )) {
     $description = $description . "<img src='" . image_style_url( 'uc_product_list', $term->uc_catalog_image['und'][0]['uri']) . "' class='term-image' /> ";

  if (module_exists('i18n_taxonomy') && i18n_taxonomy_vocabulary_mode($term->vid) == I18N_MODE_LOCALIZE) {
    $description = $description . i18n_string("taxonomy:term:$term->tid:description", $term->description);
  } else {
    $description = $description . $term->description;
  $description = $description . "</div>";
  print $description;
  • Thanks, this looks promising. I've managed to create the global text area but how do I set the input filter to the PHP code? – Alan Spark Mar 6 '13 at 15:58
  • Got it. I didn't have the PHP code filter module turned on. – Alan Spark Mar 6 '13 at 16:04
  • Under the text input box you will find a dropdown list labelled 'Text Format'. One of the items will be PHP Code if you have that filter available. If not, enable the core module (PHP Filter) under /admin/modules, and make sure you have permission. – Triskelion Mar 6 '13 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.