Commit 4c2dce2f authored by Dominik Hebeler's avatar Dominik Hebeler

Fixed Error in product search

parent a1a98edf
...@@ -16,16 +16,19 @@ class ProdSearch extends Searchengine ...@@ -16,16 +16,19 @@ class ProdSearch extends Searchengine
public function loadResults($result) public function loadResults($result)
{ {
$results = json_decode($result, true); $results = json_decode($result, true);
if ($results === null) {
return;
}
foreach ($results as $result) { foreach ($results as $result) {
if ($this->counter >= 10) { if ($this->counter >= 10) {
break; break;
} }
$title = $result["title"]; $title = $result["title"];
$link = $result["product-link"]; $link = $result["product-link"];
$anzeigeLink = $link; $anzeigeLink = $link;
$price = 0; $price = 0;
$descr = ""; $descr = "";
if (isset($result['price_cents'])) { if (isset($result['price_cents'])) {
$price = intval($result['price_cents']); $price = intval($result['price_cents']);
$descr .= "<p>Preis: " . (intval($result['price_cents']) / 100.0) . " €</p>"; $descr .= "<p>Preis: " . (intval($result['price_cents']) / 100.0) . " €</p>";
...@@ -41,7 +44,7 @@ class ProdSearch extends Searchengine ...@@ -41,7 +44,7 @@ class ProdSearch extends Searchengine
$link, $link,
$anzeigeLink, $anzeigeLink,
$descr, $descr,
$this->engine->{"display-name"},$this->engine->homepage, $this->engine->{"display-name"}, $this->engine->homepage,
$this->counter, $this->counter,
[ [
'price' => $price, 'price' => $price,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment