![]() |
Hidden Categories
3.5.8-3.5.9 but may work on others
In the older version of x-cart, disabled categories were still viewable so you could have hidden categories. This was good for hidden categories, not so good if you actually wanted to disable the category. In the newer x-carts I've noticed they actually disable the category, but you can't have hidden categories. This mod just allows you to create a hidden category using the admin section. The category won't show up in the navigation, and will still accessible by direct link. Mod is pretty basic, was just difficult finding where the exclusion took place :) ----- First lets get it to allow the hidden categories. Open up /include/categories.php FIND: $categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', 1) as root_category_name from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category")); REPLACE WITH: $categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', 1) as root_category_name from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' OR $sql_tbl[categories].avail='H' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category")); The key here is just adding the: OR $sql_tbl[categories].avail='H' ----- Lets make hidden categories creatable from the admin Open /skin1/admin/category_modify.tpl FIND: <select name=avail> <option value='Y' {if ($current_category.avail eq 'Y')} selected {/if}>Enabled</option> <option value='N' {if ($current_category.avail eq 'N')} selected {/if}>Disabled</option> </select> REPLACE WITH: <select name=avail> <option value='Y' {if ($current_category.avail eq 'Y')} selected {/if}>Enabled</option> <option value='N' {if ($current_category.avail eq 'N')} selected {/if}>Disabled</option> <option value='H' {if ($current_category.avail eq 'H')} selected {/if}>Hidden</option> </select> ------------------------- Everything is working now, except they are still on the side navigation, so lets remove them. Open /skin1/customer/categories.tpl FIND BOTH INSTANCES OF: <font class=CategoriesList>{$categories[cat_num].category_name}</font> CHANGE TO: {if $categories[cat_num].avail ne "H"}<font class=CategoriesList>{$categories[cat_num].category_name}</font> {/if} NOTE: There are two links in this file, the categories and the subcategories. The modification needs to be made to both. ------------------------- That should do it. Feel free to paypal a donation to jon@hitemup.com if you feel this mod has saved you cost of some development time :) |
NOTE: A small edit has been made to the categories.tpl modification. It needs to be implemented twice, once for the categories and once for the subcategories.
If your using this, please let me know so I know posting these mods isn't a waste of my time. Thanks :) |
is there any way this can work in conjunction with fancy categories?
|
I don't have the fancy categories module. I imagine it's just a matter of putting in the if statement. If you send me the module files I will have a look and see if I can implement for you.
Can I see what the fancy categories look like on your site? I'm not even really sure what they are. |
jon, any luck on making this work with fancy cats?
thx :) |
None yet. Haven't had the chance to really get into it though, I should have a chance before the weekend.
|
nice!
no rush of course. i think there are a lot of folks who could use this mod. mike |
jon,
any progress? |
Sorry I haven't had any time to address this.
I opened up the fancy categories code and it looks complex. Haven't had any time to go any further than that. Don't know if I will. |
Thanks Jon! I was just about to write this but luckily found your post.
|
For 4.0 the code is basically the same. Here's the code for the categories.php
Open include/categories.php $categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category")); Replace with: $categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' OR $sql_tbl[categories].avail='H' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category")); |
Jon,
I am trying to apply hidden category to my XCart 4.0 but I could not find any code from include/categories.php. This is the code of categories.php Code:
<?php Could you show me where to replace the code? |
4.0.7
This is the categories.php code for version 4.0.7
Change: Code:
$search_condition = "AND avail='Y' AND (membership='".addslashes($user_account["membership"])."' OR membership='')"; Code:
$search_condition = "AND avail='Y' OR $sql_tbl[categories].avail='H' AND (membership='".addslashes($user_account["membership"])."' OR membership='')"; Nice little mod. Thanks! |
Very Nice Jon... Thank You
|
I think this mod should be standard XCart issue, however, there is one bug. If you try to search by price in v.4.09 you will get a four mile long SQL error :(
|
that should be handy for seperating some products out of the normal categories list. Thanks!
|
Jon
I am trying to do something like this but with embedded pages. I would like to create a few embedded pages to link via hyperlinks, but not be visable under the help section. Is there something that could achive this as you have done here with the catagories? Thanks in advance |
I don't use embedded pages so I can't say for sure.
You could probably edit your help menu template file and put a conditional to now show a certain page id #. |
Quote:
Thanks for the reply, I will look at the template and see how it is called and see what I can do. I thought there was a thread that actually spoke of this, and I cannot find it to save my life. Thanks again |
Hidden is the word you need to use - Hidden Static Pages
Hi All
Nice MOD Jon. I will look into trying it soon. To Markwhoo and others: Hidden Static Pages. Here are some links on this topic: http://forum.x-cart.com/viewtopic.php?t=13705&highlight=hidden+pages+hatto n http://forum.x-cart.com/viewtopic.php?t=11602&highlight= Note: Follow the links and view the examples. If you or anybody else is interested in my mods - email/pmail me and I will give you the details. Regards Ing. Stephen Hatton :idea: |
I wonder if hidden categories could be the answer to MAP pricing.
Does hidden catagories get added to the HTML catalog? Do the products in a hidden category get added to a froogal feed? If the answer to my 2 questions is no... we have the makings of an excellent MAP Mod. |
Re: Hidden is the word you need to use - Hidden Static Pages
Quote:
This is it! These were the pages I have been looking for. I think this search engine in the forum is useless sometimes. I have used some of the same words in the titles for searches and have come up blank or other off topic items. Thanks so much and a PM is on the way! |
Hello Jon,
Firstly I would like to thank you for sharing such a wonderful mod and to Elleven for adding the mod for Version 4.07 Could you please help me with a little something from this mod that is stumping me 8O I have followed your mod steps (thanks Jon) but with the one change of using the categories.php suitable for V4.0.7 as provided by Elleven. I have created some 25 hidden categories as I want to use these for a Alpha Image Map. For some reason when I view any of the the hidden categories the Category name appears the same. They all show the name of the very first Hidden Category I created regardless fo the link being different. Basically I have 25 Hidden categories being A to Z starting from home.php?cat=300 up to home.php?cat=325 Here are a few to see what I mean. http://www.giftandhomewarehouse.com.au/home.php?cat=300 http://www.giftandhomewarehouse.com.au/home.php?cat=312 http://www.giftandhomewarehouse.com.au/home.php?cat=302 http://www.giftandhomewarehouse.com.au/home.php?cat=321 I hope someone can see past what I see as I am so stumpped with why this is occurring. Thanks for looking. |
Quote:
Jon, Do you know if the products in hidden categories are created in the HTML catalog? Are they added to a froogle feed when using MM 3.0? Thanks |
Sorry to say I'm not sure about either of those scenerios. You can easily test to see if the products of hidden categories are created.
As for MM3 you'd have to ask groovico. |
FYI, you don't need to modify categories.tpl in 4.0.12, the same is probably true of all 4.x.
I noticed after I applied this mod into my cart that I had forgoten to exclude the hidden categories in the horizontral category menu I have at the bottom of my pages. When I looked, the hidden categories weren't being displayed. The code is almost identical to the side menu, so I took the if statements out of categories.tpl. However I now have a problem, how the hell do you display ONLY the hidden categories? Or even display them at all? Is hardcoding the only option? |
Sorry I can't provide support for this modification, I don't use the 4.x branches of x-cart and have a hard enough time just keeping my paid modules up to speed with the variety of x-cart releases.
|
I'm sure I'll figure it out. I think it's only loading available categories into the $categories variable.
*edit* I figured it out. In categories.php I commented out: Code:
$search_condition[] = "$sql_tbl[categories].avail='Y'"; I wouldn't do that if you have disabled categories though. I have no idea where else $search_condition is used. But for me, it fits my needs. I had to put back the if statements in categories.tpl. |
did anyone figure out how to get the name to change?
|
Hello,
Sorry as yet I have not been able to get the name of the categories to work right with this mod. I too would love to know if anyone has this working on the same xcart versions as I use. Cheers |
4.0.8
Has anyone got this to work on 4.0.8? I made the changes to category_modify.tpl but can't find the code mentioned in catagories.tpl
Would be great if I could get this working. |
That is because you need to edit categories.php, not categories.tpl. Totally different file :)
|
Cheers
What a doofis! Thanks again!
|
Just doesn't want to work.
As Alltribes said, "didn't need to modify categories.tpl" as I am 4.0.8. But i canged the code in category_modify.tpl to:
Code:
<select name=avail> It still isn't working Just to make sure I'm being clear in what I want to achieve, I want to be able to disable the catagory in admin and still be able to access it via direct URL. What I have done is taken the url then disabled the catagory, gone back and pasted url directly into address bar, but it just takes me to my shop index. What am I doing wrong? |
That mod is not working on X-Cart 4.0.14 :(
Anyone can help me? I can post my categories.php if needed. Thanks! Martin |
Read the thread carefully...there are solutions for 4.0 posted within the thread. I have it working fine on multiple versions of 4.0.x, including .14.
|
An extension of the page title "bug", the description also gets taken only from the 1st hidden category. Tried to work around by giving the first hidden category a general name, and use the description to differentiate the categories. Didn't work. Every category (hidden or not) displays the same title and description as the 1st hidden category. Anyone figured it out yet?
|
You are right, the same happens on 4.0.14
This mod is not working properly :( Anyone has a solution? |
OK, this seems to be working all right on my site now.
Check it out at www.heritagetoys.com On the right, you will see a "Shop by Age" tab like menu. Each link in this menu goes to a hidden category. How I did this was by following the mod instructions in this thread. Then I created a category (I named it Shop by Age), and made it hidden. I created sub categories that I wanted to be the "hidden categories" (0-18 months, 1-2 years, etc.) and set them to "active" status, and just hard coded the links in to the tab. Results: If I move categories around in the admin, occassionally some of the categories (never know which!?) will display "Shop by Age" in the bread crumb and title. After a little while (minutes to hours) it goes back to it's own title/breadcrumb. Why? I don't know, but it seems to work in general. |
Seems like this Mod is still very buggy.
I couldn't find a solution to make it work properly yet. |
All times are GMT -8. The time now is 09:47 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.