| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
4 Level SEO friendly Flyout Menus - 4.1.x compatible | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
4 Level SEO friendly Flyout Menus - 4.1.x compatible
Credit for this mod goes to Alltribes, as he posted the original code in this thread:
X-Cart 4.0.x flyout menus The code is cleaned up a bit, with an additional change to make it show all levels under 4.1.x (the original code, due to how 4.1.x operates, only displayed the categories at your current viewing level) ----------------- This uses an unordered list formatted with CSS, so you'll have a link on your front page to all your subcategories, which should boost their pagerank up to whatever pagerank your root level categories are. Just don't expent it to work overnight. This was tested in IE6(XP), IE7(XP), Firefox (XP&Linux), Konqueror(Linux), Opera (Linux) and Safari (OSX). First, create the directory 'menu' in your skin1 directory. The following code has had it's logic changed slightly from the original, to remove any redundant code & logic statements Inside that directory create menu.tpl and put in the following: Code:
Please note, the css styling below is styled specifically for alltribes.com, the creator of this mod. You'll need to change the styling to match your site Then create menu.css in the same directory with the following content: Code:
IE, being what it is, needs a little javascript help. So create menu.js in the same directory. Code:
Now edit /skin1/customer/home.tpl to add the new menu.tpl, a link to the CSS and js file. Add the following right before </head>: Code:
And replace: Code:
With: Code:
Also, you need to make sure this exists at the top of your /skin1/customer/home.tpl: Code:
For 4.1.x compatibility, open /home.php. Find: Code:
After, add: Code:
Cheers |
|||||||
#2
|
|||||||
|
|||||||
Re: 4 Level SEO friendly Flyout Menus - 4.1.x compatible
I've followed all the steps but so far all I see in the source is just
Code:
I've cleared the cache too. I suggest the following: Change Code:
Code:
I'll continue playing around with the code to see what went wrong but if you have any insight please let me know. EDIT: I don't see the absolute need for the bolded part because every category should have a categoryid (which is what I'm assuming you are checking for). However, I would recommend a check to see if that category is available (underlined) Code:
SECOND EDIT: Well, instead of using section, I changed it to foreach (along with some corresponding code changes to allow foreach to work) and it works. However, it's a bit inefficient because essentially you are looping over the $allcategories over and over to display anything with a matching parentid. Hopefully, I didn't use the counter wrong, I just incremented it once everytime the loops run. If you have a large amount of categories, it could hurt. Code:
Comparing with the other method I posted in the other thread (I'm still trying to figure out how and why it works because I can't seem to merge it with yours though they are almost identical) Code:
We can ignore the fact that yours run to the 4th level and the other method only runs to the 3rd level because you have Code:
To give you an idea of how our category structure works: 13 Root Categories. 3 Levels Deep. 47 Subcategories (basically level 2 and level 3 combined). Will you try both ways to see if you notice any difference? You should be able to just use it directly in menu.tpl.
__________________
4.1.8 |
|||||||
#3
|
|||||||
|
|||||||
Re: 4 Level SEO friendly Flyout Menus - 4.1.x compatible
A CSS recommendation:
Add the following to your menu.css (adjust as necessary) Code:
Then instead of just using the '+', you would do Code:
One thing I have to note is that the CSS is very well done and nicely documented! EDIT: Well, I figured out the difference between both versions. I overlooked one very tiny difference. You were using $allcategories for sublevels. The other method was using $allsubcategories. $allsubcategories is basically an array that lists each categories' subcategories which means X-Cart has already done the work somewhere and we shouldn't do it again (by traversing through all of $allcategories). Here are some actual numbers to let you see the efficiency of both methods. Using $allcategories and using the Smarty debug info, we have the following for menu/menu.tpl: Code:
Using $allsubcategories and using the Smarty debug info, we have the following for menu/menu.tpl: Code:
Here's what it finally looks like Code:
Code:
A good future enhancement would be to create a PHP or Smarty page that generates the TPL which will contain pure HTML and no Smarty code. This will be perfect for people who have a large amount of categories and subcategories. They can generate it every once in a while and use a static flyout to improve the performance. It can dynamically generate it each time a category is modified (requires extensive changes, have to find where categories are modified) or there could be a button (which would be better as long as users don't forget to run it when they change categories). Maybe I'll do it in the future. EDIT: Code update (7/25/2007). Removed "alt" tags since they are "proprietary to Netscape or Internet Explorer". Added the checks to see if the category is available. I'm going to ignore user's personal order for the time being. Put the symbol into a variable to allow easy modification for the future - it's a constant afterall :P
__________________
4.1.8 |
|||||||
#4
|
|||||||||
|
|||||||||
Re: 4 Level SEO friendly Flyout Menus - 4.1.x compatible
Without a doubt... No method in this thread seems to work for me on 4.1.8
I can get the floating, bloated, bolded, scattered, covered and smothered + sign. But there is never any flyout categories on mouseover Did you guys forget a step or something
__________________
Dedicated Server provided by EWD Hosting X-Cart version 4.1.12 PHP 5.3.2 MySQL server 5.0.87-community Operation system Linux Perl 5.008008 dogbytecomputer.com |
|||||||||
#5
|
|||||||
|
|||||||
Re: 4 Level SEO friendly Flyout Menus - 4.1.x compatible
Are you sure you followed all the instructions? Did you try clearing your cache (both browser's and Smarty's)?
__________________
4.1.8 |
|||||||
#6
|
|||||||||
|
|||||||||
Re: 4 Level SEO friendly Flyout Menus - 4.1.x compatible
Now I didn't clear my browser cache, but I did clear templates C
Every change I would make to code or css would appear on the page fine.... There just isn't any flyout category lists
__________________
Dedicated Server provided by EWD Hosting X-Cart version 4.1.12 PHP 5.3.2 MySQL server 5.0.87-community Operation system Linux Perl 5.008008 dogbytecomputer.com |
|||||||||
#7
|
|||||||||
|
|||||||||
Re: 4 Level SEO friendly Flyout Menus - 4.1.x compatible
I cleared everything but the server and the kitchen sink but still no luck... Here is what I have done
I created a folder within skin1 called menu In skin1/menu I added the following files I created a file named menu.tpl and placed the following code into it: Code:
I created a file named menu.css and placed the following code into it: (I think alltribes site is cool, so no slight to him, but I changed this) Code:
I created a file named menu.js and placed the following code into it: Code:
Just before </head> in customer/home.tpl I placed this code: Code:
And I replaced also in customer/home.tpl: Code:
With: Code:
I also made sure the following exists at the top of /skin1/customer/home.tpl: Code:
In /home.php I made the following changes: Find: Code:
After, add: Code:
OK... now you have it. Where did I go wrong?
__________________
Dedicated Server provided by EWD Hosting X-Cart version 4.1.12 PHP 5.3.2 MySQL server 5.0.87-community Operation system Linux Perl 5.008008 dogbytecomputer.com |
|||||||||
#8
|
|||||||||
|
|||||||||
Re: 4 Level SEO friendly Flyout Menus - 4.1.x compatible
A snippet of my page source... Note the absence of level 2+
Code:
I have done and redone the methods in this thread.... The best I can get is a goodlooking css menu that does not work any better than what was there
__________________
Dedicated Server provided by EWD Hosting X-Cart version 4.1.12 PHP 5.3.2 MySQL server 5.0.87-community Operation system Linux Perl 5.008008 dogbytecomputer.com |
|||||||||
#9
|
|||||||||
|
|||||||||
Re: 4 Level SEO friendly Flyout Menus - 4.1.x compatible
OK I tried this entire thread again from scratch just to make sure I'm not nuts.
If I use the code in intel352's post (post #1 of this thread). I don't even get a menu to show at all. At least with nevets1219's code I get a dang good looking category menu. But alas, there are still no flyout subcats to be seen. My source is still as it was in my earlier post. Maybe nevets1219 will look at the code I posted and find an obvious error when he signs on next.
__________________
Dedicated Server provided by EWD Hosting X-Cart version 4.1.12 PHP 5.3.2 MySQL server 5.0.87-community Operation system Linux Perl 5.008008 dogbytecomputer.com |
|||||||||
#10
|
|||||||||
|
|||||||||
Re: 4 Level SEO friendly Flyout Menus - 4.1.x compatible
Since I can't get an answer back on this one.... Does anyone know which is the best pay for solution for 250+ categories? Is it the new X-Cart fancycats 4.1.x version?
__________________
Dedicated Server provided by EWD Hosting X-Cart version 4.1.12 PHP 5.3.2 MySQL server 5.0.87-community Operation system Linux Perl 5.008008 dogbytecomputer.com |
|||||||||
|
|||
X-Cart forums © 2001-2020
|