session_start();
unset($_SESSION['deeplink']);
unset($_SESSION['artikel_img']);
unset($_SESSION['shopurl']);
unset($_SESSION['shoplogo']);
include("config1.inc.php");
include("functions1.inc.php");
function getDetail($ProductID,$i=999) {
define ("WSDL_LOGON", "http://api.affili.net/V2.0/Logon.svc?wsdl");
define ("WSDL_PROD", "http://api.affili.net/V2.0/ProductServices.svc?wsdl");
$Username = $GLOBALS['PartnerID'];
$Password = $GLOBALS['Password'];
$SOAP_LOGON = new SoapClient(WSDL_LOGON);
$Token = $SOAP_LOGON->Logon(array(
'Username' => $Username,
'Password' => $Password,
'WebServiceType' => 'Product'
));
$params = array(
'ProductId' => "$ProductID"
);
/* */
$SOAP_REQUEST = new SoapClient(WSDL_PROD);
$Result = $SOAP_REQUEST->GetProductDetail(array(
'CredentialToken' => $Token,
'GetProductDetailRequestMessage' => $params
));
//print_r($Result);
$details[ID]=$Result->Products->Product->Id;
$details[ArtNr]=$Result->Products->Product->ArticleNumber;
$details[Titel]=$Result->Products->Product->Title;
$details[Preis]=$Result->Products->Product->DisplayPrice;
if (!$details[Preis]) $details[Preis]=$Result->Products->Product->Price;
$details[VK]=$Result->Products->Product->DisplayShipping;
if (!$details[VK]) $details[VK]=$Result->Products->Product->Shipping;
if (!$details[VK]) $details[VK]=$Result->Products->Product->PriceSuffix;
$details[Preis]=preg_replace("/http:.*/","",$details[Preis]);
$details[VK]=preg_replace("/http:.*/","",$details[VK]);
$details[Deeplink]=$Result->Products->Product->DeepLink1;
$details[Deeplink2]=$Result->Products->Product->DeepLink2;
$details[KW]=$Result->Products->Product->Keywords;
$details[ShopName]=$Result->Products->Product->ShopInformation->ShopName;
if (!$details[ShopName]) $details[ShopName]=$Result->Products->Product->ShopInformation->ShopListName;
$details[ShopLogo]=$Result->Products->Product->ShopInformation->Logo50->ImageUrl;
$details[ShopLogo90]=$Result->Products->Product->ShopInformation->Logo90->ImageUrl;
$details[ShopLogo120]=$Result->Products->Product->ShopInformation->Logo120->ImageUrl;
$details[ShopLogo150]=$Result->Products->Product->ShopInformation->Logo150->ImageUrl;
$details[ShopLogo468]=$Result->Products->Product->ShopInformation->Logo468->ImageUrl;
$details[ShopUrl]=$Result->Products->Product->ShopInformation->ShopUrl;
$details[Rank]=$Result->Products->Product->Rank;
$details[BeschreibungKurz]=$Result->Products->Product->DescriptionShort;
$details[Beschreibung]=$Result->Products->Product->Description;
$details[MerchCatID]=$Result->Products->Product->MerchantCategoryId;
$details[PreisAlt]=$Result->Products->Product->Price_Old;
$details[Waehrung]=$Result->Products->Product->Currency_Symbol;
$details[Hersteller]=$Result->Products->Product->Manufacturer;
$details[Distributor]=$Result->Products->Product->Distributor;
$details[Marke]=$Result->Products->Product->Brand;
$details[EAN]=$Result->Products->Product->EAN;
$details[KategoriePfad]=$Result->Products->Product->CategoryPath;
$details[Image]=$Result->Products->Product->Image->ImageUrl;
$details[Image30]=$Result->Products->Product->Image30->ImageUrl;
$details[Image60]=$Result->Products->Product->Image60->ImageUrl;
$details[Image90]=$Result->Products->Product->Image90->ImageUrl;
$details[Image120]=$Result->Products->Product->Image120->ImageUrl;
$details[Image180]=$Result->Products->Product->Image180->ImageUrl;
if (!$details[Waehrung]) $details[Waehrung]="EUR";
$_SESSION['deeplink'][$i]=$details[Deeplink];
$_SESSION['artikel_img'][$i]=$details[Image180];
$_SESSION['shopurl'][$i]=$details[ShopUrl];
$_SESSION['shoplogo'][$i]=$details[ShopLogo];
return $details;
}
function searchProducts($shop_arr,$Keywords,$Page,$MinPrice,$MaxPrice) {
define ("WSDL_LOGON", "http://api.affili.net/V2.0/Logon.svc?wsdl");
define ("WSDL_PROD", "http://api.affili.net/V2.0/ProductServices.svc?wsdl");
$Username = $GLOBALS['PartnerID'];
$Password = $GLOBALS['Password'];
$SOAP_LOGON = new SoapClient(WSDL_LOGON);
$Token = $SOAP_LOGON->Logon(array(
'Username' => $Username,
'Password' => $Password,
'WebServiceType' => 'Product'
));
$params = array(
'ShopIds' => $shop_arr,
'Query' => "$Keywords",
'WithImageOnly' => true,
'Details' => 'true',
'ImageSize' => 'AllImages',
'CurrentPage' => $Page,
'PageSize' => '15',
'MinimumPrice' => $MinPrice,
'MaximumPrice' => $MaxPrice,
'SortBy' => 'Rank',
'SortOrder' => 'Descending'
);
$SOAP_REQUEST = new SoapClient(WSDL_PROD);
$Result = $SOAP_REQUEST->SearchProducts(array(
'CredentialToken' => $Token,
'SearchProductsRequestMessage' => $params
));
$total=$Result->TotalRecords;
$treffer=$Result->Records;
//print_r($Result);
for ($i=0; $i < $treffer; $i++) {
$artikelliste['total'][$i]=$total;
$artikelliste['treffer'][$i]=$treffer;
if ($treffer==1) {
$artikelliste[ID][$i]=$Result->Products->Product->Id;
$artikelliste[ArtNr][$i]=$Result->Products->Product->ArticleNumber;
$artikelliste[Titel][$i]=$Result->Products->Product->Title;
$artikelliste[Preis][$i]=$Result->Products->Product->DisplayPrice;
if (!$artikelliste[Preis][$i]) $artikelliste[Preis][$i]=$Result->Products->Product->Price;
$artikelliste[VK][$i]=$Result->Products->Product->DisplayShipping;
if (!$artikelliste[VK][$i]) $artikelliste[VK][$i]=$Result->Products->Product->Shipping;
if (!$artikelliste[VK][$i]) $artikelliste[VK][$i]=$Result->Products->Product->PriceSuffix;
$artikelliste[Preis][$i]=preg_replace("/http:.*/","",$artikelliste[Preis][$i]);
$artikelliste[VK][$i]=preg_replace("/http:.*/","",$artikelliste[VK][$i]);
$Deeplink=$Result->Products->Product->DeepLink1;
$artikelliste[BeschreibungKurz][$i]=$Result->Products->Product->DescriptionShort;
$artikelliste[Beschreibung][$i]=$Result->Products->Product->Description;
$artikelliste[PreisAlt][$i]=$Result->Products->Product->Price_Old;
$artikelliste[Waehrung][$i]=$Result->Products->Product->Currency_Symbol;
$Image30=$Result->Products->Product->Image30->ImageUrl;
}
else {
$artikelliste[ID][$i]=$Result->Products->Product[$i]->Id;
$artikelliste[ArtNr][$i]=$Result->Products->Product[$i]->ArticleNumber;
$artikelliste[Titel][$i]=$Result->Products->Product[$i]->Title;
$artikelliste[Preis][$i]=$Result->Products->Product[$i]->DisplayPrice;
if (!$artikelliste[Preis][$i]) $artikelliste[Preis][$i]=$Result->Products->Product[$i]->Price;
$artikelliste[VK][$i]=$Result->Products->Product[$i]->DisplayShipping;
if (!$artikelliste[VK][$i]) $artikelliste[VK][$i]=$Result->Products->Product[$i]->Shipping;
if (!$artikelliste[VK][$i]) $artikelliste[VK][$i]=$Result->Products->Product[$i]->PriceSuffix;
$artikelliste[Preis][$i]=preg_replace("/http:.*/","",$artikelliste[Preis][$i]);
$artikelliste[VK][$i]=preg_replace("/http:.*/","",$artikelliste[VK][$i]);
$Deeplink=$Result->Products->Product[$i]->DeepLink1;
$artikelliste[BeschreibungKurz][$i]=$Result->Products->Product[$i]->DescriptionShort;
$artikelliste[Beschreibung][$i]=$Result->Products->Product[$i]->Description;
$artikelliste[PreisAlt][$i]=$Result->Products->Product[$i]->Price_Old;
$artikelliste[Waehrung][$i]=$Result->Products->Product[$i]->Currency_Symbol;
$Image30=$Result->Products->Product[$i]->Image30->ImageUrl;
}
if (!$artikelliste[Waehrung][$i]) $artikelliste[Waehrung][$i]="EUR";
$_SESSION['deeplink'][$i]=$Deeplink;
$_SESSION['artikel_img'][$i]=$Image30;
}
return $artikelliste;
}
function getProducts($pids) {
//$pids[]="154900042";
//$pids[]="197160773";
//$pids[]="192408423";
define ("WSDL_LOGON", "http://api.affili.net/V2.0/Logon.svc?wsdl");
define ("WSDL_PROD", "http://api.affili.net/V2.0/ProductServices.svc?wsdl");
$Username = $GLOBALS['PartnerID'];
$Password = $GLOBALS['Password'];
$SOAP_LOGON = new SoapClient(WSDL_LOGON);
$Token = $SOAP_LOGON->Logon(array(
'Username' => $Username,
'Password' => $Password,
'WebServiceType' => 'Product'
));
$params = array(
'ProductIds' => $pids,
'Details' => false,
'ImageSize' => 'NoImage',
'CurrentPage' => '1',
'PageSize' => '10',
'SortBy' => 'Rank',
'SortOrder' => 'Descending'
);
$SOAP_REQUEST = new SoapClient(WSDL_PROD);
$Result = $SOAP_REQUEST->GetProducts(array(
'CredentialToken' => $Token,
'GetProductsRequestMessage' => $params
));
$total=$Result->TotalRecords;
$treffer=$Result->Records;
for ($i=0; $i < $treffer; $i++) {
if ($treffer==1) {
$ID=$Result->Products->Product->Id;
$ArtNr=$Result->Products->Product->ArticleNumber;
$Titel=$Result->Products->Product->Title;
$Preis=$Result->Products->Product->Price;
$VK=$Result->Products->Product->Shipping;
if (!$VK) $VK=$Result->Products->Product->PriceSuffix;
$BeschreibungKurz=$Result->Products->Product->DescriptionShort;
$Beschreibung=$Result->Products->Product->Description;
$PreisAlt=$Result->Products->Product->Price_Old;
$Waehrung=$Result->Products->Product->Currency_Symbol;
$KategoriePfad=$Result->Products->Product->CategoryPath;
}
else {
$ID=$Result->Products->Product[$i]->Id;
$ArtNr=$Result->Products->Product[$i]->ArticleNumber;
$Titel=$Result->Products->Product[$i]->Title;
$Preis=$Result->Products->Product[$i]->Price;
$VK=$Result->Products->Product[$i]->Shipping;
if (!$VK) $VK=$Result->Products->Product[$i]->PriceSuffix;
$KW=$Result->Products->Product[$i]->Keywords;
$PreisAlt=$Result->Products->Product[$i]->Price_Old;
$Waehrung=$Result->Products->Product[$i]->Currency_Symbol;
$KategoriePfad=$Result->Products->Product[$i]->CategoryPath;
}
if (!$Waehrung) $Waehrung="EUR";
echo "ArtNr: $ArtNr ";
echo " $Titel
";
}
}
if (!$_GET) {
include("head1.inc.php");
include("suchen1.php");
exit;
}
$action=$_GET['action'];
$ShopId=$_GET['ShopId'];
$CatId=$_GET['CatId'];
$CatTitle=$_GET['CatTitle'];
$PageSize=$_GET['PageSize'];
$Page=$_GET['Page'];
if ($Page > 50) $Page=1;
$MinPrice=$_GET['PriceMin'];
$MaxPrice=$_GET['PriceMax'];
if (!$Page) $Page=1;
if (!$MinPrice) $MinPrice=0;
if (!$MaxPrice) $MaxPrice=0;
//alle Shops:
$shop_arr=array('0');
if (is_file("temp/shoplist")) $shop_arr=explode(",",file_get_contents("temp/shoplist"));
//print_r($shop_arr);
//nur 239 (alphamusic)
if ($ShopId)
$shop_arr=array($ShopId);
//$shop_arr=array('681');
// 239 u 240
//$shop_arr=array('239','240');
$CategoryID=$_GET['CategoryID'];
$ProductID=$_GET['ProductID'];
$Products=$_GET['Products'];
$ShowDetail=$_GET['ShowDetail'];
$ImageSize=$_GET['ImageSize'];
$UseAffilinetCategories=$_GET['UseAffilinetCategories'];
$PageSize=$_GET['PageSize'];
$OrderBy=$_GET['OrderBy'];
$OrderDirection=$_GET['OrderDirection'];
$IncludeChildNodes=$_GET['IncludeChildNodes'];
$Keywords=$_GET['Keywords'];
$WithImgOnly=$_GET['WithImgOnly'];
//$Keywords=preg_replace("/ue/","Ã",$Keywords);
//$umlaute = Array("/ä/","/ö/","/ü/");
//$replace = Array("ae","oe","ue");
//$Keywords = preg_replace($replace, $umlaute, $Keywords);
$Keywords=str_replace("ue","ü",$Keywords);
$Keywords=str_replace("oe","ö",$Keywords);
$Keywords=str_replace("ae","ä",$Keywords);
$Keywords=str_replace("_","+",$Keywords);
//$Keywords="Winnie+Pooh";
////////////////////////////////////////////////////////////////////////
// V2
////////////////////////////////////////////////////////////////////////
define ("WSDL_LOGON", "http://api.affili.net/V2.0/Logon.svc?wsdl");
define ("WSDL_PROD", "http://api.affili.net/V2.0/ProductServices.svc?wsdl");
$Username = $PartnerID;
$SOAP_LOGON = new SoapClient(WSDL_LOGON);
$Token = $SOAP_LOGON->Logon(array(
'Username' => $Username,
'Password' => $Password,
'WebServiceType' => 'Product'
));
$SOAP_REQUEST = new SoapClient(WSDL_PROD);
////////////////////////////////////////////////////////////////////////
// V2
////////////////////////////////////////////////////////////////////////
if($action=='getShopList')
{
$SOAP_REQUEST = new SoapClient(WSDL_PROD);
$Result = $SOAP_REQUEST->GetShopList(array(
'CredentialToken' => $Token
));
//print_r($Result);
$totalProducts=$Result->TotalProducts;
$treffer=$Result->Records;
include("head1.inc.php");
echo "Shops:$treffer
";
echo "Produkte:$totalProducts
";
echo "";
for ($i=0; $i < $treffer; $i++) {
$ShopName=$Result->Shops->Shop[$i]->Title;
$ShopId=$Result->Shops->Shop[$i]->ShopId;
$Products=$Result->Shops->Shop[$i]->Products;
$LastUpdate=$Result->Shops->Shop[$i]->LastUpdate;
echo "";
echo "$ShopId | ";
echo "$ShopName | ";
echo "$Products | ";
echo "$LastUpdate | ";
echo "
";
}
echo "
";
}
if($action=='getCategoryList')
{
$params = array('ShopId' => $ShopId);
$SOAP_REQUEST = new SoapClient(WSDL_PROD);
$Result = $SOAP_REQUEST->GetCategoryList(array(
'CredentialToken' => $Token,
'GetCategoryListRequestMessage' => $params
));
//print_r($Result);
$treffer=$Result->CategoryResult->Records;
$Prog=$Result->CategoryResult->ProgramTitle;
include("head1.inc.php");
echo "Records:$treffer
";
echo "Programm:$Prog
";
echo "";
for ($i=0; $i < $treffer; $i++) {
$CategoryId=$Result->CategoryResult->Categories->Category[$i]->CategoryId;
$ParentCategoryId=$Result->CategoryResult->Categories->Category[$i]->ParentCategoryId;
$CategoryTitle=$Result->CategoryResult->Categories->Category[$i]->Title;
$CategoryPath=$Result->CategoryResult->Categories->Category[$i]->CategoryPath;
$Products=$Result->CategoryResult->Categories->Category[$i]->Products;
if ($ParentCategoryId==0) {
echo "";
//echo "$CategoryId | ";
//echo "$CategoryId | ";
echo "$CategoryId | ";
echo "$CategoryTitle | ";
echo "$CategoryPath | ";
echo "$Products | ";
echo "
";
}
}
echo "
";
}
if($action=='searchProducts')
{
$artikelliste=searchProducts($shop_arr,$Keywords,$Page,$MinPrice,$MaxPrice);
if (!is_array($artikelliste)) {
$ergebnis_hinweis="'".$Keywords."' nicht gefunden";
$expl=explode("+",$Keywords);
$Keywords=$expl[0] . "+".$expl[1];
$artikelliste=searchProducts($shop_arr,$Keywords,$Page,$MinPrice,$MaxPrice);
}
//Kein Treffer
if (!$artikelliste['total'][0]) {
$ergebnis_hinweis="'".$Keywords."' nicht gefunden";
$Keywords=date("Y");
if ($alternateKeyword) $Keywords=$alternateKeyword;
$artikelliste=searchProducts($shop_arr,$Keywords,$Page,$MinPrice,$MaxPrice);
}
$total=$artikelliste['total'][0];
$treffer=$artikelliste['treffer'][0];
if (!$total) $total=0;
$title="$Keywords Münzen und Briefmarken";
include("head1.inc.php");
include("suchen1.php");
if (!$ergebnis_hinweis) echo " '".$Keywords."' gefunden: ".$total."
";
else echo " " .$ergebnis_hinweis . ", aber z.B. '".$Keywords."': $total
";
if ($treffer) {
include("seiten1.inc.php");
include("artikelliste.inc.php");
}
}
if($action=='getProductDetail')
{
$details=getDetail($ProductID,'999');
$title="$details[Titel] - $Titelzusatz";
$meta_keywords="";
$meta_description="";
include("head1.inc.php");
include("suchen1.php");
//Head Details
include("artikeldetail.inc.php");
}
include("footer.tpl");
?>