I'm developing an ecommerce application, using ASP.net MVC 3
Having some trouble figuring out the best way to map "categories"
For each category, I have a root page - that will display some offers, info, etc.. (these are examples)
- /books
- /clothes
- /electronics
Currently, I have a books controller, and a sports controller, and an electronics controller Index of each returns the appropriate view...
This seems a little "clunky" as if a new category is added, we have to create a controller for it..
In the product database, I have categories "flattened" in a hierarchy. So, a book on computing might have:
- /books/
- /books/non-fiction/
- /books/non-fiction/computing
I also have a "search" controller This handles product searching (search/?q=some query) Also, can do search/?q=*&category=/books/non-fiction/computing - this would show all products with /books/non-fiction/computing listed as a category.
So... I think what I'm trying to do... is route the "root" category to show the default view for that category. If there is anything after that, should be treated as a category search...
Is there a way of doing this?