| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
ALWAYS display first level subcats beneath root cats | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
ALWAYS display first level subcats beneath root cats
I've experimented with a couple of mods on here for this, which are really great mods, but people keep asking how to get the first level subcategories displayed beneath EVERY root category ALL the time like this:
Root category 1 - subcategory 1a - subcategory 1b - subcategory 1c Root category 2 - subcategory 2a - subcategory 2b - subcategory 2c Root category 3 - subcategory 3a - subcategory 3b - subcategory 3c So I adapted Fernandos mod to do it - it actually only required trimming it down and just adding an if statement to check each subcategory against the current root category id it's looping through. Below is my whole skin1/categories.tpl file which is the only thing that needs modding: Code:
The above is just a mod on the original x-cart template so there's no other stuff in there to confuse the issue.
__________________
-------------------------------------------- 4.0.14-gold_upgrade |
|||||||
|
#2
|
|||||||
|
|||||||
Good Job! Thanks for this mod!
- Shannon
__________________
- www.TheShotList.com X-Cart version 4.0.13 PHP 4.3.10 MySQL 4.0.23 Web server Apache Operation system Linux Perl 5.008004 XML parser (expat) 1.95.6 |
|||||||
#3
|
|||||||
|
|||||||
Nice first post! Many thanks.
__________________
xcartmods.co.uk |
|||||||
#4
|
|||||||
|
|||||||
menu mod
glad it helped
I think you can use Fancy Categories for this sort of thing, but considering how easy it is to do, it's worth just modding it. Also, while you're looping through the subcategories you can use their other values to do things like changing link locations or text styles etc - I used the categories position value to determine different hrefs.
__________________
-------------------------------------------- 4.0.14-gold_upgrade |
|||||||
#5
|
|||||||||
|
|||||||||
Great mod, keep in mind it loops through ALL of your categories many times over, so if you have a lot of categories this is going to be a LOT of overhead to your page loading. If that's the case for you, your better to run the mod, copy the html, and hard code them.
|
|||||||||
#6
|
|||||||
|
|||||||
loading
I have considered that yes, as I do have quite a few categegories, but saying that, am very happy with the speed of it.
But (and without actually figuring it out) you could probably break up the subcategories array or just loop through the relevant parts... anyone facy doing that...?
__________________
-------------------------------------------- 4.0.14-gold_upgrade |
|||||||
#7
|
|||||||||
|
|||||||||
No other way to do it via smarty alone, subcategories array only holds the subcategories of the current category.
|
|||||||||
#8
|
|||||||
|
|||||||
Quote:
Tell me about it.. I have about 50+ categories w/ 3 - 6 categories each.. .. I am going to do mine all static.... |
|||||||
#9
|
|||||||
|
|||||||
This mod is very helpful - however I am having trouble with one thing. I have a few root categories, some with sub and then sub-sub categories, others with no subs. I would like the root/sub/sub-sub categories from only one root at a time to appear on its respective page. For example:
Materials (root) Siding (sub) vinyl (sub sub) aluminum (sub sub) tiles (sub) shingles (sub) This appears on the materials.php page of the website. Another menu will appear on the services.php page. I am x-cart version 4 0 14. I would really appreciate any help with this, I'm super pleased with x-cart Gold so far and don't want to get stumped so as to not continue using it. Thanks for any suggestions!
__________________
Version 4.0.14 |
|||||||
#10
|
|||||||
|
|||||||
Thanks for the mod. Just what I was seeking, and there were only old posts for older versions. So thanks, ExoZed!!!
I modified your code so that all main categories will show on home page and when you click on a main category, only the subcats for that cat will show (and stay shown!) while the main categories will always show. I'm new to PHP and Smarty, so someone please check my code. Code:
__________________
4.1.5 Gold |
|||||||
|
|||
X-Cart forums © 2001-2020
|