cyberspy wrote:Also, out of curiosity, how do you even do this, force a method to keep the same signature? All the other places that call this controller action are quite happy with it - they do not break at run time, so this 'feature' must have been explicitly encoded. How is this done?
Thanks & Regards
Adam
Hi Adam,
Thank you for explaining what you are trying to achieve!
Please note that you can change whatever method in nopCommerce without any problems BUT not all changes are good to the plugins as some of the changes can break them. Basically some of the controllers of our plugins i.e
JCarouselController, inherit from the nopCommerce
CatalogController. We do this as we reuse the building of the product overview models. So when we compile our plugins they know exactly what the signature of the
protected PrepareProductOverviewModels method of the
Catalog controller is. Unfortunately adding an optional parameter to a method is a
breaking change since it will require recompiling of all the dlls (plugins) that uses it. If we were to use a custom method for preparing the models and we didn't use the PrepareProductOverviewModels method then you wouldn't be able to change how the model is built at all. So now you can change the logic in this method of how the model is built and the same logic will be used everywhere in the store and the plugins. This I think is the right way to be done. You also have all the MVC extensibility points like ActionFilters etc.
I think the best way to approach this without writing too much code is to have both images in the PictureModel. This model has a dictionary CustomProperties that you can use to store the second image and then in the Razor views you can get the second image from the CustomProperties where necessary.
Hope this helps!
Best Regards,
Nop-Templates.com Support Team