(Update: 12/20/2021 - This is a very old blog. Some of the properties have changed. Contact us at support@noptools.com for up-to-date information.)
The previous blog discussed expressions, and that the underlying attributes of the Shopping Cart can be referenced. Below is a partial shopping cart hierarchy. You use a dot (".") between attributes in the hierachy to reference children. Some attributes are collections (lists), that can contain 0 or more other objects. All expressions must yield a scalar value, so collections must have some Query Operator applied like All() [a boolean], or Sum() [a decimal].
Some query operators, like All(), will return a boolean. For example, Any() will return true if any items in the collection meet the criteria. For example - The customer has the Administrator role:
Customer.CustomerRoles.Any(Name = "Administrators")
Some query operators, like Where(), will return a subset which is still a collection, so a First() operator must then be applied and then probably followed with an attribute name. This Where().First() is a common scenario. For example, check if customer has the role with Any() above, and then check if that role is Active:
and Customer.CustomerRoles.Where(Name = "Administrators").First().Active
Customer Customer
Id 1
Username user@optonline.net
Email user@optonline.net
AdminComment NULL
LanguageId NULL
CurrencyId NULL
TaxDisplayTypeId 0
IsTaxExempt False
VatNumber NULL
VatNumberStatusId 0
CheckoutAttributes
DiscountCouponCode
GiftCardCouponCodes
UseRewardPointsDuringCheckout False
TimeZoneId NULL
AffiliateId NULL
Active True
IsSystemAccount False
SystemName NULL
CreatedOnUtc 9/3/2011 2:08:02 AM
Affiliate NULL
Language NULL
Currency NULL
CustomerRoles Collection[CustomerRole]
Id 1
Name Administrators
FreeShipping False
TaxExempt False
Active True
IsSystemRole True
SystemName Administrators
CustomerAttributes Collection[CustomerAttribute]
Key FirstName
Value John
Key LastName
Value Smith
Key LastVisitedPage
Value http://localhost:7872/
Key LastShippingOption
Value
Key LastContinueShoppingPage
Value http://localhost:7872/m/261/test
Key Gender
Value
Key DateOfBirth
Value
Key Company
Value
Items List[ShoppingCartItem]
Id 16
ProductVariantId 59
CustomerEnteredPrice 0.0000
Quantity 1
CreatedOnUtc 10/5/2011 3:12:37 AM
UpdatedOnUtc 10/15/2011 1:52:19 AM
ProductVariant
Id 59
ProductId 58
Name Box Cutter
Sku 123456789
Description NULL
AdminComment NULL
ManufacturerPartNumber 099999
IsGiftCard False
GiftCardTypeId 0
...
IsDownload False
...
IsFreeShipping False
AdditionalShippingCharge 0.0000
IsTaxExempt False
TaxCategoryId 0
...
CallForPrice False
Price 52.9100
...
Weight 1.0000
Length 0.0000
Width 0.0000
Height 0.0000
...
Product System.Data.Entity.DynamicProxies.Product
Id 58
Name Box Cutter
ShortDescription NULL
...
ProductCategories Collection[ProductCategory]
Id 14
ProductId 58
CategoryId 72
IsFeaturedProduct False
DisplayOrder 1
Category Category
Id 72
Name Box Cutter Knife, Blades
Description NULL
...
ProductManufacturers Collection[ProductManufacturer]
Id 14
ProductId 58
ManufacturerId 5
IsFeaturedProduct False
DisplayOrder 1
Manufacturer Manufacturer
Id 5
Name ABC Industries
Description NULL
...
ShippingAddress Address
FirstName NULL
LastName NULL
Email NULL
Company NULL
CountryId 1
StateProvinceId 40
City NULL
Address1 NULL
Address2 NULL
ZipPostalCode 10021
PhoneNumber NULL
FaxNumber NULL
CreatedOnUtc 1/1/0001 12:00:00 AM
Country Country
Country : 1
StateProvince StateProvince
StateProvince : 40
Id 0
CountryFrom NULL
StateProvinceFrom NULL
ZipPostalCodeFrom