Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getImages($cartId)
 {
     $itemData = [];
     /** @see code/Magento/Catalog/Helper/Product.php */
     $items = $this->itemRepository->getList($cartId);
     /** @var \Magento\Quote\Model\Quote\Item $cartItem */
     foreach ($items as $cartItem) {
         $allData = $this->itemPool->getItemData($cartItem);
         $itemData[$cartItem->getItemId()] = $allData['product_image'];
     }
     return $itemData;
 }
Example #2
0
 /**
  * Get array of last added items
  *
  * @return \Magento\Quote\Model\Quote\Item[]
  */
 protected function getRecentItems()
 {
     $items = [];
     if (!$this->getSummaryCount()) {
         return $items;
     }
     foreach (array_reverse($this->getAllQuoteItems()) as $item) {
         /* @var $item \Magento\Quote\Model\Quote\Item */
         if (!$item->getProduct()->isVisibleInSiteVisibility()) {
             $productId = $item->getProduct()->getId();
             $products = $this->catalogUrl->getRewriteByProductStore([$productId => $item->getStoreId()]);
             if (!isset($products[$productId])) {
                 continue;
             }
             $urlDataObject = new \Magento\Framework\DataObject($products[$productId]);
             $item->getProduct()->setUrlDataObject($urlDataObject);
         }
         $items[] = $this->itemPoolInterface->getItemData($item);
     }
     return $items;
 }