How can I make a specification attribute required?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 Jahre weitere
Hello!  I have some specification attributes (like these: http://docs.nopcommerce.com/display/en/Specification+attributes) which are required.  I need to be able to prevent an internal user from saving a product if these attributes have a value of 0.

Thanks in advance!
6 Jahre weitere
Alternatively, could I put some code on the edit page that prevents submission if the fields fail validation?
6 Jahre weitere
It's going to require some customization.  Either in the .cshml file, or in the backend via the controller, or with a plugin maybe using an ActionFilter.
6 Jahre weitere
Yes, you need customization fro this. :)

6 Jahre weitere
I was able to accomplish this in a validator:

RuleFor(x => x.Weight).GreaterThan(0).WithMessage("Weight is required.");
RuleFor(x => x.Length).GreaterThan(0).WithMessage("Length is required.");
RuleFor(x => x.Width).GreaterThan(0).WithMessage("Width is required.");
RuleFor(x => x.Height).GreaterThan(0).WithMessage("Height is required.");


That was way easier than I anticipated.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.