Hi,
The simple solution is added at this moment. It is not a good way to do it as it must be through plugins. But at this moment not sure how to do it in plug-in.
\Presentation\Nop.Web\Models\Common\AddressModel.cs1] Add one varibale -> isPinValidationRequired. Add on additional constructor for it.
2] Add constructor getting this as true. in default consturctor make it as false.
\Presentation\Nop.Web\Validators\Common\AddressValidator.cs1]Add additional clause in zipPostalCode checking with Must to check all you pincodes. But When clause is also important with isPinValidationRequired.
2] RuleFor(x => x.ZipPostalCode).NotEmpty().WithMessage(localizationService.GetResource("Account.Fields.ZipPostalCode.Required"));
RuleFor(x => x.ZipPostalCode).Must(checkcodes).When(x => x.isPinValidationRequired).WithMessage("Invalid Shipping pin"));
\Presentation\Nop.Web\Models\Checkout\CheckoutShippingAddressModel.cs1] NewAddress = new AddressModel(true);
\Presentation\Nop.Web\Controllers\CheckoutController.cs1] In existing address addition in PrepareShippingAddress you may restrict the address based on zip validation for shipping
foreach (var address in addresses)
{
var addressModel = new AddressModel();
addressModel.PrepareModel(address,
false,
_addressSettings);
if( Valid with address.zipPostalCode )
model.ExistingAddresses.Add(addressModel);
}
This solution is for people who wants to make only few changes to nop.web.dll and shipping validation will work correctly in 1 hours time. Build the solution and change your Nop.Web.dll
If anyone can help us regarding how to take this code in plugin so that updates will be easier?
Rohit