SilverCommerce\OrdersAdmin\Model\LineItem
A LineItem is a single line item on an order, extimate or even in the shopping cart.
An item has a number of fields that describes a product:
- Key: ID used to detect this item
- Title: Title of the item
- Content: Description of this object
- Quantity: Number or items in this order
- Weight: Weight of this item (unit of measurment is defined globally)
- TaxRate: Rate of tax for this item (e.g. 20.00 for 20%)
- ProductClass: ClassName of product that this item is matched against
- StockID: Unique identifier of this item (used with ProductClass
match to a product)
- Locked: Is this a locked item? Locked items cannot be changed in the
shopping cart
- Deliverable: Is this a product that can be delivered? This can effect
delivery options
- Author: Mo <morven@ilateral.co.uk>
Synopsis
class LineItem
extends DataObject
implements
TaxableProvider
{
- // members
- private static string $table_name = 'LineItem';
- private static string $stock_param = "StockLevel";
- private static array $db = ;
- private static array $has_one = ;
- private static array $has_many = ;
- private static array $defaults = ;
- private static array $casting = ;
- private static array $summary_fields = ;
- private static array $field_labels = ;
- // methods
- public float getBasePrice()
- public TaxRate getTaxRate()
- public string getLocale()
- public bool getShowPriceWithTax()
- public false getShowTaxString()
- public FieldList getCMSFields()
- public float getNoTaxPrice()
- public void getUnitPrice()
- public float getUnitTax()
- public float getTaxAmount()
- public float getUnitTotal()
- public float getSubTotal()
- public float getTaxTotal()
- public float getTotal()
- public Image Image()
- public string getCustomisationList()
- public string getCustomisationAndPriceList()
- public DBHTMLText CustomisationHTML()
- public DataObject Match()
- public DataObject FindStockItem()
- public Int checkStockLevel()
- public string generateKey()
- public Boolean canView()
- public Boolean canCreate()
- public Boolean canEdit()
- public Boolean canDelete()
- public DataObject duplicate()
- public void onBeforeWrite()
- public void onBeforeDelete()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Uses
- SilverCommerce\TaxAdmin\Traits\Taxable
Implements
- SilverCommerce\TaxAdmin\Interfaces\TaxableProvider
Members
private
- $casting
—
array
Function to DB Object conversions - $db
—
array
Standard database columns - $defaults
—
array
Specify default values of a field - $field_labels
- $has_many
—
array
One to many associations - $has_one
—
array
Foreign key associations in DB - $stock_param
—
string
The name of the param used on a related product to track Stock Levels. - $summary_fields
—
array
Fields to display in list tables - $table_name
Methods
public
- CustomisationHTML() — Get list of customisations rendering into a basic HTML string
- FindStockItem() — Find our original stock item (useful for adding links back to the original product).
- Image() — Get an image object associated with this line item.
- Match() — Match this item to another object in the Database, by the provided details.
- canCreate() — Anyone can create an order item
- canDelete() — No one can delete items once they are created
- canEdit() — No one can edit items once they are created
- canView() — Only order creators or users with VIEW admin rights can view
- checkStockLevel() — Check stock levels for this item, will return the actual number of remaining stock after removing the current quantity
- duplicate() — Overwrite default duplicate function
- generateKey() — Generate a key based on this item and its customisations
- getBasePrice() — Get the basic price for this object
- getCMSFields() — Modify default field scaffolding in admin
- getCustomisationAndPriceList() — Provide a string of customisations seperated by a comma and including a price
- getCustomisationList() — Provide a string of customisations seperated by a comma but not including a price
- getLocale() — Get the locale from the site
- getNoTaxPrice() — Get the price for a single line item (unit), minus any tax
- getShowPriceWithTax() — Get should this field automatically show the price including TAX?
- getShowTaxString() — We don't want to show a tax string on Line Items
- getSubTotal() — Get the value of this item, minus any tax
- getTaxAmount() — Overwrite TaxAmount with unit tax
- getTaxRate() — Return the tax rate for this Object
- getTaxTotal() — Get the total amount of tax for a single unit of this item
- getTotal() — Get the value of this item, minus any tax
- getUnitPrice()
- getUnitTax() — Get the amount of tax for a single unit of this item
- getUnitTotal() — Get the total price and tax for a single unit
- onBeforeDelete() — Clean up DB on deletion
- onBeforeWrite() — Pre-write tasks