cancel
Showing results for 
Search instead for 
Did you mean: 

Download button for customer Magento 2.4

Download button for customer Magento 2.4

Hi,

 

I've run into a problem when creating a button to download pdf file from custom tab on the product page. While I don't really think place matters, as it probably wouldn't work anywhere.

 

Anyway what I'm trying to achieve:

 

I have custom tabs for some of my products.

On these tabs I'd like to have buttons which will allow customer download files.

Files will be small pdf's around 200-500 kb.

Tabs will have from 1 to probably 10 files each.

 

I did create such button with code:

<style>
.btn {
  border: none;
  color: white;
  padding: 12px 30px;
  cursor: pointer;
  font-size: 20px;
  width: 200px;
}

.btn:hover {
  background-color: #626d70;
}
</style>
<h2>Lorem Ipsum</h2><br>
<p><button class="btn">Button 1</button></p>
<p-><button class="btn">Button 2</button></p>

It works as intended.

However if I add "a href download" it wont work. 

The files are labeled as missing/broken (not sure because my browser is not in english)

 

So I have two questions. 

 

Is it possible to use such simple html to create downloadable files in magento? 

Where should I store such files? I used /pub/media/custom folder path but I also tried different one.

 

I know there are extensions that allow this, but I don't know why this shouldn't work.