Link to parent/root cat
Hey guys, I know I've seen this somewhere before, but I can't find it, and can't remember how I did this. I have a couple of clients that need links directly to a products root category, and a sub-categories parent category. Any idea what the context would be for this? I tried playing with the location variable with no success. Thanks!
|
Re: Link to parent/root cat
To link to a products root category based on the location variable you can...
Open product.php FIND: Code:
$smarty->assign("product",$product_info); BEFORE ADD: Code:
// WCM - Assign Root Category In skin1/customer/main/product.tpl use: Code:
{if $product.root_category_link} |
Re: Link to parent/root cat
Sweet - that looks like it will work exactly the way I want! Thanks Jon! Any ideas on the parent cat for a sub-cat?
|
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) In your template use: Code:
{if $current_category.parent_categoryid gt 0} |
Re: Link to parent/root cat
Beautiful! Thanks a million Jon. Only tweak necessary was to change this:
<a href="home.php?cat={$current_category.parent_categ ory}"> to this: <a href="home.php?cat={$current_category.parent_categ oryid}"> Going to put this in the Custom Mods forum. FYI, this was tested on a 4.1.12 install. |
Re: Link to parent/root cat
Oops - thanks I've updated the instructions.
It will work on all versions 4.0-4.3. Versions prior to that didn't use the categoryid_path. |
Re: Link to parent/root cat
is there anyway to see this in action? I'm not sure I follow the description of the functionality and it sounds like something one of my clients want.
I'm using X-Cart 4.3 |
Re: Link to parent/root cat
It is just a simple link that links the user back to the product's root category.
|
Re: Link to parent/root cat
Hi Jon,
Im using 4.0.14 and the root category mod worked great thanks! However just tried the parent category part and that doesnt seem to show up - is there different coding for this version? Cheers, Chris |
Re: Link to parent/root cat
I'm trying to check for a parent category in product.tpl in version 4.4.1
Any idea how I would do that? None of the code above seems to match with the new version of x-cart. Thanks! Jenny |
All times are GMT -8. The time now is 04:46 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.