$action = $_GET['action']; $not_is_new = substr($action, 0, 4) != 'new_'; $cID = $_GET['cID']; $pID = $_GET['pID']; $categories_query = olc_db_query($categories_query); while ($categories = olc_db_fetch_array($categories_query)) { $categories_count++; $rows++; // Get parent_id for subcategories if search if ($search) { $cPath = $categories['parent_id']; } $categories_id = $categories['categories_id']; if (!$pID) { if ((!$cID || $cID == $categories_id) && !$cInfo && $not_is_new) { $category_childs = array('childs_count' => olc_childs_in_category_count($categories_id)); $category_products = array('products_count' => olc_products_in_category_count($categories_id)); $cInfo_array = olc_array_merge($categories, $category_childs, $category_products); $cInfo = new objectInfo($cInfo_array); $categories_name = stripslashes($cInfo->categories_name); $cInfo->categories_name = str_replace('\\', EMPTY_STRING, $categories_name); } } if (is_object($cInfo) && $categories_id == $cInfo->categories_id) { $selected = 'Selected'; echo ' <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_CATEGORIES, olc_get_path($categories_id)) . '">' . NEW_LINE; } else { $selected = EMPTY_STRING; echo ' <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" ' . 'onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id) . '">' . NEW_LINE; } $td_start = '<td class="dataTableContent' . $selected . '" ';
function olc_childs_in_category_count($categories_id) { $categories_count = 0; $categories_query = olc_db_query(SELECT . "categories_id" . SQL_FROM . TABLE_CATEGORIES . SQL_WHERE . "parent_id = '" . $categories_id . APOS); while ($categories = olc_db_fetch_array($categories_query)) { $categories_count++; $categories_count += olc_childs_in_category_count($categories['categories_id']); } return $categories_count; }