UIHint["Download"] inside plugin

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

I have developed a plugin to import products from a text file.

To submit text file, I've used the DataAnnotation UIHint["Download"] in my model. All is working if I click the upload button and select file from my computer.

But if I select the checkbox "use download url" and fill the text box with the file url, I got this error in the log:

A public action method 'SaveDownloadUrl' was not found on controller 'Nop.Web.Controllers.DownloadController'.

System.Web.HttpException (0x80004005): A public action method 'SaveDownloadUrl' was not found on controller 'Nop.Web.Controllers.DownloadController'. at System.Web.Mvc.Controller.HandleUnknownAction(String actionName) at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

This is because the script in the DiplayTemplate call the method SaveDownloadUrl of the controller Nop.Web.Controllers.DownloadController and it doesn't work if the caller is a plugin.

Is it possible to fix it and put inside relative path to the upload method?

Thanks, Domenico.
8 years ago
Thanks a lot for reporting, Domenico! Fixed
8 years ago
Thank you Andrei!
8 years ago
I've fix the EditorTemplate download.cshtml, and the error are gone.

But I can't understand how to use it if I write the download url.

The downloadId, returned by the display template is 0.

There's any example?

Thanks.
8 years ago
Could you please clarify the question? Do you still experience some issue?
8 years ago
OK, I try to explain.

I've a model with a property like


[UIHint("Download")]
public int DownloadId {get; set;}



In mvc view when I select the file from my computer through the DisplayTemplate "Download", and post the form, in my controller method the property DownloadId I find the id represent the file uploaded id.

Otherwise, if I choose to use the download, I check the checkbox, the write the url and click the upload button, and I get correctly the message "file uploaded" because the fix, but when I submit the form, the property DownloadId is not set, is always 0.

Is the issue clear?
8 years ago
I cannot reproduce this issue. It works fine. An entered download URL is successfully saved (getting "Download object is saved" notification)
8 years ago
Yes, the message is ok.

But how can I get the downloadId after form is submitted?
8 years ago
Download identifier is set to an appropriate property ("DownloadId" in your case) absolutely the same way as it's set when a file is uploaded. It's NOT set to 0 if you save some "Download URL" value. It should have some positive value. It works fine
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.