View Single Post
  #4  
Old 01-22-2010, 09:10 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Link to parent/root cat

To show the parent of a subcategory:

Open home.php

FIND:

Code:
require $xcart_dir."/include/categories.php";


AFTER ADD:

Code:
// WCM - Get Parent Cat (customization) $wcmParentCat = func_query_first("SELECT categoryid,category FROM $sql_tbl[categories] WHERE categoryid='" . (int)$current_category['parentid'] . "'"); $current_category['parent_categoryid'] = $wcmParentCat['categoryid']; $current_category['parent_category'] = $wcmParentCat['category']; $smarty->assign('current_category',$current_category); // WCM - Get Parent Cat (customization)


In your template use:

Code:
{if $current_category.parent_categoryid gt 0} The parent category for this is: <a href="home.php?cat={$current_category.parent_categoryid}">{$current_category.parent_category}</a>. {/if}
Reply With Quote