Class ProductListItem

An item in a product list. Types of items are:

  • An item that references a product via the product’s SKU.
  • An item that represents a gift certificate.

Constant Summary 

ConstantDescription
TYPE_GIFT_CERTIFICATE: Number = 2Constant representing a gift certificate list item type.
TYPE_PRODUCT: Number = 1Constant representing a product list item type.

Property Summary 

PropertyDescription
ID: String (read-only)Returns the unique system generated ID of the object.
list: ProductList (read-only)Returns the product list that this item belongs to.
priority: NumberSpecify the priority level for the item.
product: ProductReturns the referenced product for this item.
productID: String (read-only)Returns the ID of the product referenced by this item.
productOptionModel: ProductOptionModelReturns the ProductOptionModel for the product associated with this item, or null if there is no valid product associated with this item.
public: BooleanA flag, typically used to determine whether the item should display in a customer’s view of the list (as opposed to the list owner’s view).
purchasedQuantity: Quantity (read-only)Returns the sum of the quantities of all the individual purchase records for this item.
purchasedQuantityValue: Number (read-only)Returns the value part of the underlying purchased quantity object, as distinct from the unit.
purchases: Collection (read-only)Returns all purchases made for this item.
quantity: QuantityReturns the quantity of the item.
quantityValue: NumberReturns the value part of the underlying quantity object, as distinct from the unit.
type: Number (read-only)Returns the type of this product list item.

Constructor Summary 

This class does not have a constructor, so you cannot create it directly.

Method Summary 

MethodDescription
createPurchase(Number, String)Create a purchase record for this item.
getID()Returns the unique system generated ID of the object.
getList()Returns the product list that this item belongs to.
getPriority()Specify the priority level for the item.
getProduct()Returns the referenced product for this item.
getProductID()Returns the ID of the product referenced by this item.
getProductOptionModel()Returns the ProductOptionModel for the product associated with this item, or null if there is no valid product associated with this item.
getPurchasedQuantity()Returns the sum of the quantities of all the individual purchase records for this item.
getPurchasedQuantityValue()Returns the value part of the underlying purchased quantity object, as distinct from the unit.
getPurchases()Returns all purchases made for this item.
getQuantity()Returns the quantity of the item.
getQuantityValue()Returns the value part of the underlying quantity object, as distinct from the unit.
getType()Returns the type of this product list item.
isPublic()A flag, typically used to determine whether the item should display in a customer’s view of the list (as opposed to the list owner’s view).
setPriority(Number)Specify the priority level for the item.
setProduct(Product)Sets the referenced product for this item by storing the product’s id.
setProductOptionModel(ProductOptionModel)Store a product option model with this object.
setPublic(Boolean)Typically used to determine if the item is visible to other customers.
setQuantity(Quantity)Sets the quantity of the item.
setQuantityValue(Number)Set the value part of the underlying quantity object, as distinct from the unit.

Methods inherited from class ExtensibleObject 

describe, getCustom

Methods inherited from class PersistentObject 

getCreationDate, getLastModified, getUUID

Methods inherited from class Object 

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Constant Details 

TYPE_GIFT_CERTIFICATE 

TYPE_GIFT_CERTIFICATE: Number = 2

Constant representing a gift certificate list item type.


TYPE_PRODUCT 

TYPE_PRODUCT: Number = 1

Constant representing a product list item type.


Property Details 

ID 

ID: String (read-only)

Returns the unique system generated ID of the object.


list 

list: ProductList (read-only)

Returns the product list that this item belongs to.


priority 

priority: Number

Specify the priority level for the item. Typically the lower the number, the higher the priority. This can be used by the owner of the product list to express which items he/she likes to get purchased first.


product 

product: Product

Returns the referenced product for this item. The reference is made via the product ID attribute. This method returns null if there is no such product in the system or if the product exists but is not assigned to the site catalog.


productID 

productID: String (read-only)

Returns the ID of the product referenced by this item. This attribute is set when a product is assigned via setProduct(). It is possible for the ID to reference a product that doesn't exist anymore. In this case getProduct() would return null.


productOptionModel 

productOptionModel: ProductOptionModel

Returns the ProductOptionModel for the product associated with this item, or null if there is no valid product associated with this item.


public 

public: Boolean

A flag, typically used to determine whether the item should display in a customer's view of the list (as opposed to the list owner's view).


purchasedQuantity 

purchasedQuantity: Quantity (read-only)

Returns the sum of the quantities of all the individual purchase records for this item.


purchasedQuantityValue 

purchasedQuantityValue: Number (read-only)

Returns the value part of the underlying purchased quantity object, as distinct from the unit.


purchases 

purchases: Collection (read-only)

Returns all purchases made for this item.


quantity 

quantity: Quantity

Returns the quantity of the item. The quantity is the number of products or gift certificates that get shipped when purchasing this product list item.


quantityValue 

quantityValue: Number

Returns the value part of the underlying quantity object, as distinct from the unit.


type 

type: Number (read-only)

Returns the type of this product list item.


Method Details 

createPurchase(Number, String) 

createPurchase(quantity: Number, purchaserName: String): ProductListItemPurchase

Create a purchase record for this item.

Parameters:

  • quantity - The number of items purchased.
  • purchaserName - The name of the purchaser.

Returns:

  • the purchase record.

getID() 

getID(): String

Returns the unique system generated ID of the object.

Returns:

  • the ID of object.

getList() 

getList(): ProductList

Returns the product list that this item belongs to.

Returns:

  • the list.

getPriority() 

getPriority(): Number

Specify the priority level for the item. Typically the lower the number, the higher the priority. This can be used by the owner of the product list to express which items he/she likes to get purchased first.

Returns:

  • the specified priority level.

getProduct() 

getProduct(): Product

Returns the referenced product for this item. The reference is made via the product ID attribute. This method returns null if there is no such product in the system or if the product exists but is not assigned to the site catalog.

Returns:

  • the product referenced by this item, or null.

getProductID() 

getProductID(): String

Returns the ID of the product referenced by this item. This attribute is set when a product is assigned via setProduct(). It is possible for the ID to reference a product that doesn't exist anymore. In this case getProduct() would return null.

Returns:

  • the product ID, or null if none exists.

getProductOptionModel() 

getProductOptionModel(): ProductOptionModel

Returns the ProductOptionModel for the product associated with this item, or null if there is no valid product associated with this item.

Returns:

  • the associated ProductOptionModel or null.

getPurchasedQuantity() 

getPurchasedQuantity(): Quantity

Returns the sum of the quantities of all the individual purchase records for this item.

Returns:

  • the sum of the quantities of all the individual purchase records for this item.

getPurchasedQuantityValue() 

getPurchasedQuantityValue(): Number

Returns the value part of the underlying purchased quantity object, as distinct from the unit.

Returns:

  • the value part of the underlying purchased quantity object, as distinct from the unit.

getPurchases() 

getPurchases(): Collection

Returns all purchases made for this item.

Returns:

  • the collection of purchase records for this item. Returns an empty list if this item has not been purchased yet.

getQuantity() 

getQuantity(): Quantity

Returns the quantity of the item. The quantity is the number of products or gift certificates that get shipped when purchasing this product list item.

Returns:

  • the quantity of the item.

getQuantityValue() 

getQuantityValue(): Number

Returns the value part of the underlying quantity object, as distinct from the unit.

Returns:

  • the value part of the underlying quantity object, as distinct from the unit.

getType() 

getType(): Number

Returns the type of this product list item.

Returns:

  • a code that specifies the type of item (i.e. product or gift certificate).

isPublic() 

isPublic(): Boolean

A flag, typically used to determine whether the item should display in a customer's view of the list (as opposed to the list owner's view).

Returns:

  • true if the item is public.

setPriority(Number) 

setPriority(priority: Number): void

Specify the priority level for the item. Typically the lower the number, the higher the priority. This can be used by the owner of the product list to express which items he/she likes to get purchased first.

Parameters:

  • priority - The new priority level.

setProduct(Product) 

setProduct(product: Product): void

Sets the referenced product for this item by storing the product's id. If null is specified, then the id is set to null.

Parameters:

  • product - The referenced product for this item.

Deprecated:

Use ProductList.createProductItem(Product) instead.

Warning


setProductOptionModel(ProductOptionModel) 

setProductOptionModel(productOptionModel: ProductOptionModel): void

Store a product option model with this object. This stores a copy of the specified model, rather than an assocation to the same instance.

Parameters:

  • productOptionModel - The object to store.

setPublic(Boolean) 

setPublic(flag: Boolean): void

Typically used to determine if the item is visible to other customers.

Parameters:

  • flag - If true, this product list becomes visible to other customers. If false, this product list can only be seen by the owner of the product list.

setQuantity(Quantity) 

setQuantity(value: Quantity): void

Sets the quantity of the item.

Parameters:

  • value - the new quantity of the item.

Deprecated:

Use setQuantityValue(Number) instead.

Warning


setQuantityValue(Number) 

setQuantityValue(value: Number): void

Set the value part of the underlying quantity object, as distinct from the unit.

Parameters:

  • value - the value to use.