You are here

function uc_catalog_link_alter in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_catalog/uc_catalog.module \uc_catalog_link_alter()

Implementation of hook_link_alter().

Rewrite taxonomy term links to point to the catalog.

File

uc_catalog/uc_catalog.module, line 317
Übercart Catalog module.

Code

function uc_catalog_link_alter(&$node, &$links) {

  // Link back to the catalog and not the taxonomy term page
  foreach ($links as $module => $link) {
    if (strstr($module, 'taxonomy_term')) {
      $tid = explode('_', $module);
      $tid = $tid[2];
      $term = taxonomy_get_term($tid);
      if ($term->vid == variable_get('uc_catalog_vid', 0)) {
        $links[$module]['href'] = uc_catalog_path($term);
      }
    }
  }
}