\Item
An Item for an {@link Order}.
Synopsis
class Item
extends DataObject
{
- // members
- private static Array $db = ;
- private static Array $has_one = ;
- private static Array $has_many = ;
- private static Array $defaults = ;
- // methods
- public void Amount()
- public Price Price()
- public void onBeforeDelete()
- public void UnitAmount()
- public Money UnitPrice()
- public Price Total()
- public void TotalPrice()
- public Mixed Variation()
- public Mixed Product()
- public ValidationResult validateForCart()
- public ValidationResult validate()
- public void SummaryOfOptions()
Hierarchy
Extends
- DataObject
Tasks
Line | Task |
---|---|
23 | Multi currency |
125 | Multi currency |
229 | Make this more flexible for formatting |
Members
private
- $db
—
Array
DB fields for an Item, the object this Item represents (e.g. {@link Product} has a version ID saved as well, so if price is changed or something then a record of the price at time of ordering exists and can be retrieved. - $defaults
—
Array
Default values for this class - $has_many
—
Array
Relations for this class - $has_one
—
Array
Relations for this class
Methods
public
- Amount()
- Price() — Display price, can decorate for multiple currency etc.
- Product() — Get the product for the item
- SummaryOfOptions()
- Total() — Get unit price for this item including item options price and quantity.
- TotalPrice()
- UnitAmount()
- UnitPrice() — Get unit price for this Item including price of any {@link ItemOption}s.
- Variation() — Get the variation for the item if a Variation exists in the ItemOptions This assumes only one variation per item.
- onBeforeDelete() — Find item options and delete them to clean up DB.
- validate() — Validate that product exists and is published, variation exists for product if necessary and quantity is greater than 0
- validateForCart() — Validate this Item to make sure it can be added to a cart.