/** * @return array */ protected function getItems() { $items = []; foreach ($this->helper->getItemCollection() as $item) { $items[] = ['id' => $item->getId(), 'product_url' => $this->productUrl->getUrl($item), 'name' => $this->outputHelper->productAttribute($item, $item->getName(), 'name'), 'remove_url' => $this->helper->getPostDataRemove($item)]; } return $items; }
/** * Retrieve Exclude Product Ids List for Collection * * @return array */ public function getExcludeProductIds() { $productIds = []; if ($this->_productCompare->hasItems()) { foreach ($this->_productCompare->getItemCollection() as $_item) { $productIds[] = $_item->getEntityId(); } } if ($this->_registry->registry('current_product')) { $productIds[] = $this->_registry->registry('current_product')->getId(); } return array_unique($productIds); }
/** * @see testGetListUrl() for coverage of customer case */ public function testGetItemCollection() { $this->assertInstanceOf('Magento\\Catalog\\Model\\ResourceModel\\Product\\Compare\\Item\\Collection', $this->_helper->getItemCollection()); }