tlelliott77 0 Posted December 20, 2004 I can't find an ongoing thread for the Enable/Disable categories contribution so this is in a new thread. I noticed that when you disable a subcategory the product count in the categories infobox still displays the total number of products as if the subcategory were enabled. To correct this you can change the following: Find (line 378 in the version in the contribution): $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int)$category_id . "'"); And change to: $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.categories_status = '1' and p.products_status = '1' and p2c.categories_id = '" . (int)$category_id . "'"); If anyone knows of a suitable thread to add this to please post a reply so I can repost elsewhere. Tim Share this post Link to post Share on other sites
djenniex 0 Posted December 21, 2004 Hey Tim, thanks for the correction, but what file is that in? Is it the /includes/functions/general.php file? As for a suitable thread, I think you just started one for this Contribution. Share this post Link to post Share on other sites
tlelliott77 0 Posted December 23, 2004 Hey Tim, thanks for the correction, but what file is that in? Is it the /includes/functions/general.php file? As for a suitable thread, I think you just started one for this Contribution. <{POST_SNAPBACK}> Yes, the file is catalog/includes/functions/general.php. p.s. Thanks to all who've contributed to this useful mod. Share this post Link to post Share on other sites
PopTheTop 0 Posted January 8, 2005 I have a problem now since I added this contribution. When you view New Products, it shows ALL products in ALL categories. Even products that you copy (by link) to other categories, causing them to be listed more than once. I have 135 items right now and New Products show 314 items. Go to http://www.popthetop.com/catalog/products_new.php to see what I mean. Here is the code that this contribution modified in products_new.php //################## Added Enable / Disable Categories #################" // $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where c.categories_status=1 and p.products_id = p2c.products_id and c.categories_id = p2c.categories_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; //################## End Added Enable / Disable Categories ################# Any ideas? L8r, PopTheTop Published osC Contributions: - eCheck Payment Module v3.1 - Reviews in Product Display v2.0 - Fancier Invoice & Packingslip v6.1 - Admin Notes / Customer Notes v2.2 - Customer Zip & State Validation v2.2 - Search Box with Dropdown Category Menu v1.0 Pop your camper's top today! It's a popup thing... You wouldn't understand Share this post Link to post Share on other sites
ricky_h 0 Posted January 10, 2005 Hi if i disable a category i can still se products from that category in bestsellers and in reviews I will proberly be baldheaded after riping my hear of Share this post Link to post Share on other sites
PopTheTop 0 Posted January 10, 2005 You have to disable the products too L8r, PopTheTop Published osC Contributions: - eCheck Payment Module v3.1 - Reviews in Product Display v2.0 - Fancier Invoice & Packingslip v6.1 - Admin Notes / Customer Notes v2.2 - Customer Zip & State Validation v2.2 - Search Box with Dropdown Category Menu v1.0 Pop your camper's top today! It's a popup thing... You wouldn't understand Share this post Link to post Share on other sites
PopTheTop 0 Posted January 21, 2005 I have a problem now since I added this contribution. When you view New Products, it shows ALL products in ALL categories. Even products that you copy (by link) to other categories, causing them to be listed more than once. I have 135 items right now and New Products show 314 items. Go to http://www.popthetop.com/catalog/products_new.php to see what I mean. Here is the code that this contribution modified in products_new.php //################## Added Enable / Disable Categories #################" // ?$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; ?$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where c.categories_status=1 and p.products_id = p2c.products_id and c.categories_id = p2c.categories_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; //################## End Added Enable / Disable Categories ################# Does any one have any idea on how to fix this? L8r, PopTheTop Published osC Contributions: - eCheck Payment Module v3.1 - Reviews in Product Display v2.0 - Fancier Invoice & Packingslip v6.1 - Admin Notes / Customer Notes v2.2 - Customer Zip & State Validation v2.2 - Search Box with Dropdown Category Menu v1.0 Pop your camper's top today! It's a popup thing... You wouldn't understand Share this post Link to post Share on other sites
KiLLaH 0 Posted January 29, 2005 I noticed something strangely when i disabled something inside a category, such as a product or subcategory. Then disabled the entire category and enabled it again. Everything inside the category was also enabled? That seems a dodgy? :blink: //Maz Share this post Link to post Share on other sites
PopTheTop 0 Posted January 30, 2005 When you create a new category, it defaults to disable. How do you bring it to default as enabled? L8r, PopTheTop Published osC Contributions: - eCheck Payment Module v3.1 - Reviews in Product Display v2.0 - Fancier Invoice & Packingslip v6.1 - Admin Notes / Customer Notes v2.2 - Customer Zip & State Validation v2.2 - Search Box with Dropdown Category Menu v1.0 Pop your camper's top today! It's a popup thing... You wouldn't understand Share this post Link to post Share on other sites
Charles_K 0 Posted March 17, 2005 Hiif i disable a category i can still se products from that category in bestsellers and in reviews <{POST_SNAPBACK}> Hi, I'm having the same problem! Did you get it working? If so, Would you share the solution! Thx in advance /Charles /Charles K Get Tattoo'd and feel the power of the needle's... Share this post Link to post Share on other sites
PopTheTop 0 Posted March 18, 2005 No, still need a solution on that one. L8r, PopTheTop Published osC Contributions: - eCheck Payment Module v3.1 - Reviews in Product Display v2.0 - Fancier Invoice & Packingslip v6.1 - Admin Notes / Customer Notes v2.2 - Customer Zip & State Validation v2.2 - Search Box with Dropdown Category Menu v1.0 Pop your camper's top today! It's a popup thing... You wouldn't understand Share this post Link to post Share on other sites
wolfear 0 Posted March 25, 2005 Anyone have a clue where I found the code changes to prevent disabled categories from showing the the categories navigation? I had it all working and then due to case of HUA got things messed up and now I can't remember where I originally found the code changes. Just when you think you've got if foolproof, they go and release Fool 2.0 Contibutions installed (but still tweaking) successfully so far (my personal triumphs!..ok..I had help from these forums) : Categories Description 1.9, Enable-Disable Categories, Header Tags 2.4.3, Loginbox_Best, STS, Paypal IPN 3.1.5, PWA 0.82, Conditions/Privacy Template 2.0, Contact_us_choice 1.0, MS2-2.2 Sitemap Share this post Link to post Share on other sites
wolfear 0 Posted March 26, 2005 I found my problem, or at least a working solution to it. In order to hide the disabled categories in the category box, I changed the line following if ($category_depth == 'nested') { of my index.php file from: $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'"); to this: $category_query = tep_db_query("select cd.categories_name, cd.categories_heading_title, c.category_head_title_tag, c.category_head_desc_tag, cd.categories_description, c.category_head_keywords_tag, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_status = '1' and c.categories_id = '" . $current_category_id . "' and cd.categories_id = '" . $current_category_id . "' and cd.language_id = '" . $languages_id . "'"); $category = tep_db_fetch_array($category_query); I'm not sure how I had it working before as this line is not changed in the index.php included with my downloaded contrib .zip. Oh well...one of the great mysteries of the universe. Hope this helps someone else. Great contibution. I absolutely love it. Just when you think you've got if foolproof, they go and release Fool 2.0 Contibutions installed (but still tweaking) successfully so far (my personal triumphs!..ok..I had help from these forums) : Categories Description 1.9, Enable-Disable Categories, Header Tags 2.4.3, Loginbox_Best, STS, Paypal IPN 3.1.5, PWA 0.82, Conditions/Privacy Template 2.0, Contact_us_choice 1.0, MS2-2.2 Sitemap Share this post Link to post Share on other sites
Spaceboy 1 Posted April 9, 2005 I have a problem now since I added this contribution. When you view New Products, it shows ALL products in ALL categories. Even products that you copy (by link) to other categories, causing them to be listed more than once. I have 135 items right now and New Products show 314 items. Go to http://www.popthetop.com/catalog/products_new.php to see what I mean. I found the solution by using a "distinct" for the SQL command. Here are the changes to do in products_new.php : Change in the beginning of the file : $products_new_query_raw = "select p.products_id... to $products_new_query_raw = "select distinct p.products_id,... Second modification to have the SQL command to work : Just below the SQL command, change $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW); into $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, 'p.products_id'); You will now have the exact number of all products and no duplicates anymore. There is maybe a better way by tweaking the SQL command but the "new products" page is not a critical page so my modification should be fine. I will publish a new version of Enable/Disable categories 1.6 once I have finished my development. I did some other changes too like always :thumbsup: Didier. Published modified Contributions Share this post Link to post Share on other sites
PopTheTop 0 Posted April 9, 2005 Thanks, that worked like a charm! L8r, PopTheTop Published osC Contributions: - eCheck Payment Module v3.1 - Reviews in Product Display v2.0 - Fancier Invoice & Packingslip v6.1 - Admin Notes / Customer Notes v2.2 - Customer Zip & State Validation v2.2 - Search Box with Dropdown Category Menu v1.0 Pop your camper's top today! It's a popup thing... You wouldn't understand Share this post Link to post Share on other sites
Spaceboy 1 Posted April 9, 2005 I noticed something strangely when i disabled something inside a category, such as a product or subcategory. Then disabled the entire category and enabled it again.Everything inside the category was also enabled? That seems a dodgy? :blink: <{POST_SNAPBACK}> Good point ! When changing the status of a main category, it changes the status for all subcatgories. So you loose it's original value. Another way would have been NOT to touch the subcategories, but only changing the main category. It would have been more expensive in the frontend because you had to go up to the main category level to see if it's disabled or not. So it's maybe better to change the sub categories also. To solve your problem, we should add a second column in the table "categories" to store the old value. But we'll keep it manually. I will add it in the readme.txt as a limitation when I will publish a new version. Didier. Published modified Contributions Share this post Link to post Share on other sites
Spaceboy 1 Posted April 9, 2005 When you create a new category, it defaults to disable. How do you bring it to default as enabled? <{POST_SNAPBACK}> Hi Scott ! I want to keep it disabled as default. For you , there are 2 solutions : 1. sql : change the default value of the "categories_status" attribute in table "categories" : put it to "1" instead of "0" 2. add the input field in the category page when you create a new one (like for products). This is my code of my categories.php page : <tr> <td class="main"><?php echo TEXT_CATEGORY_STATUS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('categories_status', '1', $enabled) . ' ' . TEXT_CATEGORY_ENABLED . ' ' . tep_draw_radio_field('categories_status', '0', $disabled) . ' ' . TEXT_CATEGORY_DISABLED; ?></td> </tr> You have to put this where you want to display or modify a new category. Also, add text defines for TEXT_CATEGORY_STATUS, TEXT_CATEGORY_ENABLED and TEXT_CATEGORY_DISABLED. We need also to define $enabled and $disabled : // DDB - 050409 - Enable & Disable Category if (!isset($cInfo->categories_status)) $cInfo->categories_status = '1'; switch ($cInfo->categories_status) { case '0': $enabled = false; $disabled = true; break; case '1': default: $enabled = true; $disabled = false; } I'm unable to tell you where to put it but I think you get the idea of this code. Didier. Published modified Contributions Share this post Link to post Share on other sites
greenfrg 0 Posted April 12, 2005 Has anyone used the Enable/Disable Categories contribution with the Main Categories contribution? I just installed Enable/Disable Categories and everything is working well... but I need some help with modifying the Main Categories contrib so it also works with Enable/Disable. I'm no programmer so any pointers or help with this will be greatly appreciated. Thanks in advance. Paul Share this post Link to post Share on other sites
PopTheTop 0 Posted April 12, 2005 Hi Scott ! I want to keep it disabled as default. For you , there are 2 solutions : 1. sql : change the default value of the "categories_status" attribute in table "categories" : put it to "1" instead of "0" 2. add the input field in the category page when you create a new one (like for products). This is my code of my categories.php page : <tr> ? ? ? ? ? ?<td class="main"><?php echo TEXT_CATEGORY_STATUS; ?></td> ? ? ? ? ? ?<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('categories_status', '1', $enabled) . ' ' . TEXT_CATEGORY_ENABLED . ' ' . tep_draw_radio_field('categories_status', '0', $disabled) . ' ' . TEXT_CATEGORY_DISABLED; ?></td> ? ? ? ?</tr> You have to put this where you want to display or modify a new category. Also, add text defines for TEXT_CATEGORY_STATUS, TEXT_CATEGORY_ENABLED and TEXT_CATEGORY_DISABLED. We need also to define $enabled and $disabled : // DDB - 050409 - Enable & Disable Category if (!isset($cInfo->categories_status)) $cInfo->categories_status = '1'; ? ?switch ($cInfo->categories_status) { ? ? ?case '0': $enabled = false; $disabled = true; break; ? ? ?case '1': ? ? ?default: $enabled = true; $disabled = false; ? ? } I'm unable to tell you where to put it but I think you get the idea of this code. Didier. <{POST_SNAPBACK}> Well, my database already has a 1 there so I do not need to change that. This is what I have: categories_status / tinyint(1) / UNSIGNED / No / 1 L8r, PopTheTop Published osC Contributions: - eCheck Payment Module v3.1 - Reviews in Product Display v2.0 - Fancier Invoice & Packingslip v6.1 - Admin Notes / Customer Notes v2.2 - Customer Zip & State Validation v2.2 - Search Box with Dropdown Category Menu v1.0 Pop your camper's top today! It's a popup thing... You wouldn't understand Share this post Link to post Share on other sites
Dragonmom 0 Posted May 29, 2005 (edited) I installed this contrib, and I don't know if it all works, because- when I change the categories box, the loading gets completely hung up. My browser just hangs fire until it tells me could not load any data. It hangs at the categories box. The change is so simple; from ? ?$categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); to ?$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.categories_status = '1' and c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); I've tried it on several different boxes, and I get the same hangup each time. Any ideas? Edited May 29, 2005 by Dragonmom psst... wanna buy a wand? Share this post Link to post Share on other sites
djenniex 0 Posted May 30, 2005 I installed this contrib, and I don't know if it all works, because- when I change the categories box, the loading gets completely hung up. My browser just hangs fire until it tells me could not load any data. It hangs at the categories box. The change is so simple; from $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); to $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.categories_status = '1' and c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); I've tried it on several different boxes, and I get the same hangup each time. Any ideas? <{POST_SNAPBACK}> I believe your problem might be your second sql statement. Try: $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.categories_status = '1' and c.parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); All I did is replace c.parent_id = '0' with c.parent_id = '" . (int)$parent_id . "' Let me know how that works out for you. Share this post Link to post Share on other sites
Dragonmom 0 Posted June 2, 2005 Well, it doesn't hangup anymore- I think I can only use it on a top category, but that's okay- I was planning to use it to create two different lists of my work- one the custom stuff, and one with currently made items as well. That way, I can disable the current listings when I take off with them to craft shows- so I don't come home to finds something has sold twice :shudder- that's happened before!: psst... wanna buy a wand? Share this post Link to post Share on other sites
clongato 0 Posted July 10, 2005 I?m installing this contrib and found some "bugs" in it as described below, so I?m posting a fix for them (sorry for no time to make a new package): - when you access the product page typing the url, you still can see the product information even if its category is disabeld. The fix for this is as follows: in product_info.php change de the following line: $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); to: $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where c.categories_status = '1' and p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); - the customer shouldn?t be able to see the name of the category nor product?s name, so you have to change the breadcrumb trail in application top: find the line wich inserts the category?s name to the breadcrumb $categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'"); and change it to: $categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd left join " . TABLE_CATEGORIES . " c on cd.categories_id = c.categories_id where c.categories_status = '1' and cd.categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'"); find the line wich inserts the product?s name to the breadcrumb: $name_query = tep_db_query("select pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id") and change it to: $name_query = tep_db_query("select pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where c.categories_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id") and that will do it. Thank?s for the contrib! Claudio Share this post Link to post Share on other sites
djenniex 0 Posted July 10, 2005 I?m installing this contrib and found some "bugs" in it as described below, so I?m posting a fix for them (sorry for no time to make a new package): - when you access the product page typing the url, you still can see the product information even if its category is disabeld. The fix for this is as follows: and that will do it. Thank?s for the contrib! Claudio <{POST_SNAPBACK}> Hey clongato thanks for the updates. Could you please reply with the filenames for those fixes? Thanks Share this post Link to post Share on other sites
astehli 0 Posted July 16, 2005 In version 1.6.1 the Application_top.php has an incorrect SQL Statement. In Application_top.php find: $model_query = tep_db_query("select pd.products_model from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where c.categories_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id"); Replace with: $model_query = tep_db_query("select p.products_model from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where c.categories_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id"); Thats it, Al Share this post Link to post Share on other sites