ProductRender.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Catalog\Model;
  8. use Magento\Catalog\Api\Data\ProductRender\ButtonInterface;
  9. use Magento\Catalog\Api\Data\ProductRender\PriceInfoInterface;
  10. use Magento\Catalog\Api\Data\ProductRenderInterface;
  11. /**
  12. * DTO which represents structure for product render information
  13. */
  14. class ProductRender extends \Magento\Framework\Model\AbstractExtensibleModel implements ProductRenderInterface
  15. {
  16. /**
  17. * @inheritdoc
  18. */
  19. public function getAddToCartButton()
  20. {
  21. return $this->getData('add_to_cart_button');
  22. }
  23. /**
  24. * @inheritdoc
  25. */
  26. public function setAddToCartButton(ButtonInterface $addToCartButton)
  27. {
  28. $this->setData('add_to_cart_button', $addToCartButton);
  29. }
  30. /**
  31. * @inheritdoc
  32. */
  33. public function getAddToCompareButton()
  34. {
  35. return $this->getData('add_to_compare_button');
  36. }
  37. /**
  38. * @inheritdoc
  39. */
  40. public function setAddToCompareButton(ButtonInterface $compareButton)
  41. {
  42. $this->setData('add_to_compare_button', $compareButton);
  43. }
  44. /**
  45. * @inheritdoc
  46. */
  47. public function getPriceInfo()
  48. {
  49. return $this->getData('price_info');
  50. }
  51. /**
  52. * @inheritdoc
  53. */
  54. public function setPriceInfo(PriceInfoInterface $priceInfo)
  55. {
  56. $this->setData('price_info', $priceInfo);
  57. }
  58. /**
  59. * @inheritdoc
  60. */
  61. public function getImages()
  62. {
  63. return $this->getData('images');
  64. }
  65. /**
  66. * @inheritdoc
  67. */
  68. public function setImages(array $images)
  69. {
  70. $this->setData('images', $images);
  71. }
  72. /**
  73. * @inheritdoc
  74. */
  75. public function getUrl()
  76. {
  77. return $this->getData('url');
  78. }
  79. /**
  80. * @inheritdoc
  81. */
  82. public function setUrl($url)
  83. {
  84. $this->setData('url', $url);
  85. }
  86. /**
  87. * @inheritdoc
  88. */
  89. public function getId()
  90. {
  91. return $this->getData('id');
  92. }
  93. /**
  94. * @inheritdoc
  95. */
  96. public function setId($id)
  97. {
  98. $this->setData('id', $id);
  99. }
  100. /**
  101. * @inheritdoc
  102. */
  103. public function getName()
  104. {
  105. return $this->getData('name');
  106. }
  107. /**
  108. * @inheritdoc
  109. */
  110. public function setName($name)
  111. {
  112. $this->setData('name', $name);
  113. }
  114. /**
  115. * @inheritdoc
  116. */
  117. public function setType($productType)
  118. {
  119. $this->setData('type', $productType);
  120. }
  121. /**
  122. * @inheritdoc
  123. */
  124. public function getType()
  125. {
  126. return $this->getData("type");
  127. }
  128. /**
  129. * @inheritdoc
  130. */
  131. public function getIsSalable()
  132. {
  133. return $this->getData("is_salable");
  134. }
  135. /**
  136. * @inheritdoc
  137. */
  138. public function setIsSalable($isSalable)
  139. {
  140. $this->setData('is_salable', $isSalable);
  141. }
  142. /**
  143. * @inheritdoc
  144. */
  145. public function setStoreId($storeId)
  146. {
  147. $this->setData('store_id', $storeId);
  148. }
  149. /**
  150. * @inheritdoc
  151. */
  152. public function getStoreId()
  153. {
  154. return $this->getData('store_id');
  155. }
  156. /**
  157. * @inheritdoc
  158. */
  159. public function getCurrencyCode()
  160. {
  161. return $this->getData('currency_code');
  162. }
  163. /**
  164. * @inheritdoc
  165. */
  166. public function setCurrencyCode($currencyCode)
  167. {
  168. $this->setData('currency_code', $currencyCode);
  169. }
  170. /**
  171. * Retrieve existing extension attributes object or create a new one.
  172. *
  173. * @return \Magento\Catalog\Api\Data\ProductRenderExtensionInterface
  174. */
  175. public function getExtensionAttributes()
  176. {
  177. return $this->getData(self::EXTENSION_ATTRIBUTES_KEY);
  178. }
  179. /**
  180. * Set an extension attributes object.
  181. *
  182. * @param \Magento\Catalog\Api\Data\ProductRenderExtensionInterface $extensionAttributes
  183. * @return void
  184. */
  185. public function setExtensionAttributes(
  186. \Magento\Catalog\Api\Data\ProductRenderExtensionInterface $extensionAttributes
  187. ) {
  188. $this->_setExtensionAttributes($extensionAttributes);
  189. }
  190. }