<!-- Home slideder-->

    <div class="container">
        <div class="row">
            <div class="col-sm-3 slider-left"></div>
            <div class="col-sm-9 header-top-right">
                <div class="homeslider">
                   					<!-- Insert to your webpage where you want to display the slider --> 
				 <div id="amazingslider-wrapper-1" style="display:block;position:relative;max-width:900px;margin:0px auto 0px;">
        <div id="amazingslider-1" style="display:block;position:relative;margin:0 auto;">
            <ul class="amazingslider-slides" style="display:none;">
									<?php 
		$SliderSorgu = mysql_query("SELECT * FROM slider WHERE durum = 1 ORDER BY id ASC"); 
		while($SliderSonuc = mysql_fetch_object($SliderSorgu)){?>
			<li><a href="<?php echo $SliderSonuc->url; ?>"><img src="uploads/slider/<?php echo $SliderSonuc->resim; ?>"  /></a></li>
        <?php }?>   
						</ul> 
					</div> 
				</div>    <!-- End of body section HTML codes -->
                </div>
            </div>
        </div>
    </div>

<style>
.bx-viewport{
	height:445px !important;
}
</style>
<!-- END Home slideder-->
<!-- servives -->
<div class="container">
    <div class="service ">
        <div class="col-xs-6 col-sm-3 service-item">
            <div class="icon">
                <img alt="services" src="assets/data/s1.png" />
            </div>
            <div class="info">
                <a href="#"><h3>ÜCRETSİZ KARGO</h3></a>
                <span>200 TL üzeri Ücretsiz Kargo</span>
            </div>
        </div>
        <div class="col-xs-6 col-sm-3 service-item">
            <div class="icon">
                <img alt="services" src="assets/data/s2.png" />
            </div>
            <div class="info">
                <a href="#"><h3>14 GÜN KOLAY İADE</h3></a>
                <span>Para iade garantisi</span>
            </div>
        </div>
        <div class="col-xs-6 col-sm-3 service-item">
            <div class="icon">
                <img alt="services" src="assets/data/s3.png" />
            </div>
            
            <div class="info" >
                <a href="#"><h3>24/7 DESTEK</h3></a>
                <span>Canlı destek</span>
            </div>
        </div>
        <div class="col-xs-6 col-sm-3 service-item">
            <div class="icon">
                <img alt="services" src="assets/data/s4.png" />
            </div>
            <div class="info">
                <a href="#"><h3>GÜVENLİ ALIŞVERİŞ</h3></a>
                <span>Güvenli Alışveriş Garantisi</span>
            </div>
        </div>
    </div>
</div>
<!-- end services -->

<div class="page-top">

    <div class="container">
        <div class="row">
            <div class="col-xs-12 col-sm-12 page-top-left">
                 <div id="view-product-list" class="view-product-list">
                    <h2 class="page-heading">
                        <span class="page-heading-title">Popüler Ürünlerimiz</span>
                    </h2>
                    
                    <!-- PRODUCT LIST -->
                    <ul class="row product-list grid" name="uubry">
					<?php $USorgu = Sorgu("SELECT * FROM urunler WHERE durum = '1' and anasayfa = '1' ORDER BY id DESC LIMIT 20");
					if(!mysql_affected_rows()){?>
					<div class="center_column col-xs-12 col-sm-12" id="center_column" style="margin-top:20px;">
					<div class="well margin-top-10"><b>Üzgünüz,</b>
						<br>Mağazamızda  ürün bulunamadı.
						<br>
						<br>
						
					</div>
					</div>
					<?php }else{
                        $sayfa = 1;
                        $sayfa_goster = 11; // gösterilecek sayfa sayısı
                        $toplam_sayfa = ceil(say($USorgu) / 10);
                        $en_az_orta = ceil($sayfa_goster/2);
                        $en_fazla_orta = ($toplam_sayfa+1) - $en_az_orta;
                        $sayfa_orta = $sayfa;//Olduğu sayfa
                        if($sayfa_orta < $en_az_orta) $sayfa_orta = $en_az_orta;
                        if($sayfa_orta > $en_fazla_orta) $sayfa_orta = $en_fazla_orta;
                        $sol_sayfalar = round($sayfa_orta - (($sayfa_goster-1) / 2));
                        $sag_sayfalar = round((($sayfa_goster-1) / 2) + $sayfa_orta);
                        if($sol_sayfalar < 1) $sol_sayfalar = 1;
                        if($sag_sayfalar > $toplam_sayfa) $sag_sayfalar = $toplam_sayfa;
						while($USonuc = Sonuc($USorgu)){?> 
                       <li class="col-sx-12 col-sm-3" style="height: 300px;">
                            <div class="product-container">
                                <div class="left-block">
                                    <a href="Urun/<?php echo $USonuc->seo;?>.html">
                                        <img style="width:170px; height:210px; " class="img-responsive" alt="<?php echo $USonuc->adi;?>" src="uploads/urunler/orta/<?php echo $USonuc->resim;?>" />
                                    </a>
                                    <div class="quick-view">
                                            <a title="Karşılaştırmak için ekle" class="compare" href="?kekle=<?php echo $USonuc->id;?>"></a>
                                            <a title="Ürün Detay" class="search" href="Urun/<?php echo $USonuc->seo;?>.html"></a>
                                    </div>
                                    <?php if($USonuc->secenek != ""){?>
										<form action="Urun/<?php echo $USonuc->seo;?>.html" method="post">
										<?php }else{?>
										<form action="?ekle=<?php echo $USonuc->id;?>" method="post">
										<?php }?>
										<input type="hidden" name="adet" value="1" />
										<div class="add-to-cart">
											<button><i style="line-height: inherit;font-size: 20px;" class="fa fa-shopping-cart"></i> Sepete Ekle</button>
										</div>
										<div class="group-price">
											<?php if($USonuc->indirim == "1"){?>
											<?php 
											$fiyat1 	= $USonuc->fiyat - $USonuc->ifiyat; 
											$fiyat2 	= $USonuc->fiyat; 
											$yuzde 		= ($fiyat1 / $fiyat2) * 100;																	
											?>
                                                <span class="product-sale"> %<?php echo floor($yuzde);?> İNDİRİM</span>
											<?php }?>
                                            </div>
									</form>
                                </div>
                                <div class="right-block">
                                    <h5 class="product-name kisalt"><a href="Urun/<?php echo $USonuc->seo;?>.html"><?php echo $USonuc->adi;?></a></h5>
                                    <div class="content_price">
										<?php if($USonuc->indirim == "1"){?>
										<span class="price product-price"> <?php echo number_format($USonuc->ifiyat, 2, ',', '.');?> TL</span>
										<span class="price old-price"> <?php echo number_format($USonuc->fiyat, 2, ',', '.');?> TL</span>
										<?php }elseif($USonuc->indirim == "0"){?>
										<span class="price product-price"> <?php echo number_format($USonuc->fiyat, 2, ',', '.');?> TL</span>
										<?php }?>				
									</div>
									<?php $YorumVarmi = Sonuc(Sorgu("SELECT * FROM urun_yorum WHERE durum = '1' AND urun_id = '$USonuc->id'"));?>
											<?php if($YorumVarmi > 0){?>
												<?php $YSorgu = Sorgu("SELECT * FROM urun_yorum WHERE durum = '1' AND urun_id = '$USonuc->id' ORDER BY id DESC");
												$ytoplam = 0;
												$ysay = 0;
												while($YSonuc = Sonuc($YSorgu)){?>
												<?php $ytoplam+=$YSonuc->puan;?>
												<?php $ysay++;?>
												<?php }?>
											<?php $yorumorani = ($ytoplam) / ($ysay*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 class="info-orther">
                                        <p>Ürün Kodu: <?php echo $USonuc->urun_kodu;?></p>
                                        <p class="availability">Stok Durumu: <?php echo($USonuc->stok > 0 ? '<span class="in-stock"> Var </span>' : '<span class="out-stock"> Tükendi</span>');?></p>
                                        <div class="product-desc">
										<?php 
										 $parcala = explode("|",$USonuc->ozellik);
										 $index = end($parcala);
										 foreach($parcala as $ozellik){?>
											 <?php echo $ozellik;?><?php echo($ozellik != $index ? ',' : '');?>
										 <?php }?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
					<?php }}?>
					<div class="clearfix"></div>
                    </ul>
                    <!-- ./PRODUCT LIST -->
                </div>
            </div>
        </div>
    </div>
</div>
<!---->
<div id="content-wrap">
    <div class="container">
        <div id="hot-categories" class="row">
            <div class="col-sm-12 group-title-box">
                <h2 class="group-title ">
                    <span>Popüler Kategoriler</span>
                </h2>
            </div>
            <?php $Sorgu = Sorgu("SELECT * FROM urun_kategori WHERE durum = '1' ORDER BY id ASC LIMIT 8");
			$say = 1;
			while($Sonuc = Sonuc($Sorgu)){?>
			<?php $link = Sonuc(Sorgu("SELECT * FROM alt_urun_kategori WHERE durum = '1' AND ust_id = '$Sonuc->id'"));?>
            <div class="col-sm-6  col-lg-3 cate-box">
                <div class="cate-tit" >
                    <div class="div-1" style="width: 46%;">
                        <div class="cate-name-wrap">
                            <p class="cate-name"><?php echo $Sonuc->kategori_adi;?></p>
                        </div>
                        <a href="AnaKategori/<?php echo $Sonuc->seo;?>.html" class="cate-link link-active" data-ac="flipInX" ><span>İNCELE</span></a>
                    </div>
                    <div class="div-2" >
                        <a href="AnaKategori/<?php echo $Sonuc->seo;?>.html">
                            <img src="uploads/urunkategori/kucuk/<?php echo $Sonuc->resim;?>" style="width:110px;" alt="<?php echo $Sonuc->kategori_adi;?>" class="hot-cate-img" />
                        </a>
                    </div> 
                </div>
				<?php $AltSorgu = Sorgu("SELECT * FROM alt_urun_kategori WHERE durum = '1' AND ust_id = '$Sonuc->id' ORDER BY sira ASC limit 7");
				if(!mysql_affected_rows()){
				}else{
					echo '
					<div class="cate-content">
                    <ul>';
					while($AltSonuc = Sonuc($AltSorgu)){?>
						<li><a href="Kategori/<?php echo $AltSonuc->seo;?>.html"><?php echo $AltSonuc->kategori_adi;?></a></li>
					<?php } echo '</ul></div>';?>
				<?php }?> 
            </div> <!-- /.cate-box -->
			<?php if($say++%4 == 0){echo '<div style="clear:both;"></div>';}?>
			<?php } ?>                                          
        </div> <!-- /#hot-categories -->
        
    </div> <!-- /.container -->
</div>