".mysql_error()); // Display random content $random_querry = "SELECT product_id, product_name, category, sub_category, description, thumbnail, price, retail_price FROM $cfg[sass_prod_table] ORDER BY RAND() LIMIT 2"; $pages = 1; mysql_select_db($cfg['database'], $mydb); $radom_result = mysql_query($random_querry) or die (mysql_error()); $col=1; while ($random_row = mysql_fetch_assoc($radom_result)) { if ($cfg['seo']) { $temp = sanitize($random_row['product_name']); $random_row['int_link'] = "prod-$random_row[product_id]-$temp.html"; } else { $random_row['int_link'] = "prod.php?product_id=$random_row[product_id]&merchant_id=$merchant_id"; } $random_row['tr_start'] = ($col == 1 ? "" : ""); $random_row['tr_end'] = ($col == 4 ? "" : ""); $random_array[] = $random_row; $col++; if ($col > $cfg['columns_per_page']) {$col=1;} } // Display random content END if ($merchant_category == "random" or $merchant_sub_category == "random") { $query = "SELECT count(*) AS count from $cfg[sass_prod_table] WHERE merchant_id = '$merchant_id';"; } else { if ($merchant_sub_category != "random") { $query = "SELECT count(*) AS count from $cfg[sass_prod_table] WHERE merchant_id = '$merchant_id' AND category = '$merchant_category' AND sub_category = '$merchant_sub_category';"; } else { $query = "SELECT count(*) AS count from $cfg[sass_prod_table] WHERE merchant_id = '$merchant_id' AND category = '$merchant_category';"; } } mysql_select_db($cfg['database'], $mydb); $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_assoc($result); $total_products = $row['count']; $pages = $total_products / $cfg['products_per_page']; if ($pages != intval($pages)) {$pages=$pages+1;} $pages = (int) $pages; if ($pages < 1) {$pages = 1;} $starting_point = ($page_num-1) * $cfg['products_per_page']; if ($merchant_category == "random" or $merchant_sub_category == "random") { $query = "SELECT product_id, product_name, category, sub_category, description, thumbnail, price, retail_price FROM $cfg[sass_prod_table] WHERE merchant_id = '$merchant_id' ORDER BY RAND() LIMIT $cfg[products_per_page]"; $pages = 1; } else { if ($merchant_sub_category != "random") { $query = "SELECT product_id, product_name, category, sub_category, description, thumbnail, price, retail_price FROM $cfg[sass_prod_table] WHERE merchant_id = '$merchant_id' AND category = '$merchant_category' AND sub_category = '$merchant_sub_category' LIMIT $starting_point,$cfg[products_per_page]"; } else { $query = "SELECT product_id, product_name, category, sub_category, description, thumbnail, price, retail_price FROM $cfg[sass_prod_table] WHERE merchant_id = '$merchant_id' AND category = '$merchant_category' LIMIT $starting_point,$cfg[products_per_page]"; } } mysql_select_db($cfg['database'], $mydb); $result = mysql_query($query) or die (mysql_error()); $col=1; while ($row = mysql_fetch_assoc($result)) { // $parm1 = "";$parm2=""; // if ($merchant_category != "random") {$parm1 = "&cat=$merchant_category";} // if ($merchant_sub_category != "random") {$parm2 = "&subcat=$merchant_sub_category";} if ($cfg['seo']) { $temp = sanitize($row['product_name']); $row['int_link'] = "prod-$row[product_id]-$temp.html"; } else { $row['int_link'] = "prod.php?product_id=$row[product_id]&merchant_id=$merchant_id"; } $row['tr_start'] = ($col == 1 ? "" : ""); $row['tr_end'] = ($col == 4 ? "" : ""); $array[] = $row; $col++; if ($col > $cfg['columns_per_page']) {$col=1;} } $size = count($array)-1; if ($col != $cfg['columns_per_page']) {$array[$size]['tr_end'] = "";} for ($i=0;$i<$pages;$i++) { $y = $i+1; $page_info['number'] = $y; if ($cfg['seo']) { $page_info['link'] = "scat-$merchant_category-$merchant_sub_category.html"; } else { $page_info['link'] = "merchant_product_list.php?merchant_id=$merchant_id&cat=$merchant_category&subcat=$merchant_sub_category&page_num=$y"; } $page_array[] = $page_info; } if ($page_num > 1) { $page_info['number'] = "Prev"; $x = $page_num - 1; if ($cfg['seo']) { $page_info['link'] = "scat-$merchant_category-$merchant_sub_category.html"; } else { $page_info['link'] = "merchant_product_list.php?merchant_id=$merchant_id&cat=$merchant_category&subcat=$merchant_sub_category&page_num=$x"; } $page_array[] = $page_info; } if ($page_num < $pages) { $x = $page_num + 1; $page_info['number'] = "Next"; if ($cfg['seo']) { $page_info['link'] = "scat-$merchant_category-$merchant_sub_category.html"; } else { $page_info['link'] = "merchant_product_list.php?merchant_id=$merchant_id&cat=$merchant_category&subcat=$merchant_sub_category&page_num=$x"; } $page_array[] = $page_info; } $display_page_array = ($pages == 1 ? 0 : 1); if ($cfg['seo']) { $main_cat_link = ""; } else { $main_cat_link = "merchant_product_list.php?merchant_id=$merchant_id"; } // Display random content $tpl->set('random_record', $random_array);$tpl->set('record', $array); $tpl->set('display_pages',$display_page_array, TRUE); $tpl->set('display_pages2',$display_page_array, TRUE); $tpl->set('random_list',$random_list,TRUE); $tpl->set('pages', $page_array); $tpl->set('pages2', $page_array); $tpl->set('retailer_name',get_merchant_name($merchant_id)); if ($cfg['seo']) { $merchant_name_link = "merchant_product_list.php?merchant_id=$merchant_id"; $merchant_cat_link = "merchant_product_list.php?merchant_id=$merchant_id&cat=$merchant_category"; } else { $merchant_name_link = "merchant_product_list.php?merchant_id=$merchant_id"; $merchant_cat_link = "merchant_product_list.php?merchant_id=$merchant_id&cat=$merchant_category"; } if ($merchant_category<>"random") { $category = str_replace('_',' ',$merchant_category).' Category : '; $category_text=str_replace('_',' ',$merchant_category); }; if ($merchant_sub_category<>"random") { $sub_category = str_replace('_',' ',$merchant_sub_category).' : '; $sub_category_text=str_replace('_',' ',$merchant_sub_category); }; $tpl->set('retailer_name_link',$merchant_name_link); $tpl->set('category',$merchant_category); $tpl->set('sub_category',$merchant_sub_category); $tpl->set('maincat',get_maincat_list($merchant_id)); if ($merchant_category != "random") {$tpl->set('sub_cat',$sub_cat_list); }; $tpl->set('main_cat',$merchant_category); $tpl->set('main_cat_text',$category_text); $tpl->set('sub_cat_text',$sub_category_text); $tpl->set('cat_selected',$cat_selected, TRUE); $tpl->set('cat_selected1',$cat_selected, TRUE); $tpl->set('maincatlink',$main_cat_link); $tpl->set('no_cats_yet',0,TRUE); // Display random content $random_content = $tpl->fetch('templates/random.tpl'); $main_content = $tpl->fetch('templates/merchant_product_list.tpl'); // ************************************************************************************ // * * // * * // * * // ************************************************************************************ $tpl2 = & new Template(); $tpl2->set('merchant',get_merchant_list()); $tpl2->set('maincat',get_maincat_list($merchant_id)); $tpl2->set('site_name',get_site_name()); $tpl2->set('title',$category_text.' : '.$sub_category_text.' : Online Fishing stuff'); $tpl2->set('description',get_site_description().' Get lowest prices for fishing '.$category_text.' stuff. Here are good all '.$sub_category_text.' you need. Find here best fishing stuff online. Get best price for '.$category_text.' and '.$sub_category_text ); $tpl2->set('keywords',$category_text.', '.$category_text.' online, discounted '.$category_text.', cheap '.$category_text.', '.$sub_category_text.'online, fly fishing'); $tpl2->set('notice_message',get_notice_message()); $tpl2->set('main_content',$main_content); $x = $tpl2->fetch('templates/master.tpl'); echo $x; ?>