Script: Class dw.customer.ProductListItem

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.

Constants

TYPE_GIFT_CERTIFICATE : Number=2

Constant representing a gift certificate list item type.

TYPE_PRODUCT : Number=1

Constant representing a product list item type.

Properties

ID : String Read Only

The unique system generated ID of the object.

list : ProductList Read Only

The product list that this item belongs to.

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

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 : String Read Only

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

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

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 : Quantity Read Only

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

purchasedQuantityValue : Number Read Only

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

purchases : Collection Read Only

All purchases made for this item.

quantity : Quantity

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 : Number

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

type : Number Read Only

The type of this product list item.

Constructor Summary

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

Method Summary

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

Create a purchase record for this item.

getID() : String

Returns the unique system generated ID of the object.

getList() : ProductList

Returns the product list that this item belongs to.

getPriority() : Number

Specify the priority level for the item.

getProduct() : Product

Returns the referenced product for this item.

getProductID() : String

Returns the ID of the product referenced by this item.

getProductOptionModel() : ProductOptionModel

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

getPurchasedQuantity() : Quantity

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

getPurchasedQuantityValue() : Number

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

getPurchases() : Collection

Returns all purchases made for this item.

getQuantity() : Quantity

Returns the quantity of the item.

getQuantityValue() : Number

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

getType() : Number

Returns the type of this product list item.

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).

setPriority(priority : Number) : void

Specify the priority level for the item.

setProduct(product : Product) : void

Sets the referenced product for this item by storing the product's id.

setProductOptionModel(productOptionModel : ProductOptionModel) : void

Store a product option model with this object.

setPublic(flag : boolean) : void

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

setQuantity(value : Quantity) : void

Sets the quantity of the item.

setQuantityValue(value : Number) : void

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

Method Detail

createPurchase

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

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

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.

Deprecated:

Use ProductList.createProductItem(Product) instead.

Parameters:

product - The referenced product for this item.


setProductOptionModel

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

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

setQuantity(value : Quantity) : void

Sets the quantity of the item.

Deprecated:

Use setQuantityValue(Number) instead.

Parameters:

value - the new quantity of the item.


setQuantityValue

setQuantityValue(value : Number) : void

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

Parameters:

value - the value to use.