%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/riacommer/public_html/
Upload File :
Create Path :
Current File : /home/riacommer/public_html/search.php

<!DOCTYPE html>
<html>
	<head>
		<?php include_once("header.php"); ?>
	</head>
	<body>

		<div class="body">
		
			<?php include_once("top.php"); ?>
		
			<div role="main" class="main shop">
			
				<section class="page-header">
					<div class="container">
						<div class="row">
							<div class="col-md-12">
<?php
$section_id=0;
if(isset($_GET["sec"])){
	$section_id = $_GET["sec"];
	if($section_id=='1'){
		echo '<h1>Medical Equipment</h1>';
	} else if($section_id=='3'){
		echo '<h1>Specialty Gas Equipment</h1>';
	} else if($section_id=='2'){
		echo '<h1>Industrial Equipment</h1>';
	}
}

$cat_id=0;
if(isset($_GET["cat"])){
	$cat_id=$_GET["cat"];
	$sql = "SELECT * FROM sa_product_category WHERE id='$cat_id'";
	$mysql_result = mysql_query($sql, $connection);
	$num_rows = mysql_num_rows($mysql_result);
	if($num_rows>=1){
		while($row = mysql_fetch_array($mysql_result)){
			echo '<h1>'.$row["product_category"].'</h1>';
		}
	}
}

if(isset($_GET["q"])){
	echo '<h1>Search Result</h1>';
}

?>							
								
							</div>
						</div>
					</div>
				</section>

				<div class="container">

					<div class="row">
						<div class="col-md-12">
							<hr class="tall">
						</div>
					</div>

					<div class="row">
						<div class="col-md-9">

							<div class="row">
								<div class="col-md-6">
									<h1 class="mb-none"><strong>Product Listing</strong></h1>
									<!--<p>Showing 1–9 of 25 results.</p>-->
								</div>
							</div>

							<div class="row">

								<ul class="products product-thumb-info-list" data-plugin-masonry data-plugin-options='{"layoutMode": "fitRows"}'>
								
<?php
$q = '';
$mysql_result;
$num_rows==0;
if(isset($_GET["q"])){
	$q = $_GET["q"];
	$sql = "select * from (
	SELECT p.id, (select section from sa_section where id = p.section_id) as section, (select brand from sa_brand where id = p.brand_id) as brand, 
	(select product_category from sa_product_category where id = p.product_category_id) as category, p.product_code, p.product_name, p.product_desp, p.product_image  
	FROM sa_product p) as tbl where (tbl.section like '%".$q."%' or tbl.brand like '%".$q."%' or
	tbl.category like '%".$q."%' or	tbl.product_code like '%".$q."%' or	tbl.product_name like '%".$q."%' or	tbl.product_desp like '%".$q."%' )";

		$mysql_result = mysql_query($sql, $connection);
		$num_rows = mysql_num_rows($mysql_result);
		if($num_rows==0){
			//if no result found then query below
			$sql = "SELECT * FROM sa_product ORDER BY RAND() LIMIT 10";
			$mysql_result = mysql_query($sql, $connection);
			$num_rows = mysql_num_rows($mysql_result);
		}
		
} else {
	$sql = "SELECT * FROM sa_product ORDER BY RAND() LIMIT 10";
	$mysql_result = mysql_query($sql, $connection);
	$num_rows = mysql_num_rows($mysql_result);
}

if($num_rows>=1){
	while($row = mysql_fetch_array($mysql_result)){
	
		$product_url = 'product-details.php?id='.$row["id"];
		$thumb_url = 'contents/products/thumb_'.$row["product_image"];
		
		if(!file_exists($thumb_url)){
			$thumb_url = 'contents/products/'.urlencode($row["product_image"]);
		}
		
		$product_name = $row["product_name"];
		$product_code = $row["product_code"];
	
		echo '<li class="col-md-4 col-sm-6 col-xs-12 product">
										<span class="product-thumb-info">
											<a href="'.$product_url.'">
												<span class="product-thumb-info-image">
													<span class="product-thumb-info-act">
														<span class="product-thumb-info-act-left"><em>View</em></span>
														<span class="product-thumb-info-act-right"><em><i class="fa fa-plus"></i> Details</em></span>
													</span>
													<img alt="" class="img-responsive" src="'.$thumb_url.'" style="padding:40px;">
												</span>
											</a>
											<span class="product-thumb-info-content">
												<a href="'.$product_url.'">
													<h4 class="heading-primary">'.$product_name.'</h4>
													<span class="price">
														<span class="amount">'.$product_code.'</span>
													</span>
												</a>
											</span>
										</span>
									</li>';
	
	}
}
?>								
	
								</ul>
							</div>

							<!--<div class="row">
								<div class="col-md-12">
									<ul class="pagination pull-right">
										<li><a href="#"><i class="fa fa-chevron-left"></i></a></li>
										<li class="active"><a href="#">1</a></li>
										<li><a href="#">2</a></li>
										<li><a href="#">3</a></li>
										<li><a href="#"><i class="fa fa-chevron-right"></i></a></li>
									</ul>
								</div>
							</div>-->
						</div>
						<div class="col-md-3">
							<aside class="sidebar">

								<!--<form>
									<div class="input-group input-group-lg">
										<input class="form-control" placeholder="Search..." name="s" id="s" type="text">
										<span class="input-group-btn">
											<button type="submit" class="btn btn-primary btn-lg"><i class="fa fa-search"></i></button>
										</span>
									</div>
								</form>-->

								<hr>

								<h5 class="heading-primary">Category</h5>

<?php
$sql = "SELECT p.product_category_id, cat.product_category FROM sa_product p,  sa_product_category cat where p.section_id IN (1,2,3) and cat.id = p.product_category_id 
group by p.product_category_id, cat.product_category order by cat.product_category";
$mysql_result = mysql_query($sql, $connection);
$num_rows = mysql_num_rows($mysql_result);
if($num_rows>=1){
	while($row = mysql_fetch_array($mysql_result)){
		$product_url = 'product.php?cat='.$row["product_category_id"];
		echo '<a href="'.$product_url.'"><span class="label label-dark" style="font-size:12px;">'.$row["product_category"].'</span></a><br />';
	}
}
?>								

								<hr />

								
								</ul>

							</aside>
						</div>
					</div>
				</div>

			</div>

			<?php include_once("footer.php"); ?>
			
		</div>

		<?php include_once("footer-js.php"); ?>


	</body>
</html>

Zerion Mini Shell 1.0