![]() |
Custom Category and Subcategory Menu Blocks
I am trying to create a custom menu block that displays depending on what the root category the user is browsing.
So far I have came up with a few ways to display the custom menu when they are in a specific category, but when they browse to a subcategory - the menu is gone. Here are the different ways I have found so far, but again it only works for the current category that they are in: Code:
{if $current_category.category eq "Livestock"} How can I create something like this, but will work acrosss the subcategories of the specific root category? Also there is only 3 root categories if that makes it simple... |
Please post your X-Cart version in your signature per the forum rules.
|
sorry, when I started using X-Cart it wasnt necessary. But its done now
|
I just did this for a client...let me dig up the code and post it for you.
|
thanks!
|
Where you able to dig it up? I really appreciate the help...
|
Still trying to find it....too many clients :)
|
Ok, here's the code you want:
Code:
{if $location[0].0 eq "Rootname"} Replace Rootname with the name of the root category you want it displayed for. If you have three root categories, all of which will show different menus, write it like this: Code:
{if $location[0].0 eq "Rootname"} Hope this helps! |
I had tried something like this, but it doesn't seem to work. Not sure whats up. Any ideas?
Code:
{if $location[0].0 eq "Livestock"} |
It must be something to do with Pro :( Try opening a ticket with X-Cart and see if they can assist....
|
Well we were close. Here is what works:
Code:
{if $location[1].0 eq "Livestock" } I am wanting to take it one step further and include certain pages also. For example: Code:
{if $location[1].0 eq "Livestock" or $smarty.get.pageid eq '1'} Which works, but I want to add mutiple pages. Like pageid 1,3,4,6,7,8 for the first section and 9, 10, 13, 14, etc for second section and so on and so forth. I'm not sure how to add the multiple pages without having to do them each separate. Like this - Code:
{if $location[1].0 eq "Livestock" or $smarty.get.pageid eq '1' or $smarty.get.pageid eq '3' or $smarty.get.pageid eq '4' or $smarty.get.pageid eq '6' .... This would get fairly messy. I'm looking for something more like this - Code:
{if $location[1].0 eq "Livestock" or $smarty.get.pageid eq '1,3,4,6,7,8'} Ideas? |
Re: Custom Category and Subcategory Menu Blocks
Can this code be modified to work based on the root category id?
Just curious |
Re: Custom Category and Subcategory Menu Blocks
Also, let's say I want to display .tpl file only on the product page for a specific product. Could something like this be written that would do this?
Ie. {if product id eq 1} {include customer/abd.tpl} {/if} Thanks for the help! |
Re: Custom Category and Subcategory Menu Blocks
OK, figured it out:
{if $product.productid eq '47'} {include file="yourfilename.tpl"} {/if} |
All times are GMT -8. The time now is 12:23 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.