csaba Posted January 5, 2017 Share Posted January 5, 2017 There was a simple add-on for the osc 2.2 to hide (do not display) categories which don't have any active products. Is there a similar add-on for osc 2.3.4? I've been looking but couldn't find one. Link to comment Share on other sites More sharing options...
ecommunlimited Posted January 6, 2017 Share Posted January 6, 2017 @@csaba This is the 2.3 version of the Activate or Inactivate Categories contribution. Hide Categories with category cache Take care Bill Link to comment Share on other sites More sharing options...
csaba Posted January 9, 2017 Author Share Posted January 9, 2017 Thanks Bill, but that's not exactly what i am looking for. There was a simple modification for the 2.2 version, in which, if you had no products in a category, that category was automatically not displayed in the online shop. And as soon as you had at least 1 product in stock in that category, the category was displayed automatically. Link to comment Share on other sites More sharing options...
ecommunlimited Posted January 9, 2017 Share Posted January 9, 2017 @@csaba I miss that feature myself. For v2.2 you can check this out:http://addons.oscommerce.com/info/6911Not sure how old your systems is but you can check these out as well: http://www.oscommerce.com/forums/topic/107841-only-show-categories-with-active-products/http://www.oscommerce.com/forums/topic/117784-how-to-hide-categories-with-no-products/http://www.oscommerce.com/forums/topic/43436-hide-empty-categories-in-default-php/http://www.oscommerce.com/forums/topic/61211-show-hide-categories/#entry239214 Take care Bill Link to comment Share on other sites More sharing options...
csaba Posted January 9, 2017 Author Share Posted January 9, 2017 Thanks Bill. So far i had no luck with those... will continue tomorrow. If anybody has an idea how to do it, i would really appreciate it. Here is my categories.php below <?php /* $Id: categories.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ function tep_show_category($counter, $count) { global $tree, $categories_string, $cPath_array; $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { /* for ($i=0; $i<$tree[$counter]['level']; $i++) { */ if ($count == 0 ) $kk=' class="bg_list_un"'; else $kk=' class="bg_list"'; $count++; $categories_string .= '<li'.$kk.'>'; for ($i=0; $i<$tree[$counter]['level']; $i++) { $categories_string .= '<div>'; } $categories_string .= '<a href="'; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '"><i>'; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } // display category name $categories_string .= $tree[$counter]['name']; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '</b>'; } if (SHOW_COUNTS == 'true') { $categories_string .= ' <strong>(' . $products_in_category . ')</strong>'; } } if (tep_has_category_subcategories($counter)) { $categories_string .= '</i><font>'.tep_image(DIR_WS_IMAGES.'bg_list_.gif','','','','').'</font>'; } if (tep_has_category_subcategories($counter)) { $categories_string .= '</a>'; }else{ $categories_string .= '</i></a>'; } for ($i=0; $i<$tree[$counter]['level']; $i++) { $categories_string .= '</div>'; } $categories_string .= '</li>'; if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id'], $count); } } ?> <!-- categories //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); new infoBoxHeading($info_box_contents, true, false); $count = 0; $categories_string = ''; $tree = array(); $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 = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $tree[$categories['categories_id']] = array('name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false); if (isset($parent_id)) { $tree[$parent_id]['next_id'] = $categories['categories_id']; } $parent_id = $categories['categories_id']; if (!isset($first_element)) { $first_element = $categories['categories_id']; } } //------------------------ if (tep_not_null($cPath)) { $new_path = ''; reset($cPath_array); while (list($key, $value) = each($cPath_array)) { unset($parent_id); unset($first_id); $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 cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); if (tep_db_num_rows($categories_query)) { $new_path .= $value; while ($row = tep_db_fetch_array($categories_query)) { $tree[$row['categories_id']] = array('name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key+1, 'path' => $new_path . '_' . $row['categories_id'], 'next_id' => false); if (isset($parent_id)) { $tree[$parent_id]['next_id'] = $row['categories_id']; } $parent_id = $row['categories_id']; if (!isset($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } $tree[$last_id]['next_id'] = $tree[$value]['next_id']; $tree[$value]['next_id'] = $first_id; $new_path .= '_'; } else { break; } } } tep_show_category($first_element, $count); $info_box_contents = array(); $info_box_contents[] = array('text' => '<ul class="categories">' . $categories_string . '</ul>'); new infoBox($info_box_contents); ?> </td> </tr> <!-- categories_eof //--> Link to comment Share on other sites More sharing options...
csaba Posted January 10, 2017 Author Share Posted January 10, 2017 @@csaba I miss that feature myself. For v2.2 you can check this out: http://addons.oscommerce.com/info/6911 Not sure how old your systems is but you can check these out as well: http://www.oscommerce.com/forums/topic/107841-only-show-categories-with-active-products/ http://www.oscommerce.com/forums/topic/117784-how-to-hide-categories-with-no-products/ http://www.oscommerce.com/forums/topic/43436-hide-empty-categories-in-default-php/ http://www.oscommerce.com/forums/topic/61211-show-hide-categories/#entry239214 Take care Bill I've tried again all these but they don't work on my osc 2.3.4. And they work on the old osc2.2. Why? Link to comment Share on other sites More sharing options...
♥mdtaylorlrim Posted April 20, 2017 Share Posted April 20, 2017 @@csaba I have a process that runs every so often that updates my products quantity on hand and prices changes, as supplied by my vendor. The last couple of lines of the job is here: if ($qty == 0){ $product_status = 0; } else { $product_status = 1; } $sql = "update products set products_quantity = '" . $qty . "', products_price = '" . $cost . "', products_status = '" . $product_status . "' where vendor_model = '" . $itemno . "' and vendor_id = '1'"; $result = $mysqli->query($sql); } I have an extra couple of fields in my db since I have multiple vendors so you will have to edit this to match your db and run it as your application warrants. Mark Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.