SilverShop\Model\Order
The order class is a databound object for handling Orders within SilverStripe.
Synopsis
class Order
extends DataObject
{
- // members
- private static array $db = ;
- private static array $has_one = ;
- private static array $has_many = ;
- private static array $indexes = ;
- private static array $defaults = ;
- private static array $casting = ;
- private static array $summary_fields = ;
- private static array $searchable_fields = ;
- private static string $table_name = 'SilverShop_Order';
- private static string $singular_name = 'Order';
- private static string $plural_name = 'Orders';
- private static string $default_sort = '"Placed" DESC, "Created" DESC';
- private static array $placed_status = ;
- private static array $payable_status = ;
- private static array $hidden_status = ;
- private static array $log_status = ;
- private static bool $cancel_before_payment = true;
- private static bool $cancel_before_processing = false;
- private static bool $cancel_before_sending = false;
- private static bool $cancel_after_sending = false;
- private static boolean $place_before_payment = false;
- private static array $modifiers = ;
- private static integer $rounding_precision = 2;
- private static integer $reference_id_padding = 5;
- private static boolean $allow_zero_order_total = false;
- protected bool $flagOrderStatusWrite = false;
- // methods
- public static void get_order_status_options()
- public void getCMSFields()
- public void fieldLabels()
- public SearchContext getDefaultSearchContext()
- public void getComponents()
- public void SubTotal()
- public float calculate()
- public void getModifier()
- public void setTotal()
- public void Total()
- public void GrandTotal()
- public float TotalOutstanding()
- public string getStatusI18N()
- public void Link()
- public boolean canCancel()
- public boolean canPay()
- public boolean canDelete()
- public boolean canView()
- public boolean canEdit()
- public boolean canCreate()
- public string Currency()
- public void getLatestEmail()
- public void getName()
- public void getTitle()
- public void getShippingAddress()
- public void getBillingAddress()
- protected Address getAddress()
- public boolean getAddressesDiffer()
- public boolean IsSent()
- public boolean IsProcessing()
- public boolean IsPaid()
- public void IsCart()
- public void generateReference()
- public void getReference()
- protected void onBeforeWrite()
- protected void statusTransition()
- protected void onBeforeDelete()
- public void onAfterWrite()
- public void debug()
- public array provideI18nEntities()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Members
private
- $allow_zero_order_total
—
boolean
Will allow completion of orders with GrandTotal=0, which could be the case for orders paid with loyalty points or vouchers. - $cancel_after_sending
—
SilverShop\Model\bool
Whether or not an order can be cancelled after sending - $cancel_before_payment
—
SilverShop\Model\bool
Whether or not an order can be cancelled before payment - $cancel_before_processing
—
SilverShop\Model\bool
Whether or not an order can be cancelled before processing - $cancel_before_sending
—
SilverShop\Model\bool
Whether or not an order can be cancelled before sending - $casting
-
$db
Status codes and what they mean: - $default_sort
- $defaults
- $has_many
- $has_one
- $indexes
- $log_status
—
array
Statuses that should be logged in the Order-Status-Log - $modifiers
—
array
Modifiers represent the additional charges or deductions associated to an order, such as shipping, taxes, vouchers etc. -
$payable_status
Statuses for which an order can be paid for - $place_before_payment
—
boolean
Place an order before payment processing begins -
$placed_status
Statuses for orders that have been placed. - $plural_name
- $reference_id_padding
—
int
Minimal length (number of decimals) of order reference ids - $rounding_precision
—
int
Rounding precision of order amounts - $searchable_fields
- $singular_name
- $summary_fields
- $table_name
protected
- $flagOrderStatusWrite
—
SilverShop\Model\bool
A flag indicating that an order-status-log entry should be written
Methods
protected
- getAddress()
- onBeforeDelete() — delete attributes, statuslogs, and payments
- onBeforeWrite() — Force creating an order reference
- statusTransition() — Called from @see onBeforeWrite whenever status changes
public
- Currency() — Return the currency of this order.
- GrandTotal() — Alias for Total.
- IsCart()
- IsPaid() — Return whether this Order has been paid for (Status == Paid) or Status == Processing, where it's been paid for, but is currently in a processing state.
- IsProcessing() — Is this order currently being processed? (at "Sent" OR "Processing" status).
- IsSent() — Has this order been sent to the customer? (at "Sent" status).
- Link() — Get the link for finishing order processing.
- SubTotal() — Returns the subtotal of the items for this order.
- Total() — Get final value of order.
- TotalOutstanding() — Calculate how much is left to be paid on the order.
- calculate() — Calculate the total
- canCancel() — Returns TRUE if the order can be cancelled PRECONDITION: Order is in the DB.
- canCreate() — Prevent standard creation of orders.
- canDelete() — Prevent deleting orders.
- canEdit() — Check if an order can be edited.
- canPay() — Check if an order can be paid for.
- canView() — Check if an order can be viewed.
- debug()
- fieldLabels() — Augment field labels
- generateReference() — Create a unique reference identifier string for this order.
- getAddressesDiffer() — Check if the two addresses saved differ.
- getBillingAddress() — Get billing address, if marked to use seperate address, otherwise use shipping address, or the member default billing address.
- getCMSFields() — Create CMS fields for cms viewing and editing orders
- getComponents() — Hack for swapping out relation list with OrderItemList
- getDefaultSearchContext() — Adjust scafolded search context
- getLatestEmail() — Get the latest email for this order.z
- getModifier() — This is needed to maintain backwards compatiability with some subsystems using modifiers. eg discounts
- getName() — Gets the name of the customer.
- getReference() — Get the reference for this order, or fall back to order ID.
- getShippingAddress() — Get shipping address, or member default shipping address.
- getStatusI18N() — Get the order status. This will return a localized value if available.
- getTitle()
- get_order_status_options()
- onAfterWrite()
- provideI18nEntities() — Provide i18n entities for the order class
- setTotal() — Enforce rounding precision when setting total