1 <?php
2 /* --------------------------------------------------------------
3 GXEngineProduct.inc.php 2016-02-16
4 Gambio GmbH
5 http://www.gambio.de
6 Copyright (c) 2016 Gambio GmbH
7 Released under the GNU General Public License (Version 2)
8 [http://www.gnu.org/licenses/gpl-2.0.html]
9 --------------------------------------------------------------
10 */
11
12 /**
13 * Class GXEngineProduct
14 *
15 * @category System
16 * @package Product
17 * @subpackage Entities
18 */
19 class GXEngineProduct implements ProductInterface
20 {
21 /**
22 * Product settings.
23 *
24 * @var ProductSettingsInterface
25 */
26 protected $settings;
27
28 /**
29 * Determines whether this product is active.
30 *
31 * @var boolean
32 */
33 protected $active = false;
34
35 /**
36 * Sort order.
37 *
38 * @var int
39 */
40 protected $sortOrder = 0;
41
42 /**
43 * Available DateTime.
44 *
45 * @var EmptyDateTime
46 */
47 protected $availableDateTime;
48
49 /**
50 * Added DateTime.
51 *
52 * @var DateTime
53 */
54 protected $addedDateTime;
55
56 /**
57 * Last modified DateTime.
58 *
59 * @var DateTime
60 */
61 protected $lastModifiedDateTime;
62
63 /**
64 * Viewed count.
65 *
66 * @var EditableKeyValueCollection
67 */
68 protected $viewedCount;
69
70 /**
71 * Ordered count.
72 *
73 * @var int
74 */
75 protected $orderedCount = 0;
76
77 /**
78 * Names collection.
79 *
80 * @var EditableKeyValueCollection
81 */
82 protected $names;
83
84 /**
85 * Description collection.
86 *
87 * @var EditableKeyValueCollection
88 */
89 protected $descriptions;
90
91 /**
92 * Short description collection.
93 *
94 * @var EditableKeyValueCollection
95 */
96 protected $shortDescriptions;
97
98 /**
99 * Keyword collection.
100 *
101 * @var EditableKeyValueCollection
102 */
103 protected $keywords;
104
105 /**
106 * Meta title collection.
107 *
108 * @var EditableKeyValueCollection
109 */
110 protected $metaTitles;
111
112 /**
113 * Meta description collection.
114 *
115 * @var EditableKeyValueCollection
116 */
117 protected $metaDescriptions;
118
119 /**
120 * Meta keywords collection.
121 *
122 * @var EditableKeyValueCollection
123 */
124 protected $metaKeywords;
125
126 /**
127 * URL.
128 *
129 * @var EditableKeyValueCollection
130 */
131 protected $url;
132
133 /**
134 * URL keywords.
135 *
136 * @var EditableKeyValueCollection
137 */
138 protected $urlKeywords;
139
140 /**
141 * Checkout information collection.
142 *
143 * @var EditableKeyValueCollection
144 */
145 protected $checkoutInformation;
146
147 /**
148 * Product model.
149 *
150 * @var string
151 */
152 protected $productModel = '';
153
154 /**
155 * EAN.
156 *
157 * @var string
158 */
159 protected $ean = '';
160
161 /**
162 * Price.
163 *
164 * @var float
165 */
166 protected $price = 0.00;
167
168 /**
169 * Tax class ID.
170 *
171 * @var int
172 */
173 protected $taxClassId = 0;
174
175 /**
176 * Quantity.
177 *
178 * @var float
179 */
180 protected $quantity = 0.00;
181
182 /**
183 * Weight.
184 *
185 * @var float
186 */
187 protected $weight = 0.00;
188
189 /**
190 * Discount allowed.
191 *
192 * @var float
193 */
194 protected $discountAllowed = 0.00;
195
196 /**
197 * Shipping costs.
198 *
199 * @var float
200 */
201 protected $shippingCosts = 0.00;
202
203 /**
204 * Shipping time ID.
205 *
206 * @var int
207 */
208 protected $shippingTimeId = 0;
209
210 /**
211 * Product type ID.
212 *
213 * @var int
214 */
215 protected $productTypeId = 0;
216
217 /**
218 * Manufacturer ID.
219 *
220 * @var int
221 */
222 protected $manufacturerId = 0;
223
224 /**
225 * Is FSK 18?
226 *
227 * @var bool
228 */
229 protected $fsk18 = false;
230
231 /**
232 * Is VPE active?
233 *
234 * @var bool
235 */
236 protected $vpeActive = false;
237
238 /**
239 * VPE ID.
240 *
241 * @var int
242 */
243 protected $vpeId = 0;
244
245 /**
246 * VPE value.
247 *
248 * @var float
249 */
250 protected $vpeValue = 0.00;
251
252 /**
253 * Addons collection.
254 *
255 * @var EditableKeyValueCollection
256 */
257 protected $addonValues;
258
259 /**
260 * Image container.
261 *
262 * @var ProductImageContainer
263 */
264 protected $imageContainer;
265
266
267 /**
268 * GXEngineProduct constructor.
269 *
270 * @param ProductSettingsInterface $settings Product settings.
271 */
272 public function __construct(ProductSettingsInterface $settings)
273 {
274 $this->settings = $settings;
275
276 $this->setAvailableDateTime(new EmptyDateTime());
277
278 $this->setAddedDateTime(new DateTime());
279
280 $this->setLastModifiedDateTime(new DateTime());
281
282 $this->imageContainer = MainFactory::create('ProductImageContainer');
283
284 $this->names = MainFactory::create('EditableKeyValueCollection', array());
285
286 $this->viewedCount = MainFactory::create('EditableKeyValueCollection', array());
287
288 $this->url = MainFactory::create('EditableKeyValueCollection', array());
289
290 $this->descriptions = MainFactory::create('EditableKeyValueCollection', array());
291
292 $this->shortDescriptions = MainFactory::create('EditableKeyValueCollection', array());
293
294 $this->keywords = MainFactory::create('EditableKeyValueCollection', array());
295
296 $this->metaTitles = MainFactory::create('EditableKeyValueCollection', array());
297
298 $this->metaDescriptions = MainFactory::create('EditableKeyValueCollection', array());
299
300 $this->metaKeywords = MainFactory::create('EditableKeyValueCollection', array());
301
302 $this->urlKeywords = MainFactory::create('EditableKeyValueCollection', array());
303
304 $this->checkoutInformation = MainFactory::create('EditableKeyValueCollection', array());
305
306 $this->addonValues = MainFactory::create('EditableKeyValueCollection', array());
307 }
308
309
310 /**
311 * Is Active
312 *
313 * Checks if a product is active.
314 *
315 * @return bool Product status.
316 */
317 public function isActive()
318 {
319 return $this->active;
320 }
321
322
323 /**
324 * Get Sort Order
325 *
326 * Returns an integer which represents a specific sort order.
327 *
328 * @return int The sort order.
329 */
330 public function getSortOrder()
331 {
332 return $this->sortOrder;
333 }
334
335
336 /**
337 * Get Available Date Time
338 *
339 * Returns the available date time of the product.
340 *
341 * @return DateTime The available date time.
342 */
343 public function getAvailableDateTime()
344 {
345 return $this->availableDateTime;
346 }
347
348
349 /**
350 * Get Added Date Time
351 *
352 * Returns the added date time of the product.
353 *
354 * @return DateTime The added date time.
355 */
356 public function getAddedDateTime()
357 {
358 return $this->addedDateTime;
359 }
360
361
362 /**
363 * Get Last Modified Date Time
364 *
365 * Returns the last modified date time.
366 *
367 * @return DateTime The last modified date time.
368 */
369 public function getLastModifiedDateTime()
370 {
371 return $this->lastModifiedDateTime;
372 }
373
374
375 /**
376 * Get View Count
377 *
378 * Returns the current view count of the product, depending on the provided language code.
379 *
380 * @throws InvalidArgumentException if the language code is not valid.
381 *
382 * @param LanguageCode $language The language code of the language to be returned.
383 *
384 * @return int The current view count.
385 */
386 public function getViewedCount(LanguageCode $language)
387 {
388 return $this->viewedCount->getValue($language->asString());
389 }
390
391
392 /**
393 * Get Ordered Count
394 *
395 * Returns the ordered count of the product.
396 *
397 * @return int The ordered count.
398 */
399 public function getOrderedCount()
400 {
401 return $this->orderedCount;
402 }
403
404
405 /**
406 * Get Product Settings.
407 *
408 * Returns the product settings.
409 *
410 * @return ProductSettingsInterface
411 */
412 public function getSettings()
413 {
414 return $this->settings;
415 }
416
417
418 /**
419 * Get Name
420 *
421 * Returns the name of the product, depending on the provided language code.
422 *
423 * @throws InvalidArgumentException if the language code is not valid.
424 *
425 * @param LanguageCode $language The language code of the name to return.
426 *
427 * @return string The name of the product.
428 */
429 public function getName(LanguageCode $language)
430 {
431 return $this->names->getValue($language->asString());
432 }
433
434
435 /**
436 * Get Description
437 *
438 * Returns the description of the product, depending on the provided language code.
439 *
440 * @throws InvalidArgumentException if the language code is not valid.
441 *
442 * @param LanguageCode $language The language code of the description to return.
443 *
444 * @return string The description of the product.
445 */
446 public function getDescription(LanguageCode $language)
447 {
448 return $this->descriptions->getValue($language->asString());
449 }
450
451
452 /**
453 * Get Short Description
454 *
455 * Returns the short description of the product, depending on the provided language code.
456 *
457 * @throws InvalidArgumentException if the language code is not valid.
458 *
459 * @param LanguageCode $language The language code of the short description to return.
460 *
461 * @return string The short description of the product.
462 */
463 public function getShortDescription(LanguageCode $language)
464 {
465 return $this->shortDescriptions->getValue($language->asString());
466 }
467
468
469 /**
470 * Get Keywords
471 *
472 * Returns the keywords of the product, depending on the provided language code.
473 *
474 * @throws InvalidArgumentException if the language code is not valid.
475 *
476 * @param LanguageCode $language The language code of the keywords to return.
477 *
478 * @return string The keywords of the product.
479 */
480 public function getKeywords(LanguageCode $language)
481 {
482 return $this->keywords->getValue($language->asString());
483 }
484
485
486 /**
487 * Get Meta Title
488 *
489 * Returns the meta title of the product, depending on the provided language code.
490 *
491 * @throws InvalidArgumentException if the language code is not valid.
492 *
493 * @param LanguageCode $language The language code of the meta title to return.
494 *
495 * @return string The meta title of the product.
496 */
497 public function getMetaTitle(LanguageCode $language)
498 {
499 return $this->metaTitles->getValue($language->asString());
500 }
501
502
503 /**
504 * Get Meta Description
505 *
506 * Returns the meta description of the product, depending on the provided language code.
507 *
508 * @throws InvalidArgumentException if the language code is not valid.
509 *
510 * @param LanguageCode $language The language code of the meta description to return.
511 *
512 * @return string The meta description of the product.
513 */
514 public function getMetaDescription(LanguageCode $language)
515 {
516 return $this->metaDescriptions->getValue($language->asString());
517 }
518
519
520 /**
521 * Get Meta Keywords
522 *
523 * Returns the meta keywords of the product, depending on the provided language code.
524 *
525 * @throws InvalidArgumentException if the language code is not valid.
526 *
527 * @param LanguageCode $language The language code of the meta keywords to return.
528 *
529 * @return string The meta keywords of the product.
530 */
531 public function getMetaKeywords(LanguageCode $language)
532 {
533 return $this->metaKeywords->getValue($language->asString());
534 }
535
536
537 /**
538 * Get Url
539 *
540 * Returns the URL of the product, depending on the provided language code.
541 *
542 * @throws InvalidArgumentException if the language code is not valid.
543 *
544 * @param LanguageCode $language The language code of the URL to return.
545 *
546 * @return string Product URL
547 */
548 public function getUrl(LanguageCode $language)
549 {
550 return $this->url->getValue($language->asString());
551 }
552
553
554 /**
555 * Get URL Keywords
556 *
557 * Returns the URL keywords of the product, depending on the provided language code.
558 *
559 * @throws InvalidArgumentException if the language code is not valid.
560 *
561 * @param LanguageCode $language The language code of the URL keywords to be return.
562 *
563 * @return string The URL keywords of the product.
564 */
565 public function getUrlKeywords(LanguageCode $language)
566 {
567 return $this->urlKeywords->getValue($language->asString());
568 }
569
570
571 /**
572 * Get Checkout Information
573 *
574 * Returns the checkout information of the product, depending on the provided language code.
575 *
576 * @throws InvalidArgumentException if the language code is not valid.
577 *
578 * @param LanguageCode $language The language code of the checkout information to be return.
579 *
580 * @return string The checkout information of the product.
581 */
582 public function getCheckoutInformation(LanguageCode $language)
583 {
584 return $this->checkoutInformation->getValue($language->asString());
585 }
586
587
588 /**
589 * Get Product Model
590 *
591 * Returns the product model.
592 *
593 * @return string The product model.
594 */
595 public function getProductModel()
596 {
597 return $this->productModel;
598 }
599
600
601 /**
602 * Get EAN
603 *
604 * Returns the EAN of the product.
605 *
606 * @return string The EAN of the product.
607 */
608 public function getEan()
609 {
610 return $this->ean;
611 }
612
613
614 /**
615 * Get Price
616 *
617 * Returns the price of a product.
618 *
619 * @return float The price of the product.
620 */
621 public function getPrice()
622 {
623 return $this->price;
624 }
625
626
627 /**
628 * Get Tax Class ID
629 *
630 * Returns the tax class ID of the product.
631 *
632 * @return int The tax class ID.
633 */
634 public function getTaxClassId()
635 {
636 return $this->taxClassId;
637 }
638
639
640 /**
641 * Get Quantity
642 *
643 * Returns the quantity of the product.
644 *
645 * @return float The quantity of the product.
646 */
647 public function getQuantity()
648 {
649 return $this->quantity;
650 }
651
652
653 /**
654 * Get Weight
655 *
656 * Returns the weight of the product.
657 *
658 * @return float The weight of the product.
659 */
660 public function getWeight()
661 {
662 return $this->weight;
663 }
664
665
666 /**
667 * Get Discount Allowed
668 *
669 * Returns the allowed discount.
670 *
671 * @return float The allowed discount.
672 */
673 public function getDiscountAllowed()
674 {
675 return $this->discountAllowed;
676 }
677
678
679 /**
680 * Get Shipping Costs
681 *
682 * Returns the shipping cost of the product.
683 *
684 * @return float The shipping costs of the product.
685 */
686 public function getShippingCosts()
687 {
688 return $this->shippingCosts;
689 }
690
691
692 /**
693 * Get Shipping Time ID
694 *
695 * Returns the shipping time ID of the product.
696 *
697 * @return int The shipping time ID.
698 */
699 public function getShippingTimeId()
700 {
701 return $this->shippingTimeId;
702 }
703
704
705 /**
706 * Get Product Type ID.
707 *
708 * Returns the product type ID.
709 *
710 * @return int The product type ID.
711 */
712 public function getProductTypeId()
713 {
714 return $this->productTypeId;
715 }
716
717
718 /**
719 * Get Manufacturer ID
720 *
721 * Returns the manufacturer ID.
722 *
723 * @return int The manufacturer ID.
724 */
725 public function getManufacturerId()
726 {
727 return $this->manufacturerId;
728 }
729
730
731 /**
732 * Is FSK 18
733 *
734 * Checks if the product is only available for FSK 18.
735 *
736 * @return bool Is the product FSK18?
737 */
738 public function isFsk18()
739 {
740 return $this->fsk18;
741 }
742
743
744 /**
745 * Is VPE Active
746 *
747 * Checks if VPE is active on the product.
748 *
749 * @return bool Is VPE active on the product?
750 */
751 public function isVpeActive()
752 {
753 return $this->vpeActive;
754 }
755
756
757 /**
758 * Get VPE ID.
759 *
760 * Returns the VPE ID.
761 *
762 * @return int VPE ID.
763 */
764 public function getVpeId()
765 {
766 return $this->vpeId;
767 }
768
769
770 /**
771 * Get VPE Value
772 *
773 * Returns the VPE value.
774 *
775 * @return float The VPE value.
776 */
777 public function getVpeValue()
778 {
779 return $this->vpeValue;
780 }
781
782
783 /**
784 * Get Addon Value
785 *
786 * Returns the addon value of a product, depending on the provided key.
787 *
788 * @throws InvalidArgumentException if the key is not valid.
789 *
790 * @param StringType $key The key of the addon value to return.
791 *
792 * @return string The addon value.
793 */
794 public function getAddonValue(StringType $key)
795 {
796 return $this->addonValues->getValue($key->asString());
797 }
798
799
800 /**
801 * Get Addon Values
802 *
803 * Returns a key value collection of the product.
804 *
805 * @return KeyValueCollection The key value collection.
806 */
807 public function getAddonValues()
808 {
809 return $this->addonValues;
810 }
811
812
813 /**
814 * Set Active
815 *
816 * Activates or deactivates a product status.
817 *
818 * @param BoolType $status The status to activate or deactivate the product.
819 *
820 * @return GXEngineProduct Same instance for chained method calls.
821 */
822 public function setActive(BoolType $status)
823 {
824 $this->active = $status->asBool();
825
826 return $this;
827 }
828
829
830 /**
831 * Set Sort Order
832 *
833 * Sets the sort order of the product.
834 *
835 * @param IntType $sortOrder The sort order.
836 *
837 * @return GXEngineProduct Same instance for chained method calls.
838 */
839 public function setSortOrder(IntType $sortOrder)
840 {
841 $this->sortOrder = $sortOrder->asInt();
842
843 return $this;
844 }
845
846
847 /**
848 * Set Available Date Time
849 *
850 * Sets an available date time.
851 *
852 * @param DateTime $date The date time to add.
853 *
854 * @return GXEngineProduct Same instance for chained method calls.
855 */
856 public function setAvailableDateTime(DateTime $date)
857 {
858 $this->availableDateTime = $date;
859
860 return $this;
861 }
862
863
864 /**
865 * Set Last Modified Date Time
866 *
867 * Sets the last modified date time.
868 *
869 * @param DateTime $date The last modified date time.
870 *
871 * @return GXEngineProduct Same instance for chained method calls.
872 */
873 public function setLastModifiedDateTime(DateTime $date)
874 {
875 $this->lastModifiedDateTime = $date;
876
877 return $this;
878 }
879
880
881 /**
882 * Set Viewed Count
883 *
884 * Sets the viewed count.
885 *
886 * @param IntType $count The amount of views.
887 * @param LanguageCode $language The language code for the product name.
888 *
889 * @return GXEngineProduct Same instance for chained method calls.
890 */
891 public function setViewedCount(IntType $count, LanguageCode $language)
892 {
893 $this->viewedCount->setValue($language->asString(), $count->asInt());
894
895 return $this;
896 }
897
898
899 /**
900 * Set Ordered Count
901 *
902 * Sets the ordered count.
903 *
904 * @param IntType $count The ordered count.
905 *
906 * @return GXEngineProduct Same instance for chained method calls.
907 */
908 public function setOrderedCount(IntType $count)
909 {
910 $this->orderedCount = $count->asInt();
911
912 return $this;
913 }
914
915
916 /**
917 * Set Image Container
918 *
919 * Sets the image container of a product.
920 *
921 * @param ProductImageContainerInterface $images
922 *
923 * @return GXEngineProduct Same instance for chained method calls.
924 */
925 public function setImageContainer(ProductImageContainerInterface $images)
926 {
927 $this->imageContainer = $images;
928
929 return $this;
930 }
931
932
933 /**
934 * Sets a product setting object
935 *
936 * @param ProductSettingsInterface $productSettings
937 *
938 * @return GXEngineProduct Same instance for chained method calls.
939 */
940 public function setSettings(ProductSettingsInterface $productSettings)
941 {
942 $this->settings = $productSettings;
943
944 return $this;
945 }
946
947
948 /**
949 * Set Name
950 *
951 * Sets the products name.
952 *
953 * @param StringType $text The name of the product.
954 * @param LanguageCode $language The language code for the product name.
955 *
956 * @return GXEngineProduct Same instance for chained method calls.
957 */
958 public function setName(StringType $text, LanguageCode $language)
959 {
960 $this->names->setValue($language->asString(), $text->asString());
961
962 return $this;
963 }
964
965
966 /**
967 * Set Description
968 *
969 * Sets the products description.
970 *
971 * @param StringType $text The description.
972 * @param LanguageCode $language The language code for the description.
973 *
974 * @return GXEngineProduct Same instance for chained method calls.
975 */
976 public function setDescription(StringType $text, LanguageCode $language)
977 {
978 $this->descriptions->setValue($language->asString(), $text->asString());
979
980 return $this;
981 }
982
983
984 /**
985 * Set Short Description
986 *
987 * Sets the products description.
988 *
989 * @param StringType $text The short description.
990 * @param LanguageCode $language The language code for the short description.
991 *
992 * @return GXEngineProduct Same instance for chained method calls.
993 */
994 public function setShortDescription(StringType $text, LanguageCode $language)
995 {
996 $this->shortDescriptions->setValue($language->asString(), $text->asString());
997
998 return $this;
999 }
1000
1001
1002 /**
1003 * Set Keywords
1004 *
1005 * Sets the products keywords.
1006 *
1007 * @param StringType $text The keywords.
1008 * @param LanguageCode $language The language code for the keywords.
1009 *
1010 * @return GXEngineProduct Same instance for chained method calls.
1011 */
1012 public function setKeywords(StringType $text, LanguageCode $language)
1013 {
1014 $this->keywords->setValue($language->asString(), $text->asString());
1015
1016 return $this;
1017 }
1018
1019
1020 /**
1021 * Set Meta title.
1022 *
1023 * Sets the meta title of a product.
1024 *
1025 * @param StringType $text
1026 * @param LanguageCode $language
1027 *
1028 * @return GXEngineProduct Same instance for chained method calls.
1029 */
1030 public function setMetaTitle(StringType $text, LanguageCode $language)
1031 {
1032 $this->metaTitles->setValue($language->asString(), $text->asString());
1033
1034 return $this;
1035 }
1036
1037
1038 /**
1039 * Set Meta description.
1040 *
1041 * Sets the meta description of a product.
1042 *
1043 * @param StringType $text
1044 * @param LanguageCode $language
1045 *
1046 * @return GXEngineProduct Same instance for chained method calls.
1047 */
1048 public function setMetaDescription(StringType $text, LanguageCode $language)
1049 {
1050 $this->metaDescriptions->setValue($language->asString(), $text->asString());
1051
1052 return $this;
1053 }
1054
1055
1056 /**
1057 * Set Meta Keywords
1058 *
1059 * Sets the products meta keywords.
1060 *
1061 * @param StringType $text The meta keywords.
1062 * @param LanguageCode $language The language code for the meta keywords.
1063 *
1064 * @return GXEngineProduct Same instance for chained method calls.
1065 */
1066 public function setMetaKeywords(StringType $text, LanguageCode $language)
1067 {
1068 $this->metaKeywords->setValue($language->asString(), $text->asString());
1069
1070 return $this;
1071 }
1072
1073
1074 /**
1075 * Set URL
1076 *
1077 * Sets the products URL.
1078 *
1079 * @param StringType $url The URL.
1080 * @param LanguageCode $language The language code for the URL keywords.
1081 *
1082 * @return GXEngineProduct Same instance for chained method calls.
1083 */
1084 public function setUrl(StringType $url, LanguageCode $language)
1085 {
1086 $this->url->setValue($language->asString(), $url->asString());
1087
1088 return $this;
1089 }
1090
1091
1092 /**
1093 * Set URL Keywords
1094 *
1095 * Sets the products URL Keywords.
1096 *
1097 * @param StringType $text The URL Keywords.
1098 * @param LanguageCode $language The language code for the URL keywords.
1099 *
1100 * @return GXEngineProduct Same instance for chained method calls.
1101 */
1102 public function setUrlKeywords(StringType $text, LanguageCode $language)
1103 {
1104 $this->urlKeywords->setValue($language->asString(), $text->asString());
1105
1106 return $this;
1107 }
1108
1109
1110 /**
1111 * Set Checkout Information
1112 *
1113 * Sets the checkout information of a product.
1114 *
1115 * @param StringType $text The checkout information.
1116 * @param LanguageCode $language The language code for the checkout information.
1117 *
1118 * @return GXEngineProduct Same instance for chained method calls.
1119 */
1120 public function setCheckoutInformation(StringType $text, LanguageCode $language)
1121 {
1122 $this->checkoutInformation->setValue($language->asString(), $text->asString());
1123
1124 return $this;
1125 }
1126
1127
1128 /**
1129 * Set Product Model
1130 *
1131 * Set the product model.
1132 *
1133 * @param StringType $model The product model.
1134 *
1135 * @return GXEngineProduct Same instance for chained method calls.
1136 */
1137 public function setProductModel(StringType $model)
1138 {
1139 $this->productModel = $model->asString();
1140
1141 return $this;
1142 }
1143
1144
1145 /**
1146 * Set EAN
1147 *
1148 * Sets a EAN for the product.
1149 *
1150 * @param StringType $ean The EAN to set.
1151 *
1152 * @return GXEngineProduct Same instance for chained method calls.
1153 */
1154 public function setEan(StringType $ean)
1155 {
1156 $this->ean = $ean->asString();
1157
1158 return $this;
1159 }
1160
1161
1162 /**
1163 * Set Price
1164 *
1165 * Sets a price of the product.
1166 *
1167 * @param DecimalType $price The price to set.
1168 *
1169 * @return GXEngineProduct Same instance for chained method calls.
1170 */
1171 public function setPrice(DecimalType $price)
1172 {
1173 $this->price = $price->asDecimal();
1174
1175 return $this;
1176 }
1177
1178
1179 /**
1180 * Set Tax Class ID
1181 *
1182 * Sets a tax class ID for the product.
1183 *
1184 * @param IdType $id The tax class ID to set.
1185 *
1186 * @return GXEngineProduct Same instance for chained method calls.
1187 */
1188 public function setTaxClassId(IdType $id)
1189 {
1190 $this->taxClassId = $id->asInt();
1191
1192 return $this;
1193 }
1194
1195
1196 /**
1197 * Set Quantity
1198 *
1199 * Sets a quantity for the product.
1200 *
1201 * @param DecimalType $quantity The quantity to set.
1202 *
1203 * @return GXEngineProduct Same instance for chained method calls.
1204 */
1205 public function setQuantity(DecimalType $quantity)
1206 {
1207 $this->quantity = $quantity->asDecimal();
1208
1209 return $this;
1210 }
1211
1212
1213 /**
1214 * Set Weight
1215 *
1216 * Sets the weight of a product.
1217 *
1218 * @param DecimalType $weight The weight to set.
1219 *
1220 * @return GXEngineProduct Same instance for chained method calls.
1221 */
1222 public function setWeight(DecimalType $weight)
1223 {
1224 $this->weight = $weight->asDecimal();
1225
1226 return $this;
1227 }
1228
1229
1230 /**
1231 * Set Discount Allowed
1232 *
1233 * Sets the allowed discount of a product.
1234 *
1235 * @param DecimalType $discount The discount to set.
1236 *
1237 * @return GXEngineProduct Same instance for chained method calls.
1238 */
1239 public function setDiscountAllowed(DecimalType $discount)
1240 {
1241 $this->discountAllowed = $discount->asDecimal();
1242
1243 return $this;
1244 }
1245
1246
1247 /**
1248 * Set Shipping Costs
1249 *
1250 * Sets the shipping costs of a product.
1251 *
1252 * @param DecimalType $price The shipping costs to set.
1253 *
1254 * @return GXEngineProduct Same instance for chained method calls.
1255 */
1256 public function setShippingCosts(DecimalType $price)
1257 {
1258 $this->shippingCosts = $price->asDecimal();
1259
1260 return $this;
1261 }
1262
1263
1264 /**
1265 * Set Shipping Time ID
1266 *
1267 * Sets the shipping time ID of a product.
1268 *
1269 * @param IdType $id The shipping time ID to set.
1270 *
1271 * @return GXEngineProduct Same instance for chained method calls.
1272 */
1273 public function setShippingTimeId(IdType $id)
1274 {
1275 $this->shippingTimeId = $id->asInt();
1276
1277 return $this;
1278 }
1279
1280
1281 /**
1282 * Set Product Type ID.
1283 *
1284 * Sets the product type ID of the product.
1285 *
1286 * @param IdType $id Product type ID.
1287 *
1288 * @return GXEngineProduct
1289 */
1290 public function setProductTypeId(IdType $id)
1291 {
1292 $this->productTypeId = $id->asInt();
1293
1294 return $this;
1295 }
1296
1297
1298 /**
1299 * Set Manufacturer ID
1300 *
1301 * Sets the manufacturer ID of a product.
1302 *
1303 * @param IdType $id The manufacturer ID to set.
1304 *
1305 * @return GXEngineProduct Same instance for chained method calls.
1306 */
1307 public function setManufacturerId(IdType $id)
1308 {
1309 $this->manufacturerId = $id->asInt();
1310
1311 return $this;
1312 }
1313
1314
1315 /**
1316 * Set FSK 18
1317 *
1318 * Activates or deactivates FSK18 for a product.
1319 *
1320 * @param BoolType $status Should FSK be activated?
1321 *
1322 * @return GXEngineProduct Same instance for chained method calls.
1323 */
1324 public function setFsk18(BoolType $status)
1325 {
1326 $this->fsk18 = $status->asBool();
1327
1328 return $this;
1329 }
1330
1331
1332 /**
1333 * Set VPE Active
1334 *
1335 * Activates or deactivates VPE for a product.
1336 *
1337 * @param BoolType $status Should VPE be activated?
1338 *
1339 * @return GXEngineProduct Same instance for chained method calls.
1340 */
1341 public function setVpeActive(BoolType $status)
1342 {
1343 $this->vpeActive = $status->asBool();
1344
1345 return $this;
1346 }
1347
1348
1349 /**
1350 * Set VPE ID
1351 *
1352 * Sets the VPE ID of a product.
1353 *
1354 * @param IdType $id The VPE ID to set.
1355 *
1356 * @return GXEngineProduct Same instance for chained method calls.
1357 */
1358 public function setVpeId(IdType $id)
1359 {
1360 $this->vpeId = $id->asInt();
1361
1362 return $this;
1363 }
1364
1365
1366 /**
1367 * Set VPE Value
1368 *
1369 * Sets the VPE value of a product.
1370 *
1371 * @param DecimalType $vpeValue The VPE value to set.
1372 *
1373 * @return GXEngineProduct Same instance for chained method calls.
1374 */
1375 public function setVpeValue(DecimalType $vpeValue)
1376 {
1377 $this->vpeValue = $vpeValue->asDecimal();
1378
1379 return $this;
1380 }
1381
1382
1383 /**
1384 * Set Addon Value
1385 *
1386 * Sets the addon value of a product.
1387 *
1388 * @param StringType $key The key for the addon value.
1389 * @param StringType $value The value for the addon.
1390 *
1391 * @return GXEngineProduct Same instance for chained method calls.
1392 */
1393 public function setAddonValue(StringType $key, StringType $value)
1394 {
1395 $this->addonValues->setValue($key->asString(), $value->asString());
1396
1397 return $this;
1398 }
1399
1400
1401 /**
1402 * Add Addon Values
1403 *
1404 * Adds a key value collection to a product.
1405 *
1406 * @param KeyValueCollection $keyValueCollection The key value collection to add.
1407 *
1408 * @return GXEngineProduct Same instance for chained method calls.
1409 */
1410 public function addAddonValues(KeyValueCollection $keyValueCollection)
1411 {
1412 $this->addonValues->addCollection($keyValueCollection);
1413
1414 return $this;
1415 }
1416
1417
1418 /**
1419 * Delete Addon Value
1420 *
1421 * Deletes an addon value of a product.
1422 *
1423 * @throws InvalidArgumentException if the key is not valid.
1424 *
1425 * @param StringType $key The key of the addon value to delete.
1426 *
1427 * @return GXEngineProduct Same instance for chained method calls.
1428 */
1429 public function deleteAddonValue(StringType $key)
1430 {
1431 $this->addonValues->deleteValue($key->asString());
1432
1433 return $this;
1434 }
1435
1436
1437 /**
1438 * Sets the added date time.
1439 *
1440 * @param DateTime $date Added date time.
1441 *
1442 * @return GXEngineProduct Same instance for chained method calls.
1443 */
1444 public function setAddedDateTime(DateTime $date)
1445 {
1446 $this->addedDateTime = $date;
1447
1448 return $this;
1449 }
1450
1451
1452 /**
1453 * Returns the image container of the product.
1454 *
1455 * @return ProductImageContainer Product image container.
1456 */
1457 public function getImageContainer()
1458 {
1459 return $this->imageContainer;
1460 }
1461
1462
1463 /**
1464 * Returns the product's primary image.
1465 *
1466 * @return ProductImage
1467 */
1468 public function getPrimaryImage()
1469 {
1470 return $this->imageContainer->getPrimary();
1471 }
1472
1473
1474 /**
1475 * Returns a product's additional images.
1476 *
1477 * @return ProductImageCollection
1478 */
1479 public function getAdditionalImages()
1480 {
1481 return $this->imageContainer->getAdditionals();
1482 }
1483
1484 }