add shipping information

This commit is contained in:
Jonas Leder 2022-02-03 10:17:39 +01:00
parent 5fbd725f6c
commit 0eb8e4d22d
No known key found for this signature in database
GPG key ID: CC3C488E27DFF5CA
2 changed files with 13 additions and 1 deletions

View file

@ -19,6 +19,11 @@ class sellingTable extends HTMLElement {
"fieldName": "price",
"displayType": "text"
},
{
"title": "Versand",
"fieldName": "shipping",
"displayType": "text"
},
{
"title": "Link",
"fieldName": "link",

View file

@ -24,9 +24,16 @@ $ads = $response["{http://www.ebayclassifiedsgroup.com/schema/ad/v1}ads"]["value
foreach($ads as $ad) {
$element = [
"title" => $ad["title"]["value"],
"price" => $ad["price"]["amount"]["value"] . ""
"price" => $ad["price"]["amount"]["value"] . "",
"shipping" => "nein"
];
foreach($ad["attributes"]["attribute"] as $attribute) {
if(str_contains($attribute["name"], "versand")) {
$element["shipping"] = $attribute["value"][0]["value"];
}
}
foreach($ad["link"] as $link) {
if($link["rel"] == "self-public-website") {
$element["link"] = $link["href"];