Jump to content
Sign in to follow this  
Andrew J

[Contribution] Show Sub-categories

Recommended Posts

After looking at it in a little more detail, it would appear that the whole sub-category tree is one long text string instead of each sub-category starting on a new row. Is no one else seeing this?

 

Fixed by editing categories.php on line 129 adding <br> and couple of hard spaces for the subcategory text right before "<a href" like this:

$text_subcategories .= '' . '<br>  <a href="' . tep_href_link(FILENAME_DEFAULT,
$cPath_new_sub, 'NONSSL') . '" class="menusubcateg">' . '  ' . tep_image(DIR_WS_IMAGES . 
'pointer_blue_light.gif', '') . $subcategories['categories_name'] . '</a>' . " ";

Don't know how this thing is usable without doing something similar to this.

Edited by etzeppy

Share this post


Link to post
Share on other sites

Thanks to Keith's ideas, I got this working correctly as well. I went one step further and took out all the  's. Mainly because if you use underline in your CSS for links, it gives that extended underline, plus it is really un-needed code.

 

Since the contribution gives you better CSS control over the menu, the   is not needed, just use padding to move the cats and sub cats where you want.

 

At first I thought this mod wasn't going to work right, but it works quite well. I've tried most every one I could find, this was the best. Well, unless you want some fancy menu.

Share this post


Link to post
Share on other sites
Hi there everyone.

 

Firstly, let me say this is a great contribution and really helps to make the category menu more functional and attractive.

 

Unfortunately, I think I've run into a bug which has caused me to uninstall this contribution. Hopefully someone will be able to figure out if it is a bug and how to fix it.

 

Suspected Bug Overview:

 

If I have 2 categories (each with their own products and subcategories):

cPath=1

cPath=2

And if I have 2 subcategories in each of the above categories

cPath=1_11

cPath=1_12

cPath=2_21

cPath=2_22

Everything works fine as long as I come into the cart at the top level (index.php). It also works fine if I come in to the cart at the top of a category (index.php?cPath=1).

 

But as soon as I click into a subcategory (such as index.php?cPath=1_11 or index.php?cPath=2_21) all of the other links in the menu pick up the cPath of whatever subcategory I'm in and then also add the corresponding cPath for their own category.

 

So in this case, all of my links will now point to index.php?cPath=1_11_1 or index.php?cPath=1_11_2, which are nonexistent.

 

As a result, it becomes impossible to get back to index.php?cPath=1 using the categories menu.

 

My php skills are not sufficient to figure out where this incorrect "residual" cPath info is being inserted. But I'm hoping someone here will be able to see it. I won't bother posting the code from the contribution's categories.php for reference, but I have used it straight "out-of-the-box" without modifying it at all.

 

Thanks in advance for anyone who can help. I'd love to get this working on my site.

 

I am also having the same problem as outlined above. I did search the forums to try and find an answer. Perhaps this contrib has become outdated, but I am using it in my store and have noticed the same behavior mentioned in the quoted text.

 

Anyone have any ideas?

 

-S

Share this post


Link to post
Share on other sites
I am also having the same problem as outlined above. I did search the forums to try and find an answer. Perhaps this contrib has become outdated, but I am using it in my store and have noticed the same behavior mentioned in the quoted text.

 

Anyone have any ideas?

 

-S

 

I believe I fixed my own problem... in case anyone is interested. Not sure where this "nested" cPath issue came from or where it was introduce. But here's a little something I came up with to fix it.

 

This change goes to catalog - includes - boxes - catagories.php approx. line 135. This is taken from bedfordch 30 Oct 2008 update.

			} // While Interno
		//start befordch fix (show category count)
		  $cPath_myNewPath = explode('_',str_replace("cPath=", "", $cPath_new));
		  $cPath_new_fix = "cPath=" . $cPath_myNewPath[count($cPath_myNewPath)-1];
		$buildtext = ' <a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new_fix, 'NONSSL') . '" class="menucateg"><b>' . ' ' . tep_image(DIR_WS_IMAGES . 'cat_arrow_right.gif', '') . $categories['categories_name'];

Hope that helps. I did not submit a contribution fix for this.

-DA

Share this post


Link to post
Share on other sites
I believe I fixed my own problem... in case anyone is interested. Not sure where this "nested" cPath issue came from or where it was introduce. But here's a little something I came up with to fix it.

 

This change goes to catalog - includes - boxes - catagories.php approx. line 135. This is taken from bedfordch 30 Oct 2008 update.

			} // While Interno
		//start befordch fix (show category count)
		  $cPath_myNewPath = explode('_',str_replace("cPath=", "", $cPath_new));
		  $cPath_new_fix = "cPath=" . $cPath_myNewPath[count($cPath_myNewPath)-1];
		$buildtext = ' <a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new_fix, 'NONSSL') . '" class="menucateg"><b>' . ' ' . tep_image(DIR_WS_IMAGES . 'cat_arrow_right.gif', '') . $categories['categories_name'];

Hope that helps. I did not submit a contribution fix for this.

-DA

 

I have a problem. I would to put the counter of subcategory in the same line of the subcategory name and i don't can.

Any help?

Thanks

Edited by picaderomurla

Share this post


Link to post
Share on other sites
I have a problem. I would to put the counter of subcategory in the same line of the subcategory name and i don't can.

Any help?

Thanks

 

 

The problem lies with this code:

 

Find:

 

if ($subcategories['parent_id'] == $categories['categories_id'])

			{



									$cPath_new_sub = "cPath="  . $categories['categories_id'] . "_" . $subcategories['categories_id'];



				$text_subcategories .= '' . '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new_sub, 'NONSSL') . '" class="menusubcateg">' . '  ' . tep_image(DIR_WS_IMAGES . 'pointer_blue_light.gif', '') . $subcategories['categories_name'] . '</a>' . " ";

Remove the </a> in the last line so it looks like this:

 

if ($subcategories['parent_id'] == $categories['categories_id'])

			{



									$cPath_new_sub = "cPath="  . $categories['categories_id'] . "_" . $subcategories['categories_id'];



				$text_subcategories .= '' . '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new_sub, 'NONSSL') . '" class="menusubcateg">' . '  ' . tep_image(DIR_WS_IMAGES . 'pointer_blue_light.gif', '') . $subcategories['categories_name'] . '' . " ";

 

This will place the product count of the subcategory back on the same line as the subcategory name.


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites

I believe I fixed my own problem... in case anyone is interested. Not sure where this "nested" cPath issue came from or where it was introduce. But here's a little something I came up with to fix it.

 

This change goes to catalog - includes - boxes - catagories.php approx. line 135. This is taken from bedfordch 30 Oct 2008 update.

			} // While Interno
		//start befordch fix (show category count)
		  $cPath_myNewPath = explode('_',str_replace("cPath=", "", $cPath_new));
		  $cPath_new_fix = "cPath=" . $cPath_myNewPath[count($cPath_myNewPath)-1];
		$buildtext = ' <a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new_fix, 'NONSSL') . '" class="menucateg"><b>' . ' ' . tep_image(DIR_WS_IMAGES . 'cat_arrow_right.gif', '') . $categories['categories_name'];

Hope that helps. I did not submit a contribution fix for this.

-DA

 

I am having this same problem, and have tried this fix, but nothing changed... are there any updates to this fix? Thanks.

Share this post


Link to post
Share on other sites

Anyone know how to make this only display sub categories, not sub-sub categories?

 

I have 5 main categories with lots of subcategories in each one. I want these to display, but not the categories within those too.

 

Basically I want it to work on the 2nd level but not the third. How do I disable this?

 

Cheers.

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  

×