Dagster Posted June 23, 2019 Share Posted June 23, 2019 Is it possible to hide a category from public display? I know you can set a product to be inactive and it doesn't show up, but I would like to do the same sort of thing for the category itself and can't seem to find anything that might provide that capability. I'm using v2.3.4.1, if that helps. Link to comment Share on other sites More sharing options...
♥raiwa Posted June 23, 2019 Share Posted June 23, 2019 Hide Categories & Products About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
SCH_001 Posted July 2, 2019 Share Posted July 2, 2019 Hi @raiwa I went to install this on v2.3.4.1 but the module does not seem to be compatible part of the install says In catalog/index.php Near 89 Find: $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); Replace With: $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_status = 1 and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); but the index.php only goes to line 78 and has no lines like this in it. The install says There may other instances I have missed, the general Rule is: If there is a general tep_db_query including TABLE_CATEGORIES add the filter: and categories_status = 1 So where have these been moved to seems they are not in index.php As I would also like to install this add_on Link to comment Share on other sites More sharing options...
♥raiwa Posted July 2, 2019 Share Posted July 2, 2019 I never used this Addon and can't help you. I just gave you the link where to find it. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥JcMagpie Posted July 2, 2019 Share Posted July 2, 2019 44 minutes ago, supercheaphobb said: So where have these been moved to seems they are not in index.php Use a tool like grepWin to search for them in your install. In stock frozen they are, Link to comment Share on other sites More sharing options...
Jack_mcs Posted July 2, 2019 Share Posted July 2, 2019 42 minutes ago, supercheaphobb said: So where have these been moved to seems they are not in index.php Your version of oscommerce has parts of the index.php file in modules so you would have to find the code to change there. And even then, that addon is not coded for your version of oscommerce so there will be changed needed to make it compatible. It never was a simple install and converting it to work with your shop at the same time will be time-consuming, though it is possible. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
YePix Posted July 2, 2019 Share Posted July 2, 2019 I use this addon and have to say that it is very helpful but the installation is very complicated. You have to rewrite all product queries. all modules for product display. all boxes for product display. then come the functions and a few other things that need to be adjusted and changed. Nevertheless, with a little patience, everything is possible. Link to comment Share on other sites More sharing options...
SCH_001 Posted July 3, 2019 Share Posted July 3, 2019 Sounds like this is a bit above my knowledge on what needs changing to what.... It's so hard to support OSC when so many of the needed add_ons are just way above what a shop owner can handle programming wise.. I will add this to my wish list with so many other items I have tried to setup Link to comment Share on other sites More sharing options...
kgtee Posted July 3, 2019 Share Posted July 3, 2019 @supercheaphobb Hi, I think it may be not at all difficult to hide categories. First, prefix the category name with something like "*", e.g. "Shoes" to "*Shoes". Secondly, to make sure categories with "*" prefix not be shown upon queried, simply set the filter in categories database query. Hmm.. just an idea. Someone please write a contribution. It sounds simple but it is difficult for me because I am not a coder. 😉 Link to comment Share on other sites More sharing options...
♥JcMagpie Posted July 3, 2019 Share Posted July 3, 2019 Renaming Cat's is probably not a good idea as it will imapct your SEO for the site. Also hiding cat's will impact all products within that cat again not good for SEO I would think. The code needed is already in osC as products can be turned off. They use "products_status" which can be set in admin to determin if a product should be shown or not. Just use the same code and add new colum "categories_status" to categories table. Then simply add status code to categories in catogorys.php in admin so you can turn them on and off. Then simply add the status to the cats db query as it is to products and every time cats are displayed they will be fillterd by status. Personaly I dont like turning things off as it will affect search engines as links may be lost or broken. This artical covers some of the pros and cons. https://www.goinflow.com/manage-stock-products-seo/ If it's out of stock better to show when new stock will be available, if it's no longer avaiable better to redirect to alternative product. If no alternative redirect to index. SEO can become complex so best to get profesional help. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted July 3, 2019 Share Posted July 3, 2019 If you still wish to hide the cat's then try this add-on as it's more upto date as it's for 2.3 Hide Categories with category cache Link to comment Share on other sites More sharing options...
SCH_001 Posted July 3, 2019 Share Posted July 3, 2019 Hi @JcMagpie looked at that one too and it again wont work on frozen, again it says to edit index.php Once I get a couple of more urgent things resolved I will fork out for a programmer to get it working. Step 6 ====== In: catalog/index.php ====================== Wherever you find a query that references TABLE_CATEGORIES add the "and status_categ = 1" in the query, so only active subcategories are selected from the database and displayed as icons in the main page. I found 6 places in the index.php where this must be done. Around line 23 change the query to read: $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "' and status_categ = 1"); Link to comment Share on other sites More sharing options...
♥JcMagpie Posted July 3, 2019 Share Posted July 3, 2019 1 hour ago, supercheaphobb said: fork out for a programmer to get it working Sure they can then test fully as required. However just tested and works fine. Remember in frozen cat is now in a class so make change in that public_html/includes/classes/category_tree.php line 41 $categories_query = tep_db_query("select c.categories_id, c.parent_id, c.categories_image, cd.categories_name, cd.categories_description, cd.categories_seo_description, cd.categories_seo_keywords, cd.categories_seo_title from categories c, categories_description cd where c.categories_id = cd.categories_id and cd.language_id and c.status_categ = '1' = '" . (int)$languages_id. "' order by c.parent_id, c.sort_order, cd.categories_name"); Make sure to run SQL first so status_categ is in db or it will brake store front. But works fine before after turning off first cat Hardware we have db Link to comment Share on other sites More sharing options...
YePix Posted July 3, 2019 Share Posted July 3, 2019 that's exactly how addon works, who posted @raiwa above and described it. Link to comment Share on other sites More sharing options...
SCH_001 Posted July 3, 2019 Share Posted July 3, 2019 Ok well it's half way installed on my test site only stopped when I got stuck on index.php I will go and have a plat now and see how I go Link to comment Share on other sites More sharing options...
YePix Posted July 3, 2019 Share Posted July 3, 2019 look the file category_tree.php in includes/classes/ here the query must be supplemented by: " and c.categories_status = 1". Link to comment Share on other sites More sharing options...
YePix Posted July 3, 2019 Share Posted July 3, 2019 like this $categories_query = tep_db_query("select c.categories_id, c.parent_id, c.categories_image, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and c.categories_status = 1 and cd.language_id = '" . (int)$languages_id. "' order by c.parent_id, c.sort_order, cd.categories_name"); Link to comment Share on other sites More sharing options...
SCH_001 Posted July 3, 2019 Share Posted July 3, 2019 Thank you @YePix you send that just as I got an error on the front page. I will post all the changes I had to make here to make it work when done for others Link to comment Share on other sites More sharing options...
SCH_001 Posted July 3, 2019 Share Posted July 3, 2019 First of all thank you to those that assisted and supplied the code I needed to get this to work To get the add_on Hide Categories & Products working in osCommerce Online Merchant v2.3.4.1 CE (Aka Frozen BS) I opened the Hide Categories & Products V1.1.txt (install instructions) in my favorite text editor and did a search and replace as per below Search $HTTP_GET_VARS replace $_GET Search $HTTP_POST_VARS replace $_POST Search DIR_WS_IMAGES replace 'images/' Search FILENAME_CATEGORIES replace 'categories.php' Then install as per instructions until you get to In catalog/index.php, instead go to catalog/includes/classes/category_tree.php Find at line 41 $categories_query = tep_db_query("select c.categories_id, c.parent_id, c.categories_image, cd.categories_name, cd.categories_description, cd.categories_seo_description, cd.categories_seo_keywords, cd.categories_seo_title from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id. "' order by c.parent_id, c.sort_order, cd.categories_name"); ands replace with $categories_query = tep_db_query("select c.categories_id, c.parent_id, c.categories_image, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and c.categories_status = 1 and cd.language_id = '" . (int)$languages_id. "' order by c.parent_id, c.sort_order, cd.categories_name"); and that's it Link to comment Share on other sites More sharing options...
SCH_001 Posted July 3, 2019 Share Posted July 3, 2019 Now I should point out that this will stop the category or sub category showing but if you have stock in the category that is still active it will not stop this item coming up in a search. Which can or can not be helpful, If you want the products also not to show you will need to set them to inactive. If there is a lot of items in the category I choose to use "easy populate" to export then change the status and import (update) if only a small amount you can either do it manually or use "easy update" Link to comment Share on other sites More sharing options...
YePix Posted July 3, 2019 Share Posted July 3, 2019 nice that it works but it's not all. you have to take a closer look at all modules and boxes otherwise products in the hidden category will continue to be displayed Link to comment Share on other sites More sharing options...
YePix Posted July 3, 2019 Share Posted July 3, 2019 find $categories_query = tep_db_query("select c.categories_id, c.parent_id, c.categories_image, cd.categories_name, cd.categories_description, cd.categories_seo_description, cd.categories_seo_keywords, cd.categories_seo_title from categories c, categories_description cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id. "' order by c.parent_id, c.sort_order, cd.categories_name"); change to $categories_query = tep_db_query("select c.categories_id, c.parent_id, c.categories_image, cd.categories_name, cd.categories_description, cd.categories_seo_description, cd.categories_seo_keywords, cd.categories_seo_title from categories c, categories_description cd where c.categories_id = cd.categories_id and c.categories_status = 1 and cd.language_id = '" . (int)$languages_id. "' order by c.parent_id, c.sort_order, cd.categories_name"); Link to comment Share on other sites More sharing options...
SCH_001 Posted July 3, 2019 Share Posted July 3, 2019 I will leave that to the choice of the shop owner, having hidden items with a very unusual name might be good. I will just set the products inactive @YePix If you install Responsive-osCommerce-2341-Frozen from github then it has the line I put up $categories_query = tep_db_query("select c.categories_id, c.parent_id, c.categories_image, cd.categories_name, cd.categories_description, cd.categories_seo_description, cd.categories_seo_keywords, cd.categories_seo_title from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id. "' order by c.parent_id, c.sort_order, cd.categories_name"); not sure why you have different original code unless you have edge? but the code you gave to replace it works so all good Link to comment Share on other sites More sharing options...
YePix Posted July 3, 2019 Share Posted July 3, 2019 this line is from Frozen if the seo is not queried there are errors in the issue Link to comment Share on other sites More sharing options...
SCH_001 Posted July 3, 2019 Share Posted July 3, 2019 Weird I even opened the zip file download 21-05-2019 and it has my version. Oh well it's what it gets replaced with that important 😉 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.