Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you create an EditorTemplate in a Plugin for nopCommerce v2.20
    primarykey
    data
    text
    <p>I'm trying to create a plugin for nopCommerce v2.20 that allows the user to request a quote for goods and services by describing the requirements and attaching any relevant documents.</p> <p>I have started by using <a href="http://blog.csharpwebdeveloper.com/2011/09/10/writing-a-plugin-for-nopcommerce-2-x/" rel="nofollow">http://blog.csharpwebdeveloper.com/2011/09/10/writing-a-plugin-for-nopcommerce-2-x/</a> as a guide, this has been very good so far. My project is almost identical to the one in the blog post so I'll only add code snippets as I think they are required, so please ask me to expand and provide details if I have left anything important out.</p> <p>Now I want to add a facility to upload multiple files using uploadify and have decided based on the existing code that I should create an EditorTemplate for attachments.</p> <p>My problem is I can't work out how to setup my template in a way that can be located by the MVC framework when I use the following line of code to get the template.</p> <pre><code>@Html.EditorFor(m => m.Attachment)</code></pre> <p>In my model I’m using the UIHintAttribute("Attachments") on the Attachment property to identify the template with no noticeable effect.</p> <p>I have created a folder below the "Views" folder called "EditorTemplates" and added a file called "Attachments.cshtml" with the build action set to "Embedded Resource", contents below:</p> <pre><code>@model int @using Nop.Core; @{ var randomNumber = CommonHelper.GenerateRandomInteger(); var clientId = "download" + randomNumber; var downloadService = EngineContext.Current.Resolve(); var download = downloadService.GetDownloadById(Model); } &lt;div>This is a download control @string.Format("randomNumber = {0}, clientId = {1}, download = {2}", randomNumber, clientId, download);&lt;/div></code></pre> <p>I intend to implement the template once I can get the MVC framework to resolve its location.</p> <p>So is it possible to have an editor template in a plugin (a separate class library from the main project) and if so what do I need to do to enable the MVC framework to resolve my template location?</p> <p>I'd also like to add I'm quite new to MVC, Razor, and nopCommerce, sorry in advance if I missed something obvious.</p> <p>As a side, could you suggest a better title for my question as stackoverflow tells me that it appears subjective?</p> <p>thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload