C# Class Nop.Services.Orders.ShoppingCartService

Shopping cart service
Inheritance: IShoppingCartService
Mostra file Open project: jimmy00784/nopCommerce-Linux-Mysql

Public Methods

Method Description
AddToCart ( Customer customer, Nop.Core.Domain.Catalog.ProductVariant productVariant, ShoppingCartType shoppingCartType, string selectedAttributes, decimal customerEnteredPrice, int quantity, bool automaticallyAddRequiredProductVariantsIfEnabled ) : IList

Add a product variant to shopping cart

DeleteExpiredShoppingCartItems ( System.DateTime olderThanUtc ) : int

Deletes expired shopping cart items

DeleteShoppingCartItem ( Nop.Core.Domain.Orders.ShoppingCartItem shoppingCartItem, bool resetCheckoutData = true, bool ensureOnlyActiveCheckoutAttributes = false ) : void

Delete shopping cart item

FindShoppingCartItemInTheCart ( IList shoppingCart, ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, string selectedAttributes = "", decimal customerEnteredPrice = decimal.Zero ) : Nop.Core.Domain.Orders.ShoppingCartItem

Finds a shopping cart item in the cart

GetRequiredProductVariantWarnings ( Customer customer, ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, bool automaticallyAddRequiredProductVariantsIfEnabled ) : IList

Validates required product variants (product variants which require other variant to be added to the cart)

GetShoppingCartItemAttributeWarnings ( ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, string selectedAttributes ) : IList

Validates shopping cart item attributes

GetShoppingCartItemGiftCardWarnings ( ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, string selectedAttributes ) : IList

Validates shopping cart item (gift card)

GetShoppingCartItemWarnings ( Customer customer, ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, string selectedAttributes, decimal customerEnteredPrice, int quantity, bool automaticallyAddRequiredProductVariantsIfEnabled, bool getStandardWarnings = true, bool getAttributesWarnings = true, bool getGiftCardWarnings = true, bool getRequiredProductVariantWarnings = true ) : IList

Validates shopping cart item

GetShoppingCartWarnings ( IList shoppingCart, string checkoutAttributes, bool validateCheckoutAttributes ) : IList

Validates whether this shopping cart is valid

GetStandardWarnings ( Customer customer, ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, string selectedAttributes, decimal customerEnteredPrice, int quantity ) : IList

Validates a product variant for standard properties

MigrateShoppingCart ( Customer fromCustomer, Customer toCustomer ) : void

Migrate shopping cart

ShoppingCartService ( IRepository sciRepository, IWorkContext workContext, ICurrencyService currencyService, IProductService productService, ILocalizationService localizationService, IProductAttributeParser productAttributeParser, ICheckoutAttributeService checkoutAttributeService, ICheckoutAttributeParser checkoutAttributeParser, IPriceFormatter priceFormatter, ICustomerService customerService, Nop.Core.Domain.Orders.ShoppingCartSettings shoppingCartSettings, IEventPublisher eventPublisher, IPermissionService permissionService ) : System

Ctor

UpdateShoppingCartItem ( Customer customer, int shoppingCartItemId, int newQuantity, bool resetCheckoutData ) : IList

Updates the shopping cart item

Method Details

AddToCart() public method

Add a product variant to shopping cart
public AddToCart ( Customer customer, Nop.Core.Domain.Catalog.ProductVariant productVariant, ShoppingCartType shoppingCartType, string selectedAttributes, decimal customerEnteredPrice, int quantity, bool automaticallyAddRequiredProductVariantsIfEnabled ) : IList
customer Nop.Core.Domain.Customers.Customer Customer
productVariant Nop.Core.Domain.Catalog.ProductVariant Product variant
shoppingCartType ShoppingCartType Shopping cart type
selectedAttributes string Selected attributes
customerEnteredPrice decimal The price enter by a customer
quantity int Quantity
automaticallyAddRequiredProductVariantsIfEnabled bool Automatically add required product variants if enabled
return IList

DeleteExpiredShoppingCartItems() public method

Deletes expired shopping cart items
public DeleteExpiredShoppingCartItems ( System.DateTime olderThanUtc ) : int
olderThanUtc System.DateTime Older than date and time
return int

DeleteShoppingCartItem() public method

Delete shopping cart item
public DeleteShoppingCartItem ( Nop.Core.Domain.Orders.ShoppingCartItem shoppingCartItem, bool resetCheckoutData = true, bool ensureOnlyActiveCheckoutAttributes = false ) : void
shoppingCartItem Nop.Core.Domain.Orders.ShoppingCartItem Shopping cart item
resetCheckoutData bool A value indicating whether to reset checkout data
ensureOnlyActiveCheckoutAttributes bool A value indicating whether to ensure that only active checkout attributes are attached to the current customer
return void

FindShoppingCartItemInTheCart() public method

Finds a shopping cart item in the cart
public FindShoppingCartItemInTheCart ( IList shoppingCart, ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, string selectedAttributes = "", decimal customerEnteredPrice = decimal.Zero ) : Nop.Core.Domain.Orders.ShoppingCartItem
shoppingCart IList Shopping cart
shoppingCartType ShoppingCartType Shopping cart type
productVariant Nop.Core.Domain.Catalog.ProductVariant Product variant
selectedAttributes string Selected attributes
customerEnteredPrice decimal Price entered by a customer
return Nop.Core.Domain.Orders.ShoppingCartItem

GetRequiredProductVariantWarnings() public method

Validates required product variants (product variants which require other variant to be added to the cart)
public GetRequiredProductVariantWarnings ( Customer customer, ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, bool automaticallyAddRequiredProductVariantsIfEnabled ) : IList
customer Nop.Core.Domain.Customers.Customer Customer
shoppingCartType ShoppingCartType Shopping cart type
productVariant Nop.Core.Domain.Catalog.ProductVariant Product variant
automaticallyAddRequiredProductVariantsIfEnabled bool Automatically add required product variants if enabled
return IList

GetShoppingCartItemAttributeWarnings() public method

Validates shopping cart item attributes
public GetShoppingCartItemAttributeWarnings ( ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, string selectedAttributes ) : IList
shoppingCartType ShoppingCartType Shopping cart type
productVariant Nop.Core.Domain.Catalog.ProductVariant Product variant
selectedAttributes string Selected attributes
return IList

GetShoppingCartItemGiftCardWarnings() public method

Validates shopping cart item (gift card)
public GetShoppingCartItemGiftCardWarnings ( ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, string selectedAttributes ) : IList
shoppingCartType ShoppingCartType Shopping cart type
productVariant Nop.Core.Domain.Catalog.ProductVariant Product variant
selectedAttributes string Selected attributes
return IList

GetShoppingCartItemWarnings() public method

Validates shopping cart item
public GetShoppingCartItemWarnings ( Customer customer, ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, string selectedAttributes, decimal customerEnteredPrice, int quantity, bool automaticallyAddRequiredProductVariantsIfEnabled, bool getStandardWarnings = true, bool getAttributesWarnings = true, bool getGiftCardWarnings = true, bool getRequiredProductVariantWarnings = true ) : IList
customer Nop.Core.Domain.Customers.Customer Customer
shoppingCartType ShoppingCartType Shopping cart type
productVariant Nop.Core.Domain.Catalog.ProductVariant Product variant
selectedAttributes string Selected attributes
customerEnteredPrice decimal Customer entered price
quantity int Quantity
automaticallyAddRequiredProductVariantsIfEnabled bool Automatically add required product variants if enabled
getStandardWarnings bool A value indicating whether we should validate a product variant for standard properties
getAttributesWarnings bool A value indicating whether we should validate product attributes
getGiftCardWarnings bool A value indicating whether we should validate gift card properties
getRequiredProductVariantWarnings bool A value indicating whether we should validate required product variants (product variants which require other variant to be added to the cart)
return IList

GetShoppingCartWarnings() public method

Validates whether this shopping cart is valid
public GetShoppingCartWarnings ( IList shoppingCart, string checkoutAttributes, bool validateCheckoutAttributes ) : IList
shoppingCart IList Shopping cart
checkoutAttributes string Checkout attributes
validateCheckoutAttributes bool A value indicating whether to validate checkout attributes
return IList

GetStandardWarnings() public method

Validates a product variant for standard properties
public GetStandardWarnings ( Customer customer, ShoppingCartType shoppingCartType, Nop.Core.Domain.Catalog.ProductVariant productVariant, string selectedAttributes, decimal customerEnteredPrice, int quantity ) : IList
customer Nop.Core.Domain.Customers.Customer Customer
shoppingCartType ShoppingCartType Shopping cart type
productVariant Nop.Core.Domain.Catalog.ProductVariant Product variant
selectedAttributes string Selected attributes
customerEnteredPrice decimal Customer entered price
quantity int Quantity
return IList

MigrateShoppingCart() public method

Migrate shopping cart
public MigrateShoppingCart ( Customer fromCustomer, Customer toCustomer ) : void
fromCustomer Nop.Core.Domain.Customers.Customer From customer
toCustomer Nop.Core.Domain.Customers.Customer To customer
return void

ShoppingCartService() public method

Ctor
public ShoppingCartService ( IRepository sciRepository, IWorkContext workContext, ICurrencyService currencyService, IProductService productService, ILocalizationService localizationService, IProductAttributeParser productAttributeParser, ICheckoutAttributeService checkoutAttributeService, ICheckoutAttributeParser checkoutAttributeParser, IPriceFormatter priceFormatter, ICustomerService customerService, Nop.Core.Domain.Orders.ShoppingCartSettings shoppingCartSettings, IEventPublisher eventPublisher, IPermissionService permissionService ) : System
sciRepository IRepository Shopping cart repository
workContext IWorkContext Work context
currencyService ICurrencyService Currency service
productService IProductService Product settings
localizationService ILocalizationService Localization service
productAttributeParser IProductAttributeParser Product attribute parser
checkoutAttributeService ICheckoutAttributeService Checkout attribute service
checkoutAttributeParser ICheckoutAttributeParser Checkout attribute parser
priceFormatter IPriceFormatter Price formatter
customerService ICustomerService Customer service
shoppingCartSettings Nop.Core.Domain.Orders.ShoppingCartSettings Shopping cart settings
eventPublisher IEventPublisher Event publisher
permissionService IPermissionService Permission service
return System

UpdateShoppingCartItem() public method

Updates the shopping cart item
public UpdateShoppingCartItem ( Customer customer, int shoppingCartItemId, int newQuantity, bool resetCheckoutData ) : IList
customer Nop.Core.Domain.Customers.Customer Customer
shoppingCartItemId int Shopping cart item identifier
newQuantity int New shopping cart item quantity
resetCheckoutData bool A value indicating whether to reset checkout data
return IList