Forums / All Other Contributions/Addons / Simple Category Tree

Simple Category Tree

Views: 97,118

Results 141 to 160 of 249
18 Jul 2008, 2:50 PM
#141
gabstero avatar

gabstero

Zen Follower

Join Date:
Nov 2007
Posts:
342
Plugin Contributions:
0

Simple Category Tree

Also observed another problem:

The parent category link is broken. It points to "www.domainname.com/128" where I believe the "128" is the category id.

Is there a way to remove the Parent cat link?

thanks again!
g

2 Aug 2008, 10:59 PM
#142
bluesky2008 avatar

bluesky2008

New Zenner

Join Date:
Jul 2008
Posts:
75
Plugin Contributions:
0

Re: Simple Category Tree

i dowloaded all_sub_cats_products.zip and have it installed.

for each categories i get what i want except the index page.

cause i dont want it shows all products on my index page. for the index page i only want to show one photo, and new products, featured products, special products below the photo.

how to modify it then? thanks.

17 Sep 2008, 5:32 PM
#143
orsenfelt avatar

orsenfelt

New Zenner

Join Date:
Jun 2008
Posts:
4
Plugin Contributions:
0

Re: Simple Category Tree

bluesky2008:

i dowloaded all_sub_cats_products.zip and have it installed.

for each categories i get what i want except the index page.

cause i dont want it shows all products on my index page. for the index page i only want to show one photo, and new products, featured products, special products below the photo.

how to modify it then? thanks.

I would like to know this also.

As a kind of additional, Is it possible to have category and sub-category images displayed, Then products listed?

For example, The main page would show top level category images. Once clicked you see it's sub-category images, Underneath which is all the products in the top level category..

1 Oct 2008, 7:55 PM
#144
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Simple Category Tree

As for those who want to style the tree, you can always use css, the tree takes your desired tags, and then fill in the classes for each level, so it should be relatively easy to use css to style it anyway you want.

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

12 Oct 2008, 3:28 AM
#146
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Simple Category Tree

Glamorousshoe:

What happen to yellow, Where are the links to his mods, I need the Simple categorie tree but the link will not work.
Here you go:
http://public.rubikintegration.com/

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

12 Oct 2008, 4:05 AM
#148
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Simple Category Tree

Glamorousshoe:

Thank You Much, Is there a reason why you are not linking to them in your signature

My site is under going construction right now ^_^

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

24 Oct 2008, 8:58 AM
#149
some_name_not_taken avatar

some_name_not_taken

Zen Follower

Join Date:
Sep 2008
Posts:
106
Plugin Contributions:
0

Re: Simple Category Tree

What is the purpose of Simple Category Tree?

I have installed the latest version, created the two blank files necessary to get the module to show in the layout boxes, disabled the usual category box and...

...now have a row of category listings above the EZ Page line that cannot be removed and a perfect duplicate of the Zen Cart default category box :wacko:...

The screenshots I have seen all show something quite different, so why is this module duplicating the normal category box or is something screwed up with my install?

24 Oct 2008, 10:00 AM
#150
some_name_not_taken avatar

some_name_not_taken

Zen Follower

Join Date:
Sep 2008
Posts:
106
Plugin Contributions:
0

Re: Simple Category Tree

I have also downloaded all_sub_cats_products, so I now have all_sub_cat_products and simple_category_tree.

So, I'm guessing that I need the latter in place before the former? ...and that the following files are required:

**includes/modules/sideboxes/**my_categories.php
**includes/templates/template_default/**sideboxes/tpl_my_categories.php

...and that my_categories.php needs to contain

includes/modules/sideboxes/my_categories.php
PHP Code:
<?php
    require($template->get_template_dir('tpl_categories.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_my_categories.php');

    $title = 'Simple Categories Tree Demo';
    $title_link = false;

    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);

?>

includes/templates/template_default/sideboxes/tpl_my_categories.php
PHP Code:
<?php
$content = '';
$content .= $_SESSION['category_tree']->build_category_string('ul', 'li', '', 0, 2);
?>

...whilst **includes/templates/template_default/sideboxes/**tpl_my_categories.php remains blank?

I am not sure what use the all_sub_cats_products would then be.

24 Oct 2008, 12:33 PM
#151
some_name_not_taken avatar

some_name_not_taken

Zen Follower

Join Date:
Sep 2008
Posts:
106
Plugin Contributions:
0

Re: Simple Category Tree

...now have a row of category listings above the EZ Page line that cannot be removed

These were being generated through the Categories Tabs Menu ON/OFF :oops:

...and I still cannot get this (either of these?) modules working...

24 Oct 2008, 3:06 PM
#152
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Simple Category Tree

What is the purpose of Simple Category Tree?It replaces the original tree of ZenCart, it uses a single query to retrieve the tree along with caching through session, so it saves the resources. (if you have a large number of cats, you will notice a difference in loading speed)

You will the have to style the tree the way you want, of course.

This module can also let you retrieve more than 1 trees, for example: some people want to break the tree into multiple boxes. This module let you prints out part of the tree only, so you can print out only the sub-categories of the current category for example. It also allows you to limit the number of category level it will display....

I am not sure what use the all_sub_cats_products would then be.Zencart does not list products of the categories that contain only subcats, this module helps you to do that.

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

25 Oct 2008, 1:22 AM
#153
some_name_not_taken avatar

some_name_not_taken

Zen Follower

Join Date:
Sep 2008
Posts:
106
Plugin Contributions:
0

Re: Simple Category Tree

Thank-you, Yellow1912, the confusion of files is beginning to make sense now and I can now more clearly see the scale of potential visualised by other people posting on this thread.

So my next question is how do I get this working?

I can see that first of all I need to get Simple Catergory Tree working, so I have uploaded the auto_loaders file and the classes file, but am now not sure where to go from here.

I have checked the Layout Boxes Controller but don't see anything there, so is there where I need to create two files of my own? ...and where would they go ...and what should they contain to get me going?

I don't need a precise idiot's guide, here - just some pointers whilst I familiarise myself with the file structure of Zen Cart and apply some of what I have seen already in the posts on this thread.

25 Oct 2008, 1:26 AM
#154
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Simple Category Tree

If I remember correctly, I included in the readme a very short example as how to create a new sidebox that contains the new category tree. Is the instruction included in the package you downloaded? Did you have any problem following the instruction? Or did you follow it yet the sidebox still doesnt show up in admin?

Regards

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

25 Oct 2008, 2:01 AM
#155
some_name_not_taken avatar

some_name_not_taken

Zen Follower

Join Date:
Sep 2008
Posts:
106
Plugin Contributions:
0

Re: Simple Category Tree

I am not sure about the readme.txt, but I think that you would use the code lines in there to modify the code in the sample_sidebox.txt

So, looking at the code contained therein

includes/modules/sideboxes/my_categories.php
PHP Code:
<?php
    require($template->get_template_dir('tpl_categories.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_my_categories.php');

    $title = 'Simple Categories Tree Demo';
    $title_link = false;

    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);

?>

includes/templates/template_default/sideboxes/tpl_my_categories.php
PHP Code:
<?php
$content = '';
$content .= $_SESSION['category_tree']->build_category_string('ul', 'li', '', 0, 2);
?>

I would need to create two files, my_categories.php (which would be placed in

includes/templates/custom_templates/sideboxes)

...and tpl_my_categories.php (which would be placed in

includes/templates/custom_templates/templates)?

...the whole of which would then require activating in the Layout Boxes Controller?

Two further question, though:

Would this would display correctly in centercolumn or would it be a sidebox only display?

What needs to go into the tpl_my_categories.php?

25 Oct 2008, 2:06 AM
#156
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Simple Category Tree

You got it right.
Note that the code just shows you how to create a new sidebox which contains the new category tree.

You can follow the example to create more than 1 sideboxes (say 1 sidebox only show the top categories, while the other one only shows the subcategories of the current visited category)

And nothing can stop you from displaying the tree ANYWHERE on your site:
echo
$_SESSION['category_tree']->build_category_string('ul', 'li', '', 0, 2);

Please read the document and perhaps check the code to see which parameter does what.

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

25 Oct 2008, 2:11 AM
#157
some_name_not_taken avatar

some_name_not_taken

Zen Follower

Join Date:
Sep 2008
Posts:
106
Plugin Contributions:
0

Re: Simple Category Tree

Thank-you, Yellow!

So what about that tpl_my_categories.php (sorry, - amended things whilst you were posting!)? - Does that need to contain anything or is it OK as a blank file?

...and when you say sideboxes, that would include the centercolumn area would it not?

25 Oct 2008, 2:13 AM
#158
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Simple Category Tree

some name not taken:

Thank-you, Yellow!

So what about that tpl_my_categories.php (sorry, - amended things whilst you were posting!)? - Does that need to contain anything or is it OK as a blank file?

...and when you say sideboxes, that would include the centercolumn area would it not?
That one should contain:

<?php $content = ''; $content .= $_SESSION['category_tree']->build_category_string('ul', 'li', '', 0, 2); ?>

And yes, this module simply create the tree, then let you pull out the content when and where you want it.

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

25 Oct 2008, 2:24 AM
#159
some_name_not_taken avatar

some_name_not_taken

Zen Follower

Join Date:
Sep 2008
Posts:
106
Plugin Contributions:
0

Re: Simple Category Tree

Thanks, again.

That code explains where I went wrong when I first tried to use this - blank tpl_my_categories.php...

Then the 0,2 references from the root of the category tree and depth (number of levels), so change according to preference?

Then (for anyone else reading this) the li can be styled through CSS and given a CSS class name.

In case you had not already guessed I am asking some of questions in order to make things perfectly clear not just for myself, but also for anyone else wanting to use your contributions.

25 Oct 2008, 2:25 AM
#160
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Simple Category Tree

Taken from the readme:

This class is very simple to use, you have only a few functions that you can call:

  1. Basic:
    a. build_category_string($parent_tag = 'div', $child_tag = 'span', $divider = '', $categories_id = 0,
    $max_level = 9, $include_root = false, $strict = false)

--> This is the most important function, it will build and return the category string (already in html code) for you, all you have to do is to print it out.
As you can see, the function takes a number of parameters:
Let me draw a sample cat tree so that you can understand it better: (assuming we use the default params)

|<div class="level_0 has_sub">
|--------<span class="level_0 has_sub"> link here
|----------------|<div class="level_1 has_sub">
|----------------|--------<span class="level_1 no_sub">link here</span>
|----------------|--------<span class="level_1 has_sub current">link here</span>
|----------------|----------------|<div class="level_2 has_sub current">
|----------------|----------------|--------<span class="level_2 no_sub"> link here</span>
|----------------|----------------|--------<span class="level_2 no_sub"> link here</span>
|----------------|----------------|</div>
|----------------|</div>

</div>

And it goes on and on.

  • $divider will be put between children (sub cats same level), so be careful when you use it along with parent_tag and child_tag, you may have invalid html code.

  • $categories: the root of the tree, what it to start else where? pass the cat id there.
    For instance, here is the code I used to build a tree based on the current Category current visiting:
    if(isset($_GET['cPath']))
    $_SESSION['category_tree']->build_category_string('ul', 'li', '', $_GET['cPath'], 2)

  • $include_root: this is interesting, usually when you build a tree, you dont want to include the root of that tree, however, if you want to, set this to true.

  • $strict: this is alsu interesting: the category tree will auto expand when you go into deeper sub cat (even if the max_level is exceeded). However, if you want it to always stick to the max level strictly, set this to true.

b. retrieve_cpath($categories_id)

--> The name said it all, you passed in the cat id, you get the whole cPath back, this will even accept cPath (in case you have part of the cPath and want to get back the complete cPath)

c. retrieve_categories_tree_array()

--> return the whole category tree, in case you want to play with it

d. retrieve_deepest_cats_array($categories_id)

--> Very very useful one, this one will return the deepest level sub cats of any given cat id. Given the way ZC works, you know that these cats are the ones that actually hold products. If you want to retrieve all products of a parent cat, this is the one you need.
This function returns an array of cat id

e. build_deepest_level_children()

--> if you want to use the function above(d), make sure you call this one first, this will build the info needed.

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me