peteravu Posted July 24, 2008 Posted July 24, 2008 how to hide categories without products? Thanks to all that contributed to separate_price_per_customers_4.2.2_for_2.3.1, Add Multiple Products with plus/minus buttons, One Page Checkout for 2.3.1, Multi Attribute V2, Login Box Club osCommerce Shipping Date Chooser for 2.3.1, Quickly Update Product Stock 3.8.5 Español and order number in email subject Forum, Thanks Designing New Themes the Easy Way, how-to-set-backgrounds. my contributions Add Multiple Product In Product Listing 2.3.1 v.1.0 and Multiple Attribute entry boxes in product info page v1.0 for 2.3.1
spooks Posted July 24, 2008 Posted July 24, 2008 Hide Categories & Products http://addons.oscommerce.com/info/5907 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.
masat Posted November 8, 2012 Posted November 8, 2012 I was in search of an automatic way to hide categories with no products and thought i would throw this out on the table. http://addons.oscommerce.com/info/6911 worked good to hide cats in the menu but did not hide the cats on page (index.php ). I used the following query to get closer to acheivement of the goal: <code>$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)$current_category_id . "' and c.categories_id = cd.categories_id and cd.categories_id in (select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = c.categories_id) and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");</code> While this is not fully tested for all situations it may help you to get were you want to go. The query was inserted at around line 63 of index.php ( $category_depth['nested'] ). It effectively counted the categories with products prior to building the dynamically displayed table for categories in that section. This would work say in the case the cat staus is flagged one but has no products. How do you know when you know what you want to do for the rest of your life?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.