1 <?php
2
3 /* --------------------------------------------------------------
4 ProductAttribute.inc.php 2016-01-07
5 Gambio GmbH
6 http://www.gambio.de
7 Copyright (c) 2015 Gambio GmbH
8 Released under the GNU General Public License (Version 2)
9 [http://www.gnu.org/licenses/gpl-2.0.html]
10 --------------------------------------------------------------
11 */
12
13 /**
14 * Class ProductAttribute
15 *
16 * @category System
17 * @package ProductModule
18 * @subpackage Entities
19 */
20 class ProductAttribute implements ProductAttributeInterface
21 {
22 /**
23 * @var int
24 */
25 protected $optionId = 0;
26
27 /**
28 * @var int
29 */
30 protected $optionValueId = 0;
31
32 /**
33 * @var float
34 */
35 protected $price = 0.0;
36
37 /**
38 * @var string
39 */
40 protected $priceType = '';
41
42 /**
43 * @var float
44 */
45 protected $weight = 0.0;
46
47 /**
48 * @var string
49 */
50 protected $weightType = '';
51
52 /**
53 * @var string
54 */
55 protected $attributeModel = '';
56
57 /**
58 * @var string
59 */
60 protected $attributeEan = '';
61
62 /**
63 * @var float
64 */
65 protected $stock = 0.0;
66
67 /**
68 * @var int
69 */
70 protected $sortOrder = 0;
71
72 /**
73 * @var int
74 */
75 protected $vpeId = 0;
76
77 /**
78 * @var float
79 */
80 protected $vpeValue = 0.0;
81
82
83 /**
84 * Initialize the product attribute.
85 *
86 * @param IdType $optionId Option id of product attribute.
87 * @param IdType $valueId Option value id of product attribute.
88 */
89 public function __construct(IdType $optionId, IdType $valueId)
90 {
91 $this->optionId = $optionId->asInt();
92 $this->optionValueId = $valueId->asInt();
93 }
94
95
96 /**
97 * Returns the option id of the product attribute.
98 *
99 * @return int Option id of product attribute.
100 */
101 public function getOptionId()
102 {
103 return $this->optionId;
104 }
105
106
107 /**
108 * Sets the option id of the product attribute.
109 *
110 * @param IdType $optionId Option id of product attribute.
111 *
112 * @return ProductAttribute|$this Same instance for chained method calls.
113 */
114 public function setOptionId(IdType $optionId)
115 {
116 $this->optionId = $optionId->asInt();
117
118 return $this;
119 }
120
121
122 /**
123 * Returns option value id of the product attribute.
124 *
125 * @return int Option value id of product attribute.
126 */
127 public function getOptionValueId()
128 {
129 return $this->optionValueId;
130 }
131
132
133 /**
134 * Sets the option value id.
135 *
136 * @param IdType $optionValueId Option value id of product attribute.
137 *
138 * @return ProductAttribute|$this Same instance for chained method calls.
139 */
140 public function setOptionValueId(IdType $optionValueId)
141 {
142 $this->optionValueId = $optionValueId->asInt();
143
144 return $this;
145 }
146
147
148 /**
149 * Returns the price of the product attribute.
150 *
151 * @return float Price of product attribute.
152 */
153 public function getPrice()
154 {
155 return $this->price;
156 }
157
158
159 /**
160 * Sets the price of the product attribute.
161 *
162 * @param DecimalType $price New price of product attribute.
163 *
164 * @return ProductAttribute|$this Same instance for chained method calls.
165 */
166 public function setPrice(DecimalType $price)
167 {
168 $this->price = $price->asDecimal();
169
170 return $this;
171 }
172
173
174 /**
175 * Returns the price type of the product attribute.
176 *
177 * @return string Price type of product attribute.
178 */
179 public function getPriceType()
180 {
181 return $this->priceType;
182 }
183
184
185 /**
186 * Sets the price type of the product attribute.
187 *
188 * @param StringType $priceType New price type.
189 *
190 * @return ProductAttribute|$this Same instance for chained method calls.
191 */
192 public function setPriceType(StringType $priceType)
193 {
194 $this->priceType = $priceType->asString();
195
196 return $this;
197 }
198
199
200 /**
201 * Returns the weight of the product attribute.
202 *
203 * @return float Weight of product attribute.
204 */
205 public function getWeight()
206 {
207 return $this->weight;
208 }
209
210
211 /**
212 * Sets the weight of the product attribute.
213 *
214 * @param DecimalType $weight New weight.
215 *
216 * @return ProductAttribute|$this Same instance for chained method calls.
217 */
218 public function setWeight(DecimalType $weight)
219 {
220 $this->weight = $weight->asDecimal();
221
222 return $this;
223 }
224
225
226 /**
227 * Returns the weight type of the product attribute.
228 *
229 * @return string Weight type of product attribute.
230 */
231 public function getWeightType()
232 {
233 return $this->weightType;
234 }
235
236
237 /**
238 * Sets the weight type of the product attribute.
239 *
240 * @param StringType $weightType New weight type.
241 *
242 * @return ProductAttribute|$this Same instance for chained method calls.
243 */
244 public function setWeightType(StringType $weightType)
245 {
246 $this->weightType = $weightType->asString();
247
248 return $this;
249 }
250
251
252 /**
253 * Returns the attribute model of the product attribute.
254 *
255 * @return string Model of product attribute.
256 */
257 public function getAttributeModel()
258 {
259 return $this->attributeModel;
260 }
261
262
263 /**
264 * Sets the attribute model of the product attribute.
265 *
266 * @param StringType $attributeModel New attribute model.
267 *
268 * @return ProductAttribute|$this Same instance for chained method calls.
269 */
270 public function setAttributeModel(StringType $attributeModel)
271 {
272 $this->attributeModel = $attributeModel->asString();
273
274 return $this;
275 }
276
277
278 /**
279 * Returns the ean of the product attribute.
280 *
281 * @return string Ean of product attribute.
282 */
283 public function getAttributeEan()
284 {
285 return $this->attributeEan;
286 }
287
288
289 /**
290 * Sets the ean of the product attribute.
291 *
292 * @param StringType $attributeEan New ean.
293 *
294 * @return ProductAttribute|$this Same instance for chained method calls.
295 */
296 public function setAttributeEan(StringType $attributeEan)
297 {
298 $this->attributeEan = $attributeEan->asString();
299
300 return $this;
301 }
302
303
304 /**
305 * Returns the stock of the product attribute.
306 *
307 * @return float Stock of product attribute.
308 */
309 public function getStock()
310 {
311 return $this->stock;
312 }
313
314
315 /**
316 * Sets the stock of the product attribute.
317 *
318 * @param DecimalType $stock New stock
319 *
320 * @return ProductAttribute|$this Same instance for chained method calls.
321 */
322 public function setStock(DecimalType $stock)
323 {
324 $this->stock = $stock->asDecimal();
325
326 return $this;
327 }
328
329
330 /**
331 * Returns the sort order of the product attribute.
332 *
333 * @return int Sort order of product attribute.
334 */
335 public function getSortOrder()
336 {
337 return $this->sortOrder;
338 }
339
340
341 /**
342 * Sets the sort order of the product attribute.
343 *
344 * @param IntType $sortOrder New sort order position.
345 *
346 * @return ProductAttribute|$this Same instance for chained method calls.
347 */
348 public function setSortOrder(IntType $sortOrder)
349 {
350 $this->sortOrder = $sortOrder->asInt();
351
352 return $this;
353 }
354
355
356 /**
357 * Returns the vpe id of the product attribute.
358 *
359 * @return int Vpe id of product attribute.
360 */
361 public function getVpeId()
362 {
363 return $this->vpeId;
364 }
365
366
367 /**
368 * Sets the vpe id of the product attribute.
369 *
370 * @param IdType $vpeId New vpe id.
371 *
372 * @return ProductAttribute|$this Same instance for chained method calls.
373 */
374 public function setVpeId(IdType $vpeId)
375 {
376 $this->vpeId = $vpeId->asInt();
377
378 return $this;
379 }
380
381
382 /**
383 * Returns the product vpe value of the product attribute.
384 *
385 * @return float Vpe value of product attribute.
386 */
387 public function getVpeValue()
388 {
389 return $this->vpeValue;
390 }
391
392
393 /**
394 * Sets the vpe value of the product attribute.
395 *
396 * @param DecimalType $vpeValue New vpe value.
397 *
398 * @return ProductAttribute|$this Same instance for chained method calls.
399 */
400 public function setVpeValue(DecimalType $vpeValue)
401 {
402 $this->vpeValue = $vpeValue->asDecimal();
403
404 return $this;
405 }
406 }