Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

coolMenu


Keyser Soze

Recommended Posts

  • Replies 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

Thank you Jose for posting this! I just wish I had started reading backwards from page 33.

 

Ok.. first of all i'am a newbie.. i just install and did everything as the instruction told me so, the only problem i ran into is the Menu seem to Float on other box.. everything came out right but i can't seem to make the Menu fit into the Categorie box ..

 

HELPP THIS NEWBIE PLEASEEEEEEE

 

Please read this post to see a solution:

http://www.oscommerce.com/forums/viewtopic.php...tart=290#217634

 

The file you have to edit is catalog/includes/coolmenu.php. Look for the line that says:

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

 

That's were you have to include the code from the link above.

 

Good luck!

Link to comment
Share on other sites

Anyone got any idea how to center the text vertically in the rows? I tried in the CSS but it didn't work and it's anoying me now.

Yepp, the css file is the right place. Search for this entry:

.clLevel0{

background-color:#ffffff;

layer-background-color:#ffffff;

color:#000000;

}

 

you could either add

text-align: center;

or

padding-left: 30px;

(or some other number)

 

If you want to do the same for subcategories, the entry to look for is: .clLevel1, .clLevel1over

 

Good luck,

Nils

Link to comment
Share on other sites

Nils that will align the text in the center horizontaly.. i'm talking about vertically.. like top middle bottom.. at the moment to text is default onthe top.. but because this isn't HTML i don't know how to align it into the middle.

Link to comment
Share on other sites

Nils that will align the text in the center horizontaly
..oops sorry, I didn't read. Try padding-top: 10px then (or some other number). And I forgot to mention that you have to do the same for the "over" entries, i.e. if you change something in .clLevel0 you should change it in .clLevel0over as well (it's what it looks like "on mouse over")

 

Nils

Link to comment
Share on other sites

Hi,

 

I'm using Coolmenu 1.2 and it works great. Just one question. The menu opens rather quickly when a page is still downloading. As a result, you can see pretty much a "blank page", but the menu is there.

 

Is there a way that I can get it to display once the page is more fully drawn or close to completion?

 

Thanks,

 

Mark

Link to comment
Share on other sites

Hi. Not sure of your question. In short the menu is shown too quickly - it is shown while page is being "drawn". On a fast internet link it may not be so obvious. On a slow one, you can see the menu "before" the page has finished loading. I need to delay it's appearance ...

 

Thanks,

Link to comment
Share on other sites

I am trying to install the coolmenu -- but, I have the basic template contribution installed. Has anyone else tried this? If so, can you give any assistance.

 

 

Anne

Link to comment
Share on other sites

What i did to make it fully autoadjust is just add these three lines (substituting the original line: $height.= 2.65*count($categories))

 

//With this line i read the top categories

$categories_query = tep_db_query("select count(*) as count_top_categories from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");



//i grab the array (actually its only one value, but i'm too lazy right now 

//to check if there is a function to grab only one value in the API

$count_top_categories = tep_db_fetch_array($categories_query);



//I multiply by 28(pixels) the number of top categories there are

$height.= 28*$count_top_categories['count_top_categories'];

 

jlramirez, your method adds an extra database quary, but none is needed. There's a faster and easier way, that has been documented in this thread too: here's my version of it (catalog/includes/coolmenu.php):

	$categories = tep_get_categories('');

$height = -21;

$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);

 if ($depth == 0) {

   $height += 17; // use oCMenu.level[0].height + 1 !!

 } 

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

}

Comments:

$height = -21; //I don't know why -21, but i found out it works for me. maybe someone can explain?

 

if ($depth == 0) //then it's a top level category, no db query needed

 

$height += 17; // use what you took as oCMenu.level[0].height + 1 !! plus one because of the border

 

For me, the above code works perfectly for all numbers of categories and all sizes of oCMenu.level[0].height .

 

Nils

Link to comment
Share on other sites

What i did to make it fully autoadjust is just add these three lines (substituting the original line: $height.= 2.65*count($categories))

 

//With this line i read the top categories

$categories_query = tep_db_query("select count(*) as count_top_categories from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");



//i grab the array (actually its only one value, but i'm too lazy right now 

//to check if there is a function to grab only one value in the API

$count_top_categories = tep_db_fetch_array($categories_query);



//I multiply by 28(pixels) the number of top categories there are

$height.= 28*$count_top_categories['count_top_categories'];

 

jlramirez, your method adds an extra database quary, but none is needed. There's a faster and easier way, that has been documented in this thread too: here's my version of it (catalog/includes/coolmenu.php):

	$categories = tep_get_categories('');

$height = -21;

$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);

 if ($depth == 0) {

   $height += 17; // use oCMenu.level[0].height + 1 !!

 } 

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

}

Comments:

$height = -21; //I don't know why -21, but i found out it works for me. maybe someone can explain?

 

if ($depth == 0) //then it's a top level category, no db query needed

 

$height += 17; // use what you took as oCMenu.level[0].height + 1 !! plus one because of the border

 

For me, the above code works perfectly for all numbers of categories and all sizes of oCMenu.level[0].height .

 

Nils

 

Exactly!!, when i wrote my hack i was in such a hurry that i didn't even notice what the for() was (or at least i don't remember giving it a look). And it is exactly what i was looking for, a way to tell how many top-level categories there are, and of course if($depth == 0).... duh!!.

 

Well i'm very sorry for that sorry piece of code. I'll have to link yours when someone else asks the same question.

 

Is there a FAQ/Tips and Tricks for this one, its asked quite frequently.

 

Cheers!!!

Link to comment
Share on other sites

What i did to make it fully autoadjust is just add these three lines (substituting the original line: $height.= 2.65*count($categories))

 

//With this line i read the top categories

$categories_query = tep_db_query("select count(*) as count_top_categories from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");



//i grab the array (actually its only one value, but i'm too lazy right now 

//to check if there is a function to grab only one value in the API

$count_top_categories = tep_db_fetch_array($categories_query);



//I multiply by 28(pixels) the number of top categories there are

$height.= 28*$count_top_categories['count_top_categories'];

 

jlramirez, your method adds an extra database quary, but none is needed. There's a faster and easier way, that has been documented in this thread too: here's my version of it (catalog/includes/coolmenu.php):

	$categories = tep_get_categories('');

$height = -21;

$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);

 if ($depth == 0) {

   $height += 17; // use oCMenu.level[0].height + 1 !!

 } 

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

}

Comments:

$height = -21; //I don't know why -21, but i found out it works for me. maybe someone can explain?

 

if ($depth == 0) //then it's a top level category, no db query needed

 

$height += 17; // use what you took as oCMenu.level[0].height + 1 !! plus one because of the border

 

For me, the above code works perfectly for all numbers of categories and all sizes of oCMenu.level[0].height .

 

Nils

 

Exactly!!, when i wrote my hack i was in such a hurry that i didn't even notice what the for() was (or at least i don't remember giving it a look). And it is exactly what i was looking for, a way to tell how many top-level categories there are, and of course if($depth == 0).... duh!!.

 

Well i'm very sorry for that sorry piece of code. I'll have to link yours when someone else asks the same question.

 

Is there a FAQ/Tips and Tricks for this one, its asked quite frequently.

 

Cheers!!!

 

but where to put this code this code replace wha, it is possible for anyone to post is full coolmenu.php modified with this code and that works thanks!

Link to comment
Share on other sites

Can someone tell me if you can place and external link inside coolmenu using sub-catagories and if so how. The shop is set up for regular ecommerce transactions however this would be the only catagory that would need external linking.

 

Business Services >Telecomm

..............................>Hosting

 

Telecom and hosting would link directely to another site.

Sinbad

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

Link to comment
Share on other sites

Thank Nils P, however I found my answer in another area thanks to Seafire and Maxidvd,

 

In the index.php

 

around line 16

require('includes/application_top.php');

// the following cPath references come from application_top.php

$category_depth = 'top';

if (isset($cPath) && tep_not_null($cPath)) {

//add here

if ( $cPath == '50_52' ) //change '50_52' to your cpath for category

{

header( 'Location: http://www.sitename.com' );

exit;

}

 

This also works for more than one link just place the same lines below and edit as needed and so on. I just need to find out how to open this in a new window.

Sinbad

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

Link to comment
Share on other sites

hi there

 

Im having some trouble with the coolmenu.

http://www.fluxmind.dyns.net/~flux/catalog/

 

As you can see it floats above the page.

 

I have finished reading thru these 35 pages and made two changes:

the code by Nils for auto positioning.

and

the JS_NO_JS contrib for coolmenu by Marc Zacher

however that doesnt seem to help as there is no categories box in the first place.

Ive tried moving the code in the body part around to see if it will fit inside the left column but it doesnt seem to . It takes its own space and everything else becomes above or below it.

 

Any and all help is honestly appreciated.

Thankyou for your time

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