public interface OrderItem extends Serializable, Cloneable
| Modifier and Type | Method and Description |
|---|---|
void |
addCandidateItemOffer(CandidateItemOffer candidateItemOffer)
Used by the promotion engine to add offers that might apply to this orderItem.
|
void |
assignFinalPrice()
Used to set the final price of the item and corresponding details.
|
OrderItem |
clone() |
void |
finalizePrice()
Called by the pricing engine after prices have been computed.
|
Money |
getAdjustmentValue()
Deprecated.
Delegates to
getAverageAdjustmentValue() instead but this method is of little
or no value in most practical applications unless only simple promotions are being used. |
Money |
getAverageAdjustmentValue()
Returns the average unit item adjustments.
|
Money |
getAveragePrice()
Returns the average unit display price for the item.
|
List<CandidateItemOffer> |
getCandidateItemOffers() |
Category |
getCategory() |
List<OrderItem> |
getChildOrderItems() |
GiftWrapOrderItem |
getGiftWrapOrderItem() |
Long |
getId()
The unique identifier of this OrderItem
|
boolean |
getIsDiscounted()
Returns true if this item received a discount.
|
boolean |
getIsOnSale()
Default implementation uses
getSalePrice() < getRetailPrice() |
String |
getName()
Generally copied from the Sku.getName()
|
Order |
getOrder()
Reference back to the containing order.
|
List<OrderItemAdjustment> |
getOrderItemAdjustments()
Deprecated.
|
Map<String,OrderItemAttribute> |
getOrderItemAttributes()
A list of arbitrary attributes added to this item.
|
List<OrderItemPriceDetail> |
getOrderItemPriceDetails()
Collection of priceDetails for this orderItem.
|
List<OrderItemQualifier> |
getOrderItemQualifiers()
If any quantity of this item was used to qualify for an offer, then this returned list
will indicate the offer and the relevant quantity.
|
OrderItemType |
getOrderItemType() |
OrderItem |
getParentOrderItem() |
PersonalMessage |
getPersonalMessage() |
Money |
getPrice()
Deprecated.
Delegates to
getAveragePrice() |
Money |
getPriceBeforeAdjustments(boolean allowSalesPrice)
Returns the unit price of this item.
|
int |
getQuantity()
The quantity of this
OrderItem. |
Money |
getRetailPrice()
The retail price of the item that was added to the
Order at the time that this was added. |
Money |
getSalePrice()
Returns the salePrice for this item.
|
Money |
getTaxablePrice()
Deprecated.
If the item is taxable, returns
getAveragePrice()
It is recommended instead that tax calculation engines use the #getTotalTaxableAmount() which provides the taxable
total for all quantities of this item. This method suffers from penny rounding errors in some
situations. |
Money |
getTotalAdjustmentValue()
Returns the total for all item level adjustments.
|
Money |
getTotalPrice()
Returns the total price to be paid for this order item including item-level adjustments.
|
Money |
getTotalPriceBeforeAdjustments(boolean allowSalesPrice)
Returns the total price to be paid before adjustments.
|
boolean |
isAParentOf(OrderItem candidateChild) |
boolean |
isDiscountingAllowed()
If true, this item can be discounted..
|
boolean |
isInCategory(String categoryName) |
boolean |
isRetailPriceOverride()
Returns true if the retail price was manually set.
|
boolean |
isSalePriceOverride()
Returns true if the sale price was manually set.
|
boolean |
isSkuActive()
Returns a boolean indicating whether this sku is active.
|
Boolean |
isTaxable()
Returns whether or not this item is taxable.
|
int |
removeAllAdjustments()
Removes all adjustment for this order item and reset the adjustment price.
|
void |
removeAllCandidateItemOffers()
Removes all candidate offers.
|
void |
setCandidateItemOffers(List<CandidateItemOffer> candidateItemOffers) |
void |
setCategory(Category category) |
void |
setChildOrderItems(List<OrderItem> childOrderItems)
Sets the list of orderitems that are dependent on this order item
|
void |
setDiscountingAllowed(boolean discountingAllowed)
Turns off discount processing for this line item.
|
void |
setGiftWrapOrderItem(GiftWrapOrderItem giftWrapOrderItem) |
void |
setId(Long id)
Sets the unique id of the OrderItem.
|
void |
setName(String name)
Sets the name of this order item.
|
void |
setOrder(Order order)
Sets the order for this orderItem.
|
void |
setOrderItemAdjustments(List<OrderItemAdjustment> orderItemAdjustments)
Deprecated.
Item level adjustments are now stored at the OrderItemPriceDetail level instead to
prevent unnecessary item splitting of OrderItems when evaluating promotions
in the pricing engine.
|
void |
setOrderItemAttributes(Map<String,OrderItemAttribute> orderItemAttributes)
Sets the map of order item attributes.
|
void |
setOrderItemPriceDetails(List<OrderItemPriceDetail> orderItemPriceDetails)
Returns the list of orderItem price details.
|
void |
setOrderItemQualifiers(List<OrderItemQualifier> orderItemQualifiers)
Sets the list of OrderItemQualifiers
|
void |
setOrderItemType(OrderItemType orderItemType) |
void |
setParentOrderItem(OrderItem parentOrderItem)
Sets the parent order item for this order item
|
void |
setPersonalMessage(PersonalMessage personalMessage) |
void |
setPrice(Money price)
Calling this method is the same as calling the following:
setRetailPrice(Money)
setSalePrice(Money)
#setRetailPriceOverride(true)
#setSalePriceOverride(true)
#setDiscountingAllowed(false)
This has the effect of setting the price in a way that no discounts or adjustments can be made. |
void |
setQuantity(int quantity)
Sets the quantity of this item
|
void |
setRetailPrice(Money retailPrice)
Calling this method will manually set the retailPrice.
|
void |
setRetailPriceOverride(boolean override)
Indicates that the retail price was manually set.
|
void |
setSalePrice(Money salePrice)
Calling this method will manually set the salePrice.
|
void |
setSalePriceOverride(boolean override)
Indicates that the sale price was manually set.
|
void |
setTaxable(Boolean taxable)
Sets whether or not this item is taxable.
|
boolean |
updateSaleAndRetailPrices()
Used to reset the base price of the item that the pricing engine uses.
|
Long getId()
void setId(Long id)
id - Order getOrder()
void setOrder(Order order)
order - Money getRetailPrice()
Order at the time that this was added. This is preferable
to use as opposed to checking the price of the item that was added from the catalog domain (like in
DiscreteOrderItem, using DiscreteOrderItem.getSku()'s retail price) since the price in the catalog
domain could have changed since the item was added to the Order.void setRetailPrice(Money retailPrice)
#setRetailPriceOverride(true)
Consider also calling setDiscountingAllowed(boolean) with a value of false to restrict
discounts after manually setting the retail price.retailPrice - void setRetailPriceOverride(boolean override)
setRetailPrice(Money)boolean isRetailPriceOverride()
Money getSalePrice()
updateSaleAndRetailPrices() will ensure that the
retailPrice being used is current.void setSalePrice(Money salePrice)
#setSalePriceSetManually(true)
To avoid the pricing engine resetting this price, you should also make a call to
#setSalePriceOverride(true)
Typically for DiscreteOrderItems, the prices will be set with a call to updateSaleAndRetailPrices()
which will use the Broadleaf dynamic pricing engine or the values directly tied to the SKU.salePrice - void setSalePriceOverride(boolean override)
setDiscountingAllowed(boolean) with a value of false to restrict
discounts after manually setting the retail price.
If the salePrice is not lower than the retailPrice, the system will return the retailPrice when
a call to getSalePrice() is made.boolean isSalePriceOverride()
@Deprecated Money getAdjustmentValue()
getAverageAdjustmentValue() instead but this method is of little
or no value in most practical applications unless only simple promotions are being used.@Deprecated Money getPrice()
getAveragePrice()void setPrice(Money price)
setRetailPrice(Money)
setSalePrice(Money)
#setRetailPriceOverride(true)
#setSalePriceOverride(true)
#setDiscountingAllowed(false)
This has the effect of setting the price in a way that no discounts or adjustments can be made.price - int getQuantity()
OrderItem.void setQuantity(int quantity)
List<OrderItemPriceDetail> getOrderItemPriceDetails()
void setOrderItemPriceDetails(List<OrderItemPriceDetail> orderItemPriceDetails)
orderItemPriceDetails - #getOrderItemPriceDetails()}Category getCategory()
void setCategory(Category category)
List<CandidateItemOffer> getCandidateItemOffers()
void setCandidateItemOffers(List<CandidateItemOffer> candidateItemOffers)
@Deprecated List<OrderItemAdjustment> getOrderItemAdjustments()
@Deprecated void setOrderItemAdjustments(List<OrderItemAdjustment> orderItemAdjustments)
List<OrderItemQualifier> getOrderItemQualifiers()
void setOrderItemQualifiers(List<OrderItemQualifier> orderItemQualifiers)
PersonalMessage getPersonalMessage()
void setPersonalMessage(PersonalMessage personalMessage)
boolean isInCategory(String categoryName)
GiftWrapOrderItem getGiftWrapOrderItem()
void setGiftWrapOrderItem(GiftWrapOrderItem giftWrapOrderItem)
OrderItemType getOrderItemType()
void setOrderItemType(OrderItemType orderItemType)
@Deprecated Money getTaxablePrice()
getAveragePrice()
It is recommended instead that tax calculation engines use the #getTotalTaxableAmount() which provides the taxable
total for all quantities of this item. This method suffers from penny rounding errors in some
situations.boolean getIsOnSale()
getSalePrice() < getRetailPrice()boolean isDiscountingAllowed()
void setDiscountingAllowed(boolean discountingAllowed)
disableDiscounts - boolean getIsDiscounted()
String getName()
boolean updateSaleAndRetailPrices()
void finalizePrice()
void setName(String name)
name - OrderItem clone()
void assignFinalPrice()
useSalePrice - Money getPriceBeforeAdjustments(boolean allowSalesPrice)
OrderItem during the first execution of
any method that depends on the sale or retail price including this one.allowSalesPrice - updateSaleAndRetailPrices()void addCandidateItemOffer(CandidateItemOffer candidateItemOffer)
candidateItemOffer - void removeAllCandidateItemOffers()
int removeAllAdjustments()
Map<String,OrderItemAttribute> getOrderItemAttributes()
void setOrderItemAttributes(Map<String,OrderItemAttribute> orderItemAttributes)
orderItemAttributes - Money getAveragePrice()
Money getAverageAdjustmentValue()
getAveragePrice()
for an example of this.
Implementations wishing to show unit prices may choose instead to show the individual OrderItemPriceDetails
instead of this value to avoid the rounding problem. This would result in multiple cart item
display rows for each OrderItem.
Alternatively, the cart display should use getTotalAdjustmentValue().Money getTotalAdjustmentValue()
Money getTotalPrice()
Boolean isTaxable()
void setTaxable(Boolean taxable)
taxable - Money getTotalPriceBeforeAdjustments(boolean allowSalesPrice)
boolean isSkuActive()
List<OrderItem> getChildOrderItems()
void setChildOrderItems(List<OrderItem> childOrderItems)
childOrderItems - OrderItem getParentOrderItem()
void setParentOrderItem(OrderItem parentOrderItem)
parentOrderItem - boolean isAParentOf(OrderItem candidateChild)
candidateChild - Copyright © 2015. All Rights Reserved.