<main>  
	<!-- /toolbox -->
	<div class="container margin_30">

		<div class="row small-gutters">
			<?php
			if ($_GET && !empty($_GET["arama"])) 
			{
				if (!empty($_GET["arama"])) 
				{
					
					$arama=$VT->filter($_GET["arama"]);
					$urunler=$VT->VeriGetir("urunler","WHERE durum=? AND (baslik) LIKE ? OR metin LIKE ?",
						array(1,'%'.$arama.'%','%'.$arama.'%'),"ORDER BY sirano ASC");
				}
				else
				{
					$urunler=$VT->VeriGetir("urunler","WHERE durum=?",array(1),"ORDER BY sirano ASC");
				} 
			}
			else
			{
				$urunler=$VT->VeriGetir("urunler","WHERE durum=?",array(1),"ORDER BY sirano ASC");
			} 
			if ($urunler!=false)
			{
				for ($i=0; $i <count($urunler) ; $i++) 
				{ 

					?>
					<div class="col-6 col-md-4 col-xl-3">
						<div class="grid_item">
							<figure>
								<?php 
								if (!empty($urunler[$i]["indirimlifiyat"])) 
								{
									$indirimlifiyat=$urunler[$i]["indirimlifiyat"].".".$urunler[$i]["indirimlikurus"];
									$normalfiyat=$urunler[$i]["fiyat"].".".$urunler[$i]["kurus"];
									$hesapla=(($indirimlifiyat/$normalfiyat)*100);
									$indirimorani=round(100-$hesapla);

									?>
									<span class="ribbon off">% <?=$indirimorani?> İndirimli</span>
									<?php
								}
								?>
								<a href="<?=SITE?>urun/<?=$urunler[$i]["seflink"]?>">
									<img class="owl-lazy" src="<?=SITE?>images/urunler/<?=$urunler[$i]["resim"]?>" data-src="<?=SITE?>images/urunler/<?=$urunler[$i]["resim"]?>" width="100%" height="290" alt="<?=stripslashes($urunler[$i]["baslik"])?>"> 
								</a>

							</figure>
							<div class="rating"><i class="icon-star voted"></i>
								<i class="icon-star voted"></i>
								<i class="icon-star voted"></i>
								<i class="icon-star voted"></i>
								<i class="icon-star"></i>
							</div>
							<a href="<?=SITE?>urun/<?=$urunler[$i]["seflink"]?>">
								<h3><?=stripslashes($urunler[$i]["baslik"])?></h3>
							</a>
							<div class="price_box">
								<?php 
								if (!empty($urunler[$i]["indirimlifiyat"])) 
								{
									$fiyat=$urunler[$i]["indirimlifiyat"].".".$urunler[$i]["indirimlikurus"];
									$normalfiyat=$urunler[$i]["fiyat"].".".$urunler[$i]["kurus"];

									if ($urunler[$i]["kdvdurum"]==1) 
									{
										if ($urunler[$i]["kdvoran"]>9) 
										{
											$oran="1.".$urunler[$i]["kdvoran"]; 
										}
										else
										{
											$oran="1.0".$urunler[$i]["kdvoran"]; 
										} 
										$fiyat=($fiyat/$oran); /*KDVsiz Hali*/
										$normalfiyat=($normalfiyat/$oran);

									} 
									?>
									<span class="new_price"><?=number_format($fiyat,2,",",".")?> ₺</span>
									<span class="old_price"><?=number_format($normalfiyat,2,",",".")?> ₺</span>

									<?php
								}
								else
								{
									$fiyat=$urunler[$i]["fiyat"].".".$urunler[$i]["kurus"];

									if ($urunler[$i]["kdvdurum"]==1) 
									{
										if ($urunler[$i]["kdvoran"]>9) 
										{
											$oran="1.".$urunler[$i]["kdvoran"]; 
										}
										else
										{
											$oran="1.0".$urunler[$i]["kdvoran"]; 
										} 
										$fiyat=($fiyat/$oran); /*KDVsiz Hali*/ 

									} 

									?>
									<span class="new_price">₺<?=number_format($fiyat,2,",",".")?></span>
									<?php
								}
								?>

							</div>
							<ul>
								<li><a href="#0" class="tooltip-1" data-toggle="tooltip" data-placement="left" title="Favorilere Ekle"><i class="ti-heart"></i><span>Favorilere Ekle</span></a></li>


							</ul>
						</div>
						<!-- /grid_item -->
					</div>
					<?php

				}

			}
			else
			{
				?> 
				<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='100%'>
					<tr>
						<td width='100%' align='center'>
							<font style='font-family:Arial; font-size:15px;'>
								<br>
								<br>
							</font>
							<font style='font-family:Arial; font-size:16px;'>
								<img border='0' src='<?=SITE?>img/bos.png' width='150'> 
								<br>
								<b>Ürün bulunamadı.</b>
								<br><br>
								<a href='./'><i>Alışverişe başlamak için buraya tıklayınız.</i></a> 
								<br> 
								<br>
								<a href="./" class="btn_1">Ana Sayfa</a>
								<br>
								<br>
							</td>
						</tr>

					</table>

					<?php
				}
				?> 
				<!-- /col -->
			</div>
			<!-- /row -->
		</div>
		<!-- /container -->

	</main>
