Close

7spikes View Engine is intercepting partial view lookup

jirwin
4 years ago
#13326 Quote
Avatar
  • 8
Hello,
I was hoping you could help me with an issue I'm having. This isn't an issue with 7spikes code, per se, but the Nop Element theme is indirectly causing an issue that I'm hoping you have encountered.

I wrote a plugin and am overriding a partial view (_OrderDetails.Shipping). Note: this partial view resides in the admin portion of the site, and is not accessed from Nop.Web. I've taken the standard steps of adding a custom view engine and injected it so that it is the first ViewEngine that MVC finds. When I run this without the 7spikes Element/Code/etc. plugins installed, I see the correct content, for example:

http://imgur.com/a/n1zkU

However, when I install the Element theme (and accompanying 7spikes plugins) I see the original partial view without my changes. With the help of Glimpse I can see the View location is being provided by the ViewEngine7Spikes view engine, and not my own:

http://imgur.com/a/js1tZ

Removing these plugins results in me seeing my partial view again. Since the Element theme does not alter the admin site in any way, I'm wondering if it is possible to create exceptions so that the 7spikes ViewEngine does not intercept admin controller and partial view requests. I'm sure you're well seasoned in doing so, but the following guide outlines the process I followed and can be used to reproduce the issue:

http://alexwolfthoughts.com/overriding-nopcommerce-admin-views-and-partial-views/


Any insight is greatly appreciated,
Thank you
hristian.dimov
4 years ago
#13327 Quote
Avatar
  • Moderator
  • 386
jirwin wrote:
Hello,
I was hoping you could help me with an issue I'm having. This isn't an issue with 7spikes code, per se, but the Nop Element theme is indirectly causing an issue that I'm hoping you have encountered.

I wrote a plugin and am overriding a partial view (_OrderDetails.Shipping). Note: this partial view resides in the admin portion of the site, and is not accessed from Nop.Web. I've taken the standard steps of adding a custom view engine and injected it so that it is the first ViewEngine that MVC finds. When I run this without the 7spikes Element/Code/etc. plugins installed, I see the correct content, for example:

http://imgur.com/a/n1zkU

However, when I install the Element theme (and accompanying 7spikes plugins) I see the original partial view without my changes. With the help of Glimpse I can see the View location is being provided by the ViewEngine7Spikes view engine, and not my own:

http://imgur.com/a/js1tZ

Removing these plugins results in me seeing my partial view again. Since the Element theme does not alter the admin site in any way, I'm wondering if it is possible to create exceptions so that the 7spikes ViewEngine does not intercept admin controller and partial view requests. I'm sure you're well seasoned in doing so, but the following guide outlines the process I followed and can be used to reproduce the issue:

http://alexwolfthoughts.com/overriding-nopcommerce-admin-views-and-partial-views/


Any insight is greatly appreciated,
Thank you


Hi,

you can follow this example - https://www.nop-templates.com/boards/topic/3135/working-with-another-plugin#13316

So, basically, if your ViewEngine is registered at position 0, your views will be always found first before any other view engine.

Hope this helps!
Regards,
Hristian Dimov
Nop-Templates.com
jirwin
4 years ago
#13333 Quote
Avatar
  • 8
That was the missing piece. Thank you so much for your quick response!