Script: Class dw.order.ProductLineItem

Class ProductLineItem

Represents a specific product line item.

Properties

adjustedGrossPrice : Money Read Only

The gross price of the product line item after applying all product-level adjustments.

adjustedNetPrice : Money Read Only

The net price of the product line item after applying all product-level adjustments.

adjustedPrice : Money Read Only

The price of the product line item after applying all product-level adjustments. For net pricing the adjusted net price is returned (see getAdjustedNetPrice()). For gross pricing, the adjusted gross price is returned (see getAdjustedGrossPrice()).

adjustedTax : Money Read Only

The tax of the unit after applying adjustments, in the purchase currency.

bonusDiscountLineItem : BonusDiscountLineItem Read Only

The parent bonus discount line item of this line item. Only bonus product line items that have been selected by the customer as part of a BONUS_CHOICE discount have one of these.

bonusProductLineItem : boolean Read Only

Identifies if the product line item represents a bonus line item.

bundledProductLineItem : boolean Read Only

Identifies if the product line item represents a bundled line item.

bundledProductLineItems : Collection Read Only

A collection containing the bundled product line items.

catalogProduct : boolean Read Only

Returns true if the product line item represents a catalog product.

That flag is determined during product line item creation with LineItemCtnr.createProductLineItem(String, Shipment), stored at the line item container and can be accessed as productLineItem.catalogProduct. It represents what can be evaluated with

dw.catalog.ProductMgr.getProduct( productID ) != null && dw.catalog.ProductMgr.getProduct( productID ).isAssignedToSiteCatalog()

If the product is not available during product line item creation it is considered a non catalog product line item without connection to a product.

category : Category

The category the product line item is associated with. If the line item is not associated with a category, or the category does not exist in the site catalog, the method returns null.

categoryID : String

The ID of the category the product line item is associated with.

externalLineItemStatus : String

The value set for the external line item status or null if no value set.

externalLineItemText : String

The value set for the external line item text or null if no value set.

gift : boolean

Returns true if this line item represents a gift, false otherwise.

giftMessage : String

The value set for gift message or null if no value set.

manufacturerName : String

The name of the manfacturer of the product.

manufacturerSKU : String

The name of the manfacturer's SKU of this product line item.

minOrderQuantity : Quantity Read Only

The minimal order quantity allowed for the product represented by the ProductLineItem (copied from product on initialization). Note: the quantity of a ProductLineItem must obey the limits set by the ProductLineItem's attributes 'MinOrderQuantity' and 'StepQuantity', i.e. for a 'MinOrderQuantity' of 2.0 and a 'StepQuantity' of 2.5 then values 2.0, 4.5, 7.0... are allowed values.

minOrderQuantityValue : Number

Return the value portion of getMinOrderQuantity().

optionID : String Read Only

The ID of the product option this product line item represents. If the product line item does not represent an option, null is returned.

optionModel : ProductOptionModel Read Only

The product option model for a product line item representing an option product.

The returned option model has preselected values based on the dependent option line items of this product line item. Null is returned if this line item does not represent an option product.

optionProductLineItem : boolean Read Only

Identifies if the product line item represents an option line item. Option line items do not represent true products but rather options of products. An option line item always has a parent product line item representing a true product.

optionProductLineItems : Collection Read Only

A collection containing option product line items.

optionValueID : String Read Only

The ID of the product option value this product line item represents. If the product line item does not represent an option, null is returned.

orderItem : OrderItem Read Only

The order-item extension for this item, or null. An order-item extension will only exist for a ProductLineItem which belongs to an Order.

Order post-processing APIs (gillian) are now inactive by default and will throw an exception if accessed. Activation needs preliminary approval by Product Management. Please contact support in this case. Existing customers using these APIs are not affected by this change and can use the APIs until further notice.

parent : ProductLineItem Read Only

The parent line item of this line item or null if the line item is independent.

position : Number

The position within the line item container assigned to the ProductLineItem upon its creation, may be used as a sort-order.

The position is updated in the following way:

  • When a ProductLineItem is added to the LineItemCtnr, it is assigned the next available position, based on the current count
  • When a ProductLineItem is removed from the LineItemCtnr then LineItemCtnr method reassignPositions is called, so that the 'gap' left by the removed line-item is refilled. This method is dependent on no 2 ProductLineItem having the same position.
  • When a LineItemCtnr is copied (e.g. when a PlacedOrder is created from a Basket), no special position handling is necessary as the ProductLineItems are added according to their current position ordering in the source LineItemCtnr.

priceAdjustments : Collection Read Only

An iterator of price adjustments that have been applied to this product line item such as promotions on the purchase price (i.e. $10 Off or 10% Off).

product : Product Read Only

The product associated with the product line item.

The product line item might not be related to an actual catalog product, for example if it represents an option, or was not created from a catalog product, or if the product does not exist in the catalog anymore. In these cases, the method returns null.

productID : String Read Only

The ID of the related product.

Returns empty if no product is related.

productInventoryList : ProductInventoryList

The inventory list the product line item is associated with. If the line item is not associated with a inventory list, or the inventory list does not exist, the method returns null.

productInventoryListID : String

The ID of the inventory list the product line item is associated with.

productListItem : ProductListItem Read Only

The associated ProductListItem.

productName : String

The name of the product that was copied when product was added to line item container.

proratedPrice : Money Read Only

The price of this product line item after considering all dependent price adjustments and prorating all Buy-X-Get-Y and order-level discounts, according to the scheme described in PriceAdjustment.getProratedPrices(). For net pricing the net price is returned. For gross pricing, the gross price is returned.

proratedPriceAdjustmentPrices : Map Read Only

A Map of PriceAdjustment to Money instances. They keys to this map are the price adjustments that apply to this ProductLineItem either directly or indirectly when discounts are prorated according to the scheme described in PriceAdjustment.getProratedPrices(). The values in the map are the portion of the adjustment which applies to this particular product line item.

qualifyingProductLineItemForBonusProduct : ProductLineItem Read Only

The ProductLineItem that qualified the basket for this bonus product.

This method is only applicable if the product line item is a bonus product line item, and if the promotion is a product promotion with number of qualifying products granting a bonus-product discount. If these conditions aren't met, the method returns null. If there are multiple product line items that triggered this bonus product, this method returns the last one by position within the order.

quantity : Quantity Read Only

The quantity of the product represented by this ProductLineItem.

quantityValue : Number

The value of the quantity of this ProductLineItem.

relatedBonusProductLineItems : Collection Read Only

All bonus product line items for which this line item is a qualifying product line item. This method is usually called when rendering the cart so that bonus products can be shown next to the products that triggered their creation.

reserved : boolean Read Only

Returns if the product line item is reserved.

Reservations for the basket can be created with e.g. Basket.reserveInventory(Number).

Method must only be called for basket product line items. Exception is thrown if called for order product line item.

shipment : Shipment

The associated Shipment.

shippingLineItem : ProductShippingLineItem Read Only

The dependent shipping line item of this line item. The shipping line item can define product-specific shipping costs for this product line item.

stepQuantity : Quantity Read Only

Returns step quantity allowed for the product represented by the ProductLineItem (copied from product on initialization). Note: the quantity of a ProductLineItem must obey the limits set by the ProductLineItem's attributes 'MinOrderQuantity' and 'StepQuantity', i.e. for a 'MinOrderQuantity' of 2.0 and a 'StepQuantity' of 2.5 then values 2.0, 4.5, 7.0... are allowed values.

stepQuantityValue : Number

Return the value portion of getStepQuantity().

Constructor Summary

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

Method Summary

createPriceAdjustment(promotionID : String) : PriceAdjustment

Creates a product price adjustment.

createPriceAdjustment(promotionID : String, discount : Discount) : PriceAdjustment

Creates a product price adjustment representing a specific discount.

createShippingLineItem() : ProductShippingLineItem

Creates the dependent shipping line item for this line item.

getAdjustedGrossPrice() : Money

Returns the gross price of the product line item after applying all product-level adjustments.

getAdjustedNetPrice() : Money

Returns the net price of the product line item after applying all product-level adjustments.

getAdjustedPrice() : Money

Returns the price of the product line item after applying all product-level adjustments.

getAdjustedPrice(applyOrderLevelAdjustments : boolean) : Money

Returns the price of this product line item after considering all dependent price adjustments and optionally prorating all order-level price adjustments.

getAdjustedTax() : Money

Returns the tax of the unit after applying adjustments, in the purchase currency.

getBonusDiscountLineItem() : BonusDiscountLineItem

Returns the parent bonus discount line item of this line item.

getBundledProductLineItems() : Collection

Returns a collection containing the bundled product line items.

getCategory() : Category

Returns the category the product line item is associated with.

getCategoryID() : String

Returns the ID of the category the product line item is associated with.

getExternalLineItemStatus() : String

Returns the value set for the external line item status or null if no value set.

getExternalLineItemText() : String

Returns the value set for the external line item text or null if no value set.

getGiftMessage() : String

Returns the value set for gift message or null if no value set.

getManufacturerName() : String

Returns the name of the manfacturer of the product.

getManufacturerSKU() : String

Returns the name of the manfacturer's SKU of this product line item.

getMinOrderQuantity() : Quantity

Returns the minimal order quantity allowed for the product represented by the ProductLineItem (copied from product on initialization).

getMinOrderQuantityValue() : Number

Return the value portion of getMinOrderQuantity().

getOptionID() : String

Returns the ID of the product option this product line item represents.

getOptionModel() : ProductOptionModel

Returns the product option model for a product line item representing an option product.

getOptionProductLineItems() : Collection

Returns a collection containing option product line items.

getOptionValueID() : String

Returns the ID of the product option value this product line item represents.

getOrderItem() : OrderItem

Returns the order-item extension for this item, or null.

getParent() : ProductLineItem

Returns the parent line item of this line item or null if the line item is independent.

getPosition() : Number

Returns the position within the line item container assigned to the ProductLineItem upon its creation, may be used as a sort-order.

getPriceAdjustmentByPromotionID(promotionID : String) : PriceAdjustment

Returns the first price adjustment associated to the specified promotion ID.

getPriceAdjustmentByPromotionIDAndCouponCode(promotionID : String, couponCode : String) : PriceAdjustment

Returns the price adjustment associated to the specified promotion ID and coupon code combination.

getPriceAdjustments() : Collection

Returns an iterator of price adjustments that have been applied to this product line item such as promotions on the purchase price (i.e.

getPriceAdjustmentsByPromotionID(promotionID : String) : Collection

Returns the collection of price adjustments associated to the specified promotion ID.

getProduct() : Product

Returns the product associated with the product line item.

getProductID() : String

Returns the ID of the related product.

getProductInventoryList() : ProductInventoryList

Returns the inventory list the product line item is associated with.

getProductInventoryListID() : String

Returns the ID of the inventory list the product line item is associated with.

getProductListItem() : ProductListItem

Returns the associated ProductListItem.

getProductName() : String

Returns the name of the product that was copied when product was added to line item container.

getProratedPrice() : Money

Returns the price of this product line item after considering all dependent price adjustments and prorating all Buy-X-Get-Y and order-level discounts, according to the scheme described in PriceAdjustment.getProratedPrices().

getProratedPriceAdjustmentPrices() : Map

Returns a Map of PriceAdjustment to Money instances.

getQualifyingProductLineItemForBonusProduct() : ProductLineItem

Returns the ProductLineItem that qualified the basket for this bonus product.

getQuantity() : Quantity

Returns the quantity of the product represented by this ProductLineItem.

getQuantityValue() : Number

Returns the value of the quantity of this ProductLineItem.

getRelatedBonusProductLineItems() : Collection

Returns all bonus product line items for which this line item is a qualifying product line item.

getShipment() : Shipment

Returns the associated Shipment.

getShippingLineItem() : ProductShippingLineItem

Returns the dependent shipping line item of this line item.

getStepQuantity() : Quantity

Returns step quantity allowed for the product represented by the ProductLineItem (copied from product on initialization).

getStepQuantityValue() : Number

Return the value portion of getStepQuantity().

isBonusProductLineItem() : boolean

Identifies if the product line item represents a bonus line item.

isBundledProductLineItem() : boolean

Identifies if the product line item represents a bundled line item.

isCatalogProduct() : boolean

Returns true if the product line item represents a catalog product.

isGift() : boolean

Returns true if this line item represents a gift, false otherwise.

isOptionProductLineItem() : boolean

Identifies if the product line item represents an option line item.

isReserved() : boolean

Returns if the product line item is reserved.

removePriceAdjustment(priceAdjustmentLineItem : PriceAdjustment) : void

Removes the specified price adjustment from the product line item.

removeShippingLineItem() : void

Removes the dependent shipping line item for this line item.

replaceProduct(newProduct : Product) : void

Replaces the current product of the product line item with the product specified in parameter newProduct.

setCategory(category : Category) : void

Sets the specified category as the product line item category context.

setCategoryID(categoryID : String) : void

Sets the ID of the category the product line item is associated with.

setExternalLineItemStatus(status : String) : void

Sets the value to set for the external line item status.

setExternalLineItemText(text : String) : void

Sets the value to set for the external line item text.

setGift(isGift : boolean) : void

Controls if this line item is a gift or not.

setGiftMessage(message : String) : void

Sets the value to set for the gift message.

setManufacturerName(name : String) : void

Sets the name of the manufacturer of this product.

setManufacturerSKU(sku : String) : void

Sets the SKU of the manufacturer of this product.

setMinOrderQuantityValue(quantityValue : Number) : void

Set the minimum order quantity value for this object.

setPosition(aValue : Number) : void

Sets the position within the line item container.

setPriceValue(value : Number) : void

Sets price attributes of the line item based on the current purchase currency, taxation policy and line item quantity.

setProductInventoryList(productInventoryList : ProductInventoryList) : void

Sets the specified inventory list as the product line item inventory context.

setProductInventoryListID(productInventoryListID : String) : void

Sets the ID of the inventory list the product line item is associated with.

setProductName(aValue : String) : void

Sets the name of the product.

setQuantityValue(quantityValue : Number) : void

Updates the quantity value of the product line item.

setShipment(shipment : Shipment) : void

Associates the specified product line item with the specified shipment.

setStepQuantityValue(quantityValue : Number) : void

Set the step quantity value for this object.

updateOptionPrice() : void

Determines and sets the price of a option line item based on the selected option value the line item represents.

updateOptionValue(optionValue : ProductOptionValue) : void

Updates an option line item with a new option value.

updatePrice(price : Money) : void

Updates the price attributes of the line item based on the specified price.

updateQuantity(quantityValue : Number) : Number

Updates the quantity value of the product line item and all its dependent product line items.

Methods inherited from class LineItem

getBasePrice, getGrossPrice, getLineItemCtnr, getLineItemText, getNetPrice, getPrice, getPriceValue, getTax, getTaxBasis, getTaxClassID, getTaxRate, setBasePrice, setGrossPrice, setLineItemText, setNetPrice, setPriceValue, setTax, setTaxClassID, setTaxRate, updatePrice, updateTax, updateTax, updateTaxAmount

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

createPriceAdjustment

createPriceAdjustment(promotionID : String) : PriceAdjustment

Creates a product price adjustment.

The price adjustment line item is being initialized with the tax class code and tax rate of the product line item. The promotion ID is mandatory and must not be the ID of any actual promotion defined in B2C Commerce. If there already exists a price adjustment for the same promotionID, an exception is thrown.

Parameters:

promotionID - Promotion ID

Returns:

The new price adjustment

createPriceAdjustment

createPriceAdjustment(promotionID : String, discount : Discount) : PriceAdjustment

Creates a product price adjustment representing a specific discount. The price adjustment line item is initialized with the tax class code and tax rate of the product line item.

The promotion ID is mandatory and must not be the ID of any actual promotion defined in B2C Commerce. If a price adjustment already exists for the same promotionID, an exception is thrown.

The possible discounts are FixedPriceDiscount, AmountDiscount, PercentageDiscount. Example:

var myProductItem : dw.order.ProductLineItem; // assume known var paFixedUnitPrice100 : dw.order.PriceAdjustment = myProductItem.createPriceAdjustment("myPromotionID1", new FixedPriceDiscount(100.00)); var paTenPercent : dw.order.PriceAdjustment = myProductItem.createPriceAdjustment("myPromotionID2", new PercentageDiscount(10)); var paReduceBy20 : dw.order.PriceAdjustment = myProductItem.createPriceAdjustment("myPromotionID3", new AmountDiscount(20.00);

Parameters:

promotionID - Unique custom promotion ID, not null

discount - The desired discount, not null

Returns:

The new custom price adjustment


createShippingLineItem

createShippingLineItem() : ProductShippingLineItem

Creates the dependent shipping line item for this line item. The shipping line item can define product-specific shipping costs for this product line item. This method has replace semantics: If there is an existing shipping line item it will be replaced with a new shipping line item.

Returns:

the created shipping line item


getAdjustedGrossPrice

getAdjustedGrossPrice() : Money

Returns the gross price of the product line item after applying all product-level adjustments.

Returns:

gross price after applying product-level adjustments

See Also:

getAdjustedNetPrice()

getAdjustedPrice()


getAdjustedNetPrice

getAdjustedNetPrice() : Money

Returns the net price of the product line item after applying all product-level adjustments.

Returns:

net price after applying product-level adjustments

See Also:

getAdjustedGrossPrice()

getAdjustedPrice()


getAdjustedPrice

getAdjustedPrice() : Money

Returns the price of the product line item after applying all product-level adjustments. For net pricing the adjusted net price is returned (see getAdjustedNetPrice()). For gross pricing, the adjusted gross price is returned (see getAdjustedGrossPrice()).

Returns:

Adjusted net or gross price

See Also:

getAdjustedGrossPrice()

getAdjustedNetPrice()


getAdjustedPrice

getAdjustedPrice(applyOrderLevelAdjustments : boolean) : Money

Returns the price of this product line item after considering all dependent price adjustments and optionally prorating all order-level price adjustments. For net pricing the net price is returned. For gross pricing, the gross price is returned.

Parameters:

applyOrderLevelAdjustments - If true, order-level adjustments will be applied to line item price.

Returns:

Adjusted net or gross price

See Also:

getAdjustedPrice()


getAdjustedTax

getAdjustedTax() : Money

Returns the tax of the unit after applying adjustments, in the purchase currency.

Returns:

the tax of the unit after applying adjustments, in the purchase currency.


getBonusDiscountLineItem

getBonusDiscountLineItem() : BonusDiscountLineItem

Returns the parent bonus discount line item of this line item. Only bonus product line items that have been selected by the customer as part of a BONUS_CHOICE discount have one of these.

Returns:

the bonus discount line item of this line item or null


getBundledProductLineItems

getBundledProductLineItems() : Collection

Returns a collection containing the bundled product line items.

Returns:

a collection containing the bundled product line items.


getCategory

getCategory() : Category

Returns the category the product line item is associated with. If the line item is not associated with a category, or the category does not exist in the site catalog, the method returns null.

Returns:

Category or null


getCategoryID

getCategoryID() : String

Returns the ID of the category the product line item is associated with.

Returns:

Category ID or null.


getExternalLineItemStatus

getExternalLineItemStatus() : String

Returns the value set for the external line item status or null if no value set.

Returns:

the value set for the external line item status or null if no value set.


getExternalLineItemText

getExternalLineItemText() : String

Returns the value set for the external line item text or null if no value set.

Returns:

the value set for the external line item text or null if no value set.


getGiftMessage

getGiftMessage() : String

Returns the value set for gift message or null if no value set.

Returns:

the value set for gift message or null if no value set.


getManufacturerName

getManufacturerName() : String

Returns the name of the manfacturer of the product.

Returns:

The name of the manfacturer of the product.


getManufacturerSKU

getManufacturerSKU() : String

Returns the name of the manfacturer's SKU of this product line item.

Returns:

the name of the manfacturer's SKU of this product line item.


getMinOrderQuantity

getMinOrderQuantity() : Quantity

Returns the minimal order quantity allowed for the product represented by the ProductLineItem (copied from product on initialization). Note: the quantity of a ProductLineItem must obey the limits set by the ProductLineItem's attributes 'MinOrderQuantity' and 'StepQuantity', i.e. for a 'MinOrderQuantity' of 2.0 and a 'StepQuantity' of 2.5 then values 2.0, 4.5, 7.0... are allowed values.

Returns:

the minimal order quantity allowed for the product.


getMinOrderQuantityValue

getMinOrderQuantityValue() : Number

Return the value portion of getMinOrderQuantity().

Returns:

the minimal order quantity value allowed for the product.


getOptionID

getOptionID() : String

Returns the ID of the product option this product line item represents. If the product line item does not represent an option, null is returned.

Returns:

the ID of the product option this product line item represents.


getOptionModel

getOptionModel() : ProductOptionModel

Returns the product option model for a product line item representing an option product.

The returned option model has preselected values based on the dependent option line items of this product line item. Null is returned if this line item does not represent an option product.

Returns:

the product option model for a product line item representing an option product.


getOptionProductLineItems

getOptionProductLineItems() : Collection

Returns a collection containing option product line items.

Returns:

a collection containing option product line items.


getOptionValueID

getOptionValueID() : String

Returns the ID of the product option value this product line item represents. If the product line item does not represent an option, null is returned.

Returns:

the ID of the product option value this product line item represents.


getOrderItem

getOrderItem() : OrderItem

Returns the order-item extension for this item, or null. An order-item extension will only exist for a ProductLineItem which belongs to an Order.

Order post-processing APIs (gillian) are now inactive by default and will throw an exception if accessed. Activation needs preliminary approval by Product Management. Please contact support in this case. Existing customers using these APIs are not affected by this change and can use the APIs until further notice.

Returns:

null or the order-item extension


getParent

getParent() : ProductLineItem

Returns the parent line item of this line item or null if the line item is independent.

Returns:

the parent line item of this line item or null if the line item is independent.


getPosition

getPosition() : Number

Returns the position within the line item container assigned to the ProductLineItem upon its creation, may be used as a sort-order.

The position is updated in the following way:

  • When a ProductLineItem is added to the LineItemCtnr, it is assigned the next available position, based on the current count
  • When a ProductLineItem is removed from the LineItemCtnr then LineItemCtnr method reassignPositions is called, so that the 'gap' left by the removed line-item is refilled. This method is dependent on no 2 ProductLineItem having the same position.
  • When a LineItemCtnr is copied (e.g. when a PlacedOrder is created from a Basket), no special position handling is necessary as the ProductLineItems are added according to their current position ordering in the source LineItemCtnr.

Returns:

the position within the line item container assigned to the ProductLineItem upon its creation.


getPriceAdjustmentByPromotionID

getPriceAdjustmentByPromotionID(promotionID : String) : PriceAdjustment

Returns the first price adjustment associated to the specified promotion ID. It is highly recommended to use getPriceAdjustmentsByPromotionID(String) instead. If there are multiple price adjustments for the same promotion, this method will return the first found. Alternatively, to uniquely identify a price adjustment using its promotion id and coupon code, use getPriceAdjustmentByPromotionIDAndCouponCode(String, String)

Parameters:

promotionID - Promotion id

Returns:

The price adjustment associated with the promotion ID or null


getPriceAdjustmentByPromotionIDAndCouponCode

getPriceAdjustmentByPromotionIDAndCouponCode(promotionID : String, couponCode : String) : PriceAdjustment

Returns the price adjustment associated to the specified promotion ID and coupon code combination.

Parameters:

promotionID - Promotion id

couponCode - the code of the coupon used to apply the promotion, or null if the promotion is not coupon based.

Returns:

The price adjustment associated with the promotion ID and coupon code combination, or null


getPriceAdjustments

getPriceAdjustments() : Collection

Returns an iterator of price adjustments that have been applied to this product line item such as promotions on the purchase price (i.e. $10 Off or 10% Off).

Returns:

a collection of price adjustments that have been applied to this product line item.


getPriceAdjustmentsByPromotionID

getPriceAdjustmentsByPromotionID(promotionID : String) : Collection

Returns the collection of price adjustments associated to the specified promotion ID. If only one coupon code is allowed per order, then the collection should only ever have a single entry in it. The multiple coupon code feature can cause multiple price adjustments to be returned.

Parameters:

promotionID - Promotion id

Returns:

The collection of price adjustments associated with the promotion ID or null if the promotionID was null. If there are no price adjustments for the passed promotion, the collection will be empty.


getProduct

getProduct() : Product

Returns the product associated with the product line item.

The product line item might not be related to an actual catalog product, for example if it represents an option, or was not created from a catalog product, or if the product does not exist in the catalog anymore. In these cases, the method returns null.

Returns:

the product of the line item, or null

See Also:

isCatalogProduct()


getProductID

getProductID() : String

Returns the ID of the related product.

Returns empty if no product is related.

Returns:

the ID of the related product.

See Also:

isCatalogProduct()

getProduct()


getProductInventoryList

getProductInventoryList() : ProductInventoryList

Returns the inventory list the product line item is associated with. If the line item is not associated with a inventory list, or the inventory list does not exist, the method returns null.

Returns:

ProductInventoryList or null


getProductInventoryListID

getProductInventoryListID() : String

Returns the ID of the inventory list the product line item is associated with.

Returns:

ProductInventoryList ID or null.


getProductListItem

getProductListItem() : ProductListItem

Returns the associated ProductListItem.

Returns:

item or null.


getProductName

getProductName() : String

Returns the name of the product that was copied when product was added to line item container.

Returns:

the name of the product.


getProratedPrice

getProratedPrice() : Money

Returns the price of this product line item after considering all dependent price adjustments and prorating all Buy-X-Get-Y and order-level discounts, according to the scheme described in PriceAdjustment.getProratedPrices(). For net pricing the net price is returned. For gross pricing, the gross price is returned.

Returns:

Adjusted and prorated net or gross price


getProratedPriceAdjustmentPrices

getProratedPriceAdjustmentPrices() : Map

Returns a Map of PriceAdjustment to Money instances. They keys to this map are the price adjustments that apply to this ProductLineItem either directly or indirectly when discounts are prorated according to the scheme described in PriceAdjustment.getProratedPrices(). The values in the map are the portion of the adjustment which applies to this particular product line item.

Returns:

Map of PriceAdjustment to Money instances, representing the prorated adjustments applied to this ProductLineItem.


getQualifyingProductLineItemForBonusProduct

getQualifyingProductLineItemForBonusProduct() : ProductLineItem

Returns the ProductLineItem that qualified the basket for this bonus product.

This method is only applicable if the product line item is a bonus product line item, and if the promotion is a product promotion with number of qualifying products granting a bonus-product discount. If these conditions aren't met, the method returns null. If there are multiple product line items that triggered this bonus product, this method returns the last one by position within the order.

Returns:

the ProductLineItem that qualified the basket for this bonus product. Returns null if this is not a bonus product, or if there was no distinct qualifying product.


getQuantity

getQuantity() : Quantity

Returns the quantity of the product represented by this ProductLineItem.

Returns:

the quantity of the product.


getQuantityValue

getQuantityValue() : Number

Returns the value of the quantity of this ProductLineItem.

Returns:

quantity value of product line item


getRelatedBonusProductLineItems() : Collection

Returns all bonus product line items for which this line item is a qualifying product line item. This method is usually called when rendering the cart so that bonus products can be shown next to the products that triggered their creation.

Returns:

the bonus product line items triggered by the addition of this product to the cart.


getShipment

getShipment() : Shipment

Returns the associated Shipment.

Returns:

The shipment of the product line item


getShippingLineItem

getShippingLineItem() : ProductShippingLineItem

Returns the dependent shipping line item of this line item. The shipping line item can define product-specific shipping costs for this product line item.

Returns:

the shipping line item of this line item or null


getStepQuantity

getStepQuantity() : Quantity

Returns step quantity allowed for the product represented by the ProductLineItem (copied from product on initialization). Note: the quantity of a ProductLineItem must obey the limits set by the ProductLineItem's attributes 'MinOrderQuantity' and 'StepQuantity', i.e. for a 'MinOrderQuantity' of 2.0 and a 'StepQuantity' of 2.5 then values 2.0, 4.5, 7.0... are allowed values.

Returns:

step quantity allowed for the product.


getStepQuantityValue

getStepQuantityValue() : Number

Return the value portion of getStepQuantity().

Returns:

step quantity value allowed for the product.


isBonusProductLineItem

isBonusProductLineItem() : boolean

Identifies if the product line item represents a bonus line item.

Returns:

true if the product line item represents a bonus line item, false otherwise.


isBundledProductLineItem

isBundledProductLineItem() : boolean

Identifies if the product line item represents a bundled line item.

Returns:

true if the product line item represents a bundled line item.


isCatalogProduct

isCatalogProduct() : boolean

Returns true if the product line item represents a catalog product.

That flag is determined during product line item creation with LineItemCtnr.createProductLineItem(String, Shipment), stored at the line item container and can be accessed as productLineItem.catalogProduct. It represents what can be evaluated with

dw.catalog.ProductMgr.getProduct( productID ) != null && dw.catalog.ProductMgr.getProduct( productID ).isAssignedToSiteCatalog()

If the product is not available during product line item creation it is considered a non catalog product line item without connection to a product.

Returns:

true if product line item represents catalog product, otherwise false

See Also:

getProduct()


isGift

isGift() : boolean

Returns true if this line item represents a gift, false otherwise.

Returns:

true if this line item represents a gift, false otherwise.


isOptionProductLineItem

isOptionProductLineItem() : boolean

Identifies if the product line item represents an option line item. Option line items do not represent true products but rather options of products. An option line item always has a parent product line item representing a true product.

Returns:

true if the product line item represents an option line item, false otherwise.


isReserved

isReserved() : boolean

Returns if the product line item is reserved.

Reservations for the basket can be created with e.g. Basket.reserveInventory(Number).

Method must only be called for basket product line items. Exception is thrown if called for order product line item.

Returns:

true if line item is reserved, false otherwise.


removePriceAdjustment

removePriceAdjustment(priceAdjustmentLineItem : PriceAdjustment) : void

Removes the specified price adjustment from the product line item.

Parameters:

priceAdjustmentLineItem - The price adjustment to remove


removeShippingLineItem

removeShippingLineItem() : void

Removes the dependent shipping line item for this line item.


replaceProduct

replaceProduct(newProduct : Product) : void

Replaces the current product of the product line item with the product specified in parameter newProduct.

The following rules apply:

  • Preserve line item attributes UUID, Quantity, CategoryID, ExternalLineItemStatus, ExternalLineItemText, isGift, GiftMessage, Position, Parent, Shipment
  • Replace product-specific attributes ProductID, ProductName, MinOrderQuantity, StepQuantity, ManufacturerName, ManufacturerSKU
  • Remove all price adjustments related to the product line item
  • Remove the shipping line item related to the product line item
  • Remove all bundled line items of current product, and add bundled line items if new product is a bundle
  • Remove all option line items of current product, and add option line items if new product is an option product; use default option selections
  • Set all price attributes to N/A
  • Preserve all custom attributes of line item, but override order-required attributes with values from new product

The primary use is to replace one variation product with another, without having to both create a new line item for the replacement and remove the line item for the replaced product.

Parameters:

newProduct - The new product of the product line item


setCategory

setCategory(category : Category) : void

Sets the specified category as the product line item category context.

Parameters:

category - Category instance or null


setCategoryID

setCategoryID(categoryID : String) : void

Sets the ID of the category the product line item is associated with.

Parameters:

categoryID - the Category ID or null.


setExternalLineItemStatus

setExternalLineItemStatus(status : String) : void

Sets the value to set for the external line item status.

Parameters:

status - the value to set for the external line item status.


setExternalLineItemText

setExternalLineItemText(text : String) : void

Sets the value to set for the external line item text.

Parameters:

text - the value to set for the external line item text.


setGift

setGift(isGift : boolean) : void

Controls if this line item is a gift or not.

Parameters:

isGift - set to true if you want this line item to represent a gift.


setGiftMessage

setGiftMessage(message : String) : void

Sets the value to set for the gift message.

Parameters:

message - the value to set for the gift message.


setManufacturerName

setManufacturerName(name : String) : void

Sets the name of the manufacturer of this product.

Parameters:

name - The name of the manfacturer of this product


setManufacturerSKU

setManufacturerSKU(sku : String) : void

Sets the SKU of the manufacturer of this product.

Parameters:

sku - The SKU of the manfacturer of this product


setMinOrderQuantityValue

setMinOrderQuantityValue(quantityValue : Number) : void

Set the minimum order quantity value for this object.

This will be used to validate and adjust quantities when setQuantityValue() is called. For typical catalog product line items, it is usually desirable to have this value inherited from the product attributes, but for non-catalog products, it is sometimes desirable to set this value programmatically.

Null is accepted and represents Quantity.NA. Otherwise, the quantity value must be > 0.

Parameters:

quantityValue - The minimal order quantity allowed for the product or null.


setPosition

setPosition(aValue : Number) : void

Sets the position within the line item container. This value may be used as a sort-order.

The position is updated in the following way:

  • When a ProductLineItem is added to the LineItemCtnr, it is assigned the next available position, based on the current count
  • When a ProductLineItem is removed from the LineItemCtnr then LineItemCtnr method reassignPositions is called, so that the 'gap' left by the removed line-item is refilled. This method is dependent on no 2 ProductLineItem having the same position.
  • When a LineItemCtnr is copied (e.g. when an Order is created from a Basket), no special position handling is necessary as the ProductLineItems are added according to their current position ordering in the source LineItemCtnr.

Parameters:

aValue - the position within the line item container.


setPriceValue

setPriceValue(value : Number) : void

Sets price attributes of the line item based on the current purchase currency, taxation policy and line item quantity.

The method sets the 'basePrice' attribute of the line item. Additionally, it sets the 'netPrice' attribute of the line item if the current taxation policy is 'net', and the 'grossPrice' attribute, if the current taxation policy is 'gross'. The 'netPrice'/'grossPrice' attributes are set by multiplying the specified price value with the line item quantity.

If null is specified as value, the price attributes are reset to Money.NA.

Parameters:

value - Price value or null


setProductInventoryList

setProductInventoryList(productInventoryList : ProductInventoryList) : void

Sets the specified inventory list as the product line item inventory context.

Parameters:

productInventoryList - ProductInventoryList instance or null


setProductInventoryListID

setProductInventoryListID(productInventoryListID : String) : void

Sets the ID of the inventory list the product line item is associated with.

Parameters:

productInventoryListID - the ProductInventoryList ID or null.


setProductName

setProductName(aValue : String) : void

Sets the name of the product.

Parameters:

aValue - the name of the product.


setQuantityValue

setQuantityValue(quantityValue : Number) : void

Updates the quantity value of the product line item.

Validates the specified quantity value against the line item's min order and step quantity and adjusts it if necessary. In particular, if 0 is passed, then the value will be adjusted to the min order quantity, not removed from the line item container.

Null values or values < 0.0 are not accepted.

Parameters:

quantityValue - Quantity value.


setShipment

setShipment(shipment : Shipment) : void

Associates the specified product line item with the specified shipment.

The method is only applicable for independent product line items. If called for any dependent line item (option or bundled line item), the method will throw an exception. The shipment for all dependent line items will be updated automatically by the method. Product line item and shipment must belong to the same line item ctnr.

Parameters:

shipment - The new shipment of the product line item


setStepQuantityValue

setStepQuantityValue(quantityValue : Number) : void

Set the step quantity value for this object.

This will be used to validate and adjust quantities when updateQuantity() is called. For typical catalog product line items, it is usually desirable to have this value inherited from the product attributes, but for non-catalog products, it is sometimes desirable to set this value programmatically.

Null is accepted and represents Quantity.NA. Otherwise, the quantity value must be > 0.

Parameters:

quantityValue - The minimal order quantity allowed for the product or null.


updateOptionPrice

updateOptionPrice() : void

Determines and sets the price of a option line item based on the selected option value the line item represents.


updateOptionValue

updateOptionValue(optionValue : ProductOptionValue) : void

Updates an option line item with a new option value. This method will not do anything if the current line item is no option line item, if the specified value does not exist for the current option or if this value is already selected. Note, that this method will update the attributes optionValueID, productID, productName and lineItemText. It will not update the price attributes of the line item. To update the price of the line item you need to call updateOptionPrice() in addition. This is usually done during calculation in the calculate hook.

Parameters:

optionValue - The value to update the option line item with


updatePrice

updatePrice(price : Money) : void

Updates the price attributes of the line item based on the specified price. The base price is set to the specified value. If the line item is based on net pricing then the net price attribute is set. If the line item is based on gross pricing then the gross price attribute is set. Whether or not a line item is based on net or gross pricing is a site-wide configuration parameter. In either case, this price is equal to the product of the base price and the quantity of this line item in its container.

Deprecated:

Use setPriceValue(Number)

Parameters:

price - The price to use when performing the update. This price must not be null and must either be equal to NOT_AVAIALBLE or must have a currency code equal to that of the parent container.


updateQuantity

updateQuantity(quantityValue : Number) : Number

Updates the quantity value of the product line item and all its dependent product line items.

Validates the specified quantity value against the line item's min order and step quantity and adjusts it if necessary. The adjusted quantity value is returned.

In general, quantity values < 0.0 are not accepted.

Deprecated:

Use setQuantityValue(Number) followed by getQuantity() instead.

Parameters:

quantityValue - Numeric quantity value.

Returns:

Adjusted quantity value