Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

coolMenu


Keyser Soze

Recommended Posts

Anyone figured out a good way to speed up the running of this code?  I've installed the menu and gotten it working properly, but it substantially increases page load time, and I'm afraid it will run off impatient prospective customers.  I've checked out a few of the links to live sites running the coolmenu (including that of the author), and those sites seem to be pretty speedy.  I noticed a few other people complaning about page load times, but haven't seen any solutions.  If I can't get it to work any faster, I guess I'll have to abandon it...which I'd rather not have to do, as I really like the menu. Any suggestions?

 

I'm with you on this one bud - it seems that if you have a lot of products/categories your page size shoots up.

 

My index page after this mod has increased to over 130kb :o

 

Has anyone found a way of caching the menu once it's been loaded, or is this mod just a no-go for larger stores?

 

Thx,

 

Dan

Link to comment
Share on other sites

  • Replies 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

I'm with you on this one bud - it seems that if you have a lot of products/categories your page size shoots up.

 

My index page after this mod has increased to over 130kb  :o

 

Has anyone found a way of caching the menu once it's been loaded, or is this mod just a no-go for larger stores?

 

Thx,

 

Dan

 

I have found these comments about speed issues rather interesting. I've used the menu on a few shops and can honestly say that I haven't really found speed to be a problem.

 

It may not be just the menu, but also the amount of images that you have on your page and of course the size of the images.

 

If it is the menu however, I wouldn't have thought it would be the size of the code which would be slowing things down but instead the amount of processing the javascipt is running to actually create the menu on the fly. (processing plus downloading at the same time)

 

One thing that you may wish to look at is where the menu is actually created.

 

I haven't actually tried this myself, so make sure you back everything up first and double check everything before going live but how about moving the oCMenu.construct() call to the onload section of the document.

 

This is the code, which I believe actually starts the javascript to make the menu in the first place.

 

This command is normall called as the last thing in the (includes/coolmenu.php) file, but it doesn't have to be there.

 

Try moving it to the function call to the body tag of your document.

 

ie: <body variables etc... onLoad="oCMenu.construct()"

 

As I say, don't know if it will help the situation, but if you have the time, why not give it a go.

 

Try first of all with your index.php file and if that works better, put the command into all of the required pages in your shops catalogue folder.

 

 

Mark.

Link to comment
Share on other sites

It may not be just the menu, but also the amount of images that you have on your page and of course the size of the images.

 

 

Thanks Mark - I've pulled the CoolMenu section of the code into notepad and it's 116kb on it's own :o

 

That said, I've also run the same page with JS disabled, and although the code is still being loaded (but not executed) the load speed is a fair bit better - nothing like the non-coolmenu version though :(

 

I'll try your fix and see what happens - thanks again ;)

 

Dan

Link to comment
Share on other sites

LOL - pageload was much faster, but only because the menu had stopped working :blush:

 

Page appears ok - menu is visible, but onmouseover etc has no effect - dead menu :(

 

I am an idiot - I'd forgotten to remove the call from the coolmenu.php :blush:

 

right - page loads *seems* better to be honest - at least the other page elements are loading in the background rather than waiting for the menu code to drop in :)

 

Mark - which other pages would be required in the catalog folder? all of them?

 

Thx,

 

Dan :blink:

Link to comment
Share on other sites

I am an idiot - I'd forgotten to remove the call from the coolmenu.php :blush:

 

right - page loads *seems* better to be honest - at least the other page elements are loading in the background rather than waiting for the menu code to drop in :)

 

Mark - which other pages would be required in the catalog folder? all of them?

 

Thx,

 

Dan  :blink:

 

Hi Dan,

 

Most of them really.

 

All of the pages which are shown to the user at some point would need to be amended.

 

I still can't believe that the coolmenu size is that big. You must have a considerable amount of categories and subcategories, just for perspective, I've done exactly the same as you and copied the menu code into notepad and my file size was 15K.

 

Mark.

Link to comment
Share on other sites

Hi Dan,

 

Most of them really.

 

All of the pages which are shown to the user at some point would need to be amended.

 

I still can't believe that the coolmenu size is that big.  You must have a considerable amount of categories and subcategories, just for perspective, I've done exactly the same as you and copied the menu code into notepad and my file size was 15K.

 

Mark.

 

Thanx Mark - I think I'm just about there with it now - currently looking at the skin for my shop :blink:

 

My catalog is pretty big - somewhere over 1600 items, several in multiple categories (my EP file has over 3200 rows :'( )

 

Certainly not a project for the faint-hearted, and I'd be absolutely lost without this forum :thumbsup: :blush:

 

Cheers,

 

Dan

Link to comment
Share on other sites

Damn - been working away happily in FireFox and all was well.

 

Decided to do a quick cross browser check for IE6 - kaput :(

 

The Layer does not Exist (oCMenubbar-0) -

If your using Netscape please check the nesting of your tags (on the entire page)

Nest:doc.layers.oCMenubbar.

 

Looks like the 'fix' was fine in FF, but IE can't handle it?

 

The debug box then shows a million "oCMenu is undefined" errors :(

 

Time to undo the fix, or have I missed something? :)

 

Dan

Link to comment
Share on other sites

Damn - been working away happily in FireFox and all was well.

 

Decided to do a quick cross browser check for IE6 - kaput :(

Looks like the 'fix' was fine in FF, but IE can't handle it?

 

The debug box then shows a million "oCMenu is undefined" errors :(

 

Time to undo the fix, or have I missed something? :)

 

Dan

 

hm, something not quite right if you are getting that kind of message.

 

But I wouldn't undo it. At the end of the day, all you have done is change where the function is called.

 

I would imagine, something else is wrong somewhere.

 

Do you want to send me a pm of the url and I'll have a little look.

 

Mark.

Link to comment
Share on other sites

:D hi all :D

 

just a quickie on this..

 

When using coolmenu and clicking a link, the little progress meter at the bottom if IE starts to move as normal, but if the menu closes (by moving the mouse away) before the page has changed then the IE bar disappears, yet the page still moves on to the new one after its been processed...

 

on a slow site such as mine (due to having 16000 products) it can give the impression to the viewer that the menu click has failed.

 

is there a way round this? You can see what i mean at the site... The Tool Shop

Edited by adiwillow
Link to comment
Share on other sites

Hi Adi,

 

I think it's just taking the database a while to parse your query - although it certainly wasn't unacceptably slow on my 512k connection, and in Firefox at least the progress bar kept going while I was being transported :)

 

Quick threadjack though - which parameter did you alter to change the vertical offset on your 2nd level categories to keep them reasoanbly high in the screen?

 

Thx,

 

Dan :)

Link to comment
Share on other sites

The offset you saw was a badly working version of a fit to screen mod, and shoudnt have actually looked like that.

 

The proper fit to screen mod is now working properly if you take another look.

For some reason when i removed some of the commented sections from my sts files it alters my page check, and makes the menu offset as you saw.

 

Anyway, to get the pagecheck size mod i added this to the bottom of menu_animation.js , taken from the main coolmenu website contrib section. You really want to check out the main coolmenu website as it has some good simple addins for the js files.

 

/*******************************************************
CM_ADD-IN - pagecheck_AW 
Just add this code to the end of the coolmenus js file.
********************************************************/
makeCM.prototype.onshow+=";this.pagecheck(b,pm,pm.subx,pm.suby,maxw,maxh,pm.lev)"
makeCM.prototype.pagecheck=function(b,pm,x,y,w,h,n,l){
ok=0; 
l=pm.lev+1
a=b.align; if(!n) n=1
oldpmalign=pm.align;
this.getcoords(pm,this.l[l-1].borderX,this.l[l-1].borderY,pm.b.x,pm.b.y,w,h,this.l[l-1].offsetX,this.l[l-1].offsetY)
if(ok==1){pm.align=oldpmalign;}
x1=pm.subx; y1=pm.suby

if(x1+w>cmpage.x2-40){x1=pm.b.x-w-this.l[l-1].offsetX; y1=pm.b.y+pm.o.y+this.l[l-1].offsetY; }
if(x1<cmpage.x){x1=cmpage.x;}
if(y1<cmpage.y){y1=cmpage.y;}
if(h+y1>cmpage.y2-15){
yold=y1;y1=(y1-(h/2));
if(y1+h>cmpage.y2){y1=cmpage.y2-h;}
if(y1<cmpage.y){y1=cmpage.y;}
if(y1<yold-h){y1=yold-h+10;}
}
b.moveIt(x1,y1) 
}

Edited by adiwillow
Link to comment
Share on other sites

Thanks Adi - that's helped me a lot :)

 

I'd had a good sniff though there - I picked up the onClick behavours etc to allow the screen to scroll with a long menu open, but your mod helps even more :D

 

Cheers,

 

Dan

Edited by Geordiedan
Link to comment
Share on other sites

hi just installed cool menu, but having a big problem, i followed all the instructions given.

 

nothing shows up in the categories area, although my old products are still on there.

 

see my site www.deviltronics.com

 

please help

Edited by blagger
Link to comment
Share on other sites

anyone now how to remove the lines in the subcategories that separate the text.

 

I have done it in the main menu but just changing the colour of the whole border and lines to white.

 

but on th esubcategories i want to keep the border and want to get rid of the lines.

 

anyone know how.

 

i know its in the coolmenu.php but where?

Link to comment
Share on other sites

Check out the borderX and borderY settings in the subcat section:

 

  oCMenu.level[0]=new cm_makeLevel()
 oCMenu.level[0].width=150
 oCMenu.level[0].height=20
 oCMenu.level[0].regClass="clLevel0"
 oCMenu.level[0].overClass="clLevel0over"
 oCMenu.level[0].borderX=1
 oCMenu.level[0].borderY=1
 oCMenu.level[0].borderClass="clLevel0border"
 oCMenu.level[0].offsetX=0
 oCMenu.level[0].offsetY=0
 oCMenu.level[0].rows=0
 oCMenu.level[0].arrow="images/arrow.gif"
 oCMenu.level[0].arrowWidth=11
 oCMenu.level[0].arrowHeight=11
 oCMenu.level[0].align="right"

 

Dan ;)

Edited by Geordiedan
Link to comment
Share on other sites

Hmm strange one for you..

 

Does anyone know how to restrict the catergories displayed to a signle sublevel?

 

So at the minute I have my levels as:

 

Manufacturer > Model > Product

 

I'd like to try switching off Product to see if it helps my page load times.

 

Tried the obvious "change sub categories to 1" but that hasn't worked at all..

 

Dan

Link to comment
Share on other sites

define('SUB_CATEGORIES','4');

 

appears to be completely pointless - what is it supposed to do??

 

Hi Dan,

 

That line is only used for a loop in defining the style of boxes.

 

The function tep_get_categories (in functions/general.php), which is called from the coolmenu.php include file is what creates the categories loop.

 

You don't want to be changing this function because it is used in other areas of the shop however, you can make a copy of it and then add a counter to it to make it only go down two levels.

 

Try adding the following function into your general.php file.

 

  function tep_get_categories_two($categories_array = '', $parent_id = '0', $indent = '', $loopstopper = 1) {
   global $languages_id;

   if (!is_array($categories_array)) $categories_array = array();

   $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
   while ($categories = tep_db_fetch_array($categories_query)) {
     $categories_array[] = array('id' => $categories['categories_id'],
                                 'text' => $indent . $categories['categories_name']);

	 if ($parent_id ==0){
   $loopstopper = 1;
	 }else{
   $loopstopper++;
	 }

     if ($categories['categories_id'] != $parent_id) {
	 if ($loopstopper < 2) { // max 2 links down, stops loops.
         $categories_array = tep_get_categories_two($categories_array, $categories['categories_id'], $indent . '  ', $loopstopper);
       }
}
   }

   return $categories_array;
 }

 

Then change the line in your coolmenu.php to say:

 

$categories = tep_get_categories_two('');

 

Its a rather crude method, but it works.

 

Regards

 

Mark.

Link to comment
Share on other sites

i have installed the all products conrtub, which works fine apart from one thing!

 

when i got to my all_products page the cool menu dissapears and leaves an empty categories box. when i go out of the all_products page everything goes back to normal.

 

any one had the same problem?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...