Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

coolMenu


Keyser Soze

Recommended Posts

Does anyone know how to include images in the top menu category?

 

I would like to have images in the menu. just for the top categories. How would one change the coolmenu.php code to do so?

 

In the coolmenu javascript downloaded from dhtmlcentral.com the menus are specified as:

 

oCMenu.makeMenu('top','','','index.php','',125,20,'images/home_button.gif','images/home_button_on.gif')

Link to comment
Share on other sites

  • Replies 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

It's very easy to center the coolmenus in the header as well.

 

Just put the menu into a div like:

 

<div id="menu"><!-- coolMenu //-->

<?php require(DIR_WS_INCLUDES . 'coolmenu.php'); ?>

<!-- coolMenu_eof //--></div>

 

and add this to your stylesheet (meets my specifications of a menu row):

#menu {position:absolute; width:768px; height: 20px; z-index:1000; left: 50%; top: 103px; margin-left: -384px;}

It's the margin-left that needs to be "-" (minus) your layer width..

Link to comment
Share on other sites

Ok, I've been working on this for a while now...

 

I was able to add additional menu items in my menu row...such as a home button image, about us button image, contact button image, search button image, shopping cart button image, checkout button image...

 

The about us button image has drop down items (that needs to be manually added)

 

I did this as follows:

// ---

echo "oCMenu.makeMenu('A','',' Home','index.php','',125,20,'images/home_button.gif','images/home_button_on.gif')n";

echo "oCMenu.makeMenu('B','',' About us','about_us.php','',137,0,'images/about_us_button.gif','images/about_us_button_on.gif')n";

 echo "oCMenu.makeMenu('B1','B','About us','about_us.php','',135,0)n";

 echo "oCMenu.makeMenu('B2','B','Shipping & Returns','shipping.php','',135,0)n";

 echo "oCMenu.makeMenu('B3','B','Privacy Notice','privacy.php','',135,0)n";

 echo "oCMenu.makeMenu('B4','B','News','news.php','',135,0)n";

 echo "oCMenu.makeMenu('B5','B','Photo Gallery',gallery.php','',135,0)n";

 echo "oCMenu.makeMenu('B6','B','','','',135,1,'images/pixel_black.gif','images/pixel_black.gif')n";

 

function print_menu_line($categories, $depth_size,$depth_parentid, $depth) {

 

 $size=0;

 for($i=0; $depth_size[$i]!=0; $i++) {

  $size++;

 }

 

 

 

 echo "oCMenu.makeMenu('";

 

 if ($depth == 0) {

  echo "top" . '_'.$depth_size[0] . "','','";

 } else if ($depth == 1) {

  echo "sub" .'_'.$depth_size[0] .'_'. $depth_size[1] . "','top" .'_'. $depth_size[0] . "','";

 } else { // $depth < 1

  echo "sub";

  for ($i=0; $i<$size; $i++) {

   echo ($depth_size[$i] != 0) ? '_'.$depth_size[$i] : '_';

  }

  echo "','sub";

  for ($i=0; $i<$size-1; $i++) {

   echo ($depth_size[$i] != 0) ? '_'.$depth_size[$i] : '_';

  }

  echo "','";

 }

 echo $categories['text'];

 if (SHOW_COUNT == 'true') {

  $products_in_category = tep_count_products_in_category($categories['id']);

  if ($products_in_category > 0) {

   echo "<FONT COLOR="#c0c0c0">  (" . $products_in_category . ")</FONT>";

  }

 }

 

       $cPathNew = "cPath=";

 for ($i=0; $i<$size-1; $i++) {

  $cPathNew .= ($depth_size[$i] != 0) ? $depth_parentid[$i].'_':'';

       }

       $cPathNew .= $categories['id'];

 echo "','" . tep_href_link(FILENAME_DEFAULT,$cPathNew) . "','',98,20,'images/products_button.gif','images/products_button_on.gif')n";

 

}

 

 

 

// ---

 

 

$categories = tep_get_categories('');

 

$height.= 2.65*count($categories);

 

$depth=0;

$blank_length;

$depth_size;

$depth_parentid;

 

for($i=0; $i<count($categories); $i++) { // don't insert 1st entry ("please choose ...")

 $blank_length = blank_length($categories[$i]['text']);

 

 if($blank_length == $depth) {

  $categories[$i]['depth'] = $depth;

  $depth_size[$depth]++;

 } else if ($blank_length > $depth) {

  $depth++;

  $categories[$i]['depth'] = $depth;

  $depth_size[$depth]++;

 } else if ($blank_length < $depth) {

  for ($j=$depth; $j>$blank_length; $j--) {

   $depth_size[$j] = 0;

   $depth--;

  }

  $categories[$i]['depth'] = $depth;

  $depth_size[$depth]++;

 

 }

        $depth_parentid[$categories[$i]['depth']] = $categories[$i]['id'];

 

 // remove blanks

 $categories[$i]['text'] = substr($categories[$i]['text'], 12*$blank_length);

 

 print_menu_line($categories[$i], $depth_size,$depth_parentid, $depth);

}

 

echo "oCMenu.makeMenu('D','',' Contact','contact_us.php','',127,20,'images/contact_button.gif','images/contact_button_on.gif')n";

 

echo "oCMenu.makeMenu('E','',' Search','advanced_search.php','',116,20,'images/search_button.gif','images/search_button_on.gif')n";

 

echo "oCMenu.makeMenu('F','',' Cart','shopping_cart.php','',77,20,'images/cart_button.gif','images/cart_button_on.gif')n";

 

echo "oCMenu.makeMenu('G','',' Checkout','checkout_shipping.php','',88,20,'images/checkout_button.gif','images/checkout_button_on.gif')n";

?>  

 

 // create menu

 oCMenu.construct()

 

added stuff is in red...

 

I figured that the menu items and links of the about_us page wouldn't really change.

 

With the addition I did to the products menu item...I am getting the button image added. Howevere AND UNFORTUNATELY I am getting that same button image added to all of the sub-menu items.

 

I'm working on trying to solve this...

 

If anyone has an idea I would surely appreciate it!

Link to comment
Share on other sites

Ok, I figured out a temporary solution...

 

It might just work for my purpose. Maybe someone elses as well. That is if you have only one main top item and then scale out from that. (and this is of course if you are using images in your top menu item).

 

So this is what I did:

 

if ($depth == 0) {echo "','" . tep_href_link(FILENAME_DEFAULT,$cPathNew) . "','',98,20,'images/products_button.gif','images/products_button_on.gif')n";

 } else {echo "','" . tep_href_link(FILENAME_DEFAULT,$cPathNew) . "','')n";}

 

I don't know how one would rewrite the code for multiple top items? That seems pretty difficult to me...

Basically if someone was interested in having a top menu item image button they would change the "images/products.gif" button to their own specification and there you go...

 

Well, I am off to something else...

Link to comment
Share on other sites

:!:

 

I have been following this contribution for quite a while now.....and I am begining to notice some rather obtuse uses of JavaScript..

 

 

Now I am not a JS guru...but....the JavaScript used here to perform a simple ~ Grab Data / Insert-position / Apply Fancy Graphics.......seems some what overdoing it...the constant reajustments taking place for positioning is heavy man!

 

Can we not simplify this, it'll solve all these prob's with positioning! ?

 

Plz if there are any JS Guru's out there, give us all some help.....we need help with a 'Simple script to provide a Dynamic Menu..

 

I mean....most of the effects..I could create in CSS....lol...Its just grabbing the Menu-data from Database that is difficult for me....(new to PHP&mySQL!)

 

 

 

 

 

It seems this, contribution is getting more post's than actual use !

 

....we but try & and try again ! :wink:

Link to comment
Share on other sites

I have searched and searched for a Solution to the Heighth problem with the categories menu, I am not talking about the coolmenu categories, I am talking about the oscommerce categories menu. I have tried every solution in this thread.

 

I need to clear up the confusion just like everyone else..

 

How do you change the Heighth for the osCommerce Category Box.

 

Thanks in Advance

Link to comment
Share on other sites

I just installed the coolMenu contrib and it works great.

 

However, if you disable javascript in your browser properties (I used mozilla) the categories box ist just empty.

 

The rest of the store although having many javascript features still works fine.

 

Is there a possibility that the conventional categories box is shown when javascript is off? I am not much of a php expert so I don't know whether one can just check this within an if statement.

Another solution might be that the conventional box is printed underneath the javascript menu. Could that work?

 

Please share your thoughts.

 

Marc

Link to comment
Share on other sites

I did some research on my problem above and I now have a really crazy working solution by changing includes/boxes/coolmenu.php:

 

All the output of (the original) coolmenu.php is bracketed by <script> .... </script> tags and each line is wrapped by document.write("..."); . Then the conventional categories.php is included bracketed by <noscript> </noscript> tags.

 

Therefore, if javascript is on, the coolmenu categories box is shown and if javascript is off, the original osc categories box is shown.

 

Unfortunately I had to also include another variable called "table_string" into the tableBox class to have access to the produced HTML code and also two optional flags into the infobox and infoboxheading class so that they don't automatically echo their output.

 

If anyone is interested I can contribute this; however I guess I would need the consent of the original author probably to contribute it as an update of coolMenu.

Link to comment
Share on other sites

Aloha,

I am trying to figure out this coolMenu, but unfortunately I am still fumbling with php. I like this contribution very much, but I do not need it for products in the category box. I am working on a site for a nonprofit school and I only have informational links.

I do follow instructions well, so could someone point me in the direction of where to input the category and subcategory info?

 

This is what I am working on : http://alohapreschool.org/oscom/catalog/default.php

Currently, you get an error code right away, but a simple click will get you through

I would like the current Information box headings to be the categories:

Information, Philosophy, Operation, etc

with their containing links the subcategories that drop down from the menu.

I appreciate your help, whoever you may be :wink: ...

Jenn

Link to comment
Share on other sites

I did some research on my problem above and I now have a really crazy working solution by changing includes/boxes/coolmenu.php:

[...]

Therefore, if javascript is on, the coolmenu categories box is shown and if javascript is off, the original osc categories box is shown.

[...]

If anyone is interested I can contribute this; however I guess I would need the consent of the original author probably to contribute it as an update of coolMenu.

 

Marc,

thanks for posting about this. The problem of a working categories navigation for clients with JavaScript disabeled has deserved a lot more attention. It is difficult to tell how many people actually surf w/o JS turned on, but for anyone running an online shop (and using DHTML navigation), "some" should be enough for them to care about this issue. I guess though too many folks aren't aware of it.

 

You're right, it seems that all of the shop works without JS, which is one more reason to add a <noscript>'ed navigation for DHTML-menu shops.

 

I've just installed CoolMenu myself on my local WAMP shop, and I'm still struggling with customizing, but sooner or later I'd be interested in your solution.

 

The author of the original CoolMenu doesn't seem to be active at the moment, so why not make your own version of this contribution? I'm new to osC but from what I've seen it's ok to do so.

 

cheers,

Peter

This space for rent

Link to comment
Share on other sites

Hi

 

I recently downloaded coolmenu.php. And like it states, it is pretty cool. Im having trouble with it though. the catigories extend outword from the box. The box wont resize to fit the catagories. What should i do???

 

Thanks to anyone who can help

Link to comment
Share on other sites

I tried installing cool menu and i'm having problems. None of the categories are showing up. It's just blank. Anyone got a fix for this?

 

i fixed it. one of my categories had a ' in it. apparently you can't have this... =)

Link to comment
Share on other sites

Hello All,

 

I managed to adjust the size to fit in the box however, can the following line of code be changed to 100%* instead of x.xx*. and would that allow the box to auto adjust as categories are added? Obviously I'm not a programmer or I would know the answer to this, so If someone coud help please do so.

 

$height.= 2.65*count($categories)

Sinbad

"Mine is not the only way, mine is just another way

Link to comment
Share on other sites

Very strange problem. I am getting both the coolmenu and osc categories menu coming up. The column_left only says coolmenu! All modifications have been done and checked for accuracy.

 

To add insult to injury, when switching to the SSL the coolmenu is out of alignment with the categories box (It shrank).

 

I am lost on this one. I have reinstalled my backup files off of my localhost (which is working) and still no success.

Link to comment
Share on other sites

I am getting both the coolmenu and osc categories menu coming up. The column_left only says coolmenu! All modifications

 

Chris,

maybe you could post the contents of your column_left.php, plus list what else you changed for coolmenu.

 

Peter

This space for rent

Link to comment
Share on other sites

Helo,

 

sorry my english is not so good iam german man.

I have CoolMenu installed and its function, but i have same problems with the Position from the Menu.

My Shop is Center to 710 Pixel Weight.

Wenn i open the Shop in a seperate Window the CoolMenu show not in the Categorie Box.

 

Show here:

http://www.mwdata.de -> klick on Online-Shop

its show perfekt.

http://www.mwdata.de/catalog

the Menu is not in the Categorien Box

 

This is my Problem. Can some one help me?

Please help me, im not the only one in German with this Problem, show on the German OSC Forum, ther are more People with this Problem.

 

THX a lot

snopy

Link to comment
Share on other sites

Got It Working... Except for the configuring the positioning to fit in the right place - the install went off very easily.

You can see my progress here:

http://www.ronsraceshop.com/shop/

 

At this point I still have to do the css for the menus to match the rest of the site, but the usability is there for the store.

 

I also haven't found where to change the width of the submenus - as you can see they're quite long at this point... If anybody knows - holar, if not, i'll find it eventually.. its just 1700 and i'm goin home!

 

chuck

Link to comment
Share on other sites

Not sure what's going on with my coolMenu. I followed the directions exactly and it worked for a while but then it became blank. Everything under CoolMenu Is blank and doesn't show the categories. Anyone know the solution to this problem please help.

Link to comment
Share on other sites

rambo: are you sure you included the css and the <script> tags with the .js file?

 

If you forget either of those - the box will be blank.

 

On the bottom on the IE window - are there any javascript errors?? or anyother kindof errors?

Just check to see you put the css in the .css file and have included the <script __blah blah "something.js"></script> in all the files in the <head> tags

Link to comment
Share on other sites

rambo: are you sure you included the css and the <script> tags with the .js file?

 

If you forget either of those - the box will be blank.

 

On the bottom on the IE window - are there any javascript errors?? or anyother kindof errors?

Just check to see you put the css in the .css file and have included the <script __blah blah "something.js"></script> in all the files in the <head> tags

 

Ive included both the css necessary files. At least im 99% sure i am. I don't have to make any changes to the menu_animation.js file do I? There are no errors on my page, just a blank CoolMenu File. Ive tried starting from scratch too, but to no avail. I guess ill try again tomorrow morning. :cry:

Link to comment
Share on other sites

I just scrolled through every one of these postings, I see this same question and it was never answered so I'm hoping an additional request will yield an answer... :?

 

Working on this site: http://alphabetangel.com/oscom/catalog/default.php

I would like to add all of the links from the existing boxes to this coolMenu, however most of these pages are NOT products, I simply want the appropriate link to send to that page, rather than the categories or products pages.

 

i.e...mouseover Teachings should show prosperity, foundation of joy, sacred art, etc and clicking should go to those pages the way they function from the current 'lessons' box.

 

Could someone please share with me where I might alter code to make this happen? I look forward to your assistance :)

 

Jenn

Link to comment
Share on other sites

How can I increase the size of the boxes for sub categories - some items are just too long to fit in the menu display. I want to increase the length of the box displayed - is there a spot to change the pixel width and/or height?

 

Joe

Link to comment
Share on other sites

How can I increase the size of the boxes for sub categories - some items are just too long to fit in the menu display. I want to increase the length of the box displayed - is there a spot to change the pixel width and/or height?

Joe

Joe - In the "includes/coolmenu.php" file....

Sub Category box heights are at about lines 67 - 71, look for this:

	for ($i=1; $i<SUB_CATEGORIES; $i++) { 

 echo'	

	 oCMenu.level[' . $i . ']=new cm_makeLevel()

	 oCMenu.level[' . $i . '].width=150

	 oCMenu.level[' . $i . '].height=15

that is width and height for submenus (NOTE: yours will have the default numbers in there as i have changed mine)

 

nrapt - I dont know how to do that, but im sure you can cheat part of the javascript on just those links to add a URL instead of pulling the location from the store/product variables. Somebody here knows...

 

rambo - It sounds like you've included the <SCRIPT LANGUAGE="JavaScript1.2" SRC="includes/menu_animation.js"></SCRIPT> up top, because if not I think it would throw an error for an unrecognized js function.

So - Make sure you have also included this:

<!-- coolMenu //-->

<?php require(DIR_WS_INCLUDES . 'coolmenu.php'); ?>

<!-- coolMenu_eof //-->

MAKE SURE THATS ABOVE THE HEADER INCLUDE!

so most your files would have teh <body > tag then ^^ this code then the <! -- header //--> require header.php blah blah

If that doesnt work then I'm out of ideas.. :?

 

chuck

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...