Jump to content



Photo
- - - - -

Show all subcategories in box module for 2.3.1


This topic has been archived. This means that you cannot reply to this topic.
24 replies to this topic

#1   wiecek

wiecek
  • Members
  • 7 posts

Posted 01 December 2010 - 03:41

I'm trying to figure out how to show all the subcategories for all the categories in the box module for version 2.3.1.

Right now, it only shows the subcategories for the selected category. I'd like it to show whether or not it is highlighted. There are contribs that do this for previous OScommerce versions, but if there's an easy way to do this with the new version module, that'd be nice.

Thanks all.

#2   hesseh

hesseh
  • Members
  • 1 posts

Posted 02 December 2010 - 21:57

Also interested in such feature for 2.3.1

#3   derben

derben
  • Members
  • 7 posts

Posted 05 December 2010 - 04:07

index.php
line 37
Change:  if ($category_depth == 'nested') {
To:      if ($category_depth == 'nested' && isset($HTTP_GET_VARS['cPath'])) {

application_top.php
line 437
Ch:  $cPath = '';
to:  $cPath = '22';


the second change forces the default to be show all categories.
the first change allows the default home page while showing all folders.
-Colin
www.ColinGlover.com

#4   wiecek

wiecek
  • Members
  • 7 posts

Posted 05 December 2010 - 14:12

Derben, thank you, this is a step in the right direction, but not exactly what I wanted to do.

With your mod, the homepage will default to the category 22. But I would like categories 22 and 23 open on the homepage.

Further, I'd like those categories open to show their subcategories through out the entire site.

But for now, your mod is nice, clean and simple. And gets me about half way to where i want to be. Thank you.

#5   derben

derben
  • Members
  • 7 posts

Posted 05 December 2010 - 20:05

I only have one cat. (22) filled /tongue.gif' class='bbc_emoticon' alt=':P' /> so it worked for me fine. But yes if you have more cats.. it will possibly require programming to loop through them all.
-Colin
www.ColinGlover.com

#6   derben

derben
  • Members
  • 7 posts

Posted 06 December 2010 - 01:29

How about:

/includes/modules/boxes/bm_categories.php

around line 99
Find:   $parent_id = $categories['categories_id'];
Add:    $dbs[] = $categories['categories_id'];

around line 109
change:   while (list($key, $value) = each($cPath_array)) {
to:       while (list($key, $value) = each($dbs)) {


PS: one is an addition, and one is a change.

Edited by derben, 06 December 2010 - 01:35.

-Colin
www.ColinGlover.com

#7   ErikMM

ErikMM
  • Members
  • 314 posts

Posted 06 December 2010 - 19:47

How about:

/includes/modules/boxes/bm_categories.php

around line 99

Find:   $parent_id = $categories['categories_id'];
Add:    $dbs[] = $categories['categories_id'];

around line 109
change:   while (list($key, $value) = each($cPath_array)) {
to:       while (list($key, $value) = each($dbs)) {


PS: one is an addition, and one is a change.


This worked great on all pages, EXCEPT the "home" page (catalog)

thank you

#8   derben

derben
  • Members
  • 7 posts

Posted 07 December 2010 - 03:11

This worked great on all pages, EXCEPT the "home" page (catalog)

thank you


you need to combine both fixes I mentioned /smile.gif' class='bbc_emoticon' alt=':)' /> all 4 lines.
-Colin
www.ColinGlover.com

#9   wiecek

wiecek
  • Members
  • 7 posts

Posted 07 December 2010 - 03:18

This actually worked perfect for me.

ErikMM, if you make the change to application_top.php to set the cPath to on of your categories, then it should work for your homepage as well.

Thanks, derben!

#10   ErikMM

ErikMM
  • Members
  • 314 posts

Posted 08 December 2010 - 09:21

you need to combine both fixes I mentioned /smile.gif' class='bbc_emoticon' alt=':)' /> all 4 lines.


1. index.php ~line 37
Change:  if ($category_depth == 'nested') {
To:      if ($category_depth == 'nested' && isset($HTTP_GET_VARS['cPath'])) {
2. catalog/application_top.php ~line 437
Ch:  $cPath = '';
to:  $cPath = '22';
3. includes/modules/boxes/bm_categories.php ~around line 99
Find:   $parent_id = $categories['categories_id'];
Add:    $dbs[] = $categories['categories_id'];
4.includes/modules/boxes/bm_categories.php ~around line 109
change:   while (list($key, $value) = each($cPath_array)) {
to:       while (list($key, $value) = each($dbs)) {

What goes in place of the '22'?

#11   Rubin Remus

Rubin Remus
  • Members
  • 142 posts

Posted 08 December 2010 - 14:47

I could do with an answer to this one too.

Cheers.

#12   derben

derben
  • Members
  • 7 posts

Posted 11 December 2010 - 04:14

1. index.php ~line 37

Change:  if ($category_depth == 'nested') {
To:      if ($category_depth == 'nested' && isset($HTTP_GET_VARS['cPath'])) {
2. catalog/application_top.php ~line 437
Change:  $cPath = '';
to:  $cPath = '22';
3. includes/modules/boxes/bm_categories.php ~around line 99
Find:   $parent_id = $categories['categories_id'];
Add:    $dbs[] = $categories['categories_id'];
4.includes/modules/boxes/bm_categories.php ~around line 109
change:   while (list($key, $value) = each($cPath_array)) {
to:       while (list($key, $value) = each($dbs)) {

What goes in place of the '22'?


Where does it say to change a 22? Change the default '' (nothing) to '22'. /wink.gif' class='bbc_emoticon' alt=';)' />
-DerBen
-Colin
www.ColinGlover.com

#13   ErikMM

ErikMM
  • Members
  • 314 posts

Posted 11 December 2010 - 06:39

Where does it say to change a 22? Change the default '' (nothing) to '22'. /wink.gif' class='bbc_emoticon' alt=';)' />
-DerBen

exactly...it seems it should not be 22, but something else per the conversation preceding my question..."what" is the question, What goes in place of the '22'? Back to default? ' ' ? Why so cryptic btw?

wiecek said "make the change to application_top.php to set the cPath to on of your categories, then it should work for your homepage as well"

this is also a little to cryptic for me as well-- call me dumb

Edited by ErikMM, 11 December 2010 - 06:49.


#14   derben

derben
  • Members
  • 7 posts

Posted 12 December 2010 - 05:31

ErikMM ... ya lost me. No cryptics here, only 4 simple changes.

Just make the changes (all 4) exactly as I stated and it will work. I'm using it right now on my store, also it's confirmed by wiecek when he said it worked perfect for him too.
-Colin
www.ColinGlover.com

#15   wiecek

wiecek
  • Members
  • 7 posts

Posted 12 December 2010 - 14:55

Yes, works well.

Only problem that I've encountered is that when you are on the page listing a nested category, category 22 becomes bold as well as the current nested category. But that's a relatively minor style issue.

#16   ErikMM

ErikMM
  • Members
  • 314 posts

Posted 12 December 2010 - 19:47

Yes, works well.

Only problem that I've encountered is that when you are on the page listing a nested category, category 22 becomes bold as well as the current nested category. But that's a relatively minor style issue.

I played with different numbers, 22, 1, 2, 3, 50 etc. (for change #2 sited above). And I am having the bold issue as well on the home page. However, I'm kind of over it now, and like the home page cat menu collapsed...expanding after picking one of the mains and turning bold etc. on the destination page.

Thanks again for this tip despite a little confusion on my part as to why "22."

#17   wiecek

wiecek
  • Members
  • 7 posts

Posted 12 December 2010 - 21:06

'22' is just the id assigned to the first category that you create in oscommerce.

The reason that it's bold on the homepage is where the default category path on index.php is usually '' the change now makes it category '22' or whatever category that you want selected.

#18   casaba

casaba
  • Members
  • 4 posts

Posted 05 February 2011 - 21:06

Thanks for this one, Derben.

I think I found a solution to the Home or Catalog bold issue:
$cPath = '0';

So far, looks good for me: all categories expanded but nothing in bold.

Edited by casaba, 05 February 2011 - 21:07.


#19   casaba

casaba
  • Members
  • 4 posts

Posted 05 February 2011 - 21:22

Never so simple.

Right now, I have two Categories, each with multiple subcategories.

Bold works fine when I select either Category or a subcategory within the first Category.

However, if I select a subcategory in the second Category, both Categories are displayed in bold.

(This is true even when I enter $cPath = '22';.)

Anybody else run into this? Any ideas?

#20   KaoszNagymester

KaoszNagymester
  • Members
  • 2 posts

Posted 19 February 2011 - 21:33

Hi!

I use OSC 2.3.1, but for me don't work this solution. /sad.gif' class='bbc_emoticon' alt=':(' />