spooks Posted October 19, 2008 Posted October 19, 2008 Hide Categories & Products This is a simple contribution to allow you to hide, disable or inhibit any category & optionally all products within that. I created this a while back but never a support thread, so I'm doing that now. I searched for a solution for this, solutions I found were either over complex, or poorly done, so this is my solution. I believe in keeping things as simple as possible & not re-inventing the wheel. OSC already has functions to hide any product, so I use that for products. This adds a new entry in the category table (categories_status) so all thats needed on the client side is to add a filter to sql queries ( and categories_status = 1 ). This does not allow for per-customer filtering, although I reckon it wouldent be too difficult to add. Most changes occur in admin/categories.php. These allow you to change the status of any category & the status of all products within a category. Contribution is at http://addons.oscommerce.com/info/5907 Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
spooks Posted October 19, 2008 Author Posted October 19, 2008 (edited) Just one quick question, I have installed this, it was easy to follow and works great thanks, but I wondered if it is possible to link the turning off of the products with the turning off of the categories, so that you only have to set the category inactive and the products are automatically set inactive? I`m not sure thats a good idea, if someone has a lot of product in a category with a mixture of disabled/enabled that one click could make them tear their hair out!! After all you only need to select 'edit' category then its just two clicks to do the same. Actually that leads me to a second question, is it possible to set a category inactive and all sub-categories are set inactive? Thats possible, though a little more compex than may appear, I`ll take a look when I've time. Edited October 19, 2008 by spooks Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
♥stubbsy Posted October 19, 2008 Posted October 19, 2008 Thanks Sam, After all you only need to select 'edit' category then its just two clicks to do the same. lol, I guess its just me being lazy ;) Anyway, its certainly an improvement on the 'other version' and much easier to install! Keep up the good work! Dave Quote
spooks Posted October 19, 2008 Author Posted October 19, 2008 What you could do is replace (47): tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&cID=' . $HTTP_GET_VARS['cID'])); with: tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&cID=' . $HTTP_GET_VARS['cID'] . '&action=edit_category')); that would put you strait in edit mode after change a category status Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
♥stubbsy Posted October 20, 2008 Posted October 20, 2008 Thanks for that, saves a click or two :) Quote
Guest Posted November 20, 2008 Posted November 20, 2008 Wonderful!! Just what i needed Thanks Sam Quote
godt09 Posted January 7, 2009 Posted January 7, 2009 I have made the file changes, uploaded files including images, and successfully run the database query, and all appears well in admin. I can click green/red icons. Only thing is, it does not hide categories. Have I missed something? Quote
Guest Posted February 16, 2009 Posted February 16, 2009 (edited) I have made the file changes, uploaded files including images, and successfully run the database query, and all appears well in admin. I can click green/red icons. Only thing is, it does not hide categories. Have I missed something? I'm having the same problem. Looking in the database, the categories_status on an inactive category is correctly set to "0", but it's still showing up in the navigation. Here's the relevant code: $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and c.categories_status = 1 and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); You can see the filter - "categories_status = 1" - so it should be ignoring categories_status = 0, right? Anyone got any ideas? Edited February 16, 2009 by rebelina Quote
Guest Posted February 16, 2009 Posted February 16, 2009 Found out what was wrong in my case. I'm not using boxes/categories.php anymore as I installed a different categories menu some time ago - I should have been editing ul_categories instead. So if you're having this problem, remember to check you're editing the right file for your shop Quote
ianric Posted November 1, 2009 Posted November 1, 2009 Hi Just found this thread because I am looking to do what Stubbsy (2nd post in) wants to do about having the category hidden when products inside are hidden but display the category if one or more items in that category is marked "in stock". I understand Spooks's answer and it's a great contrib so lets hope Spooks or whoever can add this when they have time Many thanks Ian Quote
spooks Posted November 1, 2009 Author Posted November 1, 2009 Hi Just found this thread because I am looking to do what Stubbsy (2nd post in) wants to do about having the category hidden when products inside are hidden but display the category if one or more items in that category is marked "in stock". I understand Spooks's answer and it's a great contrib so lets hope Spooks or whoever can add this when they have time Many thanks Ian Its feasable, but there r a lot of provisows that would need to be considered, ie if a category is disabled is it ok/or not to enable on status change of a product, should status change on client side or not when product staus changes since it went out of stock, ...... Its something I'll look at in time, but its on the backburner for now!! Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
ianric Posted November 3, 2009 Posted November 3, 2009 Its feasable, but there r a lot of provisows that would need to be considered, ie if a category is disabled is it ok/or not to enable on status change of a product, should status change on client side or not when product staus changes since it went out of stock, ...... Its something I'll look at in time, but its on the backburner for now!! Hi Sam Thanks for the reply. I can't remember why I wanted the "extra bit" adding because I was looking at it today and testing and it works great Cheers Ian Quote
KJ666 Posted November 4, 2009 Posted November 4, 2009 Anyone know how to do this: I have a cat that i have set to inactive as i have the link in the nav bar to that page, but then i need the sub-cats still working ? These are not being shown any idea how to get this to work ? Quote
spooks Posted November 4, 2009 Author Posted November 4, 2009 Anyone know how to do this: I have a cat that i have set to inactive as i have the link in the nav bar to that page, but then i need the sub-cats still working ? These are not being shown any idea how to get this to work ? you just need to alter the sql a bit, look at that. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
KJ666 Posted November 4, 2009 Posted November 4, 2009 ALTER TABLE `categories` ADD `categories_status` INT( 1 ) NOT NULL DEFAULT '1';ALTER TABLE `categories` CHANGE `categories_status` `categories_status` INT( 1 ) NOT NULL DEFAULT '0' ; I have no idea what or how to change sql, could you help me please ? Quote
spooks Posted November 4, 2009 Author Posted November 4, 2009 I have no idea what or how to change sql, could you help me please ? without knowing which precise page your talking of, and possibly part of that page, I've no idea which sql would need modifying. when your trying to change something you must be very specific in your query, otherwise people don't know what u mean so ignore you. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
KJ666 Posted November 4, 2009 Posted November 4, 2009 I would like the sub-cats to show on this page: http://kjexotics.co.uk/euro/livestock-c-21.html'>http://kjexotics.co.uk/euro/livestock-c-21.html If you go to the home page: http://kjexotics.co.uk/euro You can see i have disabled this cat and placed it in the nav bar (but i need the sub-cats to show). Any more questions just ask (sorry i just didnt want my pages indexed by search engines) ? Plus i am trying to get rid of the gap on the left if you know how to do that? I have this code so far (i want the left to stay on every other page part from in this cat (21)) <td class="left-column" width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"><!-- left_navigation //--><?php if ($current_category_id != 21) require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> Quote
KJ666 Posted November 4, 2009 Posted November 4, 2009 Does anyone know how to change this ? Do you need more infomation (if so just ask). Thanks for any help. Quote
KJ666 Posted November 6, 2009 Posted November 6, 2009 Anyone figured a way i could do this please. Quote
spooks Posted November 8, 2009 Author Posted November 8, 2009 Having looked at this, it should work fine as is, all the contrib dose is disable individual categories just because a category parent is disabled will not stop its subs from appearing, just call the parent manually, as you have, check though that subs exist, are enabled & have product. Please do not post unrelated questions in existing threads (hijacking). Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
clippers Posted April 6, 2010 Posted April 6, 2010 Hi Sam Ive installed this contribution and it works fab. I was wondering if you knew where i could get code to change the hidden category to keep all products active but hide them from the public but still active for purchasing. The reason why is im installing ollacart for my high street shop to link to my website inventory, my problem is getting photos in time to upload on the web the same time as it comes into the shop, i need the products active for the POS but i don't want products visible on the web that are not finished with images. Any ideas? Thanks Emma Quote
spooks Posted April 7, 2010 Author Posted April 7, 2010 I was wondering if you knew where i could get code to change the hidden category to keep all products active but hide them from the public but still active for purchasing. Thats the way it works, if you disable a category, only that is done, you have to set within that if you also want to disable all products within. ie if you search for a product thats in a hidden category, it will be found, unless you modify the search to check category too. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
Mort-lemur Posted June 14, 2010 Posted June 14, 2010 Hi, If anyone is having a problem with this contribution when used with Categories Image Box contribution, then please see the following fix by Kymation: In catalog/includes/modules/categories_images.php find (near line 26) $categories_query = tep_db_query ("select c.categories_id, c.categories_image_front, cd.categories_description_front, cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_CATEGORIES . " c where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id = '" . (int) $languages_id . "' order by c.sort_order "); and replace with: $categories_query = tep_db_query ("select c.categories_id, c.categories_image_front, cd.categories_description_front, cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_CATEGORIES . " c where c.parent_id = '0' and c.categories_status = '1' and c.categories_id = cd.categories_id and cd.language_id = '" . (int) $languages_id . "' order by c.sort_order "); This will hide the category from the categories image box as well. All credit to Kymation for this fix. Thanks Quote Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.
dallasbird Posted February 27, 2013 Posted February 27, 2013 Hello Sam. I have installed your contribution but I do not have the catalog/boxes/categories.php - file? In fact I do not have a catalog/boxes - in os 2.3.1. The contribution is up and I can select inactive, but it still shows the categories on the menu in the box. I can select the items in the category and make them inactive, so as a temporary fix I took off the titles and put them in sort order 20 and 21 - this puts black space at the bottom of box. Would you please help. Perhaps it is that I do not have the additional page to edit that is causing the problem. Is there somewhere else I can look? Your help is appreciated. here is my site/ be warned it is an adult site: couplescorner.biz Jenny Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.