include('includes/general.php');
include('includes/header.php');
$scountry=' ';
$stype=' ';
$swhere_buy=' ';
$sreview=' ';
/*
$swhere_buy=' ';
*/
echo '
';
if((!$_GET['pricefilter'])||($_GET['pricefilter']=='desc')) $pricefilter='asc'; else $pricefilter='desc';
echo '';
echo '
| Name
| Price
| Rating
| Review
| Type
| Region
| Country
| Retailer
|
';
$fields=array('wines_title','price_range_from','price_range_to','type','region','country','where_buy','where_buy_url','description_small');
$sql="";
if($g['s']!=''){
$or="";
$sql=' and (';
foreach($fields as $k=>$v){
$sql.=$or." `$v` like '%".toq($g['s'])."%'";
$or=' or ';
}
$sql="$sql)";
}
if(isset($g['country']) && $g['country']!='N0'){
$sql.=" and `country` like '".toq($g['country'])."' ";
}
if(isset($g['type']) && $g['type']!='N0'){
$sql.=" and `type` like '".toq($g['type'])."' ";
}
if(isset($g['where_buy']) && $g['where_buy']!='N0'){
$sql.=" and `where_buy` like '".toq($g['where_buy'])."' ";
}
if(isset($g['review']) && $g['review']!='N0'){
if ($g['review']=="yes") $sql.=" and `review` <> '' ";
else $sql.=" and `review` = '' ";
}
$l=0;
$sql="select * from wines where 1 $sql and wines_status = 1 and dt_removed=0 order by price_num $pricefilter ";
$q=q($sql);
while ($w=fa($q)){
if(substr($w['where_buy_url'],0,3)!='http') $w['where_buy_url']='http://'.$w['where_buy_url'];
$l++;
if ($w['label_picture']!='' && file_exists("images/labels/$w[label_picture]")) $im="images/labels/$w[label_picture]";
else $im="images/wine-noimage.png";
$price='£'.$w['price_range_from'].($w['price_range_to']!=''?' - £'.$w['price_range_to']:'');
if($price=='£') $price='';
$price=str_replace(",", ".", $price);
echo "
- Price: '.$price.'
- Region: '.$w['region'].'
- Country: '.$w['country'].'
'.($w['rating']!=''?"- Rating: $w[rating]":'').'
- Retailer:'.($w['where_buy_url']!=''?" ":'')."$w[where_buy]".($w['where_buy_url']!=''?"":'').'
'.($w['review']!=''?"- Review: show
":'').'
- Type: '.$w['type'].'
';
if($l==2) $l=0;
}
?>
include('includes/footer.php');
?>