Click or drag to resize

EcommerceCartAfterOrderValidationArgs Class

Provides information after order validation is executed.
Inheritance Hierarchy
SystemObject
  Dynamicweb.Extensibility.NotificationsNotificationArgs
    Dynamicweb.Ecommerce.NotificationsEcommerceCartAfterOrderValidationArgs

Namespace:  Dynamicweb.Ecommerce.Notifications
Assembly:  Dynamicweb.Ecommerce (in Dynamicweb.Ecommerce.dll) Version: 1.10.0
Syntax
public class AfterOrderValidationArgs : NotificationArgs

The EcommerceCartAfterOrderValidationArgs type exposes the following members.

Constructors
  NameDescription
Public methodEcommerceCartAfterOrderValidationArgs
Initializes a new instance of the EcommerceCartAfterOrderValidationArgs class
Top
Properties
  NameDescription
Public propertyOrder
The Order being validated.
Public propertyValidationErrors
A list of validation errors. Add or remove errors from the collection to modify the result of the validation.
Top
Examples
C#
namespace Dynamicweb.Ecommerce.Examples.Notifications.CartV2
{
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterOrderValidation)]
    public class EcomCartAfterOrderValidationObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
        {
            var afterValidationArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterOrderValidationArgs;

            // Add custom validation error
            var validationError = new Dynamicweb.Ecommerce.Orders.Validation.ValidationError();
            validationError.ValidationField = Dynamicweb.Ecommerce.Orders.Validation.ValidationField.GetFieldBySystemName("EcomOrderDeliveryCountry");
            validationError.ErrorMessage = "Error message from notification subscriber";
            afterValidationArgs.ValidationErrors.Add(validationError);
        }
    }
}
See Also