Attach downloadable File to Product

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Hi,

I am trying to create a downloadable product.
I attach a downloadble File to the product when the user
has made a purchase. And it should be available for download when user clicks on Order  Details,
but the links provided do not work.
Nop will give me some link with a guid attached but it does not open the file.
example (http://localhost:15536/OnlineTicketHttpG/40679895-b438-447c-833e-6249cfe12e70)

Whats missing. what do I need to write in downloadlink. The physical location  or ...?

 string downloadLink = _webhelper.GetStoreLocation(false) + @"OnlineTicketHttpG/" + orderItem.OrderItemGuid;

                        Nop.Core.Domain.Media.Download ticketDownload = new Download()
                        {
                            DownloadGuid = orderItem.OrderItemGuid,//Guid.NewGuid(),
                            UseDownloadUrl = true,
                            ContentType = "application/pdf",
                            DownloadUrl = downloadLink,
                            Extension = "pdf",                            
                            Filename = "Ticket_" + orderProductId + ".pdf"
                        };

                        _downloadService.InsertDownload(ticketDownload);
5 years ago
You customized the link?



5 years ago
Hello,

You can get more idea from here.

How nopcommerce working with it.

https://prnt.sc/klcgld  and this one.

look at  product controller get method of edit action.


Hope you will understand
5 years ago
wooncherk wrote:
You customized the link?





I wanted it to just open the pdf-file and not show the original filename. I thought that was the guid for. But I did not know what I needed to put in so that its opening. Because when I used a path where the file was stored, it would just give an error. So I wrote a Function to look for it and open it.
It turned out that somehow the route was not working. I moved it to another Controller then it worked.
Can't tell why exactly...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.