SilverCart\Model\Order\Order
abstract for an order.
- Author: Sebastian Diel <sdiel@pixeltricks.de>
- Copyright: 2017 pixeltricks GmbH
- License: see license file in modules root directory
Synopsis
class Order
extends DataObject
implements
PermissionProvider
{
- // constants
- const SESSION_KEY = 'SilverCart.Order';
- const SESSION_KEY_EDIT_MODE = 'SilverCart.Order.EditMode';
- const ADMIN_MODE_EDIT = 'edit';
- const ADMIN_MODE_VIEW = 'view';
- const PERMISSION_EDIT = 'SILVERCART_ORDER_EDIT';
- const PERMISSION_DELETE = 'SILVERCART_ORDER_DELETE';
- const PERMISSION_VIEW = 'SILVERCART_ORDER_VIEW';
- // members
- private static array $db = ;
- private static array $has_one = ;
- private static array $has_many = ;
- private static array $casting = ;
- private static string $default_sort = "Created DESC";
- private static string $table_name = 'SilvercartOrder';
- private static bool $api_access = true;
- protected bool $cancelInProgress = false;
- protected bool $didHandleOrderStatusChange = false;
- protected bool $didHandlePaymentStatusChange = false;
- protected bool $getCMSFieldsIsCalled = false;
- // methods
- public string singular_name()
- public string plural_name()
- public array providePermissions()
- public bool canView()
- public false canCreate()
- public bool canEdit()
- public bool canDelete()
- public bool canCancel()
- public array exportColumns()
- public array summaryFields()
- public array fieldLabels()
- public array searchableFields()
- public string getTitle()
- public string getOrderNumber()
- public SearchContext getDefaultSearchContext()
- public FieldList scaffoldSearchFields()
- public string getTrackingCode()
- public string getTrackingLink()
- public string getCreatedNice()
- public DBDatetime|null getOrderStatusChangedDate()
- public DBDatetime|null getPaymentStatusChangedDate()
- public string getExpectedDelivery()
- public string getExpectedDeliveryNice()
- public string getShippingAddressSummary()
- public DBHTMLText getShippingAddressSummaryHtml()
- public type getShippingAddressTable()
- public bool InvoiceAddressEqualsShippingAddress()
- public string getInvoiceAddressSummary()
- public DBHTMLText getInvoiceAddressSummaryHtml()
- public type getInvoiceAddressTable()
- public DataList getLimitedOrderPositions()
- public bool hasMoreOrderPositionsThan()
- public array excludeFromScaffolding()
- public FieldList getCMSFields()
- public $this setCMSFieldsView()
- public $this setCMSFieldsEdit()
- public FieldList getCMSActions()
- public void resendorderconfirmation()
- public ViewableData switcheditmodetoedit()
- public ViewableData switcheditmodetoview()
- public ViewableData switcheditmode()
- public bool isAdminModeEdit()
- public FieldList getQuickAccessFields()
- public void createInvoiceAddress()
- public void createShippingAddress()
- public void createAddress()
- public void createFromShoppingCart()
- public OrderPosition|null convertShoppingCartPositionToOrderPosition()
- public void addChargesAndDiscountsForProducts()
- public void convertShoppingCartPositionsToOrderPositions()
- public Order setPaymentMethod()
- public bool setPaymentStatus()
- public bool setPaymentStatusByID()
- public Order setPaymentStatusByIDOrDefault()
- public bool isPaymentStatusOpen()
- public bool setOrderStatus()
- public bool setOrderStatusByID()
- public bool setOrderStatusByCode()
- public Order setOrderStatusByIDOrDefault()
- public $this setNote()
- public string getFormattedNote()
- public $this setWeight()
- public $this setAmountTotal()
- public $this setCustomerEmail()
- public $this setHasAcceptedRevocationInstruction()
- public $this setHasAcceptedTermsAndConditions()
- public Order setShippingMethod()
- public float getTax()
- public string getCurrency()
- public string getPositionsAsString()
- public DBMoney getPositionsPriceGross()
- public DBMoney getPositionsPriceNet()
- public DBMoney getPriceGross()
- public ArrayList OrderPositionsWithoutTax()
- public mixed OrderIncludedInTotalPositions()
- public ArrayList OrderListPositions()
- public ArrayList OrderChargePositionsTotal()
- public ArrayList OrderChargePositionsProduct()
- public string getTaxableAmountWithoutFeesNice()
- public DBMoney getTaxableAmountWithoutFees()
- public DBMoney getTaxableAmountGrossWithoutFees()
- public DBMoney getTaxableAmountNetWithoutFees()
- public string getTaxableAmountWithFeesNice()
- public DBMoney getTaxableAmountWithFees()
- public DBMoney getTaxableAmountGrossWithFees()
- public DBMoney getTaxableAmountNetWithFees()
- public ArrayList getTaxRatesWithoutFees()
- public ArrayList getTaxTotal()
- public float getTaxTotalAmount()
- public ArrayList getTaxRatesWithFees()
- public int getQuantity()
- public DBHTMLText OrderDetailActions()
- public DBHTMLText OrderDetailInformation()
- public ArrayList OrderDetailInformationAfterOrderNumber()
- public DBHTMLText OrderDetailInformationHTMLAfterOrderNumber()
- public DBHTMLText AfterOrderDetailTableEmailContent()
- public string OrderDetailTable()
- public boolean HasChargePositionsForProduct()
- public boolean HasChargePositionsForTotal()
- public boolean HasIncludedInTotalPositions()
- public string getPriceTypeText()
- public bool IsPriceTypeGross()
- public bool IsPriceTypeNet()
- public bool IsPickup()
- public void Log()
- public Order sendConfirmationMail()
- public Order sendNotificationMail()
- public bool HasPositionsWithOrderEmailText()
- public DataList PositionsWithOrderEmailText()
- public bool HasPositionsWithOrderConfirmationPageText()
- public DataList PositionsWithOrderConfirmationPageText()
- protected void onBeforeWrite()
- protected void onBeforeDelete()
- protected void handleCancelOnBeforeWrite()
- public Order cancel()
- public void handleTrackingCodeChange()
- public void sendTrackingInformationEmail()
- public void handleOrderStatusChange()
- public void handlePaymentStatusChange()
- protected void onAfterWrite()
- public static Order|null get_by_payment_reference_id()
- public static Order|null get_by_customer()
- public static Order|null get_by_customer_id()
- public float calculateAmountTotal()
- public void recalculate()
- public ShippingMethod ShippingMethod()
- public string getAmountTotalNice()
- public string getHandlingCostShipmentNice()
- public string getHandlingCostPaymentNice()
- public DBMoney getHandlingCost()
- public void markAsSeen()
- public void markAsNotSeen()
- public string Link()
- public DBHTMLText render()
- public DBHTMLText forTemplate()
- // Inherited methods from ExtensibleDataObject
- protected void beforeRequireDefaultRecords()
- protected void beforeUpdateCMSActions()
- protected void beforeUpdateFieldLabels()
- protected void beforeUpdateProvidePermissions()
- public array defaultFieldLabels()
- public static void reset_field_labels()
- protected array scaffoldFieldLabels()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Uses
Implements
- SilverStripe\Security\PermissionProvider
Constants
Name | Value |
---|---|
SESSION_KEY | 'SilverCart.Order' |
SESSION_KEY_EDIT_MODE | 'SilverCart.Order.EditMode' |
ADMIN_MODE_EDIT | 'edit' |
ADMIN_MODE_VIEW | 'view' |
PERMISSION_EDIT | 'SILVERCART_ORDER_EDIT' |
PERMISSION_DELETE | 'SILVERCART_ORDER_DELETE' |
PERMISSION_VIEW | 'SILVERCART_ORDER_VIEW' |
Members
private
- $api_access
—
SilverCart\Model\Order\bool
Grant API access on this item. - $casting
—
array
Casting. - $db
—
array
attributes - $default_sort
—
string
Default sort direction in tables. - $has_many
—
array
1:n relations - $has_one
—
array
1:1 relations - $table_name
—
string
DB table name
protected
- $cancelInProgress
—
SilverCart\Model\Order\bool
Flag to determine whether the cancel is in progress. - $defaultFieldLabels
—
array
Default field labels. - $didHandleOrderStatusChange
—
SilverCart\Model\Order\bool
Prevents multiple handling of order status change. - $didHandlePaymentStatusChange
—
SilverCart\Model\Order\bool
Prevents multiple handling of payment status change. - $getCMSFieldsIsCalled
—
SilverCart\Model\Order\bool
Marker to check whether the CMS fields are called or not
Methods
protected
- handleCancelOnBeforeWrite() — Handles the cancel process before writing an order.
- onAfterWrite() — hook triggered after write
- onBeforeDelete() — On before delete.
- onBeforeWrite() — Set a new/reserved ordernumber before writing and send attributed ShopEmails.
public
- AfterOrderDetailTableEmailContent() — Returns output to show in the order confirmation email right after the order detail table.
- HasChargePositionsForProduct() — Indicates wether there are positions that are charges or discounts for the product value.
- HasChargePositionsForTotal() — Indicates wether there are positions that are charges or discounts for the product value.
- HasIncludedInTotalPositions() — Indicates wether there are positions that are included in the total price.
- HasPositionsWithOrderConfirmationPageText() — Returns whether this order has positions with order email text to show on order confirmation page.
- HasPositionsWithOrderEmailText() — Returns whether this order has positions with order email text.
- InvoiceAddressEqualsShippingAddress() — Returns whether the invoice address equals the shipping address.
- IsPickup() — Returns whether this order is a pickup order.
- IsPriceTypeGross() — Indicates wether this order is gross calculated or not.
- IsPriceTypeNet() — Indicates wether this order is net calculated or not.
- Link() — Returns the link to show this complaint.
- Log() — writes a log entry
- OrderChargePositionsProduct() — Returns all order positions that contain charges and discounts for product values.
- OrderChargePositionsTotal() — Returns all order positions that contain charges and discounts for the shopping cart value.
- OrderDetailActions() — Returns extension injected order detail actions.
- OrderDetailInformation() — Returns plugin output.
- OrderDetailInformationAfterOrderNumber() — Returns plugin output to show in the order detail table right after the OrderNumber.
- OrderDetailInformationHTMLAfterOrderNumber() — Returns plugin output to show in the order detail table right after the OrderNumber.
- OrderDetailTable() — Returns the order positions, shipping method, payment method etc. as HTML table.
- OrderIncludedInTotalPositions() — Returns all OrderPositions that are included in the total price.
- OrderListPositions() — Returns all regular order positions.
- OrderPositionsWithoutTax() — Returns all order positions without a tax value.
- PositionsWithOrderConfirmationPageText() — Returns all positions with order email text to show on order confirmation page.
- PositionsWithOrderEmailText() — Returns all positions with order email text.
- ShippingMethod() — Returns the shipping method of this order and injects the shipping address
- addChargesAndDiscountsForProducts() — Adds charges and discounts for products.
- calculateAmountTotal() — Calculates the total amount of positions and handling cost.
- canCancel() — Indicates wether the current user can delete this object.
- canCreate() — Order should not be created via backend
- canDelete() — Indicates wether the current user can delete this object.
- canEdit() — Indicates wether the current user can edit this object.
- canView() — Indicates wether the current user can view this object.
- cancel() — Cancels the order.
- convertShoppingCartPositionToOrderPosition() — Converts the given $shoppingCartPosition to an order position.
- convertShoppingCartPositionsToOrderPositions() — convert cart positions in order positions
- createAddress() — Creates an address for an order from customers data.
- createFromShoppingCart() — creates an order from the cart
- createInvoiceAddress() — Creates an invoice address for an order from customers data.
- createShippingAddress() — Creates a shipping address for an order from customers data.
- excludeFromScaffolding() — Returns an array of field/relation names (db, has_one, has_many, many_many, belongs_many_many) to exclude from form scaffolding in backend.
- exportColumns() — Returns the CSV export columns.
- fieldLabels() — Field labels for display in tables.
- forTemplate() — Returns the rendered position.
- getAmountTotalNice() — returns the orders total amount as string incl. currency.
- getCMSActions() — Returns the CMS actions.
- getCMSFields() — customize backend fields
- getCreatedNice() — returns the orders creation date formated: dd.mm.yyyy hh:mm
- getCurrency() — returns bills currency
- getDefaultSearchContext() — Set the default search context for this field
- getExpectedDelivery() — Returns the expected delivery date (span).
- getExpectedDeliveryNice() — Returns the expected delivery date (span) in a nice format.
- getFormattedNote() — Returns the formatted note.
- getHandlingCost() — returns the orders total amount as string incl. currency.
- getHandlingCostPaymentNice() — returns the orders total amount as string incl. currency.
- getHandlingCostShipmentNice() — returns the orders total amount as string incl. currency.
- getInvoiceAddressSummary() — return the orders invoice address as complete string.
- getInvoiceAddressSummaryHtml() — return the orders invoice address as complete HTML string.
- getInvoiceAddressTable() — Returns the invoice address rendered with a HTML table
- getLimitedOrderPositions() — Returns a limited number of order positions.
- getOrderNumber() — Returns the order number.
- getOrderStatusChangedDate() — Returns the date the current order status was changed.
- getPaymentStatusChangedDate() — Returns the date the current payment status was changed.
- getPositionsAsString() — Returns the Order Positions as a string.
- getPositionsPriceGross() — Returns the gross amount of all order positions.
- getPositionsPriceNet() — Returns the net amount of all order positions.
- getPriceGross() — Returns the gross amount of the order.
- getPriceTypeText() — Returns the i18n text for the price type
- getQuantity() — returns quantity of all products of the order
- getQuickAccessFields() — Returns the quick access fields to display in GridField
- getShippingAddressSummary() — return the orders shipping address as complete string.
- getShippingAddressSummaryHtml() — return the orders shipping address as complete HTML string.
- getShippingAddressTable() — Returns the shipping address rendered with a HTML table
- getTax() — returns tax included in $this
- getTaxRatesWithFees() — Returns the sum of tax amounts grouped by tax rates for the products of the order.
- getTaxRatesWithoutFees() — Returns the sum of tax amounts grouped by tax rates for the products of the order.
- getTaxTotal() — Returns the total amount of all taxes.
- getTaxTotalAmount() — Returns the tax total amount
- getTaxableAmountGrossWithFees() — Returns the order value of all positions with a tax rate > 0 without any charges.
- getTaxableAmountGrossWithoutFees() — Returns the order value of all positions with a tax rate > 0 without any fees and charges.
- getTaxableAmountNetWithFees() — Returns the order value of all positions with a tax rate > 0 without any charges.
- getTaxableAmountNetWithoutFees() — Returns the order value of all positions with a tax rate > 0 without any fees and charges.
- getTaxableAmountWithFees() — Returns the order value of all positions with a tax rate > 0 without any charges.
- getTaxableAmountWithFeesNice() — returns the orders taxable amount with fees as string incl. currency.
- getTaxableAmountWithoutFees() — Returns the order value of all positions with a tax rate > 0 without any fees and charges.
- getTaxableAmountWithoutFeesNice() — returns the orders taxable amount without fees as string incl. currency.
- getTitle() — Returns the Title.
- getTrackingCode() — Returns the orders tracking code.
- getTrackingLink() — Returns the orders tracking link.
- get_by_customer() — Returns an order by the given Order ID and Member.
- get_by_customer_id() — Returns an order by the given Order and Member ID.
- get_by_payment_reference_id() — Returns an order by the given PaymentReferenceID.
- handleOrderStatusChange() — Handles an order status change.
- handlePaymentStatusChange() — Handles a payment status change.
- handleTrackingCodeChange() — Handles a tracking code change.
- hasMoreOrderPositionsThan() — Returns whether this order has more positions than $numberOfPositions.
- isAdminModeEdit() — Returns whether the current admin mode is view or edit.
- isPaymentStatusOpen() — Returns whether this order has the payment status open.
- markAsNotSeen() — Marks the order as not seen
- markAsSeen() — Marks the order as seen
- plural_name() — Returns the translated plural name of the object. If no translation exists the class name will be returned.
- providePermissions() — Set permissions.
- recalculate() — Recalculates the order totals for the attributed positions.
- render() — Renders the order with the default template.
- resendorderconfirmation() — Resends the confirmation email to the customer.
- scaffoldSearchFields() — Determine which properties on the DataObject are searchable, and map them to their default {@link FormField} representations. Used for scaffolding a searchform for {@link ModelAdmin}.
- searchableFields() — Searchable fields
- sendConfirmationMail() — Send a confirmation mail with order details to the customer. If $sendNotification is set to true, the notification email will also be sent to the shop owner.
- sendNotificationMail() — Send a notification mail with order details to the shop owner.
- sendTrackingInformationEmail() — Sends a tracking information email to the customer.
- setAmountTotal() — set the total price for this order
- setCMSFieldsEdit() — Returns the CMS fields to edit an order.
- setCMSFieldsView() — Returns the CMS fields to view an order (readonly).
- setCustomerEmail() — set the email for this order
- setHasAcceptedRevocationInstruction() — Set the status of the revocation instructions checkbox field.
- setHasAcceptedTermsAndConditions() — Set the status of the terms and conditions checkbox field.
- setNote() — Save the note from the form if there is one
- setOrderStatus() — set status of $this
- setOrderStatusByCode() — Set status by the given $orderStatusCode.
- setOrderStatusByID() — set status of $this
- setOrderStatusByIDOrDefault() — Sets the order status by the given $orderStatusID. If there is no existing order status, the default order status will be set.
- setPaymentMethod() — set payment method for $this
- setPaymentStatus() — set payment status of $this
- setPaymentStatusByID() — set payment status of $this
- setPaymentStatusByIDOrDefault() — Sets the payment status by the given $paymentStatusID. If there is no existing payment status, the default payment status will be set.
- setShippingMethod() — The shipping method is a relation + an attribte of the order
- setWeight() — save the carts weight
- singular_name() — Returns the translated singular name of the object. If no translation exists the class name will be returned.
- summaryFields() — Summaryfields for display in tables.
- switcheditmode() — Switches the admin mode to view or edit.
- switcheditmodetoedit() — Switched the admin mode to edit.
- switcheditmodetoview() — Switched the admin mode to view.
Inherited from SilverCart\ORM\ExtensibleDataObject
protected
- beforeRequireDefaultRecords() — Allows user code to hook into DataObject::requireDefaultRecords() prior to requireDefaultRecords being called on extensions.
- beforeUpdateCMSActions() — Allows user code to hook into DataObject::getCMSActions prior to updateCMSActions being called on extensions.
- beforeUpdateFieldLabels() — Allows user code to hook into DataObject::fieldLabels() prior to updateFieldLabels being called on extensions.
- beforeUpdateProvidePermissions() — Allows user code to hook into DataObject::updateProvidePermissions() prior to providePermissions being called on extensions.
- scaffoldFieldLabels() — Returns the default field labels for this DataObject.
public
- defaultFieldLabels() — Returns the default field labels.
- reset_field_labels() — Resets the field label cache.