Item.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Quote\Model\Cart\Totals;
  7. use Magento\Quote\Api\Data\TotalsItemInterface;
  8. use Magento\Framework\Api\AbstractExtensibleObject;
  9. /**
  10. * Cart item totals.
  11. *
  12. * @codeCoverageIgnore
  13. */
  14. class Item extends AbstractExtensibleObject implements TotalsItemInterface
  15. {
  16. /**
  17. * Set totals item id
  18. *
  19. * @param int $id
  20. * @return $this
  21. */
  22. public function setItemId($id)
  23. {
  24. return $this->setData(self::KEY_ITEM_ID, $id);
  25. }
  26. /**
  27. * Get totals item id
  28. *
  29. * @return int Item id
  30. */
  31. public function getItemId()
  32. {
  33. return $this->_get(self::KEY_ITEM_ID);
  34. }
  35. /**
  36. * Returns the item price in quote currency.
  37. *
  38. * @return float Item price in quote currency.
  39. */
  40. public function getPrice()
  41. {
  42. return $this->_get(self::KEY_PRICE);
  43. }
  44. /**
  45. * Sets the item price in quote currency.
  46. *
  47. * @param float $price
  48. * @return $this
  49. */
  50. public function setPrice($price)
  51. {
  52. return $this->setData(self::KEY_PRICE, $price);
  53. }
  54. /**
  55. * Returns the item price in base currency.
  56. *
  57. * @return float Item price in base currency.
  58. */
  59. public function getBasePrice()
  60. {
  61. return $this->_get(self::KEY_BASE_PRICE);
  62. }
  63. /**
  64. * Sets the item price in base currency.
  65. *
  66. * @param float $basePrice
  67. * @return $this
  68. */
  69. public function setBasePrice($basePrice)
  70. {
  71. return $this->setData(self::KEY_BASE_PRICE, $basePrice);
  72. }
  73. /**
  74. * Returns the item quantity.
  75. *
  76. * @return int Item quantity.
  77. */
  78. public function getQty()
  79. {
  80. return $this->_get(self::KEY_QTY);
  81. }
  82. /**
  83. * Sets the item quantity.
  84. *
  85. * @param int $qty
  86. * @return $this
  87. */
  88. public function setQty($qty)
  89. {
  90. return $this->setData(self::KEY_QTY, $qty);
  91. }
  92. /**
  93. * Returns the row total in quote currency.
  94. *
  95. * @return float Row total in quote currency.
  96. */
  97. public function getRowTotal()
  98. {
  99. return $this->_get(self::KEY_ROW_TOTAL);
  100. }
  101. /**
  102. * Sets the row total in quote currency.
  103. *
  104. * @param float $rowTotal
  105. * @return $this
  106. */
  107. public function setRowTotal($rowTotal)
  108. {
  109. return $this->setData(self::KEY_ROW_TOTAL, $rowTotal);
  110. }
  111. /**
  112. * Returns the row total in base currency.
  113. *
  114. * @return float Row total in base currency.
  115. */
  116. public function getBaseRowTotal()
  117. {
  118. return $this->_get(self::KEY_BASE_ROW_TOTAL);
  119. }
  120. /**
  121. * Sets the row total in base currency.
  122. *
  123. * @param float $baseRowTotal
  124. * @return $this
  125. */
  126. public function setBaseRowTotal($baseRowTotal)
  127. {
  128. return $this->setData(self::KEY_BASE_ROW_TOTAL, $baseRowTotal);
  129. }
  130. /**
  131. * Returns the row total with discount in quote currency.
  132. *
  133. * @return float|null Row total with discount in quote currency. Otherwise, null.
  134. */
  135. public function getRowTotalWithDiscount()
  136. {
  137. return $this->_get(self::KEY_ROW_TOTAL_WITH_DISCOUNT);
  138. }
  139. /**
  140. * Sets the row total with discount in quote currency.
  141. *
  142. * @param float $rowTotalWithDiscount
  143. * @return $this
  144. */
  145. public function setRowTotalWithDiscount($rowTotalWithDiscount)
  146. {
  147. return $this->setData(self::KEY_ROW_TOTAL_WITH_DISCOUNT, $rowTotalWithDiscount);
  148. }
  149. /**
  150. * Returns the tax amount in quote currency.
  151. *
  152. * @return float|null Tax amount in quote currency. Otherwise, null.
  153. */
  154. public function getTaxAmount()
  155. {
  156. return $this->_get(self::KEY_TAX_AMOUNT);
  157. }
  158. /**
  159. * Sets the tax amount in quote currency.
  160. *
  161. * @param float $taxAmount
  162. * @return $this
  163. */
  164. public function setTaxAmount($taxAmount)
  165. {
  166. return $this->setData(self::KEY_TAX_AMOUNT, $taxAmount);
  167. }
  168. /**
  169. * Returns the tax amount in base currency.
  170. *
  171. * @return float|null Tax amount in base currency. Otherwise, null.
  172. */
  173. public function getBaseTaxAmount()
  174. {
  175. return $this->_get(self::KEY_BASE_TAX_AMOUNT);
  176. }
  177. /**
  178. * Sets the tax amount in base currency.
  179. *
  180. * @param float $baseTaxAmount
  181. * @return $this
  182. */
  183. public function setBaseTaxAmount($baseTaxAmount)
  184. {
  185. return $this->setData(self::KEY_BASE_TAX_AMOUNT, $baseTaxAmount);
  186. }
  187. /**
  188. * Returns the tax percent.
  189. *
  190. * @return int|null Tax percent. Otherwise, null.
  191. */
  192. public function getTaxPercent()
  193. {
  194. return $this->_get(self::KEY_TAX_PERCENT);
  195. }
  196. /**
  197. * Sets the tax percent.
  198. *
  199. * @param int $taxPercent
  200. * @return $this
  201. */
  202. public function setTaxPercent($taxPercent)
  203. {
  204. return $this->setData(self::KEY_TAX_PERCENT, $taxPercent);
  205. }
  206. /**
  207. * Returns the discount amount in quote currency.
  208. *
  209. * @return float|null Discount amount in quote currency. Otherwise, null.
  210. */
  211. public function getDiscountAmount()
  212. {
  213. return $this->_get(self::KEY_DISCOUNT_AMOUNT);
  214. }
  215. /**
  216. * Sets the discount amount in quote currency.
  217. *
  218. * @param float $discountAmount
  219. * @return $this
  220. */
  221. public function setDiscountAmount($discountAmount)
  222. {
  223. return $this->setData(self::KEY_DISCOUNT_AMOUNT, $discountAmount);
  224. }
  225. /**
  226. * Returns the discount amount in base currency.
  227. *
  228. * @return float|null Discount amount in base currency. Otherwise, null.
  229. */
  230. public function getBaseDiscountAmount()
  231. {
  232. return $this->_get(self::KEY_BASE_DISCOUNT_AMOUNT);
  233. }
  234. /**
  235. * Sets the discount amount in base currency.
  236. *
  237. * @param float $baseDiscountAmount
  238. * @return $this
  239. */
  240. public function setBaseDiscountAmount($baseDiscountAmount)
  241. {
  242. return $this->setData(self::KEY_BASE_DISCOUNT_AMOUNT, $baseDiscountAmount);
  243. }
  244. /**
  245. * Returns the discount percent.
  246. *
  247. * @return int|null Discount percent. Otherwise, null.
  248. */
  249. public function getDiscountPercent()
  250. {
  251. return $this->_get(self::KEY_DISCOUNT_PERCENT);
  252. }
  253. /**
  254. * Sets the discount percent.
  255. *
  256. * @param int $discountPercent
  257. * @return $this
  258. */
  259. public function setDiscountPercent($discountPercent)
  260. {
  261. return $this->setData(self::KEY_DISCOUNT_PERCENT, $discountPercent);
  262. }
  263. /**
  264. * Returns the price including tax in quote currency.
  265. *
  266. * @return float|null Price including tax in quote currency. Otherwise, null.
  267. */
  268. public function getPriceInclTax()
  269. {
  270. return $this->_get(self::KEY_PRICE_INCL_TAX);
  271. }
  272. /**
  273. * Sets the price including tax in quote currency.
  274. *
  275. * @param float $priceInclTax
  276. * @return $this
  277. */
  278. public function setPriceInclTax($priceInclTax)
  279. {
  280. return $this->setData(self::KEY_PRICE_INCL_TAX, $priceInclTax);
  281. }
  282. /**
  283. * Returns the price including tax in base currency.
  284. *
  285. * @return float|null Price including tax in base currency. Otherwise, null.
  286. */
  287. public function getBasePriceInclTax()
  288. {
  289. return $this->_get(self::KEY_BASE_PRICE_INCL_TAX);
  290. }
  291. /**
  292. * Sets the price including tax in base currency.
  293. *
  294. * @param float $basePriceInclTax
  295. * @return $this
  296. */
  297. public function setBasePriceInclTax($basePriceInclTax)
  298. {
  299. return $this->setData(self::KEY_BASE_PRICE_INCL_TAX, $basePriceInclTax);
  300. }
  301. /**
  302. * Returns the row total including tax in quote currency.
  303. *
  304. * @return float|null Row total including tax in quote currency. Otherwise, null.
  305. */
  306. public function getRowTotalInclTax()
  307. {
  308. return $this->_get(self::KEY_ROW_TOTAL_INCL_TAX);
  309. }
  310. /**
  311. * Sets the row total including tax in quote currency.
  312. *
  313. * @param float $rowTotalInclTax
  314. * @return $this
  315. */
  316. public function setRowTotalInclTax($rowTotalInclTax)
  317. {
  318. return $this->setData(self::KEY_ROW_TOTAL_INCL_TAX, $rowTotalInclTax);
  319. }
  320. /**
  321. * Returns the row total including tax in base currency.
  322. *
  323. * @return float|null Row total including tax in base currency. Otherwise, null.
  324. */
  325. public function getBaseRowTotalInclTax()
  326. {
  327. return $this->_get(self::KEY_BASE_ROW_TOTAL_INCL_TAX);
  328. }
  329. /**
  330. * Sets the row total including tax in base currency.
  331. *
  332. * @param float $baseRowTotalInclTax
  333. * @return $this
  334. */
  335. public function setBaseRowTotalInclTax($baseRowTotalInclTax)
  336. {
  337. return $this->setData(self::KEY_BASE_ROW_TOTAL_INCL_TAX, $baseRowTotalInclTax);
  338. }
  339. /**
  340. * Returns the item options data.
  341. *
  342. * @return string[] Item price in quote currency.
  343. */
  344. public function getOptions()
  345. {
  346. return $this->_get(self::KEY_OPTIONS);
  347. }
  348. /**
  349. * Sets the item options data.
  350. *
  351. * @param string $options
  352. * @return $this
  353. */
  354. public function setOptions($options)
  355. {
  356. return $this->setData(self::KEY_OPTIONS, $options);
  357. }
  358. /**
  359. * Returns the item weee tax applied amount in quote currency.
  360. *
  361. * @return float Item weee tax applied amount in quote currency.
  362. */
  363. public function getWeeeTaxAppliedAmount()
  364. {
  365. return $this->_get(self::KEY_WEEE_TAX_APPLIED_AMOUNT);
  366. }
  367. /**
  368. * Sets the item weee tax applied amount in quote currency.
  369. *
  370. * @param float $weeeTaxAppliedAmount
  371. * @return $this
  372. */
  373. public function setWeeeTaxAppliedAmount($weeeTaxAppliedAmount)
  374. {
  375. return $this->setData(self::KEY_WEEE_TAX_APPLIED_AMOUNT, $weeeTaxAppliedAmount);
  376. }
  377. /**
  378. * Returns the item weee tax applied in quote currency.
  379. *
  380. * @return string[] Item weee tax applied in quote currency.
  381. */
  382. public function getWeeeTaxApplied()
  383. {
  384. return $this->_get(self::KEY_WEEE_TAX_APPLIED);
  385. }
  386. /**
  387. * Sets the item weee tax applied in quote currency.
  388. *
  389. * @param string $weeeTaxApplied
  390. * @return $this
  391. */
  392. public function setWeeeTaxApplied($weeeTaxApplied)
  393. {
  394. return $this->setData(self::KEY_WEEE_TAX_APPLIED, $weeeTaxApplied);
  395. }
  396. /**
  397. * {@inheritdoc}
  398. */
  399. public function getName()
  400. {
  401. return $this->_get(self::KEY_NAME);
  402. }
  403. /**
  404. * {@inheritdoc}
  405. */
  406. public function setName($name)
  407. {
  408. return $this->setData(self::KEY_NAME, $name);
  409. }
  410. /**
  411. * {@inheritdoc}
  412. *
  413. * @return \Magento\Quote\Api\Data\TotalsItemExtensionInterface|null
  414. */
  415. public function getExtensionAttributes()
  416. {
  417. return $this->_getExtensionAttributes();
  418. }
  419. /**
  420. * {@inheritdoc}
  421. *
  422. * @param \Magento\Quote\Api\Data\TotalsItemExtensionInterface $extensionAttributes
  423. * @return $this
  424. */
  425. public function setExtensionAttributes(\Magento\Quote\Api\Data\TotalsItemExtensionInterface $extensionAttributes)
  426. {
  427. return $this->_setExtensionAttributes($extensionAttributes);
  428. }
  429. }