_purchasedFactory = $purchasedFactory; $this->_itemsFactory = $itemsFactory; $this->frontendUrlBuilder = $frontendUrlBuilder; parent::__construct($context, $data); } /** * Enter description here... * * @return Purchased */ public function getLinks() { $this->_purchased = $this->_purchasedFactory->create()->load( $this->getItem()->getOrderItemId(), 'order_item_id' ); $purchasedLinks = $this->_itemsFactory->create()->addFieldToFilter( 'order_item_id', $this->getItem()->getOrderItemId() ); $this->_purchased->setPurchasedItems($purchasedLinks); return $this->_purchased; } /** * @return null|string */ public function getLinksTitle() { return $this->getLinks()->getLinkSectionTitle() ?: $this->_scopeConfig->getValue( Link::XML_PATH_LINKS_TITLE, ScopeInterface::SCOPE_STORE ); } /** * @param Item $item * @return string */ public function getPurchasedLinkUrl($item) { return $this->frontendUrlBuilder->getUrl( 'downloadable/download/link', [ 'id' => $item->getLinkHash(), '_scope' => $this->getOrder()->getStore(), '_secure' => true, '_nosid' => true ] ); } }