_scopeConfig = $scopeConfig; $this->_purchasedFactory = $purchasedFactory; $this->_itemsFactory = $itemsFactory; parent::__construct( $context, $registry, $taxData, $filesystem, $filterManager, $resource, $resourceCollection, $data ); } /** * Return Purchased link for order item * * @return \Magento\Downloadable\Model\Link\Purchased */ public function getLinks() { $this->_purchasedLinks = $this->_purchasedFactory->create()->load($this->getOrder()->getId(), 'order_id'); $purchasedItems = $this->_itemsFactory->create()->addFieldToFilter( 'order_item_id', $this->getItem()->getOrderItem()->getId() ); $this->_purchasedLinks->setPurchasedItems($purchasedItems); return $this->_purchasedLinks; } /** * Return Links Section Title for order item * * @return string */ public function getLinksTitle() { if ($this->_purchasedLinks->getLinkSectionTitle()) { return $this->_purchasedLinks->getLinkSectionTitle(); } return $this->_scopeConfig->getValue( \Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } }