I agree that it would be best to do it when I prepare the model, is there anyway to do that without changing the plugin source? Just to clarify, everything works correctly when I go to a category, the correct picture for that category is chosen. It is only when I apply a filter, then it just returns the first product picture, because obviously the plugin doesn't know about my new functionality.
I was looking at _ProductBox to do an ajax call or something, but I won't have the categoryId in ProductOverviewModel if the model is prepared through the plugin. One thing I thought was before the call to @Html.Partial("_ProductBox", product, maybe set product.CategoryId equal to the CategoryModel's id. Does this plugin use the normal CategoryTemplate.ProductsInGridOrLines view, or is there a separate view that I would have to change this in? Thanks for your help.
So I made some functionality to assign an image to the Product-Category mapping so when you view a category, you can get specific pictures to show as the default. (I sort of cloned "PrepareProductOverviewModels" to take a categoryId so that it can choose which image it should show). My problem is the ajax filters plugin obviously ignores the categoryId. Without having the source, is there anything that I can do to get the plugin to include this functionality? When I added the categoryId to "PrepareProductOverviewModels", I noticed it broke the plugin(because of signature I'm guessing), so is there any way to get your plugin to call my other version of "PrepareProductOverviewModels" with the categoryId?
This started as a PM, so here's Boyko's response...
Please refer to this post of how to properly modify the CatalogController without making any breaking changes, so that the Filters can work.
Thanks for the response Boyko, but I was able to make the change without breaking the plugin (I have two functions that both funnel to a third one). My question was more if there is any way to get the plugin to utilize my version with the categoryId. Since I can't modify the source to call my version with the extra categoryId parameter, can something be done in the views? Maybe an ajax call that passes the productId and categoryId to swap out the images? My question with that is where can I even access the categoryId from? Any ideas here? Thanks.