C# Класс Nop.Services.Orders.ShoppingCartService

Shopping cart service
Наследование: IShoppingCartService
Показать файл Открыть проект

Открытые методы

Метод Описание
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

Описание методов

AddToCart() публичный Метод

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
Результат IList

DeleteExpiredShoppingCartItems() публичный Метод

Deletes expired shopping cart items
public DeleteExpiredShoppingCartItems ( System.DateTime olderThanUtc ) : int
olderThanUtc System.DateTime Older than date and time
Результат int

DeleteShoppingCartItem() публичный Метод

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
Результат void

FindShoppingCartItemInTheCart() публичный Метод

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
Результат Nop.Core.Domain.Orders.ShoppingCartItem

GetRequiredProductVariantWarnings() публичный Метод

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
Результат IList

GetShoppingCartItemAttributeWarnings() публичный Метод

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
Результат IList

GetShoppingCartItemGiftCardWarnings() публичный Метод

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
Результат IList

GetShoppingCartItemWarnings() публичный Метод

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)
Результат IList

GetShoppingCartWarnings() публичный Метод

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
Результат IList

GetStandardWarnings() публичный Метод

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
Результат IList

MigrateShoppingCart() публичный Метод

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
Результат void

ShoppingCartService() публичный Метод

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
Результат System

UpdateShoppingCartItem() публичный Метод

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
Результат IList