<?php
include("panel/system/ayar.php");
include("panel/system/fonksiyon.php");
?>
<?php $id = g('yazdir');?>
<?php $urun = Sonuc(Sorgu("SELECT * FROM urunler WHERE durum = '1' AND seo = '$id'"));?>
<?php $kategori = Sonuc(Sorgu("SELECT * FROM urun_kategori WHERE id = '$urun->kategori'"));?>
<?php $altkategori = Sonuc(Sorgu("SELECT * FROM alt_urun_kategori WHERE id = '$urun->altkategori'"));?>
<?php $link = Sonuc(Sorgu("SELECT * FROM alt_urun_kategori WHERE durum = '1'"));?>
<?php $url="http://".$_SERVER["HTTP_HOST"].dirname($_SERVER['PHP_SELF']); ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
	<base href="<?php echo $url;?>/">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="assets/lib/bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="assets/lib/font-awesome/css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="assets/lib/select2/css/select2.min.css" />
    <link rel="stylesheet" type="text/css" href="assets/lib/jquery.bxslider/jquery.bxslider.css" />
    <link rel="stylesheet" type="text/css" href="assets/lib/owl.carousel/owl.carousel.css" />
    <link rel="stylesheet" type="text/css" href="assets/lib/jquery-ui/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" href="assets/css/animate.css" />
    <link rel="stylesheet" type="text/css" href="assets/css/reset.css" />
    <link rel="stylesheet" type="text/css" href="assets/css/style.css" />
    <link rel="stylesheet" type="text/css" href="assets/css/responsive.css" />
    <link rel="stylesheet" type="text/css" href="assets/lib/fancyBox/jquery.fancybox.css" />
    
    <title><?php echo $ayar->site_title; ?></title>
	<meta name="description" content="<?php echo $ayar->site_desc; ?>"/>
	<meta name="keywords" content="<?php echo $ayar->site_meta; ?>"/>
	<meta name="author" content="<?php echo $ayar->firma_adi; ?>"/>
	<meta name="Abstract" content="<?php echo $ayar->firma_adi; ?>">
	<meta name="Copyright" content="<?php echo $ayar->copyright; ?>">
</head>
  <body onload="window.print();">
    <div class="container" id="columns">
      <!-- Main content -->
      <section class="invoice">
        <!-- title row -->
        <div class="row">
            <div class="col-xs-12">
              <h2 class="page-header">
                <i class="fa fa-arrow-circle-right"></i> Ürün Bilgileri
              </h2>
            </div><!-- /.col -->
          </div>
        <!-- info row -->
		<!-- row -->
        <div class="row">
            
            <!-- Center colunm-->
            <div class="center_column col-xs-12 col-sm-12" id="center_column">
                <!-- Product -->
                    <div id="product">
                        <div class="primary-box row">
                            <div class="pb-left-column col-xs-5 col-sm-5">
                                <!-- product-imge-->
                                <div class="product-image">
                                    <div class="product-full">
                                        <img id="product-zoom" src='uploads/urunler/orta/<?php echo $urun->resim;?>' data-zoom-image="uploads/urunler/<?php echo $urun->resim;?>"/>
                                    </div>
                                </div>
                                <!-- product-imge-->
                            </div>
                            <div class="pb-right-column col-xs-7 col-sm-7">
                                <h1 class="product-name"><?php echo $urun->adi;?></h1>
                                <div class="product-comments">
								<?php $YorumVarmi = Sonuc(Sorgu("SELECT * FROM urun_yorum WHERE durum = '1' AND urun_id = '$urun->id'"));?>
								<?php if($YorumVarmi > 0){?>
									<?php $Sorgu = Sorgu("SELECT * FROM urun_yorum WHERE durum = '1' AND urun_id = '$urun->id' ORDER BY id DESC");
									$ytoplam = 0;
									$say = 0;
									while($Sonuc = Sonuc($Sorgu)){?>
									<?php $ytoplam+=$Sonuc->puan;?>
									<?php $say++;?>
									<?php }?>
								<?php $yorumorani = ($ytoplam) / ($say*5) * 100;?>
								<?php 
								if($yorumorani <= 20){
									echo '
									<div class="product-star">
									<i class="fa fa-star"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									</div>
									';
								}elseif($yorumorani <= 30){
									echo '
									<div class="product-star">
									<i class="fa fa-star"></i>
									<i class="fa fa-star-half-o"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									</div>
									';
								}elseif($yorumorani <= 40){
									echo '
									<div class="product-star">
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									</div>
									';
								}elseif($yorumorani <= 50){
									echo '
									<div class="product-star">
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star-half-o"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									</div>
									';
								}elseif($yorumorani <= 60){
									echo '
									<div class="product-star">
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									</div>
									';
								}elseif($yorumorani <= 70){
									echo '
									<div class="product-star">
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star-half-o"></i>
									<i class="fa fa-star-o"></i>
									</div>
									';
								}elseif($yorumorani <= 80){
									echo '
									<div class="product-star">
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star-o"></i>
									</div>
									';
								}elseif($yorumorani <= 90){
									echo '
									<div class="product-star">
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star-half-o"></i>
									</div>
									';
								}elseif($yorumorani <= 100){
									echo '
									<div class="product-star">
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									<i class="fa fa-star"></i>
									</div>
									';
								}
								?>
								
								<?php }else{?>
								<div class="product-star">
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
									<i class="fa fa-star-o"></i>
								</div>
								<?php }?>  
                                </div>
                                <div class="product-price-group">
									<?php if($urun->indirim == "1"){?>
                                    <span class="price"><?php echo number_format($urun->ifiyat, 2, ',', '.'); ?> TL</span>
                                    <span class="old-price"> <?php echo number_format($urun->fiyat, 2, ',', '.'); ?> TL</span>
									<?php 
									$fiyat1 	= $urun->fiyat - $urun->ifiyat; 
									$fiyat2 	= $urun->fiyat; 
									$yuzde 		= ($fiyat1 / $fiyat2) * 100;									
									?>
                                    <span class="discount">-<?php echo floor($yuzde);?>%</span>
									<?php }elseif($urun->indirim == "0"){?>
									<span class="price"> <?php echo number_format($urun->fiyat, 2, ',', '.'); ?> TL</span>
									<?php }?>
                                </div>
                                <div class="info-orther">
                                    <p>Ürün Kodu: <?php echo $urun->urun_kodu;?></p>
                                    <p>Stok Durumu: <span class="in-stock"><?php echo $urun->stok;?></span></p>
                                </div>
                                <div class="product-desc" style="line-height: 20px;font-size: 12px;">
                                     <?php 
									 $parcala = explode("|",$urun->ozellik);
									 foreach($parcala as $ozellik){?>
										 <?php echo $ozellik;?>,
									 <?php }?>
                                </div>
                                <div class="form-option">
                                    <p class="form-option-title">Mevcut Seçenekler:</p>
									<?php 
									$bol = explode("||",$altkategori->sec_kat);
									foreach ($bol as $b){
									$SecenekSorgu = Sorgu("SELECT * FROM secenek_kategori WHERE kategori_adi = '$b' ORDER BY id ASC");
									while($SecenekSonuc = Sonuc($SecenekSorgu)){?>
                                    <div class="attributes">
                                        <div class="attribute-label"><?php echo $SecenekSonuc->kategori_adi;?>:</div>
                                        <div class="attribute-list">
                                            <select name="secenek[]">
											<?php 
											$sec = explode("||",$urun->secenek);
											foreach ($sec as $bb){
											$Sorgu = Sorgu("SELECT * FROM secenek WHERE kategori = '$SecenekSonuc->id' AND adi = '$bb' ORDER BY id ASC");
											while($Sonuc = Sonuc($Sorgu)){?>
                                                <option value="<?php echo $SecenekSonuc->kategori_adi;?> : <?php echo $Sonuc->adi;?>"><?php echo $Sonuc->adi;?></option>
											<?php }}?>
                                            </select>
                                        </div>   
                                    </div>
									<?php }}?>
									<div class="attributes">
                                        <div class="attribute-label">Adet:</div>
                                        <div class="attribute-list product-qty">
                                            <div class="qty">
                                                <input name="adet" id="option-product-qty" type="text" value="1">
                                            </div>
                                            <div class="btn-plus">
                                                <a href="#" class="btn-plus-up">
                                                    <i class="fa fa-caret-up"></i>
                                                </a>
                                                <a href="#" class="btn-plus-down">
                                                    <i class="fa fa-caret-down"></i>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                <!-- Product -->
				<!-- tab product -->
                        <div class="product-tab">
                            <ul class="nav-tab">
                                <li class="active">
                                    <a aria-expanded="false" data-toggle="tab" href="#ozellikler">ÖZELLİKLER</a>
                                </li>
                            </ul>
                            <div class="tab-container" style="font-size:12px;">
								<div id="ozellikler" class="tab-panel active">
								<table class="table table-bordered">
							     <?php $parcala = explode("|",$urun->ozellik);
								 foreach($parcala as $ozellik){?>
									 <tr>
                                            <td><?php echo $ozellik;?></td>
                                     </tr>
								 <?php }?> 
								 </table>
                                </div>
                            </div>
                        </div>
                        <!-- ./tab product -->
            </div>
            <!-- ./ Center colunm -->
        </div>
        <!-- ./row-->


      </section><!-- /.content -->
    </div><!-- ./wrapper -->
    <!-- AdminLTE App -->
    <!-- Script-->
	<script type="text/javascript" src="assets/lib/jquery/jquery-1.11.2.min.js"></script>

	<script type="text/javascript" src="assets/lib/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="assets/lib/select2/js/select2.min.js"></script>
	<script type="text/javascript" src="assets/lib/jquery.bxslider/jquery.bxslider.min.js"></script>
	<script type="text/javascript" src="assets/lib/owl.carousel/owl.carousel.min.js"></script>
	<script type="text/javascript" src="assets/lib/jquery.countdown/jquery.countdown.min.js"></script>
	<script type="text/javascript" src="assets/lib/jquery.elevatezoom.js"></script>

	<script type="text/javascript" src="assets/lib/jquery-ui/jquery-ui.min.js"></script>

	<script type="text/javascript" src="assets/lib/fancyBox/jquery.fancybox.js"></script>

	<script type="text/javascript" src="assets/js/jquery.actual.min.js"></script>


	<script type="text/javascript" src="assets/js/theme-script.js"></script>

	</body>
</html>