%PDF- %PDF-
Direktori : /home/riacommer/public_html/ |
Current File : /home/riacommer/public_html/productx.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 $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>'; } } } $section_id=0; if(isset($_GET["sec"])){ $section_id = $_GET["sec"]; if($cat_id==0){ 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>'; } } } ?> </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"> <?php $sql = "SELECT * FROM sa_product WHERE section_id='1' LIMIT 12"; //list by section if($section_id!=0){ if($cat_id==0){ $sql = "SELECT * FROM sa_product WHERE section_id='$section_id' ORDER BY product_name"; } } //list by category if($cat_id!=0){ $sql = "SELECT * FROM sa_product WHERE product_category_id='$cat_id' ORDER BY product_name"; if($section_id!=0){ $sql = "SELECT * FROM sa_product WHERE product_category_id='$cat_id' AND section_id='$section_id' ORDER BY product_name"; } } $mysql_result = mysql_query($sql, $connection); $total_num_rows = mysql_num_rows($mysql_result); $itemPerPage=12; $ttlPage=ceil($total_num_rows/$itemPerPage); $currPage=1; if(isset($_GET["pg"])){ $currPage = $_GET["pg"]; } $offset = ($currPage-1)*$itemPerPage; if(($ttlPage*$itemPerPage)>=$total_num_rows && $currPage==$ttlPage){ $labelResult = 'Showing '.($offset+1).' - '.$total_num_rows.' of '.$total_num_rows.' result(s).'; } else { $labelResult = 'Showing '.($offset+1).' - '.($currPage*$itemPerPage).' of '.$total_num_rows.' result(s).'; } ?> <div class="row"> <div class="col-md-6"> <h1 class="mb-none"><strong>Product Listing</strong></h1> <p><?php echo $labelResult; ?></p> </div> </div> <div class="row"> <ul class="products product-thumb-info-list" data-plugin-masonry data-plugin-options='{"layoutMode": "fitRows"}'> <?php $sql .= " LIMIT ".$offset.','.$itemPerPage; //set total item per query $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> <?php if($ttlPage>1){ echo '<div class="row"><div class="col-md-12"><ul class="pagination pull-right">'; //echo '<li><a href="#"><i class="fa fa-chevron-left"></i></a></li>'; if($currPage==1){ echo '<li><a href="#" class="not-active"><i class="fa fa-chevron-left lightgrayiconcolor"></i></a></li>'; } else { if($cat_id!=0){ echo '<li><a href="product.php?cat='.$cat_id.'&pg='.($currPage-1).'"><i class="fa fa-chevron-left"></i></a></li>'; } else if($section_id!=0){ echo '<li><a href="product.php?cat='.$sec_id.'&pg='.($currPage-1).'"><i class="fa fa-chevron-left"></i></a></li>'; } } for($i=1;$i<=$ttlPage;$i++){ if($currPage==$i){ if($cat_id!=0){ echo '<li class="active"><a href="product.php?cat='.$cat_id.'&pg='.$i.'">'.$i.'</a></li>'; } else if($section_id!=0){ echo '<li class="active"><a href="product.php?sec='.$sec_id.'&pg='.$i.'">'.$i.'</a></li>'; } } else { if($cat_id!=0){ echo '<li><a href="product.php?cat='.$cat_id.'&pg='.$i.'">'.$i.'</a></li>'; } else if($section_id!=0){ echo '<li><a href="product.php?sec='.$sec_id.'&pg='.$i.'">'.$i.'</a></li>'; } } } if($currPage==$ttlPage){ echo '<li><a href="#" class="not-active"><i class="fa fa-chevron-right lightgrayiconcolor"></i></a></li>'; } else { if($cat_id!=0){ echo '<li><a href="product.php?cat='.$cat_id.'&pg='.($currPage+1).'"><i class="fa fa-chevron-right"></i></a></li>'; } else if($section_id!=0){ echo '<li><a href="product.php?cat='.$sec_id.'&pg='.($currPage+1).'"><i class="fa fa-chevron-right"></i></a></li>'; } } echo '</ul></div></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>