Dynamicweb 8 Documentation
Loaded Field (eCommerce.Cart)
Example 

Occurs after the cart has been loaded.
Syntax
'Declaration
 
Public Const Loaded As String
public const string Loaded
Example
Notification observer exampleNotification observer example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dynamicweb.Notifications;
using Dynamicweb.Extensibility;

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

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

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

Namespace Dynamicweb.Examples.Vb.Notifications.eCommerce
    <Global.Dynamicweb.Extensibility.Subscribe(Global.Dynamicweb.Notifications.eCommerce.Cart.Loaded)> _
    Public Class EcomCartLoadedObserver
        Inherits Global.Dynamicweb.Extensibility.NotificationSubscriber

        Public Overrides Sub OnNotify(ByVal notification As String, ByVal args As Object())
            If args Is Nothing OrElse args.Length = 0 OrElse Not (TypeOf args(0) Is Global.Dynamicweb.eCommerce.Orders.Order) Then
                Return
            End If

            Dim order As Global.Dynamicweb.eCommerce.Orders.Order = DirectCast(args(0), Global.Dynamicweb.eCommerce.Orders.Order)

            'TODO: Add code here
            'System.Web.HttpContext.Current.Response.Write(string.Format("The cart (ID:{0}) has been loaded", order.ID))
        End Sub

    End Class
End Namespace
Remarks
The passed NotificationArgs is Loaded
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

eCommerce.Cart Class
eCommerce.Cart Members

Send Feedback