-
how to keep categories unfolded on sidebox?
This is how I hacked up the zen-cart code to have the ability to unfold ANY or ALL categories to display sub-cats on all pages, not just the index page:
open 'includes/classes/category_tree.php'
1) change line 137
-----------------------------------------------------------------------------------
change
if (zen_not_null($cPath)) {
TO =>
if (zen_not_null($cPath) or 1) {
-----------------------------------------------------------------------------------
2) insert code in lines 141-145
ORIGINAL
-----------------------------------------------------------------------------------
reset($cPath_array);
while (list($key, $value) = each($cPath_array)) {
-----------------------------------------------------------------------------------
insert =>
$cPath_array = array(#,#);
in between the reset and while commands.
# equals the category ID you wish to be unfolded... you can have it only unfold one, or all... all would be #,#,#,#,# and so on until you have all the ID's inside the parenthesis.
END RESULT
-----------------------------------------------------------------------------------
reset($cPath_array);
$cPath_array = array(1,2,5,7);
while (list($key, $value) = each($cPath_array)) {
-----------------------------------------------------------------------------------
hope this helps some people, my buddy and I spent 2 hours trying to figure this one out. tried to add some hyphens in here for reading pleasure and such... do not insert the page breaks I made. ENJOY!!!
Any questions let me know, this is what worked for me.
-
Re: how to keep categories unfolded on sidebox
-
Re: how to keep categories unfolded on sidebox
I inserted what you had and only the 3rd cat was unfolded. Could you explain more about the id's or ###.
Thanks
Dave
-
Re: how to keep categories unfolded on sidebox
Huge pat on the back, thank you very much.
btw your line number were way different than mine, the code you speak of occurs starting on line 70 for me. I'm on 1.3.8, not sure if that is what the difference is but it still works great. Thanks.
-
Re: how to keep categories unfolded on sidebox
every category/subcat has an ID
example:
id : catname
1:shoes
-3:nike
-4:adidas
2:shirts
you can only 'unfold' categories with subcategories... it's not going to list products there... so in this instance, you would just use ID 1 there.... if shirts had subcats, you would include ID 2... and so on. only use cat IDs there with subcats inside there.
hope that helps...
-
Re: how to keep categories unfolded on sidebox
Quote:
Originally Posted by
Qwert302
btw your line number were way different than mine, the code you speak of occurs starting on line 70 for me. I'm on 1.3.8, not sure if that is what the difference is but it still works great. Thanks.
nice hack!!:smartalec: was looking for that and didnt want to add a mod for just a small change:clap:
I also had the lines of this code in different location, am using 1.3.8a here is my code starting from line 70-73;
Code:
if (zen_not_null($cPath) or 1) { //addes this "or 1)" to always open subcategories
$new_path = '';
reset($cPath_array);
$cPath_array = array(15); // added this line to always open categorie #15 > subcategories
Works great!:bigups:
-
Re: how to keep categories unfolded on sidebox
Thank you so much. I spent like 6 hours trying to find this!!!:D
-
Re: how to keep categories unfolded on sidebox
Can you post a website we can view how it works?
Thanks,
Kim
:smile:
-
Re: how to keep categories unfolded on sidebox
I can not get this to work.
Code starts on line70. I have version 1.3.8
if (zen_not_null($cPath) or 1) {
$new_path = '';
reset($cPath_array);
$cPath_array = array(82,83,84,111,112,113,114,115);
while (list($key, $value) = each($cPath_array)) {
I first tried my top category, but did not work. I went deeper into sub-category and still does not work.
Help!
Thanks,
Kim
-
Re: how to keep categories unfolded on sidebox
Thank YOU!!!
This is what i wanted to do from the start.
i have 1.3.8a and i also had the line starting at 70
This should be faq'd
-
Re: how to keep categories unfolded on sidebox
Thank you. I finally got it to work. But, I noticed that there is vertical line and underscore in front of the sub-category.
How do I get rid of it?
And I would only like the top category to unfold when clicked on...Is that possible?
Thanks again...Kim
www.burnerbooks.com/index.php
-
Re: how to keep categories unfolded on sidebox
could any one host the category_tree.php
i'm messing up when trying ti edit it
and i guessing we have to upload it to /includes/modules/sideboxes
-
Re: how to keep categories unfolded on sidebox
I still have not figured out how to get rid of the vertical line_ before my subcategories. Does anyone know how?
You can see it on my site: www.burnerbooks.com/index.php in the Shop by Categories sidebox. I am still modifying my stylesheets - the light blue is too pale. I will be changing that tonight.
Thanks,
Kim
-
Re: how to keep categories unfolded on sidebox
That's almost a different topic.
But you'll find the setting here: https://www.zen-cart.com/tutorials/i...hp?article=163
-
Re: how to keep categories unfolded on sidebox
-
Re: how to keep categories unfolded on sidebox
Quote:
Originally Posted by
sotlordrahl
This is how I hacked up the zen-cart code to have the ability to unfold ANY or ALL categories to display sub-cats on all pages, not just the index page:
open 'includes/classes/category_tree.php'
1) change line 137
-----------------------------------------------------------------------------------
change
if (zen_not_null($cPath)) {
TO =>
if (zen_not_null($cPath) or 1) {
-----------------------------------------------------------------------------------
2) insert code in lines 141-145
ORIGINAL
-----------------------------------------------------------------------------------
reset($cPath_array);
while (list($key, $value) = each($cPath_array)) {
-----------------------------------------------------------------------------------
insert =>
$cPath_array = array(#,#);
in between the reset and while commands.
# equals the category ID you wish to be unfolded... you can have it only unfold one, or all... all would be #,#,#,#,# and so on until you have all the ID's inside the parenthesis.
END RESULT
-----------------------------------------------------------------------------------
reset($cPath_array);
$cPath_array = array(1,2,5,7);
while (list($key, $value) = each($cPath_array)) {
-----------------------------------------------------------------------------------
hope this helps some people, my buddy and I spent 2 hours trying to figure this one out. tried to add some hyphens in here for reading pleasure and such... do not insert the page breaks I made. ENJOY!!!
Any questions let me know, this is what worked for me.
Thanks man this works great except for one problem. I used it to expand the first category on my page, and at the moment my page has 2 categories each with sub-categories. So Cat1 stays permanantly expanded on the entire website, but when a person clicks on Cat2, it loads the page, but in the categories sidebox, Cat 2 does not expand. Is there any way to sort this out?
-
Re: how to keep categories unfolded on sidebox?
i have installed the expanded category list, and can't see my products listed yet, not sure if this is the hack for me, as i don't have subcategories, and help appreciated.... i can't find a direct support thread for the expanded category list....:(
-
Re: how to keep categories unfolded on sidebox?
Thank you, I struggled for 2 hours trying to figure out Simple Category Tree, gave up and installed this in 5 minutes as described, except the different line numbers for v1.3.8.
I had to change some of my a hover CSS as that didn't carry over well.
-
Re: how to keep categories unfolded on sidebox?
Help! I can not set a style for the selected product after this hack.
Previously, I just added this line to the CSS to get the currently selected product highlighted with a background color on the categories sidebar:
Code:
#categoriesContent a.category-products SPAN.category-subs-selected {background-color: #669900;}
After the change, the site no longer uses the SPAN class, so there is no way for it to know which product is selected. What do I need to add to get that SPAN back in there? (v1.3.8) :wacko:
-
Re: how to keep categories unfolded on sidebox?
Anyone else having problems with breadcrumbs after installing? All top level categories with a sort number higher than the current category are being displayed. :frusty:
i.e. instead of:
Home > Sweaters > Women's Sweaters
I am now getting:
Home > Belts > Tshirts -> Shorts > Sweaters > Women's Sweaters
-
Re: how to keep categories unfolded on sidebox?
Quote:
Originally Posted by
anap
Anyone else having problems with breadcrumbs after installing? All top level categories with a sort number higher than the current category are being displayed. :frusty:
i.e. instead of:
Home > Sweaters > Women's Sweaters
I am now getting:
Home > Belts > Tshirts -> Shorts > Sweaters > Women's Sweaters
I am having a problem with the breadcrumbs as well. It always says "Home", regardless of what subcategory you are in.
-
Re: how to keep categories unfolded on sidebox?
After much searching, and reading about different ways to handle this, I ended up using the mod at
http://plone.held-im-ruhestand.de/so...art-categories
EXTEMELY easy to install - no code to edit either. Just unzip, upload 2 files, then go into your Tools/Layout Boxes Controller, and turn on the new "ch_categories" and turn off "categories". Works great! :clap:
Reason I used this is so I don't have to go edit the categories_tree file every time we add a new category with a subcategory.
I should also mention that as of now, we only have 1 subcategory in any category, so I'm not sure what will happen if we have more than 1 subcat.
-
Re: how to keep categories unfolded on sidebox?
This is a very good simple way to keep the catergories expanded but it's says that you can just expand one or as many catergories as you want but when I expanded just one of my categories my level 3 sub catergory would not expand when I clicked on it and instead of showing the products in the main section it showed all the products.
Anyone got any ideas???:huh:
-
Re: how to keep categories unfolded on sidebox?
Quote:
Originally Posted by
sotlordrahl
This is how I hacked up the zen-cart code to have the ability to unfold ANY or ALL categories to display sub-cats on all pages, not just the index page:
open 'includes/classes/category_tree.php'
1) change line 137
-----------------------------------------------------------------------------------
change
if (zen_not_null($cPath)) {
TO =>
if (zen_not_null($cPath) or 1) {
-----------------------------------------------------------------------------------
2) insert code in lines 141-145
ORIGINAL
-----------------------------------------------------------------------------------
reset($cPath_array);
while (list($key, $value) = each($cPath_array)) {
-----------------------------------------------------------------------------------
insert =>
$cPath_array = array(#,#);
in between the reset and while commands.
# equals the category ID you wish to be unfolded... you can have it only unfold one, or all... all would be #,#,#,#,# and so on until you have all the ID's inside the parenthesis.
END RESULT
-----------------------------------------------------------------------------------
reset($cPath_array);
$cPath_array = array(1,2,5,7);
while (list($key, $value) = each($cPath_array)) {
-----------------------------------------------------------------------------------
hope this helps some people, my buddy and I spent 2 hours trying to figure this one out. tried to add some hyphens in here for reading pleasure and such... do not insert the page breaks I made. ENJOY!!!
Any questions let me know, this is what worked for me.
Many thanks for posting this Zotlordrahl. It worked great and of course kept my chosen template theme. I've been working on Zen Cart projects for a month now and use this forum loads - had to register to thank you for this.:clap:
-
Re: how to keep categories unfolded on sidebox?
Hours and hours and hours of searching for this solution. THANK YOU!!! works perfectly!! :smile::smile::smile:
-
Re: how to keep categories unfolded on sidebox?
Also working for me, 1.3.9h cart. Thanks!
PS: Code was on different lines in 1.3.9h cart, used the find function in editor.
-
Re: how to keep categories unfolded on sidebox?
Okay, this morning I googled and read that for SEO it's probably best to leave subcats closed! Theme siloing and link dilution was the reason. I suppose that the basic zen cart layout is the best for seo afterall, including dynamic urls.....
-
Re: how to keep categories unfolded on sidebox?
I think the most important factor here is what is best for your customers' ease of use. Only if the menu status does not impact them materially should you change for SEO.
haggis0929 - The Uncollapsed Categories Tree mod will work for any number of subcat levels, expanding them all, all the time.
-
Re: how to keep categories unfolded on sidebox?
Thanks. I'm re-visiting opening all subcats. However, while it worked when I only had one cat with subcats, it now does not work with several cats with subcats.
1.3.9h
Barebones template
Categories Dressing mod
Where do I obtain this Uncollapsed Categories Tree mod?
-
Re: how to keep categories unfolded on sidebox?
Okay, mod edit on first page of this thread now working:
http://www.prommart.com/
But I had to use/work with the code in post #6.
1.3.9H ZC
Now have to look at my Categories Dressing mod.
-
Re: how to keep categories unfolded on sidebox?
Problem: In Nav Bread Crumbs ALL of the expanded cats/subcats show when on a product page (if you get to product from expanded cat sidebox).
Furthermore, clicking on one of the many cats in the nav crumb is not reliable: It may say your category, but show sub cats from another category.
This mod, although simple and it does expand the cats and looks nice, may be too simple, unless one turns off bread crumbs. I don't want to.
I'll look at Yellow's cat tree post. More complex; wonder if it also shows everything in breadcrumb?
-
Re: how to keep categories unfolded on sidebox?
Solution: my main site uses dynamic url's, which causes the nav breadcrumb problem. And each product shows all of the cats listed in the array in the browser url address bar.
My test site uses simple seo url. It seems to work.
Dynamic url's are the problem?
-
Re: how to keep categories unfolded on sidebox?
"Categories Dressing mod
Where do I obtain this Uncollapsed Categories Tree mod? "
Uncollapsed Categories Tree is packaged in the Categories Dressing zip, and the readme describes how to install and use it.
-
Re: how to keep categories unfolded on sidebox?
Quote:
Originally Posted by
gjh42
"Categories Dressing mod
Where do I obtain this Uncollapsed Categories Tree mod? "
Uncollapsed Categories Tree is packaged in the Categories Dressing zip, and the readme describes how to install and use it.
Thanks! I've used your Categories Dressing mod like forever, it's on my site now (although never used to it's full potential):
www.prommart.com
I have subcats showing in another font color.
I could probably accomplish what I'm trying to do (group designers by their various divisions) using a non-linked heading (or pic) with Cat Mod and making it look nice, and returning subcats to top level. But that will entail a learning curve, as all I've really done is use the line separator.
I'll check the Categories Dressing mod again, maybe download again, and take a look at the uncollapsed categories tree.
Steve
Yes! New download appears to have more than my old one.
-
Re: how to keep categories unfolded on sidebox?
* Categories Dressing v2.2 Glenn Herbert (gjh42) 2008-05-08
I packaged Uncollapsed Categories Tree with Cat Dressing in v2.7, and there are lots of improvements in functionality in the most recent version as well.
-
Re: how to keep categories unfolded on sidebox?
You may want to look at the zip of v2.8 in the support thread, post 1542 (not yet released in Free Addons), as it makes some things easier than previous versions as well as having enhanced functionality.
-
Re: how to keep categories unfolded on sidebox?
Thanks! I'll go to the Cat Dressing thread, get the new zip, and make any further posts there.
But already, your updated version seems much more user friendly.
-
Re: how to keep categories unfolded on sidebox?
Quote:
Originally Posted by
sotlordrahl
This is how I hacked up the zen-cart code to have the ability to unfold ANY or ALL categories to display sub-cats on all pages, not just the index page:
open 'includes/classes/category_tree.php'
1) change line 137
-----------------------------------------------------------------------------------
change
if (zen_not_null($cPath)) {
TO =>
if (zen_not_null($cPath) or 1) {
-----------------------------------------------------------------------------------
2) insert code in lines 141-145
ORIGINAL
-----------------------------------------------------------------------------------
reset($cPath_array);
while (list($key, $value) = each($cPath_array)) {
-----------------------------------------------------------------------------------
insert =>
$cPath_array = array(#,#);
in between the reset and while commands.
# equals the category ID you wish to be unfolded... you can have it only unfold one, or all... all would be #,#,#,#,# and so on until you have all the ID's inside the parenthesis.
END RESULT
-----------------------------------------------------------------------------------
reset($cPath_array);
$cPath_array = array(1,2,5,7);
while (list($key, $value) = each($cPath_array)) {
-----------------------------------------------------------------------------------
hope this helps some people, my buddy and I spent 2 hours trying to figure this one out. tried to add some hyphens in here for reading pleasure and such... do not insert the page breaks I made. ENJOY!!!
Any questions let me know, this is what worked for me.
Hi there! I made this change to includes/classes/category_tree.php and it ALMOST works except that the link for one of the subcategories is incorrect. It directs to the product listing of another subcategory.
Women (cPath=18)
-- Sandals (cPath=18_21)
-- Fur Accessories (cPath=18_22 - properly pulls up the page with additional subcategories for items like gloves, etc)
Men (cPath=17)
-- Sandals (cPath=18_17_19 - but still links properly to the men's sandals)
-- Fur Accessories (cPath=18_17_20 - but DOES NOT properly link to the men's page with additional subcats for items like slippers, etc but rather links to the WOMEN'S)
Please, help! I've been trying to fix this for hours. I hope someone has a fix out there! Thank you.
My cPath_array is : $cPath_array = array(18,17,21,19,20,22);
Using zencart v 1.3.9h
-
Re: how to keep categories unfolded on sidebox?
If you are not trying something fancy like expanding only some of the categories, forget editing code on your own and install Uncollapsed Categories Tree (detailed in previous posts), which just works reliably without adjustments.
-
Re: how to keep categories unfolded on sidebox?
-
Re: how to keep categories unfolded on sidebox?
this works.... thanks... works great
-
Re: how to keep categories unfolded on sidebox?
I changed the codes as you specified, but seem to have a small problem. Each set of subcategories is further to the right, like so:
Master Category 1
...Subcategory 1
...Subcategory 2
Master Category 2
......Subcategory 1
......Subcategory 2
Master Category 3
.........Subcategory 1
.........Subcategory 2
(The ... have been manually inserted because when I just added spaces here, they didn't show up and everything was left-aligned into one long column.)
Also I noticed that the Master Categories with subcategories are bolded, but the Master Categories that don't have subcategories are not bolded. How can I make all the Master Categories bolded...and get rid of those extra spaces in the subcategory listings?
Thanks!
Oh...I'm using v1.5.3.
-
Re: how to keep categories unfolded on sidebox?
Well, I half-solved the problem. I replaced your code with ch_categories (no offense) and the extra-spaces problem disappeared. But something even stranger is going on now. When "Categories - Always Show on Main Page" is turned OFF, I lose the bottom half of the index page. Just the index page. The other pages seem to be fine. But when "Categories - Always Show on Main Page" is turned ON, the bottom half of the index page reappears!! What could be causing this?