Re: Parent Categories Separated In 3 sideboxes
Hi Glenn , hopefully your monitoring this thread , and I apologise for keep coming back on this one. Usually once shown I understand , this category array is very confusing ( to me )
Anyway At the moment I followed your code and it works great I have only the sub cats showing for any one top cat - the question is if I am at home page or anyother page thats not in a Cat , can I have the top cats back ?
Thanks for any help.
Mark
Re: Parent Categories Separated In 3 sideboxes
You can add a test for cPath not blank or zero. It will have a value if you are in a category. Something like:
if (($_GET[cPath] != 0 and substr_count($box_categories_array[$i]['path'],'_') == 0) or ...
It may require a slightly different formulation, but this general approach should work.
Re: Parent Categories Separated In 3 sideboxes
Quote:
Originally Posted by
gjh42
You can add a test for cPath not blank or zero. It will have a value if you are in a category. Something like:
if (($_GET[cPath] != 0 and substr_count($box_categories_array[$i]['path'],'_') == 0) or ...
It may require a slightly different formulation, but this general approach should work.
Spot on !! :clap::clap::clap:
Thanks that is just what I needed , for anyone else needing the same as me , this is a section from my tpl_categories :-
PHP Code:
// subcat limit 2007-12-20
if (($_GET[cPath] != 0 and substr_count($box_categories_array[$i]['path'],'_') == 0) or zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
// skip if this is for the document box (==3)
} else {
Thanks again .
Re: Parent Categories Separated In 3 sideboxes
Thanks for your help on this.
I have a couple of other questions, that mayby you can help me with.
Can I set a default catagory to show when someone goes to the home page.
Also is it possible to show the current catagory selected where the catagory box title is.
A bit off the subject but I am aslo struggling to find the correct place in the stylesheet.css for the the header bar and the side box sub catagories. I want to show which catagory is currently selected, by changing colour, and also show a hover and selcted colour change in the sub catagories in the sidebox.
Thanks for any help.
Regards
Laurie
Re: Parent Categories Separated In 3 sideboxes
Quote:
Originally Posted by
chalfontgifts
Thanks for your help on this.
I have a couple of other questions, that mayby you can help me with.
Can I set a default catagory to show when someone goes to the home page.
This is done in the admin / Config / layout settings
Main Page - Opens with Category = enter the cat ID in here
Quote:
Originally Posted by
chalfontgifts
Also is it possible to show the current catagory selected where the catagory box title is.
Thanks for any help.
Regards
Laurie
I tried to do this to never did find a way to do it and gave up for the time being , but would be interested in a soldi way of achieving this as it should be easy enough to have a dynamic language define to sort it out.
Good luck !
Re: Parent Categories Separated In 3 sideboxes
Solution for the above is posted here, Thank you glen.
http://www.zen-cart.com/forum/showth...955#post607955
Re: Parent Categories Separated In 3 sideboxes
For the cetegory selected/hover indication, look at the /classic/ stylesheet. There is a section for parent/child categories which shows the classes you can address.
Re: Parent Categories Separated In 3 sideboxes
Well, I was really sure I could get it working without assistance... It *does* work, but not on the home page, and I'm seriously stumped.
I'm going for the "subcats only" variant here, one top category per box. The relevant snippets of code are below:
PHP Code:
/* test for cats to display */
if(in_array(str_replace("cPath=","",$box_categories_array[$i]['path']), explode(",",'2,2_4,2_5'))) {
So only Cpath 2 and the two subcats that are set up at the moment... fairly simple.
PHP Code:
// subcat limit 2007-12-20
if (substr_count($box_categories_array[$i]['path'],'_') == 0 or zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
// skip if this is for the document box (==3)
} else {
And the subcat code, which works. Except the box shows empty on the home page. If I go to the top category listing, or a product, or anywhere else, I get just the two subcats in the box as I want it.
How is this possible? Thanks in advance for any advice.
Re: Parent Categories Separated In 3 sideboxes
When you are on the home page, you haven't chosen a category (unless you have set "Main Page opens with" to a specific category); therefore, $cPath will be empty and none of your chosen cats will display.
This bit of code
if (substr_count($box_categories_array[$i]['path'],'_') == 0
skips all top categories in the display all the time.
The
if(in_array(
already only displays the categories or subs you specify. Since you don't want any top cats, eliminate the substr_count( part, and eliminate the 2, in the explode( function.
Re: Parent Categories Separated In 3 sideboxes
OK, a bit of clarification.
You have done the "separate boxes" cloning bit?
And you are wanting to display the subcats of one category in one of the boxes, all the time?
Do you have an expanded categories mod installed? If not, there will be no subcats in the category tree to display unless you are in the particular top cat.