<?php 
error_reporting(0);
include("header.php"); 
include("common/config.php");

                          $id = $_GET[id];
								 $row = sprintf("SELECT * from  products WHERE  id = '$id'");
								 if(!($resdata=mysql_query($row))){echo mysql_error($row); exit;}
								$rowdata=mysql_fetch_assoc($resdata);                       
?>
<br><br>

  
        <!-- Page Content -->
        <main class="page-content">

            <!-- Product Details Wrapper -->
            <div class="tm-product-details-area tm-section tm-padding-section bg-white">
                <div class="container">
                    <div class="row">

                        <div class="col-lg-9 col-12">

                            <!-- Product Details -->
                            <div class="tm-prodetails">
                                <div class="row">
                                    <div class="col-lg-6 col-md-6 col-sm-10 col-12">
                                        <div class="tm-prodetails-images">
                                            <div class="tm-prodetails-largeimages">
                                                <div class="tm-prodetails-largeimage">
                                                    <a data-fancybox="tm-prodetails-imagegallery"
                                                        href="<?php echo "admin/".$uploadpath.$rowdata['proimg']; ?>"
                                                        data-caption="Product Zoom Image 1">
                                                        <center><img src="<?php echo "admin/".$uploadpath.$rowdata['proimg']; ?>"></center>
                                                           
                                                    </a>
                                                </div>
                                             
                                               
                                            </div>
                                           
                                        </div>
                                    </div>

                                    <div class="col-lg-6 col-md-6 col-12">
                                        <div class="tm-prodetails-content">
                                            <h4 class="tm-prodetails-title"><?php echo ucfirst($rowdata[proname]);?> </h4>
                                            <span class="tm-prodetails-price">INR <del><?php echo $rowdata[mrp];?></del> <?php echo $rowdata[price];?></span>
                                           
                                            <div class="tm-prodetails-infos">
                                                <div class="tm-prodetails-singleinfo">
                                                    <b>Product ID : </b><?php echo $rowdata[proid];?>
                                                </div>
                                                 <div class="tm-prodetails-infos">
                                                    <b>Category : </b><a href="#"><?php echo $rowdata[catid];?></a>
                                                </div>
												<?php if($rowdata[weight]!=""){?>
												<div>
                                                    <b>Net Weight : </b><a href="#"><?php echo $rowdata[weight];?></a>
                                                </div>
												<?php } ?>
                                                
                                                
                                            </div>
                                            <?php echo $rowdata[proinfo];?>
                                            <div class="tm-prodetails-quantitycart">
                                                <h6>Quantity :</h6>
                                                <div class="tm-quantitybox">
                                                    <input type="text" value="1">
                                                </div>
                                                <a href="online-enquiry.php?id=<?php echo $rowdata[id];?>"  class="tm-button tm-button-dark">Online Enquiry</a>
                                           <button> <a href="https://api.whatsapp.com/send?phone=91&text=Hi, I am Interested this product - https://urbanmandai.com/porwal/product-details.php?id=<?php echo $_GET[id];?>&cname=<?php echo $_GET[cname];?>" class="facebook" target="_blank"><img src="img/whatsapp.png" style="border-radius:50%;width:40px;"></a> </button>

										  </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--// Product Details -->

                            <!-- Modal -->
  
                            <!--// Product Details Description & Review -->

                            <div class="tm-similliar-products tm-padding-section-sm-top">
                                <h4 class="small-title">Similliar Products</h4>
                                <div class="row tm-products-slider3">
 <?php
             $cname = $_GET['cname'];
		
			$query=sprintf("select * from products WHERE  catid='$cname' ORDER BY RAND() LIMIT 20");
			if(!($result = mysql_query($query))){echo $query."Error".mysql_error(); exit;}
			while($rowfetch=mysql_fetch_array($result)) { ?>
                                    <!-- Single Product -->
                                    <div class="col-12">
                                        <div class="tm-product tm-scrollanim">
                                            <div class="tm-product-topside">
                                                <div class="tm-product-images">
                                                   <a href="product-details.php?id=<?php echo $rowfetch[id];?>&cname=<?php echo $rowfetch[catid];?>">  <img src="<?php echo "admin/".$uploadpath.$rowfetch['proimg']; ?>" class="img-fluid"  style="width:150px;height:150px;border-radius:2%" >
                                                </a>
												</div>
                                              
                                               
                                            </div>
                                            <div class="tm-product-bottomside">
                                                <h6 class="tm-product-title"><a href="product-details.php?id=<?php echo $rowfetch[id];?>&cname=<?php echo $rowfetch[catid];?>"><?php echo $rowfetch[proname];?></a></h6>
                                               
                                                <span class="tm-product-price">Rs. <?php echo $rowfetch[price];?></span>
                                                
                                            </div>
                                        </div>
                                    </div>
                                    <!--// Single Product -->
			<?php } ?>
                                   



                                </div>
                            </div>

                        </div>

                        <!-- Widgets -->
                        <div class="col-lg-3 col-12">
                            <div class="widgets">

                                <!-- Single Widget -->
                                <div class="single-widget widget-categories">
                                    <h6 class="widget-title">Categories</h6>
                                    <ul>
									<?php 
								$query="select * from topcategories order by id ASC	";
    if(!($result=mysql_query($query))){echo mysql_error($query); exit;}
    while($row=mysql_fetch_assoc($result)){?>
                                       <li><a href="more-category-products.php?id=<?php echo strtolower(str_replace(' ','+', $row['catname']) ); ?>"><?php echo $row['catname'];?></a></li>
	<?php } ?>
                                    </ul>
                                </div>
                                <!--// Single Widget -->

                               

                                <!-- Single Widget -->
                                <div class="single-widget widget-popularproduct">
                                    <h6 class="widget-title">Popular Product</h6>
                                    <ul>
									<?php
									$queryPopular=sprintf("select * from products ORDER BY RAND() LIMIT 4");
			if(!($resultPopular = mysql_query($queryPopular))){echo $queryPopular."Error".mysql_error(); exit;}
			while($rowfetchPopular=mysql_fetch_array($resultPopular)) { ?>
                                        <li>
                                            <a href="product-details.php?id=<?php echo $rowfetchPopular[id];?>&cname=<?php echo $rowfetchPopular[catid];?>" class="widget-popularproduct-image">
                                               <img src="<?php echo "admin/".$uploadpath.$rowfetchPopular['proimg']; ?>"
                                                    alt="product thumbnail">
                                            </a>
                                            <div class="widget-popularproduct-content">
                                                <h6><a href="product-details.php?id=<?php echo $rowfetchPopular[id];?>&cname=<?php echo $rowfetchPopular[catid];?>">
												<small><?php echo $rowfetchPopular['proname'];?></small></a></h6>
                                                <span>Rs. <?php echo $rowfetchPopular['price'];?></span>
                                            </div>
                                        </li>
			<?php } ?>
                                       
                                        
                                    </ul>
                                </div>
                                <!--// Single Widget -->

                              

                            </div>
                        </div>
                        <!--// Widgets -->

                    </div>
                </div>
            </div>
            <!--// Product Details Wrapper -->

        </main>
        <!--// Page Content -->

        <!--// Page Content -->
        <!--// Page Content -->
<?php include("footer.php");?>
<style>
.more{
			
			background-color:#ce4045;
			color:#fff;
			border-radius:2px;
			padding-left:20px;padding-right:20px;
			border:2px solid #ce4045;
			box-shadow:0 4px 10px 0 rgba(0,0,0,0.3);
		}
		
		</style>