-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathProduct.php
More file actions
69 lines (58 loc) · 1.52 KB
/
Product.php
File metadata and controls
69 lines (58 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
namespace BolCom;
class Product
{
private $id;
private $title;
private $price;
private $description;
private $thumbnailurl;
private $url;
private $offers;
private $offeridbolcom;
public function __construct($product = NULL)
{
if (!empty($product)) {
$this->id = (string)$product->id;
$this->title = (string)$product->title;
$this->price = (string)$product->offerData->offers[0]->price;
$this->description = (string)$product->shortDescription;
$this->thumbnailurl = (string)$product->images[1]->url;
$this->url = (string)$product->urls[0]->value;
$this->offers = (array)$product->offerData->offers;
}
}
public function getId()
{
return $this->id;
}
public function getTitle()
{
return $this->title;
}
public function getFirstAvailablePrice()
{
return $this->price;
}
public function getDescription()
{
return $this->description;
}
public function getThumbnailurl()
{
if ($this->thumbnailurl == "") {
// Use a default bol.com image
$sThumbnailurl = "https://s.s-bol.com/nl/static/images/main/noimage_124x100default.gif";
} else
$sThumbnailurl = $this->thumbnailurl;
return $sThumbnailurl;
}
public function getExternalurl()
{
return $this->url;
}
public function getOffers()
{
return $this->offers;
}
}