Class Context
- Namespace
- Dynamicweb.Ecommerce.Common
- Assembly
- Dynamicweb.Ecommerce.dll
Get and set context variables of the eCommerce system like language, country and currency.
public sealed class Context
- Inheritance
-
Context
- Inherited Members
Properties
Cart
Gets the cart.
public static Order? Cart { get; }
Property Value
- Order
Returns the cart from a session variables otherwise NULL is returned.
CartContext
Gets or sets the current cart context.
public static OrderContext? CartContext { get; set; }
Property Value
- OrderContext
The cart context.
Country
Gets or sets the country.
public static Country? Country { get; set; }
Property Value
- Country
The country. If no country found,
nullwill be returned
CountrySetByCustomer
Gets or sets a value indicating whether the CurrencySetByCustomer session exists and has a value.
public static bool CountrySetByCustomer { get; set; }
Property Value
- bool
trueif the CurrencySetByCustomer session exists and has a value; otherwise,false.
Currency
Gets or sets the currency.
public static Currency Currency { get; set; }
Property Value
- Currency
The currency from the session variables otherwise the default currency.
CurrencySetByCustomer
Gets or sets a value indicating whether the CurrencySetByCustomer session exists and has a value.
public static bool CurrencySetByCustomer { get; set; }
Property Value
- bool
trueif the CurrencySetByCustomer session exists and has a value; otherwise,false.
DeliveryAddressId
Gets or sets the delivery address.
public static int DeliveryAddressId { get; set; }
Property Value
- int
The delivery address from the session variables.
DisplayPricesWithVat
Gets or sets a value indicating whether prices in frontend are displayed with or without VAT.
public static bool DisplayPricesWithVat { get; set; }
Property Value
- bool
trueif prices should be displayed with VAT; otherwise,false.
DisplayPricesWithVatSetByCustomer
Gets or sets a value indicating whether DisplayPricesWithVat property has been set explicitly in QueryString.
public static bool DisplayPricesWithVatSetByCustomer { get; set; }
Property Value
- bool
trueif set explicitly; otherwise,false.
FavoriteListID
public static string? FavoriteListID { get; }
Property Value
Language
Gets or sets the language.
public static Language Language { get; set; }
Property Value
- Language
The language.
Exceptions
- ArgumentNullException
Setting a Language that is
null.
LanguageID
Gets or sets the language ID.
public static string LanguageID { get; set; }
Property Value
- string
The language ID.
Exceptions
- InvalidOperationException
Language ID does not exist in the context and default language does not exist.
- InvalidOperationException
Setting a language ID that does not exist.
LanguageSetByCustomer
Gets or sets a value indicating whether the LanguageSetByCustomer session exists and has a value.
public static bool LanguageSetByCustomer { get; set; }
Property Value
- bool
trueif the LanguageSetByCustomer session exists and has a value; otherwise,false.
OrderTime
The value of this property is used when calculating prices, discounts, periods and all other places where products or order (or related information) are affected by time.
public static DateTime OrderTime { get; set; }
Property Value
- DateTime
The order time.
ReverseChargeForVatEnabled
Gets or sets a value indicating whether VAT is in a reverse charge situation. In this case, VAT is not present in the product price for the affected VAT groups. This is standard VAT law in EU for B2B, where the buyer must handle the VAT rather than the reseller.
public static bool ReverseChargeForVatEnabled { get; set; }
Property Value
- bool
trueif VAT is in a reverse charge situation; otherwise,false.
ShowUnTranslatedItems
Determines whether to show the untranslated items if the ShowUnTranslatedItems setting is checked.
public static bool ShowUnTranslatedItems { get; }
Property Value
- bool
trueif the ShowUnTranslatedItems setting is checked; otherwise,false.
StockLocation
Gets or sets the stock location.
public static StockLocation? StockLocation { get; set; }
Property Value
- StockLocation
The stock location. If no stock location found NULL will be returned
TimeOfLoad
Gets the time of load.
public static DateTime TimeOfLoad { get; }
Property Value
- DateTime
The time of load. Value from the TimeOfLoad session.
Methods
LoadUserContextCarts()
Loads the user context carts.
public static void LoadUserContextCarts()
RemoveCart(string)
public static void RemoveCart(string key)
Parameters
keystring
SetCart(Order)
public static void SetCart(Order cart)
Parameters
cartOrder
SetPersistentCartContext(string)
Sets the persistent cart context.
public static void SetPersistentCartContext(string contextId)
Parameters
contextIdstringThe cart context ID.