November Happy Hour will be moved to Thursday December 5th.

Class CartProvider

This type/member supports the EPiServer infrastructure and is not intended to be used directly from your code.

Handles loading and persistence for ICart

Inheritance
System.Object
CartProvider
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Commerce.Order.Internal
Assembly: EPiServer.Business.Commerce.dll
Version: 13.30.0
Syntax
public class CartProvider : ICartProvider, IOrderProvider<ICart>

Constructors

CartProvider(ICurrentMarket, IOrderGroupCalculator, ReferenceConverter, IContentLoader, ICatalogSystem, IRelationRepository, ServiceAccessor<SiteContext>, LanguageResolver, CustomerContext)

Creates an instance of CartProvider

Declaration
public CartProvider(ICurrentMarket currentMarket, IOrderGroupCalculator orderGroupCalculator, ReferenceConverter referenceConverter, IContentLoader contentLoader, ICatalogSystem catalogSystem, IRelationRepository relationRepository, ServiceAccessor<SiteContext> siteContextAccessor, LanguageResolver languageResolver, CustomerContext customerContext)
Parameters
Type Name Description
ICurrentMarket currentMarket

The current market service

IOrderGroupCalculator orderGroupCalculator

The calculator that used to calculate the totals for an order group.

ReferenceConverter referenceConverter

The reference converter.

EPiServer.IContentLoader contentLoader

The content loader.

ICatalogSystem catalogSystem

The catalog system.

IRelationRepository relationRepository

The relation repository.

EPiServer.ServiceLocation.ServiceAccessor<SiteContext> siteContextAccessor

The site context accessor.

EPiServer.Globalization.LanguageResolver languageResolver

The language resolved.

CustomerContext customerContext

The customer context.

CartProvider(ICurrentMarket, IOrderGroupTotalsCalculator, ReferenceConverter, IContentLoader, ICatalogSystem, IRelationRepository, ServiceAccessor<SiteContext>, LanguageResolver, CustomerContext)

Creates an instance of CartProvider

Declaration
[Obsolete("This constructor is no longer used, use constructor with IOrderGroupCalculator instead. Will remain at least until May 2019.")]
public CartProvider(ICurrentMarket currentMarket, IOrderGroupTotalsCalculator orderGroupTotalsCalculator, ReferenceConverter referenceConverter, IContentLoader contentLoader, ICatalogSystem catalogSystem, IRelationRepository relationRepository, ServiceAccessor<SiteContext> siteContextAccessor, LanguageResolver languageResolver, CustomerContext customerContext)
Parameters
Type Name Description
ICurrentMarket currentMarket

The current market service

IOrderGroupTotalsCalculator orderGroupTotalsCalculator

The calculator that used to calculate the totals for an order group.

ReferenceConverter referenceConverter

The reference converter.

EPiServer.IContentLoader contentLoader

The content loader.

ICatalogSystem catalogSystem

The catalog system.

IRelationRepository relationRepository

The relation repository.

EPiServer.ServiceLocation.ServiceAccessor<SiteContext> siteContextAccessor

The site context accessor.

EPiServer.Globalization.LanguageResolver languageResolver

The language resolved.

CustomerContext customerContext

The customer context.

Methods

Create(Guid, String)

Creates an ICart for a specific customer.

Declaration
public ICart Create(Guid customerId, string name)
Parameters
Type Name Description
System.Guid customerId

The customer id

System.String name

The order name

Returns
Type Description
ICart

An ICart.

Delete(OrderReference)

Deletes an order using an order reference.

Declaration
public void Delete(OrderReference orderLink)
Parameters
Type Name Description
OrderReference orderLink

The order link.

Load(Guid, String)

Loads the orders.

Declaration
public IEnumerable<ICart> Load(Guid customerId, string name)
Parameters
Type Name Description
System.Guid customerId

The customer id.

System.String name

The name of the order. The name is not unique for each order, instead it's suppose to differentiate orders of the same type.

Returns
Type Description
System.Collections.Generic.IEnumerable<ICart>

The System.Collections.Generic.IEnumerable<T>.

Remarks

If the name is null or empty, it returns all carts of the customer.

Load(Int32)

Loads the order

Declaration
public ICart Load(int orderGroupId)
Parameters
Type Name Description
System.Int32 orderGroupId

The order group id

Returns
Type Description
ICart

The ICart.

Save(ICart)

Saves the specified ICart.

Declaration
public OrderReference Save(ICart cart)
Parameters
Type Name Description
ICart cart

The cart.

Returns
Type Description
OrderReference

An OrderReference.

SaveAsPaymentPlan(ICart)

Saves the ICart as IPaymentPlan.

Declaration
public IPaymentPlan SaveAsPaymentPlan(ICart cart)
Parameters
Type Name Description
ICart cart

The cart.

Returns
Type Description
IPaymentPlan

An IPaymentPlan.

SaveAsPurchaseOrder(ICart)

Saves the ICart as IPurchaseOrder.

Declaration
public IPurchaseOrder SaveAsPurchaseOrder(ICart cart)
Parameters
Type Name Description
ICart cart

The cart.

Returns
Type Description
IPurchaseOrder

An IPurchaseOrder.

Implements

See Also