Hi,

I have on my product detail page a check box that you can use to select the quantity that you want to order.
So 25, 50, 75 ... When this checkbox is selected i update the amount ordered in Amount (input field).
I have modified _ProductAttributes.cshtml and added the following lines to have the amount update. I have added these lines in function @(adjustmentFuncName) in the for loop in the first part of the if.


                var checkbox = document.getElementById(i);
        var nextSibling = checkbox.nextSibling;
        while(nextSibling && nextSibling.nodeType != 1) {
          nextSibling = nextSibling.nextSibling
        }

        var input = document.getElementById("price_"+i.split('_')[2]+"_EnteredQuantity")
        input.value = nextSibling.innerHTML.split('[')[0].trim();


Until there everything is fine, it works perfectly.
Now i would like to create a plugin that would add this functionality so if i want to apply it on another nopcommerce website, i will not have to recompile the solution.
I have created a plugin, added the modified _ProductAttribute.cshtml in the view and modified _ProductVariantLine.cshtml so that it calls my modified page and not the original one. The first line below is the original call, the second line is the call to my modified page.


        //@Html.Partial("_ProductAttributes", Model.ProductVariantAttributes, dataDictAttributes)  
        @Html.Partial("Nop.Plugin.Misc.PeerUpdateAmount.Views.Settings.Index", Model.ProductVariantAttributes, dataDictAttributes)    


I didn't find any other way to do it, but for me this doesn't change the problem i still have to make change in the code and compile the nopcommerce solution.
Is there a way for me to add this functionality without modifying the code, just with a plugin?
I am new to mvc so even after different search i couldn't find a way.

I tried to add the path to my plugin to AreaPartialViewLocationFormats in ThemeableVirtualPathProviderViewEngine at the install of my plugin, hoping that my product page would be loaded instead of the original one. I have placed my path as the first one in the list. It is well added but as ThemeableVirtualPathProviderViewEngine is reinitialized after the install i lose my value. I them, just to see if it would work, try to add it to ThemeableRazorViewEngine. It try to load my page alright but i have a HttpCompileException - the name model doesn't not exist in the current context. I had to change the copy to output to 'Copy Always', the build action is 'Embedded Resource.
Anyway that was just an attempt, as i had to add my path in the ThemeableRazorViewEngine, it doesn't change my problem, it is not really a standalone plugin.


I thank you in advance for your help.

Have a nice day,

NR