Jump to content
Sign in to follow this  
homewetbar

osC_Categories MS2-2.2

Recommended Posts

Using osC_Categories which works like a charm. My problem is that i like to disable/remove the links for categories which doesnt hold any products. I got around 750 categories and my products only recide in the third level of each category. For better understanding:

 

scheme.gif

 

Main and first subcategories should show up but shouldnt have a clickable link, only the last category should hold an clickable link.

 

Anyone got an idea what needs to be tweaked in the categories.php to achieve that?

Share this post


Link to post
Share on other sites

Just found the function "tep_count_products_in_category" which seems like it could be used to slove my problem. But i dont have an idea where to put it.

Share this post


Link to post
Share on other sites

installed this on my site and it's working great, however, I have a lot of subcatagories, and they're disapearing off the bottom of the page, is there any way of having the menu system provide 3 rows of 10 subcatagories for example rather than one long vertical list

 

3 horizontal lists if that makes any sense?

Share this post


Link to post
Share on other sites
Using osC_Categories which works like a charm. My problem is that i like to disable/remove the links for categories which doesnt hold any products. I got around 750 categories and my products only recide in the third level of each category. For better understanding:

 

scheme.gif

 

Main and first subcategories should show up but shouldnt have a clickable link, only the last category should hold an clickable link.

 

Anyone got an idea what needs to be tweaked in the categories.php to achieve that?

 

Hello!

 

Did you find a soltution yet?

 

Please let me know!

 

Thanks, Juan!

Share this post


Link to post
Share on other sites

Great contribution. Tks for making it available. :)

 

One question: how to display the number of products in each category, like in the default menu?

 

Tks in advance for any help.


Patty

Share this post


Link to post
Share on other sites

Hello? Can somebody please give some help here? I think this should be an easy one. :blush:

Product count is enabled on admin. How to show count on the menu?


Patty

Share this post


Link to post
Share on other sites

I'm still trying to find a way to show product count on the menu. Does anyone know how to do it??


Patty

Share this post


Link to post
Share on other sites
I'm still trying to find a way to show product count on the menu. Does anyone know how to do it??

 

I figured this out the other day. Open up "includes/classes/categories.php" and search for:

 

//		 $title = "'" . addslashes($category['name']) . "$count'";

 

remove the // because it comments out the line. And add the // to the line below it. (Should be lines 73 and 74.)

 

Also, delete the /* and */ on lines 62 and 69. Now it should display them.

 

 

 

Has anyone else had an issue if you increase the font size? I'm using STS 4.1 and Infobox Skins Manager and if I up the font size (and/or use the above fix to show the numerb of products) I get a box that is larger than all the other boxes. It seems like the arrow images require a certain space between them and the categoryies name and I don't know where to change that value and remove the excess spaces at.

 

Additionally, I'd like to know how or if its possible to change the color the category you are currently browsing? I'd like have a seperate style for it, but can't seem to get it to work, even if I encase the text in a span with its own style. :(

Share this post


Link to post
Share on other sites

I tried that many times before but it didn't work.

I'm testing another menu similar to this one that seems to be able to show the count.


Patty

Share this post


Link to post
Share on other sites
I tried that many times before but it didn't work.

I'm testing another menu similar to this one that seems to be able to show the count.

 

I've gone through and figured out how to both make it display the count number and remove any categories with zero products in them.

 

In "catalog/includes/classes/categories.php" search for "function buildBranch($parent_id, $level = 0)" (should be around line 48)

 

Replace the entire function with:

 

   function buildBranch($parent_id, $level = 0)
  {
 global $request_type;
 if (isset($this->data[$parent_id]))
 {
   foreach ($this->data[$parent_id] as $category_id => $category)
   {
   		$products_in_category = tep_count_products_in_category($category_id);
   		if($products_in_category != 0)
   		{

		 	$category_link = $category_id;
		 	if (isset($this->data[$category_id]))
		 	{
		 	  $result .= $this->parent_start_string;
		 	}
		 	else
		 	{
		 	  $result .= $this->child_start_string;
		 	}

			if (SHOW_COUNTS == 'true')
			{
				$count = ' (' . $products_in_category . ')';
			}

			$icon = "null";
		 	$title = "'" . addslashes($category['name']) . "$count'";
			// $title = "'" . addslashes($category['name']) . "'";
			// $url = "'" . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link,$request_type) . "'";
		 	$url = "'" . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $this->buildBreadcrumb($category_link),$request_type) . "'";

		 	$target = "''";
		 	$description = "''";
		 	$result .= "$icon, $title, $url, $target, $description";

		 	if (isset($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1)))
		 	{
		   		$result .= ",".$this->buildBranch($category_id, $level+1);
		 	}

		 	if (isset($this->data[$category_id]))
		 	{
		   		$result .= $this->parent_end_string;
		 	}
		 	else
		 	{
		   		$result .= $this->child_end_string;
		 	}
	 	}
   	}
 }
 return $result;
  }

 

 

That works for me at least. Note that I also update my JSCookMenu file to v2.03, I don't think that should be an issue though.

 

Got it working with STS, InfoboxSkins, CCGV, and various other modules... finally! :D

Share this post


Link to post
Share on other sites

randomone, you're a genius!!! That's it!!! Works like a charm!! :D

 

Thank you so much! I've been looking for this solution for months!!

Just one little thing: how to show the categories with 0 products? Most of my clients will want to show them even if there's nothing there.

 

TIA. :)


Patty

Share this post


Link to post
Share on other sites

I commented out

 

if($products_in_category != 0)

 

and now all categories are showing. Is that all?? :huh:


Patty

Share this post


Link to post
Share on other sites
I commented out

 

if($products_in_category != 0)

 

and now all categories are showing. Is that all?? :huh:

 

 

Yeah that is all. =)

 

 

Anyone else having intermitent issues with the menu not being displayed? If you check out my website every once in a while the categories simply won't show up, but I'd say about 90% of the time they are perfectly fine.

 

www.nmoutlet.com

 

I have not been able to get get it to do this consistantly under any circimstances. The site was running a bit slow so we had our webhost try to 'fix' it. Trying to figure out if the 'fix' caused an issue with the menu system somehow or if anyone else has the same problem.

Edited by randomone

Share this post


Link to post
Share on other sites

Hello, I was wondering if it would be possible to use the JSCookTree method (http://jscook.yuanheng.org/JSCookTree/index.html) as opposed to the JSCookMenu method (the one used here) by the same author. I'm redoing my site and the tree suits my needs much more than a fly-out, which I have right now. If it is possible, any help on how to implement it would be greatly appreciated because JavaScript is not exactly my forte. Thanks very much for your time.

 

-Ian

Edited by Kawazu

Ian Osos

Web Developer

Share this post


Link to post
Share on other sites

Nevermind, I think I've got it... or at least I'm pretty close to getting it.


Ian Osos

Web Developer

Share this post


Link to post
Share on other sites

Has anyone else gotten this to work with oscommerce-2.2rc2a?

I installed this with STS 4.5.8, and it whenever I select anything I get an error:

Fatal error: Call to a member function add_current_page() on a non-object in /var/www/osc/includes/application_top.php on line 313

 

The line is right where the paste an if/then clause, though removing the if/then and reverting to the original code pumped out the same error, except lin 312. It just doesn't seem to like the line:

$navigation->add_current_page();

Share this post


Link to post
Share on other sites

@randomone

Try to change application_top.php

 

// navigation history
 if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
} else {
  $navigation = new navigationHistory;
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 if($HTTP_GET_VARS['page'] <> 'javascript_categories') {
   $navigation->add_current_page();
 }


---------------------------------------------

Regards,

 

Snowbird

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×