From bb51a0d212fb978ae4a79e87d436f1b57e7c7c3e Mon Sep 17 00:00:00 2001 From: ggiessen Date: Thu, 3 Sep 2020 07:44:32 +0200 Subject: [PATCH] [MarktplaatsBridge] Improvements (#1722) - sometimes $listing->imageUrls is empty so moved after the if statement on line 91 - added price and location info - added function getName --- bridges/MarktplaatsBridge.php | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/bridges/MarktplaatsBridge.php b/bridges/MarktplaatsBridge.php index af6f28f5..d8fce6c4 100644 --- a/bridges/MarktplaatsBridge.php +++ b/bridges/MarktplaatsBridge.php @@ -86,18 +86,16 @@ class MarktplaatsBridge extends BridgeAbstract { $item['timestamp'] = $listing->date; $item['author'] = $listing->sellerInformation->sellerName; $item['content'] = $listing->description; - $item['enclosures'] = $listing->imageUrls; $item['categories'] = $listing->verticals; $item['uid'] = $listing->itemId; if(!is_null($this->getInput('i')) && !empty($listing->imageUrls)) { - if($this->getInput('i')) { - if(is_array($listing->imageUrls)) { - foreach($listing->imageUrls as $imgurl) { - $item['content'] .= "
\n"; - } - } else { - $item['content'] .= "
\n"; + $item['enclosures'] = $listing->imageUrls; + if(is_array($listing->imageUrls)) { + foreach($listing->imageUrls as $imgurl) { + $item['content'] .= "
\n"; } + } else { + $item['content'] .= "
\n"; } } if(!is_null($this->getInput('r'))) { @@ -105,8 +103,25 @@ class MarktplaatsBridge extends BridgeAbstract { $item['content'] .= "
\n
\n
\n" . json_encode($listing); } } + $item['content'] .= "
\n
\nPrice: " . $listing->priceInfo->priceCents/100; + $item['content'] .= "  (" . $listing->priceInfo->priceType .")"; + if(!empty($listing->location->cityName)) { + $item['content'] .= "

\n" . $listing->location->cityName; + } + if(!is_null($this->getInput('r'))) { + if($this->getInput('r')) { + $item['content'] .= "
\n
\n
\n" . json_encode($listing); + } + } $this->items[] = $item; } } } + + public function getName(){ + if(!is_null($this->getInput('q'))) { + return $this->getInput('q') . ' - Marktplaats'; + } + return parent::getName(); + } }