Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Items.php
Go to the documentation of this file.
1 <?php
13 
19 {
23  protected $_multishipping;
24 
28  protected $_checkoutSession;
29 
36  public function __construct(
37  \Magento\Framework\View\Element\Template\Context $context,
38  \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping,
39  \Magento\Checkout\Model\Session $checkoutSession,
40  array $data = []
41  ) {
42  $this->_multishipping = $multishipping;
43  $this->_checkoutSession = $checkoutSession;
44  parent::__construct($context, $data);
45  $this->_isScopePrivate = true;
46  }
47 
53  public function getCheckout()
54  {
55  return $this->_multishipping;
56  }
57 
63  public function getQuote()
64  {
65  return $this->_checkoutSession->getQuote();
66  }
67 
73  public function getVirtualProductEditUrl()
74  {
75  return $this->getUrl('checkout/cart');
76  }
77 
83  public function getVirtualQuoteItems()
84  {
85  $items = [];
86  foreach ($this->getQuote()->getItemsCollection() as $_item) {
87  if ($_item->getProduct()->getIsVirtual() && !$_item->getParentItemId()) {
88  $items[] = $_item;
89  }
90  }
91  return $items;
92  }
93 }
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, \Magento\Checkout\Model\Session $checkoutSession, array $data=[])
Definition: Items.php:36
$_item
Definition: default.phtml:11
$items