'; $where = ""; $select_categories = $useMysql->Select("siteManager", $mysql_tables["product_categories"], "", " WHERE `".$mysql_t_product_categories["category_parent"]."`='0' ORDER BY `".$mysql_t_product_categories["category_name"]."` ASC"); for($i=0; $line_categories = mysqli_fetch_array($select_categories); $i++){ $printed_main_category = false; $main_category_code = ''.$line_categories[$mysql_t_product_categories["category_name"]].''; $sub_categories = $useProducts->getSubCategories($line_categories[$mysql_t_product_categories["category_id"]]); if(empty($sub_categories)){ // echo ''; } foreach($sub_categories as $sub_category_id => $sub_category_name){ $printed_sub_category = false; $sub_category_link = $useProducts->getSubCategoryLink($line_categories[$mysql_t_product_categories["category_id"]], $line_categories[$mysql_t_product_categories["category_name"]], $sub_category_id, $sub_category_name); $sub_category_code = ''.$sub_category_name.''; $select_products = $useMysql->Select("siteManager", $mysql_tables["products"], "", " WHERE `".$mysql_t_products["product_is_special"]."`='1' AND `".$mysql_t_products["product_enabled"]."`='1' AND `".$mysql_t_products["product_website_enabled"]."`='1' AND `".$mysql_t_products["product_category_id"]."`='".$sub_category_id."' ORDER BY `".$mysql_t_products["product_name"]."` ASC"); $total_products = mysqli_num_rows($select_products); if($total_products<=0){ //echo ''; } else{ // echo out product list based on $select_products above for($i=0; $line_products = mysqli_fetch_array($select_products); $i++){ if(!$printed_main_category){ $printed_main_category = true; echo '
'.$main_category_code.'
'; } if(!$printed_sub_category){ $printed_sub_category = true; echo '
      '.$sub_category_code.'

'; } if(!$logged_in){ if($total_products!=1) echo '

'.$total_products.' specials to view. Please login to view.
'; else echo '
'.$total_products.' special to view. Please login to view.
'; break; } else { $product_price = $useProducts->getProductPrice($line_products[$mysql_t_products["product_id"]], "", "", true); if(is_numeric($product_price)){ $product_price_formatted = '$'.number_format($product_price, 2).' / '.$line_products[$mysql_t_products["product_unit"]]; } else{ $product_price_formatted = $product_price; } $product_link = $useProducts->getProductLink($line_products[$mysql_t_products["product_category_id"]], 'Products', $line_products[$mysql_t_products["product_category_id"]], $sub_category_name, $line_products[$mysql_t_products["product_name"]], $line_products[$mysql_t_products["product_id"]]); echo '
  '.$line_products[$mysql_t_products["product_name"]].' - '.$product_price_formatted.'
'; } } } } } echo '
No Sub-Categories
No products.
'; include_once("includes/inc.bottom.php"); ?>