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.
getCategoryID()
:
String
Returns the ID of the category the product line item is associated with.
getMinOrderQuantity()
:
Quantity
Returns the minimal order quantity allowed for the product represented by the ProductLineItem (copied from product on initialization).
getOptionID()
:
String
Returns the ID of the product option this product line item represents.
getPosition()
:
Number
Returns the position within the line item container assigned to the ProductLineItem upon its creation, may be used as a sort-order.
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.
getProductName()
:
String
Returns the name of the product that was copied when product was added to line item container.
getQuantity()
:
Quantity
Returns the quantity of the product represented by this ProductLineItem.
getStepQuantity()
:
Quantity
Returns step quantity allowed for the product represented by the ProductLineItem (copied from product on initialization).
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.
isReserved()
:
boolean
Returns if the product line item is reserved.
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.
setGift(isGift
:
boolean)
:
void
Controls if this line item is a gift or not.
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.
setShipment(shipment
:
Shipment)
:
void
Associates the specified product line item with the specified shipment.
updateOptionPrice()
:
void
Determines and sets the price of a option line item based on the selected option value the line item represents.
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.
createPriceAdjustment
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
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
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
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
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
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
getAdjustedTax
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
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
Returns a collection containing the bundled product line items.
Returns:
a collection containing the bundled product line items.
getCategory
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
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
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
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
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
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
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
Returns a collection containing option product line items.
Returns:
a collection containing option product line items.
getOptionValueID
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
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
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
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
Parameters:
promotionID
-
Promotion id
Returns:
The price adjustment associated with the promotion ID or null
getPriceAdjustmentByPromotionIDAndCouponCode
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
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
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
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
getProductID
Returns the ID of the related product.
Returns empty if no product is related.
Returns:
the ID of the related product.
getProductInventoryList
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
Returns the associated ProductListItem.
getProductName
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
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
Returns the quantity of the product represented by this ProductLineItem.
Returns:
the quantity of the product.
getQuantityValue
Returns the value of the quantity of this ProductLineItem.
Returns:
quantity value of product line item
getRelatedBonusProductLineItems
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
Returns the associated Shipment.
Returns:
The shipment of the product line item
getShippingLineItem
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
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
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
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
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
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
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
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.
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
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.
Parameters:
quantityValue
-
Numeric quantity value.
Returns:
Adjusted quantity value