smartstore / Smartstore

A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 7
http://www.smartstore.com/
GNU Affero General Public License v3.0
1.2k stars 447 forks source link

[Question] Backend data editing in module - where to put the views #931

Closed Algorithman closed 11 months ago

Algorithman commented 11 months ago

Is your feature request related to a problem? Please describe. Since we also have our own data tables implemented, now I wanted to add backend editing in the admin area. I adapted a existing admin controller and put the views in the same structure as in Smartstore.Web.

But the shop doesn't seem to look inside Module folders at all.

InvalidOperationException: The view 'List' was not found. The following locations were searched:
/Areas/Admin/Views/Messetermine/List.cshtml
/Areas/Admin/Views/Shared/List.cshtml
/Views/Shared/List.cshtml

I could copy the files into Smartstore.Web/Areas/Admin/Views (and it does work) but that would defy modularization principles...

Algorithman commented 11 months ago

Bit background info: I essentially copied the CurrencyController (admin) and adapted it to my Domain and Model, adapted the views to represent my fields. The only thing is, the engine does not find my views since it doesn't look into Module folders. Do i need to register it somehow maybe? Where does the resolving happen for publiccontroller views?

Michael-Herzog commented 11 months ago

Maybe it's easier to start with one of our example plugins. This repo als o contains a link to our "unpublisch" documentation where you should find infos about view resolving.

Algorithman commented 11 months ago

The gitbook (https://smartstore.gitbook.io/developer-guide/compose/theming/theme-inheritance#view-resolution) is neat, but it only is for theming. What I need is to add views for the backend, not the frontend.

As for the tutorials: I only see admin controllers for settings. That's not what i want to do. I'm writing a controller for database editing, my settings are covered somewhere else.

Algorithman commented 11 months ago

Ok, I found out why it didn't work: You can't have a theme module which has also admin content... I pulled the data stuff out into a separate module and now it works.