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.Collections.Generic;
using Dynamicweb.Ecommerce.Shops;
using Dynamicweb.Extensibility.Notifications;
using static Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart;
namespace Dynamicweb.Ecommerce.Examples.Notifications;
/// <summary>
/// Subscribing on Cart.Created event
/// </summary>
[Subscribe(Created)]
public class EcomCartCreatedObserver : 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, NotificationArgs args)
{
if (args is not CreatedArgs cArgs)
return;
var shops = new List<Shop>(Services.Shops.GetShops());
if (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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsChanged)]
public class EcomCartAfterCustomFieldValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsChangedArgs? afterCustomFieldValueIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsChangedArgs;
if (afterCustomFieldValueIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsSet)]
public class EcomCartAfterCustomFieldValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsSetArgs? afterCustomFieldValueIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterCustomFieldValueIsSetArgs;
if (afterCustomFieldValueIsSetArgs is null)
return;
//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
Examples
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)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsChangedArgs? afterCustomerAcceptedValueIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsChangedArgs;
if (afterCustomerAcceptedValueIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsSet)]
public class EcomCartAfterCustomerAcceptedValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsSetArgs? afterCustomerAcceptedValueIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerAcceptedValueIsSetArgs;
if (afterCustomerAcceptedValueIsSetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsChanged)]
public class EcomCartAfterCustomerCountryIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsChangedArgs? afterCustomerCountryIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsChangedArgs;
if (afterCustomerCountryIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsSet)]
public class EcomCartAfterCustomerCountryIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsSetArgs? afterCustomerCountryIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterCustomerCountryIsSetArgs;
if (afterCustomerCountryIsSetArgs is null)
return;
//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
Examples
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)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterDefaultPropertiesValueIsChangedArgs? afterDefaultPropertiesValueIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterDefaultPropertiesValueIsChangedArgs;
if (afterDefaultPropertiesValueIsChangedArgs is null)
return;
//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
Examples
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)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterDefaultPropertiesValueIsSetArgs? afterDefaultPropertiesValueIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterDefaultPropertiesValueIsSetArgs;
if (afterDefaultPropertiesValueIsSetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsChanged)]
public class EcomCartAfterDeliveryCountryIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsChangedArgs? afterDeliveryCountryIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsChangedArgs;
if (afterDeliveryCountryIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsSet)]
public class EcomCartAfterDeliveryCountryIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsSetArgs? afterDeliveryCountryIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterDeliveryCountryIsSetArgs;
if (afterDeliveryCountryIsSetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsChanged)]
public class EcomCartAfterNewsletterSubscriptionValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsChangedArgs? afterNewsletterSubscriptionValueIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsChangedArgs;
if (afterNewsletterSubscriptionValueIsChangedArgs is null)
return;
//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
Examples
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)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsSetArgs? afterNewsletterSubscriptionValueIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterNewsletterSubscriptionValueIsSetArgs;
if (afterNewsletterSubscriptionValueIsSetArgs is null)
return;
//Add code here
}
}
AfterOrderValidation
Occurs after order validation is executed.
public const string AfterOrderValidation = "Ecom7CartAfterOrderValidation"
Field Value
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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentIsReset)]
public class EcomCartAfterPaymentIsResetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentIsResetArgs? afterPaymentIsResetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentIsResetArgs;
if (afterPaymentIsResetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentMethodIsChanged)]
public class EcomCartAfterPaymentMethodIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var afterPaymentMethodIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentMethodIsChangedArgs;
if (afterPaymentMethodIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentMethodIsSet)]
public class EcomCartAfterPaymentMethodIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var afterPaymentMethodIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterPaymentMethodIsSetArgs;
if (afterPaymentMethodIsSetArgs is null)
return;
//Add code here
}
}
AfterRecurringOrderPlaced
This notification is broadcast when new recurring order is just placed.
public const string AfterRecurringOrderPlaced = "Ecom7CartAfterRecurringOrderPlaced"
Field Value
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterRecurringOrderPlaced)]
public class EcomCartAfterRecurringOrderPlacedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var afterRecurringOrderPlacedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterRecurringOrderPlacedArgs;
if (afterRecurringOrderPlacedArgs is null)
return;
//Add code here
}
}
AfterShippingCalculation
Occurs just after shipping calculation is executed.
public const string AfterShippingCalculation = "Ecom7CartAfterShippingCalculation"
Field Value
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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterShippingIsReset)]
public class EcomCartAfterShippingIsResetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var afterShippingIsResetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterShippingIsResetArgs;
if (afterShippingIsResetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterShippingMethodIsChanged)]
public class EcomCartAfterShippingMethodIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var afterShippingMethodIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterShippingMethodIsChangedArgs;
if (afterShippingMethodIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.AfterShippingMethodIsSet)]
public class EcomCartAfterShippingMethodIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var afterShippingMethodIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.AfterShippingMethodIsSetArgs;
if (afterShippingMethodIsSetArgs is null)
return;
//Add code here
}
}
BeforeAddressValidation
Occurs just before address validation is executed.
public const string BeforeAddressValidation = "Ecom7CartBeforeAddressValidation"
Field Value
Examples
using System;
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;
if (beforeAddressValidationArgs is null)
return;
// Skip address validation for countries other than US
if (!beforeAddressValidationArgs.Order.DeliveryCountryCode.Equals("US", StringComparison.OrdinalIgnoreCase))
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
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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomFieldValueIsChanged)]
public class EcomCartBeforeCustomFieldValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeCustomFieldValueIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomFieldValueIsChangedArgs;
if (beforeCustomFieldValueIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomFieldValueIsSet)]
public class EcomCartBeforeCustomFieldValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeCustomFieldValueIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomFieldValueIsSetArgs;
if (beforeCustomFieldValueIsSetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerAcceptedValueIsChanged)]
public class EcomCartBeforeCustomerAcceptedValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeCustomerAcceptedValueIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerAcceptedValueIsChangedArgs;
if (beforeCustomerAcceptedValueIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerAcceptedValueIsSet)]
public class EcomCartBeforeCustomerAcceptedValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeCustomerAcceptedValueIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerAcceptedValueIsSetArgs;
if (beforeCustomerAcceptedValueIsSetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerCountryIsChanged)]
public class EcomCartBeforeCustomerCountryIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeCustomerCountryIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerCountryIsChangedArgs;
if (beforeCustomerCountryIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerCountryIsSet)]
public class EcomCartBeforeCustomerCountryIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeCustomerCountryIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeCustomerCountryIsSetArgs;
if (beforeCustomerCountryIsSetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeDefaultPropertiesValueIsChanged)]
public class EcomCartBeforeDefaultPropertiesValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeDefaultPropertiesValueIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeDefaultPropertiesValueIsChangedArgs;
if (beforeDefaultPropertiesValueIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeDefaultPropertiesValueIsSet)]
public class EcomCartBeforeDefaultPropertiesValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeDefaultPropertiesValueIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeDefaultPropertiesValueIsSetArgs;
if (beforeDefaultPropertiesValueIsSetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeDeliveryCountryIsChanged)]
public class EcomCartBeforeDeliveryCountryIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeDeliveryCountryIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeDeliveryCountryIsChangedArgs;
if (beforeDeliveryCountryIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeDeliveryCountryIsSet)]
public class EcomCartBeforeDeliveryCountryIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeDeliveryCountryIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeDeliveryCountryIsSetArgs;
if (beforeDeliveryCountryIsSetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeNewsletterSubscriptionValueIsChanged)]
public class EcomCartBeforeNewsletterSubscriptionValueIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeNewsletterSubscriptionValueIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeNewsletterSubscriptionValueIsChangedArgs;
if (beforeNewsletterSubscriptionValueIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeNewsletterSubscriptionValueIsSet)]
public class EcomCartBeforeNewsletterSubscriptionValueIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeNewsletterSubscriptionValueIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeNewsletterSubscriptionValueIsSetArgs;
if (beforeNewsletterSubscriptionValueIsSetArgs is null)
return;
//Add code here
}
}
BeforeOrderValidation
Occurs before order validation is executed.
public const string BeforeOrderValidation = "Ecom7CartBeforeOrderValidation"
Field Value
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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentIsReset)]
public class EcomCartBeforePaymentIsResetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforePaymentIsResetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentIsResetArgs;
if (beforePaymentIsResetArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentMethodIsChanged)]
public class EcomCartBeforePaymentMethodIsChangedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforePaymentMethodIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentMethodIsChangedArgs;
if (beforePaymentMethodIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentMethodIsSet)]
public class EcomCartBeforePaymentMethodIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforePaymentMethodIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforePaymentMethodIsSetArgs;
if (beforePaymentMethodIsSetArgs is null)
return;
//Add code here
}
}
BeforePlaceRecurringOrder
This notification is broadcast when new recurring is about to be placed.
public const string BeforePlaceRecurringOrder = "Ecom7CartBeforePlaceRecurringOrder"
Field Value
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforePlaceRecurringOrder)]
public class EcomCartBeforePlaceRecurringOrderObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforePlaceRecurringOrderArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforePlaceRecurringOrderArgs;
if (beforePlaceRecurringOrderArgs is null)
return;
//Add code here
}
}
BeforeRemovingNonExistingProducts
This notification is broadcast just before Non-existing products are removed.
public const string BeforeRemovingNonExistingProducts = "Ecom7CartBeforeRemovingNonExistingProducts"
Field Value
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeRemovingNonExistingProducts)]
public class EcomCartBeforeRemovingNonExistingProductsObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeRemovingNonExistingProductsArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeRemovingNonExistingProductsArgs;
if (beforeRemovingNonExistingProductsArgs is null)
return;
//Add code here
}
}
BeforeRenderingEmptyCart
This notification is broadcast just before an empty cart is rendered.
public const string BeforeRenderingEmptyCart = "Ecom7CartBeforeRenderingEmptyCart"
Field Value
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeRenderingEmptyCart)]
public class EcomCartBeforeRenderingEmptyCartObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeRenderingEmptyCartArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeRenderingEmptyCartArgs;
if (beforeRenderingEmptyCartArgs is null)
return;
//Add code here
}
}
BeforeRenderingNewStep
This notification is broadcast just before a new step is rendered.
public const string BeforeRenderingNewStep = "Ecom7CartBeforeRenderingNewStep"
Field Value
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeRenderingNewStep)]
public class EcomCartBeforeRenderingNewStepObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeRenderingNewStepArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeRenderingNewStepArgs;
if (beforeRenderingNewStepArgs is null)
return;
//Add code here
}
}
BeforeShippingCalculation
Occurs just before shipping calculation is executed.
public const string BeforeShippingCalculation = "Ecom7CartBeforeShippingCalculation"
Field Value
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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingIsReset)]
public class EcomCartBeforeShippingIsResetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeShippingIsResetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingIsResetArgs;
if (beforeShippingIsResetArgs is null)
return;
//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
Examples
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)
{
var beforeShippingMethodIsChangedArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingMethodIsChangedArgs;
if (beforeShippingMethodIsChangedArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingMethodIsSet)]
public class EcomCartBeforeShippingMethodIsSetObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var beforeShippingMethodIsSetArgs = args as Ecommerce.Notifications.Ecommerce.Cart.BeforeShippingMethodIsSetArgs;
if (beforeShippingMethodIsSetArgs is null)
return;
//Add code here
}
}
CheckoutDone
This notification is broadcast when the Order is passed back from the CheckoutHandler.
public const string CheckoutDone = "Ecom7CartCheckoutDone"
Field Value
CheckoutDoneOrderIsComplete
This notification is broadcast when the Order is passed back from CheckoutHandler and is complete.
public const string CheckoutDoneOrderIsComplete = "Ecom7CartCheckoutDoneOrderIsComplete"
Field Value
Examples
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)
{
var checkoutDoneOrderIsCompleteArgs = args as Ecommerce.Notifications.Ecommerce.Cart.CheckoutDoneOrderIsCompleteArgs;
if (checkoutDoneOrderIsCompleteArgs is null)
return;
//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
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.CheckoutDoneOrderIsNotComplete)]
public class EcomCartCheckoutDoneOrderIsNotCompleteObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var checkoutDoneOrderIsNotCompleteArgs = args as Ecommerce.Notifications.Ecommerce.Cart.CheckoutDoneOrderIsNotCompleteArgs;
if (checkoutDoneOrderIsNotCompleteArgs is null)
return;
//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
Examples
using System.Collections.Generic;
using Dynamicweb.Ecommerce.Shops;
using Dynamicweb.Extensibility.Notifications;
using static Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart;
namespace Dynamicweb.Ecommerce.Examples.Notifications;
/// <summary>
/// Subscribing on Cart.Created event
/// </summary>
[Subscribe(Created)]
public class EcomCartCreatedObserver : 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, NotificationArgs args)
{
if (args is not CreatedArgs cArgs)
return;
var shops = new List<Shop>(Services.Shops.GetShops());
if (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
Examples
using static Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart;
using Dynamicweb.Extensibility.Notifications;
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Subscribe(Deleted)]
public class EcomCartDeletedObserver : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
if (args is not DeletedArgs deletedArgs)
return;
// 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
Examples
using Dynamicweb.Extensibility.Notifications;
using static Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart;
namespace Dynamicweb.Ecommerce.Examples.Notifications;
/// <summary>
/// Subscribing on Cart.Loaded event
/// </summary>
[Subscribe(Loaded)]
public class EcomCartLoadedObserver : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
if (args is not LoadedArgs myArgs)
return;
}
}
Loaded
Occurs after the cart has been loaded.
public const string Loaded = "DWN_ECOM_CART_LOADED"
Field Value
Examples
using Dynamicweb.Extensibility.Notifications;
using static Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart;
namespace Dynamicweb.Ecommerce.Examples.Notifications;
/// <summary>
/// Subscribing on Cart.Loaded event
/// </summary>
[Subscribe(Loaded)]
public class EcomCartLoadedObserver : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
if (args is not LoadedArgs myArgs)
return;
}
}
OnNewsletterSubscribe
This notification is broadcast if user checks the signup for newsletter checkbox.
public const string OnNewsletterSubscribe = "Ecom7CartOnNewsletterSubscribe"
Field Value
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.OnNewsletterSubscribe)]
public class EcomCartOnNewsletterSubscribeObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var onNewsletterSubscribeArgs = args as Ecommerce.Notifications.Ecommerce.Cart.OnNewsletterSubscribeArgs;
if (onNewsletterSubscribeArgs is null)
return;
//Add code here
}
}
OrderIsPassedToCheckoutHandler
This notification is broadcast just before the Order is passed to CheckoutHandler.
public const string OrderIsPassedToCheckoutHandler = "Ecom7CartOrderIsPassedToCheckoutHandler"
Field Value
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.OrderIsPassedToCheckoutHandler)]
public class EcomCartOrderIsPassedToCheckoutHandlerObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var orderIsPassedToCheckoutHandlerArgs = args as Ecommerce.Notifications.Ecommerce.Cart.OrderIsPassedToCheckoutHandlerArgs;
if (orderIsPassedToCheckoutHandlerArgs is null)
return;
//Add code here
}
}
OrderValuesSaved
This notification is broadcast after posted Order values have been saved.
public const string OrderValuesSaved = "Ecom7CartOrderValuesSaved"
Field Value
SendMails
This notification is broadcast just before Order Emails are sent.
public const string SendMails = "Ecom7CartSendMails"
Field Value
SendingConfirmationMail
This notification is broadcast just before each individual Order Email is sent.
public const string SendingConfirmationMail = "Ecom7CartSendingConfirmationMail"
Field Value
Examples
using System.IO;
using System.Net.Mail;
using Dynamicweb.Core;
using Dynamicweb.Imaging;
namespace Dynamicweb.Ecommerce.Examples.Notifications;
[Dynamicweb.Extensibility.Notifications.Subscribe(Ecommerce.Notifications.Ecommerce.Cart.SendingConfirmationMail)]
public class EcomCartSendingConfirmationMailObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var sendingConfirmationMailArgs = args as Ecommerce.Notifications.Ecommerce.Cart.SendingConfirmationMailArgs;
if (sendingConfirmationMailArgs is null)
return;
//**** 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
var htmlForPdfTemplate = new Rendering.Template("/eCom7/CartV2/Mail/pdfReceipt.cshtml");
//Create an order renderer instance
var 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");
var settings = new PdfRendererSettings
{
PaperSizeCustomWidth = 300,
PaperSizeCustomHeight = 750
};
var renderer = new PdfRenderer(settings);
byte[] data = renderer.RenderFromHtml(html);
File.WriteAllBytes(pathToOrderConfirmation, data);
//Attach the pdf to the email
sendingConfirmationMailArgs.MailMessage.Attachments.Add(new Attachment(pathToOrderConfirmation));
}
}