Class Cart
Represents the Shopping Cart in the system. User can have unlimited number of carts which can be used for such features as Wish List, Wedding Registry and so on. Each of them will need to have a unique card name. The Cart with a DefaultName specified by the DefaultName property will be considered primary cart.
Implements
Inherited Members
Namespace: Mediachase.Commerce.Orders
Assembly: Mediachase.Commerce.dll
Version: 14.26.0Syntax
public class Cart : OrderGroup, IXmlSerializable, IStorageObject, ICloneable, ISerializable, IOrderGroupCalculatedAmount, ICart, IOrderGroup, IExtendedProperties, IDeepCloneable
Constructors
Cart()
Initializes a new instance of the Cart class.
Declaration
protected Cart()
Cart(IDataReader)
Internal constructor required by collection implementation.
Declaration
public Cart(IDataReader reader)
Parameters
Type | Name | Description |
---|---|---|
System.Data.IDataReader | reader | The reader. |
Cart(SerializationInfo, StreamingContext)
Initializes a new instance of the Cart class.
Declaration
protected Cart(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | The info. |
System.Runtime.Serialization.StreamingContext | context | The context. |
Cart(String, Guid)
Initializes a new instance of the Cart class.
Declaration
public Cart(string Name, Guid CustomerId)
Parameters
Type | Name | Description |
---|---|---|
System.String | Name | The name. |
System.Guid | CustomerId | The customer id. |
Properties
DefaultName
Gets the default name for the cart.
Declaration
public static string DefaultName { get; }
Property Value
Type | Description |
---|---|
System.String | default name for the cart. |
ExchangeName
Gets the exchange name for the cart.
Declaration
public static string ExchangeName { get; }
Property Value
Type | Description |
---|---|
System.String | exchange name for the cart. |
OrderNumberMethod
Gets or sets the order number method that is used to generate the tracking PO sequence. If none set, the framework will use built in function GenerateOrderNumber:
this.OrderNumberMethod = new CreateOrderNumber(GenerateOrderNumber);
private string GenerateOrderNumber(Cart cart) { string num = new Random().Next(100, 999).ToString(); return String.Format("PO{0}{1}", cart.OrderGroupId, num); }
Declaration
public Cart.CreateOrderNumber OrderNumberMethod { get; set; }
Property Value
Type | Description |
---|---|
Cart.CreateOrderNumber | The order number method. |
WishListName
Gets the name for the Wishlist.
Declaration
public static string WishListName { get; }
Property Value
Type | Description |
---|---|
System.String | name for the Wishlist. |
Methods
Add(OrderGroup)
Adds the specified order group to the existing cart.
Declaration
public void Add(OrderGroup orderGroup)
Parameters
Type | Name | Description |
---|---|---|
OrderGroup | orderGroup | The order group. |
Add(OrderGroup, Boolean)
Adds the specified order group to the existing cart.
Declaration
public void Add(OrderGroup orderGroup, bool lineItemRollup)
Parameters
Type | Name | Description |
---|---|---|
OrderGroup | orderGroup | The order group. |
System.Boolean | lineItemRollup | if set to |
GenerateOrderNumber(Cart)
Generates the order number.
Declaration
public string GenerateOrderNumber(Cart cart)
Parameters
Type | Name | Description |
---|---|---|
Cart | cart | The cart. |
Returns
Type | Description |
---|---|
System.String |
GetObjectData(SerializationInfo, StreamingContext)
Gets the object data.
Declaration
public override void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | The info. |
System.Runtime.Serialization.StreamingContext | context | The context. |
Overrides
LoadCartsByCustomerAndName(Guid, String)
Declaration
public static IEnumerable<Cart> LoadCartsByCustomerAndName(Guid customerId, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | customerId | |
System.String | name |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Cart> |
SaveAsPaymentPlan()
Saves the cart as payment plan, typically the last step in the checkout.
Declaration
public virtual PaymentPlan SaveAsPaymentPlan()
Returns
Type | Description |
---|---|
PaymentPlan | The payment plan |
SaveAsPurchaseOrder()
Saves the cart as purchase order, typically the last step in the checkout. The original cart will need to be deleted and is not handled by this script.
Declaration
public virtual PurchaseOrder SaveAsPurchaseOrder()
Returns
Type | Description |
---|---|
PurchaseOrder | The purchase order |
WriteXml(XmlWriter)
Converts an object into its XML representation.
Declaration
public override void WriteXml(XmlWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | The System.Xml.XmlWriter stream to which the object is serialized |
Overrides
Explicit Interface Implementations
IDeepCloneable.DeepClone()
Creates a limited deep clone of this object.
Declaration
object IDeepCloneable.DeepClone()
Returns
Type | Description |
---|---|
System.Object | A deep clone of this object. |
Remarks
Some reference type properties will NOT be cloned by this method - the original and the clone will share the same instance of: