NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<?php

function getUrunler($catId)
{
$url = "http://mage.reeder.com.tr/api/rest/products?page=1&limit=100&category_id=".$catId;


$ch = curl_init();
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');

curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',"Accept: text/xml"));
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$retValue = curl_exec($ch);
curl_close($ch);
$xml=simplexml_load_string($retValue);
return $xml;
}
?>
<!doctype HTML>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://use.fontawesome.com/fcf454fab2.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<title>Ürün Seçimi</title>
<style type="text/css">div.row { padding:5px; }</style>

</head>
<body>
<div class="container" style="margin-top:30px;width:750px" >
<div class="row">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-fw fa-lg fa-list-ul"></i> Ürün Listesi</div>
<div class="panel-body">

<ul class="nav nav-tabs nav-justified" style="margin-bottom: 0px;padding-bottom: 0px">
<li role="presentation" class="active"><a data-toggle="tab" href="#telefonlar"><i class="fa fa-fw fa-lg fa-mobile"></i> Telefonlar</a></li>
<li role="presentation"><a data-toggle="tab" href="#tabletler"><i class="fa fa-fw fa-lg fa-tablet"></i> Tabletler</a></li>
<li role="presentation"><a data-toggle="tab" href="#aksesuarlar"><i class="fa fa-fw fa-lg fa-cubes"></i> Aksesuarlar</a></li>
<li role="presentation"><a data-toggle="tab" href="#secilenler"><i class="fa fa-fw fa-lg fa-shopping-basket"></i> Seçilen Ürünler</a></li>
</ul>
<div style="width:100%;border :1px solid #DDDDDD;border-top: 0px;padding: 10px" class="tab-content">
<div class="tab-pane fade active in" id="telefonlar">
<?php
$xml = getUrunler(4);

for ($i = count($xml->data_item) -1; $i>=0; $i--)
{
?>
<div class="item_showcase">
<div class="row">
<div class="col-md-8">
<!--<img src="<?=$imgUrl;?>" style="width:100px;height:100px" />-->
<input type="text" id="<?=$xml->data_item[$i]->entity_id;?>" class="form-control input " placeholder="" value="<?=$xml->data_item[$i]->name;?>" />
</div>

<div class="col-md-2">
<input type="number" class="form-control input " placeholder="Fiyat" value="<?=$xml->data_item[$i]->final_price_with_tax;?>" />
</div>

<div class="col-md-2">
<input type="number" price="<?=$xml->data_item[$i]->final_price_with_tax;?>" prodname="<?=$xml->data_item[$i]->name;?>" prod_id="<?=$xml->data_item[$i]->entity_id;?>" id="cnt_<?=$xml->data_item[$i]->entity_id;?>"min="0" max="100" class="form-control input " placeholder="Adet" value="" />
</div>
</div>

</div>
<?php
} ?>
</div>
<div class="tab-pane fade " id="tabletler">
<?php
$xml = getUrunler(3);

for ($i = count($xml->data_item) -1; $i>=0; $i--)
{
$imgUrl = $xml->data_item[$i]->image_url;
?>
<div class="item_showcase">
<div class="row">
<div class="col-md-8">
<!--<img src="<?=$imgUrl;?>" style="width:100px;height:100px" />-->
<input type="text" id="<?=$xml->data_item[$i]->entity_id;?>" class="form-control input " placeholder="" value="<?=$xml->data_item[$i]->name;?>" />
</div>

<div class="col-md-2">
<input type="number" class="form-control input " placeholder="Fiyat" value="<?=$xml->data_item[$i]->final_price_with_tax;?>" />
</div>

<div class="col-md-2">
<input type="number" price="<?=$xml->data_item[$i]->final_price_with_tax;?>" prodname="<?=$xml->data_item[$i]->name;?>" prod_id="<?=$xml->data_item[$i]->entity_id;?>" id="cnt_<?=$xml->data_item[$i]->entity_id;?>"min="0" max="100" class="form-control input " placeholder="Adet" value="" />
</div>
</div>

</div>
<?php
} ?>
</div>
<div class="tab-pane fade " id="aksesuarlar">
<?php
$xml = getUrunler(6);

for ($i = count($xml->data_item) -1; $i>=0; $i--)
{
?>
<div class="item_showcase">
<div class="row">
<div class="col-md-8">
<!--<img src="<?=$imgUrl;?>" style="width:100px;height:100px" />-->
<input type="text" id="<?=$xml->data_item[$i]->entity_id;?>" class="form-control input " placeholder="" value="<?=$xml->data_item[$i]->name;?>" />
</div>

<div class="col-md-2">
<input type="number" class="form-control input " placeholder="Fiyat" value="<?=$xml->data_item[$i]->final_price_with_tax;?>" />
</div>

<div class="col-md-2">
<input type="number" price="<?=$xml->data_item[$i]->final_price_with_tax;?>" prodname="<?=$xml->data_item[$i]->name;?>" prod_id="<?=$xml->data_item[$i]->entity_id;?>" id="cnt_<?=$xml->data_item[$i]->entity_id;?>"min="0" max="100" class="form-control input " placeholder="Adet" value="" />
</div>
</div>

</div>
<?php
} ?>
</div>
<div class="tab-pane fade " id="secilenler">
<div id="item_showcase_selected">

</div>
</div>

<script>

function gonder()
{
alert("TOPLAM FIYAT : "+$("#tfiyat").val());
alert("URUN DATA : "+$("#sonuc").val());
$.post("sonuc.php", {"toplam_fiyat" : $("#tfiyat").val(), "urun_data" : $("#sonuc").val() }, function(d,s)
{
alert(d);
});
}


function temizle()
{
localStorage.clear();
localStorage = null;
location.reload();
}

function setDefaultValues()
{
for (var key in localStorage)
{
var tmp = localStorage.getItem(key);
var t = tmp.split(";");

var adet = parseInt(t[0]);
var ad = t[1];

$("#cnt_"+key).val(adet);
}
}

function updateBasket()
{
$("div#item_showcase_selected").html("");

var data = "";
var tfdata = "";
var toplamFiyat = 0;
for (var key in localStorage)
{
var tmp = localStorage.getItem(key);
var t = tmp.split(";");
var adet = parseInt(t[0]);
var ad = t[1];
var fiyat = t[2];
toplamFiyat += parseInt(adet) * parseFloat(fiyat);

tfdata += key+";"+tmp+"rn";
data += '<form id="siparisForm"><div class="row"><div class="col-md-6">'+
'<input type="text" class="form-control input text-left" placeholder="" readonly="readonly" value="'+ad+'" />'+
'</div>'+
'<div class="col-md-2">'+
'<input type="number" class="text-right form-control input " min="0" max="100" placeholder="Adet" value="'+adet+'" />'+
'</div>'+
'<div class="col-md-2">'+
'<input type="text" readonly="readonly" class="text-right form-control input " placeholder="Birim Fiyat" value="'+fiyat+' ₺" />'+
'</div>'+
'<div class="col-md-2">'+
'<input type="text" readonly="readonly" class="text-right form-control input " placeholder="Toplam Fiyat" value="'+( parseInt(adet) * parseFloat(fiyat) )+' ₺" />'+
'</div></div>';


}

alert(toplamFiyat);

data += "";
data += "<div class='row'>";
data += '<div class="col-md-6"><button type="button" onClick="temizle();" class=" btn btn-danger btn-lg"><i class="fa fa-fw fa-lg fa-trash-o"></i> Temizle</button></div>'
data += '<div class="col-md-6 text-right"><input type="hidden" id="tfiyat" /><button id="toplam_fiyat" onClick="gonder();" type="button" class="btn btn-success btn-lg"><i class="fa fa-fw fa-lg fa-send"></i> '+toplamFiyat+' ₺</button></div>';
data += "</form>"
$("div#item_showcase_selected").html(data);
$("#tfiyat").val(toplamFiyat);
$("#sonuc").val(tfdata);
}




$("input[type=number]").change(function()
{
var deger = $(this).val();
var prodId = $(this).attr("prod_id");
var prodname = $(this).attr("prodname");
var fiyat = $(this).attr('price');

if (deger == 0)
{
localStorage.removeItem(prodId);
updateBasket();
}
else
{
localStorage.setItem(prodId,deger+";"+prodname+";"+fiyat);
updateBasket();
}
});

$("input[type=number]").blur(function()
{
var deger = $(this).val();
var prodId = $(this).attr("prod_id");

if (deger == 0)
{
$(this).val("");
localStorage.removeItem(prodId);
updateBasket();
}
});
</script>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function()
{
if (typeof(Storage) == "undefined")
{
alert("Bu Web Tarayıcısında Local Storage Desteği Bulunmamaktadır. Lütfen Başka Bir Web Tarayıcısı Kullanın");
}
else
{
setDefaultValues();
updateBasket();
}
});
</script>


<textarea id="sonuc" name="sonuc" class="form-control input" style="width:100%;height:200px"></textarea>
</body>
</html>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.