Forums / Addon Sideboxes / Display Categories In Separate Boxes

Display Categories In Separate Boxes

Views: 41,074

Results 1 to 20 of 63
11 Jan 2010, 10:26 AM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Display Categories In Separate Boxes

Hi,
regarding the
**Display Categories In Separate Boxes v1.0 **
add-on from here
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=1231

it appears to be incomplete as in

\includes\templates\TEMPLATE\sideboxes\tpl_separate_category_sidebox.php

there is no code to display the retrieved category information.

regards
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

11 Jan 2010, 11:36 AM
#2
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: Display Categories In Separate Boxes

Did you install the mod following the instructions??? Technically you don't need the files in the template folder to operate any mod. They are there to style the mods and make them load inside your template. The module folder loads the sidebox.

11 Jan 2010, 12:25 PM
#3
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Display Categories In Separate Boxes

Hi,
thanks for the quick reply.

I copied the three files to their respective locations as per the instructions but when displayed in the shop, the new sidebox is empty, irrespective of the category c.parent_id number.

Looking at other sideboxes, the actual content is loaded into the $content variable by the file here
\includes\templates\TEMPLATE\sideboxes\tpl_ANY_sidebox.php
and then I assume passed onto the main page code.

But in the case of this mod
\includes\templates\TEMPLATE\sideboxes\tpl_separate_category_sidebox.php

nothing is loaded into $content apart from the start and end div tags, and so that is what is displayed.

Maybe I am missing the point of this mod.
I assumed it was a way to separate the master (or sub) categories into separate boxes, maintaining the sublayer links.

regards
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

11 Jan 2010, 2:54 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Display Categories In Separate Boxes

This mod is built to display a single category of your choosing in a separate sidebox. I haven't checked to see if it will display that category's subs.

It will not remove the category from the regular categories sidebox.

11 Jan 2010, 3:02 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Display Categories In Separate Boxes

On inspection, it looks like it will display the subcategories of a chosen category in the sidebox.
It also displays them in <li> tags, without a containing set of <ul> tags anywhere.

12 Jan 2010, 5:17 PM
#6
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: Display Categories In Separate Boxes

The mod will only display sub-categories of a master category in the box. They will be displayed in a <li> which can be styled easily to give a more elegant look to your tree.

You can hide the category using the Zen Cart admin, or manually code it into the categories sidebox.

12 Jan 2010, 6:25 PM
#8
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Display Categories In Separate Boxes

Hi,

  1. The point I was making at the start of this thread is that the code in the template file:
$content = '';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
$content .= '</div>';

will not display anything until the last line is changed to

$content .= $add_content .'</div>';
  1. The generated list lacks an UL, so in

\includes\modules\sideboxes\TEMPLATE\separate_category_sidebox.php

change this

	$add_content ='';
	
	while (!$categories_ap->EOF)  {
		$id = $categories_ap->fields['categories_id'];
		$name = $categories_ap->fields['categories_name'];
	  	$add_content .= '<li><a href="index.php?main_page=index&cPath='.$id.'" class="category-top">'.$name.'</a></li>' . "\n";
		
		$categories_ap->MoveNext();
	}

to this:

	$add_content ='<ul class="separatesideboxlist">';
	while (!$categories_ap->EOF)  {
		$id = $categories_ap->fields['categories_id'];
		$name = $categories_ap->fields['categories_name'];
	  	$add_content .= '<li><a href="index.php?main_page=index&cPath='.$id.'">'.$name.'</a></li>' . "\n";
	
		$categories_ap->MoveNext();
	}
	$add_content .= '</ul>';
  1. The query that gets the category information does not account for languages or table prefixes (I think), so change
$categories_query_ap = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image from categories c, categories_description cd where c.categories_id = cd.categories_id and c.categories_status = 1 and c.parent_id = 76 order by sort_order, cd.categories_name";

to

$categories_query_ap = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd " . 
"where c.categories_id = cd.categories_id 
and c.categories_status = 1 
and c.parent_id = 2 //select master category 
and cd.language_id = '" . (int)$_SESSION['languages_id']  . "'" ." order by sort_order, cd.categories_name";

Otherwise it works as advertised, showing a non-expanding list of the subcategories of a master category, which is fine by me

regards
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

13 Jan 2010, 4:27 PM
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Display Categories In Separate Boxes

My apologies, I didn't go through the first posts thoroughly to get the full import (I think I had just awakened... more or less:).
It looks like you have fixed all of the problems with the mod; you might want to package it and submit an update so others can get the correct functionality from it.

16 Jan 2010, 10:15 PM
#10
tez1104 avatar

tez1104

New Zenner

Join Date:
Nov 2009
Posts:
1
Plugin Contributions:
0

Re: Display Categories In Separate Boxes

Hi All,

I have been searching for a sidebox with this functionality for so long and so relieved to find this thread!

I've followed all the instructions in the read me file and also the modifications to the files in this thread, but the seperate categories sidebox still doesn't display the category that I want.

Referring to the readme file:


This sidebox will display the content of Any Category you choose in a separate sidebox. To define the Category you wish to display open the file: includes/modules/sideboxes/Your_Template around line 20 find:
and c.parent_id = 76 Change the 76 to the master_category_id from your site.

How do I find out the: master_category_id ?

also is it possible to have multiple categories in this new seperate box?

Thanks All

17 Jan 2010, 3:45 AM
#11
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Display Categories In Separate Boxes

What the sidebox does is display all the subcategories of the category id you specify (not certain if only first level or all levels). You can get the category id by hovering on the category link and seeing the ...&cPath=##" in the URL.

6 Feb 2010, 6:46 PM
#12
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Display Categories In Separate Boxes

Hi,
I have uploaded a fixed version 1.1,

regards
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

10 Feb 2010, 4:19 PM
#13
bettyboop28 avatar

bettyboop28

New Zenner

Join Date:
Dec 2009
Posts:
24
Plugin Contributions:
0

Re: Display Categories In Separate Boxes

where can I find the update?

This is the error that I get

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/select master category and cd.language_id = '1' order by sort_order, cd.catego' at line 3
in:
[select c.categories_id, cd.categories_name, c.parent_id, c.categories_image from zen_categories c, zen_categories_description cd where c.categories_id = cd.categories_id and c.categories_status = 1 and c.parent_id = 6 //select master category and cd.language_id = '1' order by sort_order, cd.categories_name]

10 Feb 2010, 6:12 PM
#14
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Display Categories In Separate Boxes

it may be a couple of weeks while it gets vetted/de-loused and appears in the Downloads, but in any case all the fixes I did are detailed in post#8.

The query that seems to be causing the problem should be like this

  $categories_query_ap = 
"select c.categories_id, cd.categories_name, c.parent_id, 
c.categories_image from " . TABLE_CATEGORIES . " c, " . 
TABLE_CATEGORIES_DESCRIPTION . " cd " .
 "where c.categories_id = cd.categories_id 
and c.categories_status = 1 
and c.parent_id = 2 and cd.language_id = '" . 
(int)$_SESSION['languages_id']  . "'" ." 
order by sort_order, cd.categories_name";

The only thing you need to change is the

and c.parent_id = 2

to whatever the number is for the category you want it to display.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

19 Feb 2010, 3:53 PM
#15
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Display Categories In Separate Boxes

Hi,
the corrected version is now available for download:
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=1231the

There is nothing new in it that has not been mentioned in this thread already.

regards
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

24 Mar 2010, 9:23 AM
#16
shahram avatar

shahram

Zen Follower

Join Date:
Jul 2009
Location:
New York
Posts:
122
Plugin Contributions:
1

Re: Display Categories In Separate Boxes

Hi there i upload your Display Categories In Separate Boxes but i like to remove the dot it showing next to categories on left side can you help me out with this Thanks

25 Mar 2010, 9:46 AM
#17
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Display Categories In Separate Boxes

there should not be a dot, can you provide a link to your site?
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

25 Mar 2010, 2:46 PM
#18
shahram avatar

shahram

Zen Follower

Join Date:
Jul 2009
Location:
New York
Posts:
122
Plugin Contributions:
1

Re: Display Categories In Separate Boxes

25 Mar 2010, 3:12 PM
#19
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Display Categories In Separate Boxes

That is the list item marker. If you don't want any marker, add to your stylesheet (in any convenient place)```
.separatesideboxlist li {list-style: none;}

29 Mar 2010, 1:15 AM
#20
shahram avatar

shahram

Zen Follower

Join Date:
Jul 2009
Location:
New York
Posts:
122
Plugin Contributions:
1

Re: Display Categories In Separate Boxes

gjh42:

That is the list item marker. If you don't want any marker, add to your stylesheet (in any convenient place)```
.separatesideboxlist li {list-style: none;}


hi how i can make 'Categories In Separate Boxes' list on the left side it showing in the center ? Help Please