[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:
parent
68dd2d745f
commit
bb51a0d212
1 changed files with 23 additions and 8 deletions
|
@ -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'] .= "<br />\n<img src='https:" . $imgurl . "' />";
|
||||
}
|
||||
} else {
|
||||
$item['content'] .= "<br>\n<img src='https:" . $listing->imageUrls . "' />";
|
||||
$item['enclosures'] = $listing->imageUrls;
|
||||
if(is_array($listing->imageUrls)) {
|
||||
foreach($listing->imageUrls as $imgurl) {
|
||||
$item['content'] .= "<br />\n<img src='https:" . $imgurl . "' />";
|
||||
}
|
||||
} else {
|
||||
$item['content'] .= "<br>\n<img src='https:" . $listing->imageUrls . "' />";
|
||||
}
|
||||
}
|
||||
if(!is_null($this->getInput('r'))) {
|
||||
|
@ -105,8 +103,25 @@ class MarktplaatsBridge extends BridgeAbstract {
|
|||
$item['content'] .= "<br />\n<br />\n<br />\n" . json_encode($listing);
|
||||
}
|
||||
}
|
||||
$item['content'] .= "<br>\n<br>\nPrice: " . $listing->priceInfo->priceCents/100;
|
||||
$item['content'] .= " (" . $listing->priceInfo->priceType .")";
|
||||
if(!empty($listing->location->cityName)) {
|
||||
$item['content'] .= "<br><br>\n" . $listing->location->cityName;
|
||||
}
|
||||
if(!is_null($this->getInput('r'))) {
|
||||
if($this->getInput('r')) {
|
||||
$item['content'] .= "<br />\n<br />\n<br />\n" . json_encode($listing);
|
||||
}
|
||||
}
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('q'))) {
|
||||
return $this->getInput('q') . ' - Marktplaats';
|
||||
}
|
||||
return parent::getName();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue