Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/admin/classes/index2.php |
<?php
define('ALLEGRO_ID', 'identyfikator');
define('ALLEGRO_LOGIN', 'manyak2');
define('ALLEGRO_PASSWORD', '0ibVUYyNIJBVQNd');
define('ALLEGRO_KEY', 'cfa9134df4');
define('ALLEGRO_COUNTRY', 1);
include('../config.php');
require_once 'class.allegrowebapi.php';
require_once 'Admin.php';
require '../../class.phpmailer.php';
$kampanie = new Kampanie();
try {
$allegro = new AllegroWebAPI();
$allegro->Login();
$obj = new Admin();
//Sprawdza płatnoci uzytkownika po id kupujacego
$wplaty = $allegro->objectToArray($allegro->GetMyIncomingPayments($Options)); //tablica z informacjami o płatnosci
$prz = $allegro->objectToArray($allegro->GetShipmentData());
for($i=0;$i<50;$i++){
$przesylka[$prz['shipment-data-list'][$i]['shipment-id']] = $prz['shipment-data-list'][$i]['shipment-name'];
}
/*echo "<pre>";
print_r();
echo "</pre>";)*/
for($i=0;$i<25;$i++){
$text = $allegro->objectToArray($allegro->GetPostBuyFormsDataForSellers(array($wplaty[$i]['pay-trans-id'])));
/*
echo "<pre>";
print_r($wplaty[$i]);
echo "</pre>";
echo "<pre>";
print_r($text[0]);
echo "</pre>
#########";*/
if($text[0]['post-buy-form-msg-to-seller'] != '') $infoseller = "Informacja od sprzedającego: ".$text[0]['post-buy-form-msg-to-seller']."\n###\n";
else $infoseller = '';
$dane['imie'] = $text[0]['post-buy-form-shipment-address']['post-buy-form-adr-full-name'];
$dane['email'] = $text[0]['post-buy-form-buyer-email'];
$dane['tel'] = $text[0]['post-buy-form-shipment-address']['post-buy-form-adr-phone'];
$dane['nick'] = $text[0]['post-buy-form-buyer-login'];
$dane['adres'] = $text[0]['post-buy-form-shipment-address']['post-buy-form-adr-street'].'<br>'.$text[0]['post-buy-form-shipment-address']['post-buy-form-adr-postcode']." ".$text[0]['post-buy-form-shipment-address']['post-buy-form-adr-city']."<br>Dostawa: ".$przesylka[$text[0]['post-buy-form-shipment-id']];
$dane['rodzaj'] = $text[0]['post-buy-form-items'][0]['post-buy-form-it-title'];
$dane['cokupil'] = $wplaty[$i]['pay-trans-count']." szt.";
$dane['info'] = $infoseller."Opłacono kwotę ".$wplaty[$i]['pay-trans-amount']." PLN ".Date('Y-m-d H:i:s',$wplaty[$i]['pay-trans-recv-date'])."\nIlość opłaconych: ".$wplaty[$i]['pay-trans-count']." szt. (kompletów)";
$dane['wiadodsprzed']=$infoseller;
$dane['aukcjaid'] = $wplaty[$i]['pay-trans-it-id'];
$dane['platnoscid'] = $wplaty[$i]['pay-trans-id'];
$dane['status'] = 1;
//print_r($dane);
if($obj->DodajDoBazy($dane)){
$mail = new PHPMailer;
$mail->addAddress($dane['email'],$dane['email']);
$mail->setFrom('kontakt@fotomagnesy.pl','FotoMagnesy | Obsługa');
$mail->isHTML(true); // Set email format to HTML
$mail->SetLanguage("pl", "classes/language/");
$mail->CharSet = "utf-8";
//:<br>'.$user['adres'].'
$kamp = $kampanie->pobierzdane('szablony',23);
$mail->Subject = $kamp['tytul'];
$mail->Body = $kamp['tresc'];
//print_r($mail);
//$mail->send();
unset($mail);
}
unset($dane);
unset($text);
}
}
catch(SoapFault $fault) {
print($fault->faultstring);
}
?>