[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
This commit is contained in:
ggiessen 2020-09-03 07:44:32 +02:00 committed by GitHub
parent 68dd2d745f
commit bb51a0d212
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,11 +86,10 @@ class MarktplaatsBridge extends BridgeAbstract {
$item['timestamp'] = $listing->date; $item['timestamp'] = $listing->date;
$item['author'] = $listing->sellerInformation->sellerName; $item['author'] = $listing->sellerInformation->sellerName;
$item['content'] = $listing->description; $item['content'] = $listing->description;
$item['enclosures'] = $listing->imageUrls;
$item['categories'] = $listing->verticals; $item['categories'] = $listing->verticals;
$item['uid'] = $listing->itemId; $item['uid'] = $listing->itemId;
if(!is_null($this->getInput('i')) && !empty($listing->imageUrls)) { if(!is_null($this->getInput('i')) && !empty($listing->imageUrls)) {
if($this->getInput('i')) { $item['enclosures'] = $listing->imageUrls;
if(is_array($listing->imageUrls)) { if(is_array($listing->imageUrls)) {
foreach($listing->imageUrls as $imgurl) { foreach($listing->imageUrls as $imgurl) {
$item['content'] .= "<br />\n<img src='https:" . $imgurl . "' />"; $item['content'] .= "<br />\n<img src='https:" . $imgurl . "' />";
@ -99,6 +98,15 @@ class MarktplaatsBridge extends BridgeAbstract {
$item['content'] .= "<br>\n<img src='https:" . $listing->imageUrls . "' />"; $item['content'] .= "<br>\n<img src='https:" . $listing->imageUrls . "' />";
} }
} }
if(!is_null($this->getInput('r'))) {
if($this->getInput('r')) {
$item['content'] .= "<br />\n<br />\n<br />\n" . json_encode($listing);
}
}
$item['content'] .= "<br>\n<br>\nPrice: " . $listing->priceInfo->priceCents/100;
$item['content'] .= "&nbsp;&nbsp;(" . $listing->priceInfo->priceType .")";
if(!empty($listing->location->cityName)) {
$item['content'] .= "<br><br>\n" . $listing->location->cityName;
} }
if(!is_null($this->getInput('r'))) { if(!is_null($this->getInput('r'))) {
if($this->getInput('r')) { if($this->getInput('r')) {
@ -109,4 +117,11 @@ class MarktplaatsBridge extends BridgeAbstract {
} }
} }
} }
public function getName(){
if(!is_null($this->getInput('q'))) {
return $this->getInput('q') . ' - Marktplaats';
}
return parent::getName();
}
} }