as the title suggests. I would like to create a download link to the uploaded file on a downloadable product.
I already have access to the downloadable product and call call the getLinkFile() that returns something like "a/b/file_name.pdf". However I am stuck on creating a link that will allow the customer to download the file.
All downloadables do not have price and customers do not need to purchase them. I am just looking at a way to provide these files (we are using downloadables due to another reason and require these links as a work around).
If you need anymore info I am happy to provide. Thank you for any help.
Best Answer
I was able to work out what I needed to do and I thought I would share my result.
Within Magento_Downloadable I found that Link class passes the downloadable link information to the Download class by calling Downloads' _processDownload() method.
Link class: {magento_directory}vendor/magento/module-downloadable/Controller/Download/Link.php
Download class: {magento_directory}vendor/magento/module-downloadable/Controller/Download.php
Knowing this I just extended the Download class in my own module as a new Controller and created my own frontend route to it. All I need to do is pass to _processDownload the 2 parameters, link and link type and it works.