} else { $categoryString = $current_catlist; } if (strlen($rowcategories["category_name"]) > 30) { $category_name = substr($rowcategories["category_name"], 0, 30) . "..."; } else { $category_name = $rowcategories["category_name"]; } $rootflage1 = 0; //get subcatgeory $result_subcatgeory1 = getSubCatgeoryIncludingMadeToOrder($rowcategories["category_id"]); //echo "<pre>----".$rowcategories["category_id"]; //print_r($result_subcatgeory1); //echo "</pre>"; //check product exist $result_product1 = checkProductExistChk($rowcategories["category_id"]); if (!empty($result_subcatgeory1) && mysql_num_rows($result_product1) > 0) { $rootflage1 = 1; } $catfarmstyle = ''; if (trim($category_name) == 'Farm') { $catfarmstyle = 'catfarm'; } elseif (trim($category_name) == 'Forest') { $catfarmstyle = 'catforest'; } ?> <li class="<?php echo $catfarmstyle; ?> " >
function makeSearhList($current_cat_id, $count) { global $tableprefix; static $option_results; if (!isset($current_cat_id)) { $current_cat_id = 0; } $count = $count + 1; $productRow = array(); $sql = "SELECT category_id as id, category_name as name\n\t\t FROM " . $tableprefix . "categories WHERE parent_id = '" . addslashes($current_cat_id) . "' ORDER BY name ASC "; $get_options = mysql_query($sql); $num_options = mysql_num_rows($get_options); if (mysql_num_rows($get_options) != 0) { while ($row = mysql_fetch_assoc($get_options)) { $productRow[] = $row; } } if ($current_cat_id == '2') { $MadeToOrder = getMadeToOrderCatgeoryItemsCheck($current_cat_id); if ($MadeToOrder != '') { $madetoorder[] = array('id' => '', 'name' => $MadeToOrder); $newArray = array_merge($productRow, $madetoorder); } } else { $newArray = $productRow; } $CategoryArray = array(); foreach ($newArray as $key => $row) { $CategoryArray[$key] = $row['name']; } @array_multisort($CategoryArray, SORT_ASC, $newArray); if (count($newArray) > 0) { foreach ($newArray as $catRow) { $cat_id = $catRow['id']; $cat_name = $catRow['name']; /*-------Multicart 2.0 Upgradation------------*/ if ($cat_id != '') { $result_product1 = checkProductExistChk($cat_id); $resultRows = mysql_num_rows($result_product1); if ($resultRows > 0) { if ($current_cat_id != 0) { $indent_flag = "--"; for ($x = 2; $x <= $count; $x++) { $indent_flag .= " --> "; } } $cat_name = $indent_flag . stripslashes($cat_name); $option_results[$cat_id] = stripslashes($cat_name); makeSearhList($cat_id, $count); } } if ($cat_name == 'Made To Order') { $cat_name = $indent_flag . stripslashes($cat_name); $option_results['made-to-order'] = stripslashes($cat_name); } } } return $option_results; }