Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
QtyProcessor.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
19  protected $quoteItemQtyList;
20 
24  protected $item;
25 
30  {
31  $this->quoteItemQtyList = $quoteItemQtyList;
32  }
33 
39  public function setItem(Item $quoteItem)
40  {
41  $this->item = $quoteItem;
42  return $this;
43  }
44 
50  public function getRowQty($qty)
51  {
52  $rowQty = $qty;
53  if ($this->item->getParentItem()) {
54  $rowQty = $this->item->getParentItem()->getQty() * $qty;
55  }
56  return $rowQty;
57  }
58 
64  public function getQtyForCheck($qty)
65  {
66  if (!$this->item->getParentItem()) {
67  $increaseQty = $this->item->getQtyToAdd() ? $this->item->getQtyToAdd() : $qty;
68  return $this->quoteItemQtyList->getQty(
69  $this->item->getProduct()->getId(),
70  $this->item->getId(),
71  $this->item->getQuoteId(),
72  $increaseQty
73  );
74  }
75  return $this->quoteItemQtyList->getQty(
76  $this->item->getProduct()->getId(),
77  $this->item->getId(),
78  $this->item->getQuoteId(),
79  0
80  );
81  }
82 }
$quoteItem
Definition: quote.php:38