Skip to content
Snippets Groups Projects
Commit 3f8e726b authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '162-add-to-watch-list-als-preis-bei-ebay-produktsuche' into 'development'

Resolve ""Add to watch list" als Preis bei Ebay Produktsuche"

Closes #162

See merge request !263
parents 385555c3 6711ae16
No related branches found
No related tags found
2 merge requests!265Development,!263Resolve ""Add to watch list" als Preis bei Ebay Produktsuche"
...@@ -349,7 +349,7 @@ class MetaGer ...@@ -349,7 +349,7 @@ class MetaGer
{ {
# Hier ist ein Advertiser: # Hier ist ein Advertiser:
# Das Logo hinzufügen: # Das Logo hinzufügen:
$result->image = "https://img.smartredirect.de/logos_v2/120x60/" . $hash . ".gif"; $result->logo = "https://img.smartredirect.de/logos_v2/60x30/" . $hash . ".gif";
# Den Link hinzufügen: # Den Link hinzufügen:
$publicKey = $publicKey; $publicKey = $publicKey;
$targetUrl = $result->anzeigeLink; $targetUrl = $result->anzeigeLink;
...@@ -748,11 +748,6 @@ class MetaGer ...@@ -748,11 +748,6 @@ class MetaGer
} }
$request->replace($newInput); $request->replace($newInput);
} }
if( $request->has('ebay') )
{
$this->time = 2000;
$this->warnings[] = "Hinweis: Sie haben Ebay aktiviert. Die Suche kann deshalb länger dauern und die maximale Suchzeit wurde auf 2 Sekunden hochgesetzt.";
}
if( App::isLocale("en") ) if( App::isLocale("en") )
{ {
$this->sprueche = "off"; $this->sprueche = "off";
......
...@@ -7,12 +7,12 @@ namespace App\Models; ...@@ -7,12 +7,12 @@ namespace App\Models;
class Result class Result
{ {
function __construct ( \SimpleXMLElement $provider, $titel, $link, $anzeigeLink , $descr, $gefVon, $sourceRank, $partnershop = false, $image = "" ) function __construct ( \SimpleXMLElement $provider, $titel, $link, $anzeigeLink , $descr, $gefVon, $sourceRank, $partnershop = false, $image = "", $price = 0 )
{ {
$this->titel = strip_tags(trim($titel)); $this->titel = strip_tags(trim($titel));
$this->link = trim($link); $this->link = trim($link);
$this->anzeigeLink = trim($anzeigeLink); $this->anzeigeLink = trim($anzeigeLink);
$this->descr = strip_tags(trim($descr)); $this->descr = strip_tags(trim($descr), '<p>');
$this->descr = preg_replace("/\n+/si", " ", $this->descr); $this->descr = preg_replace("/\n+/si", " ", $this->descr);
if( strlen($this->descr) > 250 ) if( strlen($this->descr) > 250 )
{ {
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace app\Models\parserSkripte; namespace app\Models\parserSkripte;
use App\Models\Searchengine; use App\Models\Searchengine;
use DateTimeZone;
use DateTime;
class Ebay extends Searchengine class Ebay extends Searchengine
{ {
...@@ -24,16 +26,26 @@ class Ebay extends Searchengine ...@@ -24,16 +26,26 @@ class Ebay extends Searchengine
{ {
return; return;
} }
$results = $content->xpath('//rss/channel/item'); $results = $content;
$results = $results->{"searchResult"};
$count = 0; $count = 0;
foreach($results as $result) foreach($results->{"item"} as $result)
{ {
if($count > 10)
break;
$title = $result->{"title"}->__toString(); $title = $result->{"title"}->__toString();
$link = $result->{"link"}->__toString(); $link = $result->{"viewItemURL"}->__toString();
$anzeigeLink = $link; $anzeigeLink = $link;
$descr = strip_tags($result->{"description"}->__toString()); $time = $result->{"listingInfo"}->{"endTime"}->__toString();
$time = date(DATE_RFC2822, strtotime($time));
$price = intval($result->{"sellingStatus"}->{"convertedCurrentPrice"}->__toString()) * 100;
$descr = "<p>Preis: " . $result->{"sellingStatus"}->{"convertedCurrentPrice"}->__toString() . " €</p>";
$descr .= "<p>Versandkosten: " . $result->{"shippingInfo"}->{"shippingServiceCost"}->__toString() . " €</p>";
if( isset($result->{"listingInfo"}->{"listingType"}))
$descr .= "<p>Auktionsart: " . $result->{"listingInfo"}->{"listingType"}->__toString() . "</p>";
$descr .= "<p>Auktionsende: " . $time . "</p>";
if( isset($result->{"primaryCategory"}->{"categoryName"}))
$descr .= "<p class=\"text-muted\">Kategorie: " . $result->{"primaryCategory"}->{"categoryName"}->__toString() . "</p>";
$image = $result->{"galleryURL"}->__toString();
$this->counter++; $this->counter++;
$this->results[] = new \App\Models\Result( $this->results[] = new \App\Models\Result(
$this->engine, $this->engine,
...@@ -42,7 +54,10 @@ class Ebay extends Searchengine ...@@ -42,7 +54,10 @@ class Ebay extends Searchengine
$anzeigeLink, $anzeigeLink,
$descr, $descr,
$this->gefVon, $this->gefVon,
$this->counter $this->counter,
false,
$image,
$price
); );
$count++; $count++;
......
...@@ -39,11 +39,12 @@ class Exalead extends Searchengine ...@@ -39,11 +39,12 @@ class Exalead extends Searchengine
} }
$results->registerXPathNamespace($prefix,$namespace); $results->registerXPathNamespace($prefix,$namespace);
try{ try{
$results = $results->xpath("//a:hits/a:Hit"); $results = $results->xpath("//a:searchResult/a:item");
} catch(\ErrorException $e) } catch(\ErrorException $e)
{ {
return; return;
} }
die(var_dump($results));
foreach($results as $result) foreach($results as $result)
{ {
try{ try{
......
...@@ -23,10 +23,12 @@ class Fairmondo extends Searchengine ...@@ -23,10 +23,12 @@ class Fairmondo extends Searchengine
$title = $result["title"]; $title = $result["title"];
$link = "https://www.fairmondo.de/articles/" . $result["id"]; $link = "https://www.fairmondo.de/articles/" . $result["id"];
$anzeigeLink = $link; $anzeigeLink = $link;
$descr = $result["slug"]; $price = 0;
$descr = "";
if( isset($result['price_cents'])) if( isset($result['price_cents']))
{ {
$descr .= " | Preis: " . (intval($result['price_cents']) / 100.0) . " €"; $price = intval($result['price_cents']);
$descr .= "<p>Preis: " . (intval($result['price_cents']) / 100.0) . " €</p>";
} }
if( isset($result['title_image_url']) ) if( isset($result['title_image_url']) )
{ {
...@@ -43,7 +45,8 @@ class Fairmondo extends Searchengine ...@@ -43,7 +45,8 @@ class Fairmondo extends Searchengine
$this->gefVon, $this->gefVon,
$this->counter, $this->counter,
false, false,
$image $image,
$price
); );
} }
} }
......
...@@ -327,6 +327,11 @@ a:hover ...@@ -327,6 +327,11 @@ a:hover
clear: both; clear: both;
} }
.result .description p {
margin: 0;
margin-bottom: 4px;
}
.result .description img { .result .description img {
margin:5px; margin:5px;
margin-left:0; margin-left:0;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
{{ $result->number }}) {{ $result->number }})
</div> </div>
<div class="resultInformation col-xs-12 col-sm-11"> <div class="resultInformation col-xs-12 col-sm-11">
<div class="col-xs-10 col-sm-11" style="padding:0; ">
<p class="title"> <p class="title">
<a class="title" href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ strip_tags($result->gefVon) }}" data-count="{{ $result->number }}"> <a class="title" href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ strip_tags($result->gefVon) }}" data-count="{{ $result->number }}">
{{ $result->titel }} {{ $result->titel }}
...@@ -58,12 +59,20 @@ ...@@ -58,12 +59,20 @@
anonym öffnen anonym öffnen
</a> </a>
</div> </div>
</div>
@if( isset($result->logo) )
<div class="col-xs-2 col-sm-1" style="padding: 0;">
<a href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ strip_tags($result->gefVon) }}" data-count="{{ $result->number }}">
<img src="{{ $metager->getImageProxyLink($result->logo) }}" alt="" />
</a>
</div>
@endif
@if( $result->image !== "" ) @if( $result->image !== "" )
<div class="description"> <div class="description">
<a href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ strip_tags($result->gefVon) }}" data-count="{{ $result->number }}"> <a href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ strip_tags($result->gefVon) }}" data-count="{{ $result->number }}">
<img src="{{ $metager->getImageProxyLink($result->image) }}" align="left" width="120px" height="60px" alt="" /> <img src="{{ $metager->getImageProxyLink($result->image) }}" align="left" width="120px" height="60px" alt="" />
</a> </a>
{{ $result->descr }} {!! $result->descr !!}
</div> </div>
@else @else
<div class="description">{{ $result->descr }}</div> <div class="description">{{ $result->descr }}</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment