![]() |
Subcategory Mods on 4.2.0
I've been struggling to find much info on here for modifying the categories menu to display subcategories on xcart 4.2.0.
I had 3 different requests. The first was probably the most common, which was that the client wanted the subcategories to appear as you clicked each category and to remain whilst they looked at products. The Second was to display the categories and subcategories all the time The Thirs was to display the categories and subcategories all the time but not be able to click on the categories (in effect they are just headings) To do this I used some code from on here for older versions and made some code up. For any of these you first need to let the pages have access to the subcategories. This is done by editing the file "include/categories.php" look for the following line: Code:
if (!empty($subcategories)) { and just before it add the following block of code: Code:
function func_getallsubcat(){ Once that has been added you just need to alter the customer/categories.tpl template file to tell it to use the new variable. For the first method I wrote the following code: Code:
{capture name=menu} For the second method I instead used the following code: Code:
{capture name=menu} And the third method was very similar to the second method and used the following code: Code:
{capture name=menu} Hopefully that will help someone else on version 4.2. I've not extensively tested it yet but it seemed to work fine. I only needed to use it with one level of subcategories so I've no idea if it will work with multiple levels. - I doubt it though! I made a style up which I put at the end of the main.css file - you can make your own up but here is mine: Code:
a.subMenuItem{ *update* I just tried adding a third level category ( a sub-subcategory ) and as I expected it won't show on the menu but will operate fine but the third level will show in the middle like the basic x-cart way does. |
Re: Subcategory Mods on 4.2.0
thank you sir - excellent :)
|
Re: Subcategory Mods on 4.2.0
I decided try 4.2 for my newest store, drop ship only, with about 2600 products in many subcategories, but only 2 main categories.
The difference I see in the default menu system for 4.2 was not expected, as I've been using a modified menu and forgot what the original was like. The default menu 4.2 menu system will not work well with my new store. I'm not as talented as artmat in coding, so I was considering going back to 4.1.x for the new store. Now I'll experiment with his code and see what it does for 4.2. I might consider Fancy Categories, but my prior experience with that is that is it not suitable for large stores due to speed issues. I previously tried it with 4.0.x stores, and gave up. Can anyone verify if Fancy Cats still has speed issues when dealing with large stores, and with 4.2 in particular? Also, I see new FREE skins are now posted for 4.2. See them at http://xcart-demo.qualiteam.biz/demo/home.php I appreciate the work you've done. Thanks for sharing! |
Re: Subcategory Mods on 4.2.0
ok question:
1) Dont you still want to show the subcategories in <li> form? 2) How can I do this and be able to have the subcategories basically indented from the main categories in <li> form? I would appreciate any help on this. |
Re: Subcategory Mods on 4.2.0
I suppose HTML produced by the this variant of subcategories.tpl wouldn't pass validation
Code:
{capture name=menu} It's better try like this Code:
{capture name=menu} Code:
.menu-categories-list ul li.subcat{ |
Re: Subcategory Mods on 4.2.0
VICTOR - You da man... Thanks a million.
|
Re: Subcategory Mods on 4.2.0
Victor - I'm sorry... Is there anyway of showing me what to use for his second model? Please.. I would really appreciate it.
|
Re: Subcategory Mods on 4.2.0
just the same (wrap links with li elements of the specific class and define this elements style in css):
Code:
{capture name=menu} |
Re: Subcategory Mods on 4.2.0
Thanks for the great work.
I tried to implement the changes but it won't show the sub-categories. I am not a strong programmer so pls forgive my ignorance. Do I need to put both a.subMenuItem{ display:block; margin-left:23px; text-decoration:none; } a.subMenuItem:hover{ text-decoration:underline; } and .menu-categories-list ul li.subcat{ /*Your extra styles for nested categories here*/ } In main.css, and if I do, what should be in place of /*Your extra styles for nested categories here*/ Are there any other settings that might prevent the subs showing up? Thanks |
Re: Subcategory Mods on 4.2.0
Did you modify include/categories.php according to the very first post in this thread?
I slightly improved the output of this mod, but the main work is described here http://forum.x-cart.com/showpost.php?p=244930&postcount=1 Please read it carefully If you choose my variant of template you can either use following lines or omit them if you don't want you subcats have a custom lookout. .menu-categories-list ul li.subcat{ /*Your extra styles for nested categories here*/ } F.e. if you want your subcat links to be red you should use .menu-categories-list ul li.subcat{ color:#ff0000; } |
All times are GMT -8. The time now is 07:52 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.