if ($_GET['productID']){
$this_prod_cat_query_res = db_query ('SELECT categoryID FROM ' . PRODUCTS_TABLE . ' WHERE productID = ' . $_GET['productID']);
$this_prod_cat = db_fetch_row ($this_prod_cat_query_res);
$prev_prod_query_res = db_query ('SELECT productID, ' . LanguagesManager::sql_prepareField('name',true) . ', slug FROM ' . PRODUCTS_TABLE . ' WHERE productID < ' . $_GET['productID'] . ' AND categoryID = ' . $this_prod_cat[0] . ' AND enabled = 1 ORDER BY productID DESC LIMIT 1');
$prev_prod = db_fetch_row ($prev_prod_query_res);
if ($prev_prod) {
$smarty->assign('prev_prod', $prev_prod);
}
$next_prod_query_res = db_query ('SELECT productID, ' . LanguagesManager::sql_prepareField('name',true) . ', slug FROM ' . PRODUCTS_TABLE . ' WHERE productID > ' . $_GET['productID'] . ' AND categoryID = ' . $this_prod_cat[0] . ' AND enabled = 1 ORDER BY productID ASC LIMIT 1');
$next_prod = db_fetch_row ($next_prod_query_res);
if ($next_prod) {
$smarty->assign('next_prod', $next_prod);
}
}