Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

osC_Categories MS2-2.2


homewetbar

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?

Link to comment
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.

Link to comment
Share on other sites

  • 3 weeks later...

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?

Link to comment
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!

Link to comment
Share on other sites

  • 3 months later...

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

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...
  • 1 month later...
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. :(

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

  • 1 month later...
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
Link to comment
Share on other sites

  • 3 months later...

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

Link to comment
Share on other sites

  • 1 year later...

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

Link to comment
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();
 }

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