Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/admin/tablice/koszyk.php |
<?php
session_start();
include('config.php');
if(isset($_GET['delete'])){
unset($_SESSION[KOSZYK][$_GET['delete']]);
header('location: koszyk.php');
}
$iloscprod = count($_SESSION[KOSZYK]);
include('../wodki/admin/config.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>koszyk - Tablice Ślubne</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="css/iosOverlay.css">
<script src="js/jquery.min.js"></script>
<script src="js/modernizr-2.0.6.min.js"></script>
<script src="js/iosOverlay.js"></script>
<script src="js/spin.min.js"></script>
<script src="js/prettify.js"></script>
<script src="js/custom.js"></script>
<script src="js/jquery.colorbox.js"></script>
<link rel="stylesheet" href="css/style.css">
<script>
$(document).ready(function() {
$('#realizuuj').click(function(){
var $val=0;
$("input.required").each(function(){
if (($(this).val())== ""){
$val = 1
}
else{
}
});
if($val == 1){
$('.popup').hide();
$('div.overwhite').show();
}
});
$('span.akcept').click(function(){
$('div.informacyjnypopup').html('');
$('div.errorpopup').hide();
$('div.alertpopup').hide();
$('div.overwhite').hide();
$('div.informacyjnypopup').hide();
$('div.blur').removeClass('active');
});
$(".zamknij").click(function() {
$('.popup').css({'display':'none'});
$('div.blur').removeClass('active');
});
$('.add_item_z').click( function() {
$( this ).parent("span").children("input").val(parseInt($( this ).parent("span").children("input").val())+1);
ilewiersz($( this ).parent().parent().attr('class'));
ilekupiono();
return false;
});
$('.sub_item_z').click( function() {
if( parseInt($( this ).parent("span").children("input").val()) >1 ) {
$( this ).parent("span").children("input").val(parseInt($( this ).parent("span").children("input").val())-1);
}
ilewiersz($( this ).parent().parent().attr('class'));
ilekupiono();
return false;
});
function ilewiersz(val){
var ilosci3 = $("."+val+" .sztuk").val();
$("."+val+" span.ilosc.cena>i").html(((Number(ilosci3))*8.6).toFixed(2));
}
function ilekupiono(){
var ilosci1 = 0;
$("input[name^=sztuk]").each(function(){
ilosci1 += Number($(this).val());
});
$("p.nagl span.ilosc i").html(((Number(ilosci1))*8.6).toFixed(2));
}
$('.sztuk').keyup(function() {
//$( this ).parent("span").children("input").val(parseInt($( this ).parent("span").children("input").val())+1);
$( this ).parent().parent().children("span.ilosc").html();
ilewiersz($( this ).parent().parent().attr('class'));
ilekupiono();
return false;
});
$(".wyslij.big_button").click(function() {
var next = 1;
$("input[name^=sztuk]").each(function(){
if(!$(this).val()) next=0;
});
<?php
if(count($_SESSION[KOSZYK])){
echo "if(next == 1){
$('div.blur').addClass('active');
$('.popup').css({'display':'block'});
$('div.overwhite').fadeIn(100);
}
else{
alert('Uzupełnij liczbę sztuk wszystkich pozycji w koszyku');
}";}
else{
echo "alert('Twój koszyk jest pusty');";
}
?>
});
});
</script>
<script>
$(document).ready(function() {
$(".group1").colorbox();
});
</script>
<body>
<div class="blur">
<div class="wrapper2 boxshadow">
<?php if(isset($_GET['submit'])){
require 'class.phpmailer.php';
$mail = new PHPMailer;
$mail->addAddress($_POST['email'], $_POST['email']);
$mail->setFrom('biuro@etykietyweselne.pl','EtykietyWeselne.pl | Obsługa');
//$mail->addAddress('barii@wp.pl', 'barii@wp.pl');
//$mail->addAddress('allegro@prolabel.pl', 'allegro@prolabel.pl'); // Add a recipient
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->isHTML(true); // Set email format to HTML
$mail->SetLanguage("pl", "classes/language/");
$mail->CharSet = "utf-8";
// subject
$subject = '';
if($_SERVER['HTTP_HOST']=='www.tablice.etykietyweselne.pl') $subject .='@PayU_koszyk';
else $subject .='@Allegro_koszyk';
$subject .=' Tablice Ślubne dla '.$_POST['imie'];
//if($_SERVER['HTTP_HOST']=='www.allegro.etykietynawino.pl') $subject .=' / nick: '.$_POST['allegro'];
// message
$message = '
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<p>Wiadomość wygenerowana automatycznie prosimy na nią nie odpowiadać.</p>
<h3>Dane klienta:</h3>
<ul style="padding:10px;margin:0px;font-size:15px;background:#F7F7F7">
<li style="list-style:none">Dnia '.Date("Y-m-d").'</li>
<li style="list-style:none">Zamawiający: '.$_POST['imie'].'</li>
<li style="list-style:none">Email: '.$_POST['email'].'</li><li style="list-style:none">Nr kontaktowy '.$_POST['tel'].'</li>';
if($_POST['allegro'])$message .= '<li style="list-style:none">Nick allegro '.$_POST['allegro'].'</li></ul>';
else $message .= '</ul><br /><h3>Adres dostawy:</h3>
<ul style="padding:10px;margin:0px;font-size:15px;background:#F7F7F7">
<li style="list-style:none">'.$_POST['imie'].'</li><li style="list-style:none">'.$_POST['ulica'].'</li><li style="list-style:none">'.$_POST['kod'].' '.$_POST['miasto'].'</li>
<li style="list-style:none">Dostawa: '.$_POST['wysylka'].'</li></ul>';
$message .= '
<br>';
if($_SERVER['HTTP_HOST']!='www.tablice.etykietyweselne.pl') $nick = str_replace(' ','_',$_POST['allegro']);
else $nick = str_replace(' ','_',$_POST['imie']);
$zip = new ZipArchive();
$filenames = 'zip/'.$nick.'-Tablice-'.Date("YmdHis").'.zip';
$zaw=0;
$sz=0;
$cena = 0 ;
if ($zip->open($filenames, ZipArchive::CREATE)!==TRUE) {
exit("cannot open <$filenames>\n");
}
$o=0;
$ii=0;
$messaget = '<h3>Podsumowanie zamównia:</h3>';
foreach ($_SESSION[KOSZYK] as $val => $rel){
for($sztuczek = 1;$sztuczek<=$_POST['sztuk'][$ii];$sztuczek++){
$zip->addFile(str_replace('thumb/','',$rel['pdf']),$_POST['email'].'-'.$_POST['sztuk'][$ii].'szt_'.$ii.'_'.$sztuczek.'.jpg');
}
//$zip->addFile(str_replace('thumb/','',$rel['pdf']),$nick.'-'.$_POST['sztuk'][$ii].'szt_'.$ii.'.jpg');
$cena += ($_POST['sztuk'][$ii]*$s['cena'.$_POST['rozmiar'][$ii]]);
$sz +=$_POST['sztuk'][$ii];
$messaget .= '<div style="width:200px;display:inline-block;text-align:center;"><img src="'.WWW.$rel['pdf'].'" style="width:180px"><p>Tablice Ślubne</p></p>Ilość '.$_POST['sztuk'][$ii].' szt.</p></div>';
$messagetm .= '<div class="podglad"><a class="group1" href="'.WWW.$rel['pdf'].'"><img src="'.WWW.$rel['pdf'].'"><br>ilość: '.$_POST['sztuk'][$ii].' szt.</div>';
$ii++;
}
$messaget .= '';
$zip->close();
if($_SERVER['HTTP_HOST']=='www.allegrotablice.etykietyweselne.pl') {$alll = '<h3>Jeśli nie dokonałeś zakupu na naszych aukcjach, skorzystaj z poniższych informacji:</h3><p><ul><li style="list-style:none;font-size:16px;color:#C21033">Ilość sztuk do kupienia na aukcji: <strong>'.($sz).'</strong><br>
<strong style="color:#C21033">Kliknij, przejdź do aukcji i zalicytuj powyższą ilość: <a target="_blank" href="'.LINKAUKCJA.'" style="display: inline-block;
border: 1px solid #ff7b1e;
color: #FFF;
text-shadow: 1px 1px 0 #ff3b10;
-moz-box-shadow: inset 0 1px 0 0 #ff9502;
-webkit-box-shadow: inset 0 1px 0 0 #ff9502;
box-shadow: inset 0 1px 0 0 #ff9502;
background: none;
background-color: #ff7300;
background-image: -moz-linear-gradient(top, #ff9502 5%, #ff6600 100%);
background-image: -webkit-linear-gradient(top, #ff9502 5%, #ff6600 100%);
background-image: -o-linear-gradient(top, #ff9502 5%, #ff6600 100%);
background-image: -ms-linear-gradient(top, #ff9502 5%, #ff6600 100%);
background-image: linear-gradient(top, #ff9502 5%, #ff6600 100%);
background-repeat: repeat-x;
padding: .2em .5em;
margin: 5px;
border-radius: 5px;
text-decoration: none;">Kup teraz</a> </strong>
</ul> '; }
$message = $message.$alll.$messaget.'<p><b>Dane kontaktowe:</b><br />
Mydlana 1, 51-502 Wrocław<br />
tel. +48 512 512 661 pon-pt od 10.00 - 17.00<br />
email: allegro@prolabel.pl</p>
<p><a href="http://www.prolabel.pl"><img src="http://www.etykietyweselne.pl/img/stopkamail.jpg" height="50" style="height:50px" valign="middle"></a> <a href="http://www.etykietyweselne.pl"><img src="http://www.etykietyweselne.pl/html/tpl/images/kreator_18.png" height="80" valign="middle" style="height:80px" ></a> <a href="https://www.facebook.com/Etykiety-Weselne-1209437839074790"><img src="http://www.etykietyweselne.pl/img/fbicon.png" height="50" valign="middle" style="height:50px"></a>
<a href="https://www.youtube.com/watch?v=9uEPblnQXew"><img src="http://www.etykietyweselne.pl/img/youtubelogo.jpg" valign="middle" height="50" style="height:50px"></a></p>
</body>
</html>';
$mail->Subject = $subject;
$mail->Body = $message;
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo '<h1 class="bold">Dziękujemy za zamówienie</h1>';
echo '<br>'.$message.'<p style="text-align:center;font-size:14px;border:0px">Powyższe informacje zostały wysłane również na podany adres e-mail<br>- jeśli nie otrzymałeś - sprawdź zakładkę "Spam".<br /></p>';
}
$mail2 = new PHPMailer;
//$mail2->addAddress($_POST['email'], $_POST['email']);
$mail2->setFrom('biuro@etykietyweselne.pl','EtykietyWeselne.pl | Obsługa');
$mail2->addAddress('biuro@prolabel.pl', 'biuro@prolabel.pl');
//$mail2->addAddress('biuro@mfbiz.pl', 'biuro@mfbiz.pl');
$mail2->addAddress('allegro@prolabel.pl', 'allegro@prolabel.pl'); // Add a recipient
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail2->isHTML(true); // Set email format to HTML
$mail2->SetLanguage("pl", "classes/language/");
$mail2->CharSet = "utf-8";
$message = '<p>PLIK DO POBRANIA: <a href="'.WWW.$filenames.'">ZIP '.$filenames.'</a></p>'.$message;
$mail2->Subject = $subject;
$mail2->Body = $message;
if(!$mail2->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail2->ErrorInfo;
} else {
//echo 'Message has been sent';
}
$obj = new Admin();
$dane['imie']=$_POST['imie'];
$dane['tel']=$_POST['tel'];
$dane['email']=$_POST['email'];
$dane['nick']=$_POST['allegro'];
$dane['adres']=$_POST['ulica'].'<br>'.$_POST['kod'].' '.$_POST['miasto'].'<br>Dostawa: '.$_POST['wysylka'];
$dane['rodzaj']='Tablice';
$dane['cokupil']= 'Tablice: '.$sz.' szt.';
if($_SERVER['HTTP_HOST']=='www.tablice.etykietyweselne.pl') {
require_once realpath(dirname(__FILE__)) . '/payu/lib/openpayu.php';
require_once realpath(dirname(__FILE__)) . '/payu/examples/config.php';
$order = array();
$order['notifyUrl'] = 'https://www.etykietyweselne.pl/admin/tablice/';
$order['continueUrl'] = 'https://www.etykietyweselne.pl/admin/tablice/koszyk.php?success';
if($_POST['wysylka']=='Poczta Polska') $kwotawys='10';
elseif($_POST['wysylka']=='Kurier') $kwotawys='15';
else $kwotawys='0';
$order['customerIp'] = '127.0.0.1';
$order['merchantPosId'] = OpenPayU_Configuration::getMerchantPosId();
$order['description'] = 'Tablica: '.$_POST['email'];
$order['currencyCode'] = 'PLN';
$order['totalAmount'] = ($cena+$kwotawys) *100;
$order['extOrderId'] = uniqid('', true);
$order['products'][0]['name'] = 'Tablica ślubna: '.$sz;
$order['products'][0]['unitPrice'] = $cena *100;
$order['products'][0]['quantity'] = 1;
$order['products'][1]['name'] = 'Wysyłka: '.$_POST['wysylka'];
$order['products'][1]['unitPrice'] = ($kwotawys) *100;
$order['products'][1]['quantity'] = 1;
$order['buyer']['email'] = $_POST['email'];
$order['buyer']['phone'] = $_POST['tel'];
$order['buyer']['firstName'] = $_POST['imie'];
$order['buyer']['lastName'] = '';
$response = OpenPayU_Order::create($order);
$ordid= $response->getResponse()->orderId;
$dane['orderid'] = $ordid;
$dane['zaplacono'] = $cena+$kwotawys;
header('Location:'.$response->getResponse()->redirectUri);
}
$dane['miniaturki'] = $messagetm;
$dane['link'] = 'https://www.etykietyweselne.pl/admin/tablice/'.$filenames;
$obj->DodajDoBazy($dane);
unset($_SESSION[KOSZYK]);
$_SESSION['i']=0;
}else{
?>
<h1>Twój koszyk</h1>
<br style="clear: both;"/>
<div class="koszyk">
<form action="koszyk.php?submit" method="post">
<?php
echo '<p class="nagl"><span class="lp">lp.</span><span class="min">miniaturka</span><span class="spec">specyfikacja</span><span class="ilosc">ilość</span>';
if($_SERVER['HTTP_HOST']=='www.tablice.etykietyweselne.pl') echo '<span class="ilosc">cena</span>';
echo '<span class="usun">usuń</span></p>';
$i=0;
$suma = 0;
foreach($_SESSION[KOSZYK] as $val => $rel){
$rozmiar = getimagesize(str_replace('thumb/','',$rel['mini']));
$rel['rozmiar'] = '52x11,5';
$i++;
$cena=(($rel['sztuk']/10)*CENA);
$suma +=$cena;
echo '<p class="pozkosz'.$i.'"><span class="lp">'.$i.'</span><span class="min"><img src="'.$rel['pdf'].'" style="height:50px"></span><span class="spec" style="text-align:left;width:240px;font-size:15px;line-height:23px">produkt: <strong>Tablice Ślubne</strong>
<br>wielkość: <strong>'.$rel['rozmiar'].' cm</strong><input type="hidden" class="rozmiar" value="'.$rel['rozmiar'].'" name="rozmiar[]"required>
<br>materiał: <strong>plastik PCV 2mm</strong>
<br>właściwości: <strong>wodoodporna</strong>
</span><span class="ilosc"><input type="text" class="sztuk" readonly autocomplete="off" value="'.$rel['sztuk'].'" name="sztuk[]" style="clear:none;float:none;margin:0px;width:27px;padding:0px;border:0px;background:white;box-shadow:none;font-size:14px" required><a href="#" class="add_item_z"><i class="material-icons">add_circle</i></a> <a href="#" class="sub_item_z"><i class="material-icons">remove_circle_outline</i></a></span>';
if($_SERVER['HTTP_HOST']=='www.tablice.etykietyweselne.pl') echo '<span class="ilosc cena" style="position:relative;top:15px"><i>'.number_format($cena,2).'</i> zł brutto</span>';
echo '<span class="usun"><a href="koszyk.php?delete='.$val.'">x</a></span></span></p>';
}
if($_SERVER['HTTP_HOST']=='www.tablice.etykietyweselne.pl') echo '<p class="nagl"><span class="lp"> </span><span class="min"> </span><span class="spec" style="text-align:right">Suma:</span><span class="ilosc"><i>'.number_format($suma,2).'</i> zł brutto</span><span class="usun"> </span></p>';
?>
<a class="wyslij big_button">Finalizuj zamówienie</a>
<a href="/?wybor" class="big_button blue">Dodaj następny</a>
<br style="clear: both;"/><br style="clear: both;"/>
</div>
<br style="clear: both;"/>
<?php
}
?>
<?php if($_SERVER['HTTP_HOST']=='www.tablice.etykietyweselne.pl') {?>
<?php
echo '<div style="text-align:center">Płatności online obsługuje: <img src="/img/logo_0.png" style="vertical-align:middle;width:100px;margin:0 20px"></div>';
}?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="popup"><div class="overwhite"></div><div class="sendpopup" <?php if($_SERVER['HTTP_HOST']=='www.allegrotablice.etykietyweselne.pl'){echo 'style="height:270px;margin:-130px -320px;"';}else{echo 'style="height:380px;margin:-200px -320px;"';}?>><a class="zamknij">X</a>
<h2>Wpisz dane do zamówienia</h2>
<p><span>Imię i Nazwisko:</span> <input type="text" name="imie" required/></p>
<p><span>Numer telefonu:</span> <input type="text" name="tel" required/></p>
<p><span>Adres e-mail:</span> <input type="text" name="email" required/></p>
<?php if($_SERVER['HTTP_HOST']=='www.tablice.etykietyweselne.pl'){?><h2>Adres dostawy:</h2>
<p><span>Ulica i numer:</span> <input type="text" name="ulica" /></p>
<p style="height:30px"><span>Kod pocztowy:</span> <input type="text" name="kod" style="width:80px !important;float:left;margin-right:30px" /> <span>Miasto:</span> <input type="text" name="miasto" style="float:left;width:150px !important" /></p>
<p><span>Wysyłka:</span>
<select name="wysylka">
<option value="Odbiór Osobisty">0zł - Odbiór Osobisty (Wrocław)</option>
<option value="Poczta Polska" selected>10zł - Poczta Polska (przedpłata)</option>
<option value="Kurier">15zł - Kurier InPost (Przedpłata)</option>
</select>
</p>
<?php }
else{ ?>
<p><span>Nick allegro:</span> <input type="text" name="allegro" required/></p>
<?php }?>
<button id="realizuuj" class="bt btn-next loading2 active" style="
position: relative;
top: -15px;border:0px"/>Potwierdzam i zamawiam</button>
</form>
</div></div>
</body>
</html>