1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Magium\Magento\Extractors\Catalog\Products; |
4
|
|
|
|
5
|
|
|
use Facebook\WebDriver\WebDriverElement; |
6
|
|
|
|
7
|
|
|
class ProductSummary |
8
|
|
|
{ |
9
|
|
|
const TITLE = 'title'; |
10
|
|
|
const PRICE = 'price'; |
11
|
|
|
const LINK = 'link'; |
12
|
|
|
const IMAGE = 'image'; |
13
|
|
|
const ORIGINAL_PRICE = 'original_price'; |
14
|
|
|
const WISHLIST_LINK = 'wishlist_link'; |
15
|
|
|
const COMPARE_LINK = 'compare_link'; |
16
|
|
|
const DESCRIPTION = 'description'; |
17
|
|
|
const ADD_TO_CART_LINK = 'add-to-cart'; |
18
|
|
|
|
19
|
|
|
protected $attributes = [ |
20
|
|
|
self::TITLE => null, |
21
|
|
|
self::PRICE => null, |
22
|
|
|
self::LINK => null, |
23
|
|
|
self::IMAGE => null, |
24
|
|
|
self::ORIGINAL_PRICE => null, |
25
|
|
|
self::WISHLIST_LINK => null, |
26
|
|
|
self::COMPARE_LINK => null, |
27
|
|
|
self::DESCRIPTION => null, |
28
|
|
|
self::ADD_TO_CART_LINK => null |
29
|
|
|
]; |
30
|
|
|
|
31
|
|
|
public function __construct( |
32
|
|
|
$title, |
33
|
|
|
$price, |
34
|
|
|
$link, |
35
|
|
|
$image, |
36
|
|
|
$originalPrice, |
37
|
|
|
WebDriverElement $wishlistLink = null, |
38
|
|
|
WebDriverElement $compareLink = null, |
39
|
|
|
$description = null, |
40
|
|
|
WebDriverElement $addToCartLink = null |
41
|
|
|
) |
42
|
|
|
{ |
43
|
|
|
$this->attributes[self::TITLE] = $title; |
44
|
|
|
$this->attributes[self::PRICE] = $price; |
45
|
|
|
$this->attributes[self::LINK] = $link; |
46
|
|
|
$this->attributes[self::IMAGE] = $image; |
47
|
|
|
$this->attributes[self::ORIGINAL_PRICE] = $originalPrice; |
48
|
|
|
$this->attributes[self::WISHLIST_LINK] = $wishlistLink; |
49
|
|
|
$this->attributes[self::COMPARE_LINK] = $compareLink; |
50
|
|
|
$this->attributes[self::DESCRIPTION] = $description; |
51
|
|
|
$this->attributes[self::ADD_TO_CART_LINK] = $addToCartLink; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function get($attribute) |
55
|
|
|
{ |
56
|
|
|
if (isset($this->attributes[$attribute])) { |
57
|
|
|
return $this->attributes[$attribute]; |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
public function getDescription() |
63
|
|
|
{ |
64
|
|
|
return $this->get(self::DESCRIPTION); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
public function getAddToCartElement() |
69
|
|
|
{ |
70
|
|
|
return $this->get(self::ADD_TO_CART_LINK); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getPrice() |
74
|
|
|
{ |
75
|
|
|
return $this->get(self::PRICE); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getTitle() |
79
|
|
|
{ |
80
|
|
|
return $this->get(self::TITLE); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getLink() |
84
|
|
|
{ |
85
|
|
|
return $this->get(self::LINK); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function getImage() |
89
|
|
|
{ |
90
|
|
|
return $this->get(self::IMAGE); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function getOriginalPrice() |
94
|
|
|
{ |
95
|
|
|
return $this->get(self::ORIGINAL_PRICE); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getWishlistLinkElement() |
99
|
|
|
{ |
100
|
|
|
return $this->get(self::WISHLIST_LINK); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function getCompareLinkElement() |
104
|
|
|
{ |
105
|
|
|
return $this->get(self::COMPARE_LINK); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
} |