Custom product validation

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hi, I'm trying to add some additional validation to the product admin page.

I could modify the ProductValidator directly, however, I need to reference code within my plugin, which I can't access from the core ProductValidator.

Is there a way I can create my own ProductValidator within my plugin and get the admin page to use mine rather than the default? Alternatively, is it possible to extend the default ProductValidator from my plugin?
12 years ago
Just a shot in the dark, but...
have you tried adding (injecting) another param to the ProductValidator  - IPluginFinder pluginFinder ?
12 years ago
Hi New York, thanks for your response.

I'm not sure if that's going to help me. I need access to a custom service which is defined within my plugin. So really I would need to add my custom service as a parameter of the ProductValidator, but Nop.Admin can't see my plugin code.
12 years ago
Scrooby wrote:
but Nop.Admin can't see my plugin code.


That's why you use pluginfinder.  Find your plugin by Name, and then call your method on the plugin<T> instance

look at ShippingService.cs,  LoadShippingRateComputationMethodBySystemName
12 years ago
Hi Noptools,

I see what you're saying, I've been able to get an instance of my plugin, but how would I get an instance of my custom service (called IUrlSlugService) from the plugin instance?
12 years ago
Yea, I guess you won't be able to do that.  Looks like you need to put your Interface in .Core
Or, create a more "generic" interface like...

@nopC team,
Maybe we need some type of IExecutePlugin having an Execute method similar to Microsoft Dynamics Plugin

      public void Execute(IPluginExecutionContext context)


This would also allow for inter-plugin communication.
7 years ago
Hi,i am trying to add some validation for Admin and customers block like(Name,Contact Number and others ).how we can add validation for ADD NEW PRODUCT.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.