Table of Contents

Class Ecommerce.Cart

Namespace
Dynamicweb.Ecommerce.Notifications
Assembly
Dynamicweb.Ecommerce.dll

Provides notification names for Ecommerce cart.

public sealed class Ecommerce.Cart
Inheritance
Ecommerce.Cart
Inherited Members

Examples

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dynamicweb.Ecommerce.Examples.Notifications
{
    /// <summary>
    /// Subscribing on Cart.Created event
    /// </summary>
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.Created)]
    public class EcomCartCreatedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        /// <summary>
        /// This notification is thrown every time a cart is created. The notification appears when user adds first product to the cart.
        /// </summary>
        /// <param name="notification"></param>
        /// <param name="args"></param>
        public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
        {
            if (args == null || !(args is Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CreatedArgs))
                return;
            Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CreatedArgs cArgs = (Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CreatedArgs)args;
            List<Dynamicweb.Ecommerce.Shops.Shop> shops = new List<Dynamicweb.Ecommerce.Shops.Shop>(Dynamicweb.Ecommerce.Services.Shops.GetShops());

            if (shops == null || shops.Count == 0)
                return;

            cArgs.Order.ShopId = shops[0].Id;
            Services.Orders.Save(cArgs.Order);
        }
    }
}

Remarks

The passed NotificationArgs is Ecommerce.Cart.CreatedArgs

Fields

AfterCustomFieldValueIsChanged

This notification is broadcast after a Custom Order Field is set. This notification is only broadcast if the Custom Order Field value has been changed.

public const string AfterCustomFieldValueIsChanged = "Ecom7CartAfterCustomFieldValueIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsChanged)]
      public class EcomCartAfterCustomFieldValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsChangedArgs afterCustomFieldValueIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsChangedArgs;

              //Add code here
          }
      }
  }

AfterCustomFieldValueIsSet

This notification is broadcast after a Custom Order Field is set. This notification is always broadcast when a Custom Order Field value is set.

public const string AfterCustomFieldValueIsSet = "Ecom7CartAfterCustomFieldValueIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsSet)]
      public class EcomCartAfterCustomFieldValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsSetArgs afterCustomFieldValueIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsSetArgs;

              //Add code here
          }
      }
  }

AfterCustomerAcceptedValueIsChanged

This notification is broadcast after Customer Accepted value is set. This notification is only broadcast if the Customer Accepted value has been changed.

public const string AfterCustomerAcceptedValueIsChanged = "Ecom7CartAfterCustomerAcceptedValueIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsChanged)]
      public class EcomCartAfterCustomerAcceptedValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsChangedArgs afterCustomerAcceptedValueIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsChangedArgs;

              //Add code here
          }
      }
  }

AfterCustomerAcceptedValueIsSet

This notification is broadcast after Customer Accepted value is set. This notification is always broadcast when the Customer Accepted value is set.

public const string AfterCustomerAcceptedValueIsSet = "Ecom7CartAfterCustomerAcceptedValueIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsSet)]
      public class EcomCartAfterCustomerAcceptedValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsSetArgs afterCustomerAcceptedValueIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsSetArgs;

              //Add code here
          }
      }
  }

AfterCustomerCountryIsChanged

This notification is broadcast after Country is set. This notification is only broadcast if Country has been changed by the user.

public const string AfterCustomerCountryIsChanged = "Ecom7CartAfterCustomerCountryIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsChanged)]
      public class EcomCartAfterCustomerCountryIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsChangedArgs afterCustomerCountryIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsChangedArgs;

              //Add code here
          }
      }
  }

AfterCustomerCountryIsSet

This notification is broadcast after Country is set. This notification is always broadcast when a Country is set by the user.

public const string AfterCustomerCountryIsSet = "Ecom7CartAfterCustomerCountryIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsSet)]
      public class EcomCartAfterCustomerCountryIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsSetArgs afterCustomerCountryIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsSetArgs;

              //Add code here
          }
      }
  }

AfterDefaultPropertiesValueIsChanged

This notification is broadcast after a Default Order Property is set. This notification is only broadcast if the Default Order Property value has changed.

public const string AfterDefaultPropertiesValueIsChanged = "Ecom7CartAfterDefaultPropertiesValueIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDefaultPropertiesValueIsChanged)]
      public class EcomCartAfterDefaultPropertiesValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDefaultPropertiesValueIsChangedArgs afterDefaultPropertiesValueIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDefaultPropertiesValueIsChangedArgs;

              //Add code here
          }
      }
  }

AfterDefaultPropertiesValueIsSet

This notification is broadcast after a Default Order Property is set. This notification is always broadcast when a Default Order Property is set.

public const string AfterDefaultPropertiesValueIsSet = "Ecom7CartAfterDefaultPropertiesValueIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDefaultPropertiesValueIsSet)]
      public class EcomCartAfterDefaultPropertiesValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDefaultPropertiesValueIsSetArgs afterDefaultPropertiesValueIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDefaultPropertiesValueIsSetArgs;

              //Add code here
          }
      }
  }

AfterDeliveryCountryIsChanged

This notification is broadcast after Delivery Country is set. This notification is only broadcast if Delivery Country has been changed by the user.

public const string AfterDeliveryCountryIsChanged = "Ecom7CartAfterDeliveryCountryIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsChanged)]
      public class EcomCartAfterDeliveryCountryIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsChangedArgs afterDeliveryCountryIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsChangedArgs;

              //Add code here
          }
      }
  }

AfterDeliveryCountryIsSet

This notification is broadcast after Delivery Country is set. This notification is always broadcast when a Delivery Country is set by the user.

public const string AfterDeliveryCountryIsSet = "Ecom7CartAfterDeliveryCountryIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsSet)]
      public class EcomCartAfterDeliveryCountryIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsSetArgs afterDeliveryCountryIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsSetArgs;

              //Add code here
          }
      }
  }

AfterNewsletterSubscriptionValueIsChanged

This notification is broadcast after Newsletter Subscription is set. This notification is only broadcast if the Newsletter Subscription value has been changed.

public const string AfterNewsletterSubscriptionValueIsChanged = "Ecom7CartAfterNewsletterSubscriptionValueIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsChanged)]
      public class EcomCartAfterNewsletterSubscriptionValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsChangedArgs afterNewsletterSubscriptionValueIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsChangedArgs;

              //Add code here
          }
      }
  }

AfterNewsletterSubscriptionValueIsSet

This notification is broadcast after Newsletter Subscription is set. This notification is always broadcast when the Newsletter Subscription value is set.

public const string AfterNewsletterSubscriptionValueIsSet = "Ecom7CartAfterNewsletterSubscriptionValueIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsSet)]
      public class EcomCartAfterNewsletterSubscriptionValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsSetArgs afterNewsletterSubscriptionValueIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsSetArgs;

              //Add code here
          }
      }
  }

AfterOrderValidation

Occurs after order validation is executed.

public const string AfterOrderValidation = "Ecom7CartAfterOrderValidation"

Field Value

string

Remarks

The passed NotificationArgs is Ecommerce.Cart.AfterOrderValidationArgs

AfterPaymentIsReset

This notification is broadcast after PaymentMethod is reset. This notification is only broadcast if the current PaymentMethod is not available for the current Country/DeliveryCountry.

public const string AfterPaymentIsReset = "Ecom7CartAfterPaymentIsReset"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentIsReset)]
      public class EcomCartAfterPaymentIsResetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentIsResetArgs afterPaymentIsResetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentIsResetArgs;

              //Add code here
          }
      }
  }

AfterPaymentMethodIsChanged

This notification is broadcast after PaymentMethod is set. This notification is only broadcast if PaymentMethod has been changed by the user.

public const string AfterPaymentMethodIsChanged = "Ecom7CartAfterPaymentMethodIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentMethodIsChanged)]
      public class EcomCartAfterPaymentMethodIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentMethodIsChangedArgs afterPaymentMethodIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentMethodIsChangedArgs;

              //Add code here
          }
      }
  }

AfterPaymentMethodIsSet

This notification is broadcast after payment method is set. This notification is always broadcast when a PaymentMethod is set by the user.

public const string AfterPaymentMethodIsSet = "Ecom7CartAfterPaymentMethodIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentMethodIsSet)]
      public class EcomCartAfterPaymentMethodIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentMethodIsSetArgs afterPaymentMethodIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentMethodIsSetArgs;

              //Add code here
          }
      }
  }

AfterRecurringOrderPlaced

This notification is broadcast when new recurring order is just placed.

public const string AfterRecurringOrderPlaced = "Ecom7CartAfterRecurringOrderPlaced"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterRecurringOrderPlaced)]
      public class EcomCartAfterRecurringOrderPlacedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterRecurringOrderPlacedArgs afterRecurringOrderPlacedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterRecurringOrderPlacedArgs;

              //Add code here
          }
      }
  }

AfterShippingCalculation

Occurs just after shipping calculation is executed.

public const string AfterShippingCalculation = "Ecom7CartAfterShippingCalculation"

Field Value

string

AfterShippingIsReset

This notification is broadcast after ShippingMethod is reset. This notification is only broadcast if the current ShippingMethod is not available for the current Country/DeliveryCountry.

public const string AfterShippingIsReset = "Ecom7CartAfterShippingIsReset"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterShippingIsReset)]
      public class EcomCartAfterShippingIsResetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterShippingIsResetArgs afterShippingIsResetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterShippingIsResetArgs;

              //Add code here
          }
      }
  }

AfterShippingMethodIsChanged

This notification is broadcast after ShippingMethod is set. This notification is only broadcast if ShippingMethod has been changed by the user.

public const string AfterShippingMethodIsChanged = "Ecom7CartAfterShippingMethodIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterShippingMethodIsChanged)]
      public class EcomCartAfterShippingMethodIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterShippingMethodIsChangedArgs afterShippingMethodIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterShippingMethodIsChangedArgs;

              //Add code here
          }
      }
  }

AfterShippingMethodIsSet

This notification is broadcast after ShippingMethod is set. This notification is always broadcast when a ShippingMethod is set by the user.

public const string AfterShippingMethodIsSet = "Ecom7CartAfterShippingMethodIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterShippingMethodIsSet)]
      public class EcomCartAfterShippingMethodIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterShippingMethodIsSetArgs afterShippingMethodIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterShippingMethodIsSetArgs;

              //Add code here
          }
      }
  }

BeforeAddressValidation

Occurs just before address validation is executed.

public const string BeforeAddressValidation = "Ecom7CartBeforeAddressValidation"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;
using CartNotifications = Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart;

namespace Dynamicweb.Ecommerce.Examples.Notifications
{
    [Subscribe(CartNotifications.BeforeAddressValidation)]
    public class EcomCartOnBeforeAddressValidationObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            var beforeAddressValidationArgs = args as CartNotifications.BeforeAddressValidationArgs;
            // Skip address validation for countries other than US
            if (beforeAddressValidationArgs.Order.DeliveryCountryCode != "US")
            {
                beforeAddressValidationArgs.Cancel = true;
            }
        }
    }
}

BeforeCheckoutStep

This notification is broadcast just before the Order is passed to the checkout step.

public const string BeforeCheckoutStep = "Ecom7CartBeforeCheckoutHandler"

Field Value

string

Examples

namespace Dynamicweb.Ecommerce.Examples.Notifications;

[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeCheckoutStep)]
public class EcomCartOrderBeforeCheckoutStepObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
    public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
    {
        if (args is not Ecommerce.Notifications.Ecommerce.Cart.BeforeCheckoutStepArgs notificationArgs)
            return;

        //Add code here
    }
}

BeforeCustomFieldValueIsChanged

This notification is broadcast before a Custom Order Field is set. This notification is only broadcast if the Custom Order Field value has been changed.

public const string BeforeCustomFieldValueIsChanged = "Ecom7CartBeforeCustomFieldValueIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomFieldValueIsChanged)]
      public class EcomCartBeforeCustomFieldValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomFieldValueIsChangedArgs beforeCustomFieldValueIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomFieldValueIsChangedArgs;

              //Add code here
          }
      }
  }

BeforeCustomFieldValueIsSet

This notification is broadcast before a Custom Order Field is set. This notification is always broadcast when a Custom Order Field value is set.

public const string BeforeCustomFieldValueIsSet = "Ecom7CartBeforeCustomFieldValueIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomFieldValueIsSet)]
      public class EcomCartBeforeCustomFieldValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomFieldValueIsSetArgs beforeCustomFieldValueIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomFieldValueIsSetArgs;

              //Add code here
          }
      }
  }

BeforeCustomerAcceptedValueIsChanged

This notification is broadcast before Customer Accepted value is set. This notification is only broadcast if the Customer Accepted value has been changed.

public const string BeforeCustomerAcceptedValueIsChanged = "Ecom7CartBeforeCustomerAcceptedValueIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerAcceptedValueIsChanged)]
      public class EcomCartBeforeCustomerAcceptedValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerAcceptedValueIsChangedArgs beforeCustomerAcceptedValueIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerAcceptedValueIsChangedArgs;

              //Add code here
          }
      }
  }

BeforeCustomerAcceptedValueIsSet

This notification is broadcast before Customer Accepted value is set. This notification is always broadcast when the Customer Accepted value is set.

public const string BeforeCustomerAcceptedValueIsSet = "Ecom7CartBeforeCustomerAcceptedValueIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerAcceptedValueIsSet)]
      public class EcomCartBeforeCustomerAcceptedValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerAcceptedValueIsSetArgs beforeCustomerAcceptedValueIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerAcceptedValueIsSetArgs;

              //Add code here
          }
      }
  }

BeforeCustomerCountryIsChanged

This notification is broadcast before Country is set. This notification is only broadcast if Country has been changed by the user.

public const string BeforeCustomerCountryIsChanged = "Ecom7CartBeforeCustomerCountryIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerCountryIsChanged)]
      public class EcomCartBeforeCustomerCountryIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerCountryIsChangedArgs beforeCustomerCountryIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerCountryIsChangedArgs;

              //Add code here
          }
      }
  }

BeforeCustomerCountryIsSet

This notification is broadcast before Country is set. This notification is always broadcast when a Country is set by the user.

public const string BeforeCustomerCountryIsSet = "Ecom7CartBeforeCustomerCountryIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerCountryIsSet)]
      public class EcomCartBeforeCustomerCountryIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerCountryIsSetArgs beforeCustomerCountryIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerCountryIsSetArgs;

              //Add code here
          }
      }
  }

BeforeDefaultPropertiesValueIsChanged

This notification is broadcast before a Default Order Property is set. This notification is only broadcast if the Default Order Property value has changed.

public const string BeforeDefaultPropertiesValueIsChanged = "Ecom7CartBeforeDefaultPropertiesValueIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDefaultPropertiesValueIsChanged)]
      public class EcomCartBeforeDefaultPropertiesValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDefaultPropertiesValueIsChangedArgs beforeDefaultPropertiesValueIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDefaultPropertiesValueIsChangedArgs;

              //Add code here
          }
      }
  }

BeforeDefaultPropertiesValueIsSet

This notification is broadcast before a Default Order Property is set. This notification is always broadcast when a Default Order Property is set.

public const string BeforeDefaultPropertiesValueIsSet = "Ecom7CartBeforeDefaultPropertiesValueIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDefaultPropertiesValueIsSet)]
      public class EcomCartBeforeDefaultPropertiesValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDefaultPropertiesValueIsSetArgs beforeDefaultPropertiesValueIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDefaultPropertiesValueIsSetArgs;

              //Add code here
          }
      }
  }

BeforeDeliveryCountryIsChanged

This notification is broadcast before Delivery Country is set. This notification is only broadcast if Delivery Country has been changed by the user.

public const string BeforeDeliveryCountryIsChanged = "Ecom7CartBeforeDeliveryCountryIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDeliveryCountryIsChanged)]
      public class EcomCartBeforeDeliveryCountryIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDeliveryCountryIsChangedArgs beforeDeliveryCountryIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDeliveryCountryIsChangedArgs;

              //Add code here
          }
      }
  }

BeforeDeliveryCountryIsSet

This notification is broadcast before Delivery Country is set. This notification is always broadcast when a Delivery Country is set by the user.

public const string BeforeDeliveryCountryIsSet = "Ecom7CartBeforeDeliveryCountryIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDeliveryCountryIsSet)]
      public class EcomCartBeforeDeliveryCountryIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDeliveryCountryIsSetArgs beforeDeliveryCountryIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeDeliveryCountryIsSetArgs;

              //Add code here
          }
      }
  }

BeforeNewsletterSubscriptionValueIsChanged

This notification is broadcast before Newsletter Subscription is set. This notification is only broadcast if the Newsletter Subscription value has been changed.

public const string BeforeNewsletterSubscriptionValueIsChanged = "Ecom7CartBeforeNewsletterSubscriptionValueIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeNewsletterSubscriptionValueIsChanged)]
      public class EcomCartBeforeNewsletterSubscriptionValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeNewsletterSubscriptionValueIsChangedArgs beforeNewsletterSubscriptionValueIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeNewsletterSubscriptionValueIsChangedArgs;

              //Add code here
          }
      }
  }

BeforeNewsletterSubscriptionValueIsSet

This notification is broadcast before Newsletter Subscription is set. This notification is always broadcast when the Newsletter Subscription value is set.

public const string BeforeNewsletterSubscriptionValueIsSet = "Ecom7CartBeforeNewsletterSubscriptionValueIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeNewsletterSubscriptionValueIsSet)]
      public class EcomCartBeforeNewsletterSubscriptionValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeNewsletterSubscriptionValueIsSetArgs beforeNewsletterSubscriptionValueIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeNewsletterSubscriptionValueIsSetArgs;

              //Add code here
          }
      }
  }

BeforeOrderValidation

Occurs before order validation is executed.

public const string BeforeOrderValidation = "Ecom7CartBeforeOrderValidation"

Field Value

string

Remarks

The passed NotificationArgs is Ecommerce.Cart.BeforeOrderValidationArgs

BeforePaymentIsReset

This notification is broadcast before PaymentMethod is reset. This notification is only broadcast if the current PaymentMethod is not available for the current Country/DeliveryCountry.

public const string BeforePaymentIsReset = "Ecom7CartBeforePaymentIsReset"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentIsReset)]
      public class EcomCartBeforePaymentIsResetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentIsResetArgs beforePaymentIsResetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentIsResetArgs;

              //Add code here
          }
      }
  }

BeforePaymentMethodIsChanged

This notification is broadcast before PaymentMethod is set. This notification is only broadcast if PaymentMethod has been changed by the user.

public const string BeforePaymentMethodIsChanged = "Ecom7CartBeforePaymentMethodIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentMethodIsChanged)]
      public class EcomCartBeforePaymentMethodIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentMethodIsChangedArgs beforePaymentMethodIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentMethodIsChangedArgs;

              //Add code here
          }
      }
  }

BeforePaymentMethodIsSet

This notification is broadcast before payment method is set. This notification is always broadcast when a PaymentMethod is set by the user.

public const string BeforePaymentMethodIsSet = "Ecom7CartBeforePaymentMethodIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentMethodIsSet)]
      public class EcomCartBeforePaymentMethodIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentMethodIsSetArgs beforePaymentMethodIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentMethodIsSetArgs;

              //Add code here
          }
      }
  }

BeforePlaceRecurringOrder

This notification is broadcast when new recurring is about to be placed.

public const string BeforePlaceRecurringOrder = "Ecom7CartBeforePlaceRecurringOrder"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePlaceRecurringOrder)]
      public class EcomCartBeforePlaceRecurringOrderObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePlaceRecurringOrderArgs beforePlaceRecurringOrderArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforePlaceRecurringOrderArgs;

              //Add code here
          }
      }
  }

BeforeRemovingNonExistingProducts

This notification is broadcast just before Non-existing products are removed.

public const string BeforeRemovingNonExistingProducts = "Ecom7CartBeforeRemovingNonExistingProducts"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeRemovingNonExistingProducts)]
      public class EcomCartBeforeRemovingNonExistingProductsObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeRemovingNonExistingProductsArgs beforeRemovingNonExistingProductsArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeRemovingNonExistingProductsArgs;

              //Add code here
          }
      }
  }

BeforeRenderingEmptyCart

This notification is broadcast just before an empty cart is rendered.

public const string BeforeRenderingEmptyCart = "Ecom7CartBeforeRenderingEmptyCart"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeRenderingEmptyCart)]
      public class EcomCartBeforeRenderingEmptyCartObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeRenderingEmptyCartArgs beforeRenderingEmptyCartArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeRenderingEmptyCartArgs;

              //Add code here
          }
      }
  }

BeforeRenderingNewStep

This notification is broadcast just before a new step is rendered.

public const string BeforeRenderingNewStep = "Ecom7CartBeforeRenderingNewStep"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeRenderingNewStep)]
      public class EcomCartBeforeRenderingNewStepObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeRenderingNewStepArgs beforeRenderingNewStepArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeRenderingNewStepArgs;

              //Add code here
          }
      }
  }

BeforeShippingCalculation

Occurs just before shipping calculation is executed.

public const string BeforeShippingCalculation = "Ecom7CartBeforeShippingCalculation"

Field Value

string

BeforeShippingIsReset

This notification is broadcast before ShippingMethod is reset. This notification is only broadcast if the current ShippingMethod is not available for the current Country/DeliveryCountry.

public const string BeforeShippingIsReset = "Ecom7CartBeforeShippingIsReset"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingIsReset)]
      public class EcomCartBeforeShippingIsResetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingIsResetArgs beforeShippingIsResetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingIsResetArgs;

              //Add code here
          }
      }
  }

BeforeShippingMethodIsChanged

This notification is broadcast before ShippingMethod is changed. This notification is only broadcast if ShippingMethod has been changed by the user.

public const string BeforeShippingMethodIsChanged = "Ecom7CartBeforeShippingMethodIsChanged"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingMethodIsChanged)]
      public class EcomCartBeforeShippingMethodIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingMethodIsChangedArgs beforeShippingMethodIsChangedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingMethodIsChangedArgs;

              //Add code here
          }
      }
  }

BeforeShippingMethodIsSet

This notification is broadcast before ShippingMethod is set. This notification is always broadcast when a ShippingMethod is set by the user.

public const string BeforeShippingMethodIsSet = "Ecom7CartBeforeShippingMethodIsSet"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingMethodIsSet)]
      public class EcomCartBeforeShippingMethodIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingMethodIsSetArgs beforeShippingMethodIsSetArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingMethodIsSetArgs;

              //Add code here
          }
      }
  }

CheckoutDone

This notification is broadcast when the Order is passed back from the CheckoutHandler.

public const string CheckoutDone = "Ecom7CartCheckoutDone"

Field Value

string

CheckoutDoneOrderIsComplete

This notification is broadcast when the Order is passed back from CheckoutHandler and is complete.

public const string CheckoutDoneOrderIsComplete = "Ecom7CartCheckoutDoneOrderIsComplete"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CheckoutDoneOrderIsComplete)]
      public class EcomCartCheckoutDoneOrderIsCompleteObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CheckoutDoneOrderIsCompleteArgs checkoutDoneOrderIsCompleteArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CheckoutDoneOrderIsCompleteArgs;

              //Add code here
          }
      }
  }

CheckoutDoneOrderIsNotComplete

This notification is broadcast when the Order is passed back from CheckoutHandler and is not complete.

public const string CheckoutDoneOrderIsNotComplete = "Ecom7CartCheckoutDoneOrderIsNotComplete"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CheckoutDoneOrderIsNotComplete)]
      public class EcomCartCheckoutDoneOrderIsNotCompleteObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CheckoutDoneOrderIsNotCompleteArgs checkoutDoneOrderIsNotCompleteArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CheckoutDoneOrderIsNotCompleteArgs;

              //Add code here
          }
      }
  }

Created

This notification is thrown every time a cart is created. The notification appears when user adds first product to the cart.

public const string Created = "DWN_ECOM_CART_CREATED"

Field Value

string

Examples

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dynamicweb.Ecommerce.Examples.Notifications
{
    /// <summary>
    /// Subscribing on Cart.Created event
    /// </summary>
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.Created)]
    public class EcomCartCreatedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        /// <summary>
        /// This notification is thrown every time a cart is created. The notification appears when user adds first product to the cart.
        /// </summary>
        /// <param name="notification"></param>
        /// <param name="args"></param>
        public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
        {
            if (args == null || !(args is Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CreatedArgs))
                return;
            Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CreatedArgs cArgs = (Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CreatedArgs)args;
            List<Dynamicweb.Ecommerce.Shops.Shop> shops = new List<Dynamicweb.Ecommerce.Shops.Shop>(Dynamicweb.Ecommerce.Services.Shops.GetShops());

            if (shops == null || shops.Count == 0)
                return;

            cArgs.Order.ShopId = shops[0].Id;
            Services.Orders.Save(cArgs.Order);
        }
    }
}

Deleted

Occurs after the cart has been deleted.

public const string Deleted = "DWN_ECOM_CART_DELETED"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.Deleted)]
      public class EcomCartDeletedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.DeletedArgs deletedArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.DeletedArgs;

              //Add code here
          }
      }
  }

InitiallyLoaded

Occurs when a cart is loaded into session, and an existing cart doesn't already exist.

public const string InitiallyLoaded = "DWN_ECOM_CART_INITIALLY_LOADED"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Ecommerce.Examples.Notifications
{
    /// <summary>
    /// Subscribing on Cart.Loaded event
    /// </summary>
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.Loaded)]
    public class EcomCartLoadedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null || !(args is Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.LoadedArgs))
                return;

            var myArgs = (Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.LoadedArgs)args;

            if (myArgs.Cart != null)
                Dynamicweb.Context.Current.Response.Write(string.Format("The cart (ID:{0}) has been loaded", myArgs.Cart.Id));
        }
    }
}

Loaded

Occurs after the cart has been loaded.

public const string Loaded = "DWN_ECOM_CART_LOADED"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Ecommerce.Examples.Notifications
{
    /// <summary>
    /// Subscribing on Cart.Loaded event
    /// </summary>
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.Loaded)]
    public class EcomCartLoadedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null || !(args is Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.LoadedArgs))
                return;

            var myArgs = (Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.LoadedArgs)args;

            if (myArgs.Cart != null)
                Dynamicweb.Context.Current.Response.Write(string.Format("The cart (ID:{0}) has been loaded", myArgs.Cart.Id));
        }
    }
}

OnNewsletterSubscribe

This notification is broadcast if user checks the signup for newsletter checkbox.

public const string OnNewsletterSubscribe = "Ecom7CartOnNewsletterSubscribe"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.OnNewsletterSubscribe)]
      public class EcomCartOnNewsletterSubscribeObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.OnNewsletterSubscribeArgs onNewsletterSubscribeArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.OnNewsletterSubscribeArgs;

              //Add code here
          }
      }
  }

OrderIsPassedToCheckoutHandler

This notification is broadcast just before the Order is passed to CheckoutHandler.

public const string OrderIsPassedToCheckoutHandler = "Ecom7CartOrderIsPassedToCheckoutHandler"

Field Value

string

Examples

using Dynamicweb;

  namespace Dynamicweb.Ecommerce.Examples.Notifications
  {
      [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.OrderIsPassedToCheckoutHandler)]
      public class EcomCartOrderIsPassedToCheckoutHandlerObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
      {
          public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
          {
              Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.OrderIsPassedToCheckoutHandlerArgs orderIsPassedToCheckoutHandlerArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.OrderIsPassedToCheckoutHandlerArgs;

              //Add code here
          }
      }
  }

OrderValuesSaved

This notification is broadcast after posted Order values have been saved.

public const string OrderValuesSaved = "Ecom7CartOrderValuesSaved"

Field Value

string

SendMails

This notification is broadcast just before Order Emails are sent.

public const string SendMails = "Ecom7CartSendMails"

Field Value

string

SendingConfirmationMail

This notification is broadcast just before each individual Order Email is sent.

public const string SendingConfirmationMail = "Ecom7CartSendingConfirmationMail"

Field Value

string

Examples

using Dynamicweb.Core;

namespace Dynamicweb.Ecommerce.Examples.Notifications
{
    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.SendingConfirmationMail)]
    public class EcomCartSendingConfirmationMailObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
        {
            Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.SendingConfirmationMailArgs sendingConfirmationMailArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.SendingConfirmationMailArgs;

            //**** Example for creating a PDF attachment for the order emails **** //

            //EXAMPLE with a razor template
            //Load a template - with full html, including html, body, inline css etc. IE browser compatible
            Dynamicweb.Rendering.Template htmlForPdfTemplate = new Rendering.Template("/eCom7/CartV2/Mail/pdfReceipt.cshtml");

            //Create an order renderer instance
            Dynamicweb.Ecommerce.Frontend.Renderer orderRenderer = new Frontend.Renderer();
            //Render all order tags
            orderRenderer.RenderOrder(sendingConfirmationMailArgs.Order, htmlForPdfTemplate);

            //Add custom tags to the template
            htmlForPdfTemplate.SetTag("RecipientEmail", sendingConfirmationMailArgs.Recipient.Address);
            htmlForPdfTemplate.SetTag("ReceiptSubject", sendingConfirmationMailArgs.MailMessage.Subject);

            string html = htmlForPdfTemplate.Output();

            //Create a pdf from the template
            string pathToOrderConfirmation = SystemInformation.MapPath($"/Files/System/OrderExport/Order{sendingConfirmationMailArgs.Order.Id}.pdf");

            using (var pdf = new Imaging.Pdf())
            {
                var bytes = pdf.ConvertHtml(html);
                System.IO.File.WriteAllBytes(pathToOrderConfirmation, bytes);
            }

            //Attach the pdf to the email
            sendingConfirmationMailArgs.MailMessage.Attachments.Add(new System.Net.Mail.Attachment(pathToOrderConfirmation));
        }
    }
}
To top