|
Shop_Order class
Represents an order.
See AlsoPublic propertiesShow inherited properties.
Public methodsShow inherited methods.
Events
Property details¶ billing_city propertypublic string $billing_city;
Specifies the customer billing city.
¶ billing_company propertypublic string $billing_company;
Specifies the customer billing company.
¶ billing_country propertypublic Shop_Country $billing_country;
A reference to the billing country.
¶ billing_email propertypublic string $billing_email;
Specifies the customer email address.
¶ billing_first_name propertypublic string $billing_first_name;
Specifies the customer billing first name.
¶ billing_last_name propertypublic string $billing_last_name;
Specifies the customer billing last name.
¶ billing_phone propertypublic string $billing_phone;
Specifies the customer billing phone number.
¶ billing_state propertypublic Shop_CountryState $billing_state;
A reference to the billing state.
¶ billing_street_addr propertypublic string $billing_street_addr;
Specifies the customer billing address.
¶ billing_zip propertypublic string $billing_zip;
Specifies a billing ZIP/postal code.
¶ coupon propertypublic Shop_Coupon $coupon;
An object, representing a coupon applied to the order, if any. The Shop_Coupon object has the
¶ customer propertypublic Shop_Customer $customer;
A reference to the customer who placed the order.
¶ customer_ip propertypublic string $customer_ip;
Customer's IP address.
¶ deleted_at propertypublic Phpr_DateTime $deleted_at;
Specifies a date and time when the order was marked as deleted. See delete_order() method.
¶ discount propertypublic float $discount;
Total order discount.
¶ discount_tax_incl propertypublic float $discount_tax_incl;
Total order discount, tax inclusive.
¶ free_shipping propertypublic boolean $free_shipping;
Indicates whether free shipping is applied to the order.
¶ goods_tax propertypublic float $goods_tax;
Total value of the sales tax.
¶ id propertypublic integer $id;
Specifies the order record identifier.
¶ items propertypublic Db_DataCollection $items;
A collection of order items. Each element is the collection is an object of the Shop_OrderItem class.
¶ order_datetime propertypublic Phpr_DateTime $order_datetime;
Specifies a date and time when the order was placed.
¶ order_notes propertypublic string $order_notes;
Specifies order notes provided by the customer.
¶ payment_method propertypublic Shop_PaymentMethod $payment_method;
A reference to a payment method, selected by the customer for the order.
¶ shipping_city propertypublic string $shipping_city;
Specifies the customer shipping city.
¶ shipping_company propertypublic string $shipping_company;
Specifies the customer shipping company.
¶ shipping_country propertypublic Shop_Country $shipping_country;
A reference to the shipping country.
¶ shipping_first_name propertypublic string $shipping_first_name;
Specifies the customer shipping first name.
¶ shipping_last_name propertypublic string $shipping_last_name;
Specifies the customer shipping last name.
¶ shipping_method propertypublic Shop_ShippingOption $shipping_method;
A reference to a shipping method, selected by the customer for the order.
¶ shipping_phone propertypublic string $shipping_phone;
Specifies the customer shipping phone number.
¶ shipping_quote propertypublic float $shipping_quote;
Value of the shipping quote.
¶ shipping_quote_tax_incl propertypublic float $shipping_quote_tax_incl;
Shipping quote, tax inclusive.
¶ shipping_state propertypublic Shop_CountryState $shipping_state;
A reference to the shipping state.
¶ shipping_street_addr propertypublic string $shipping_street_addr;
Specifies the customer shipping street address.
¶ shipping_sub_option propertypublic string $shipping_sub_option;
Specifies a shipping method sub-option name, if any.
¶ shipping_tax propertypublic float $shipping_tax;
Value of the shipping tax.
¶ shipping_zip propertypublic string $shipping_zip;
Specifies a shipping ZIP/postal code.
¶ status propertypublic Shop_OrderStatus $status;
A reference to the current order status. Usually the status information can be loaded with displayField() method.
See Shop_OrderStatus class documentation for details.
¶ status_update_datetime propertypublic Phpr_DateTime $status_update_datetime;
A reference to the date/time object representing date and time when the order status has been updated last time.
¶ subtotal propertypublic float $subtotal;
Order subtotal sum - a sum of the order item totals.
¶ subtotal_before_discounts propertypublic float $subtotal_before_discounts;
subtotal before the discount applied.
¶ subtotal_tax_incl propertypublic float $subtotal_tax_incl;
Order subtotal, tax inclusive.
¶ tax_total propertypublic float $tax_total;
Total tax value: $goods_tax + $shipping_tax.
¶ total propertypublic float $total;
Total order amount. It includes the subtotal value, tax value and the shipping quote value. The discount value is already subtracted from the $total value.
Method details¶ automated_billing_supported() methodpublic static boolean automated_billing_supported()
Determines whether there are any modules which support automated billing
¶ delete_order() methodpublic void delete_order()
Marks the order as deleted.
Orders marked as deleted remain in the database and can be restored with the restore_order() method.
See Also¶ get_payment_page_url() methodpublic string get_payment_page_url()
Returns URL of the order payment page URL.
Use this method for creating links to the payment page for unpaid orders. Payment page is a page based on shop:pay action.
See Also¶ get_shipping_address_info() methodpublic Shop_CheckoutAddressInfo get_shipping_address_info()
Returns shipping address information object.
The object is populated with shipping address information from the order.
¶ invoices_supported() methodpublic boolean invoices_supported()
Determines whether the order contains any products which support invoices.
Modules should handle the shop:onOrderSupportsInvoices event if they provide order invoices functionality.
¶ invoice_system_supported() methodpublic static boolean invoice_system_supported()
Determines whether there are any modules which support invoices.
¶ is_paid() methodpublic boolean is_paid()
Returns TRUE if the order has Paid status, or the Paid status is in the order status history.
The common usage for the is_paid() method is restricting customer's access to product files if you sell downloadable products.
See Also¶ list_all_taxes() methodpublic array list_all_taxes()
Returns a list of sales and shipping taxes applied to the order.
The method returns an array of objects containing the following fields:
Applied taxes: <? foreach ($order->list_all_taxes() as $tax): ?> <?= ($tax->name) ?>: <?= format_currency($tax->total) ?><br/> <? endforeach ?> See Also¶ list_invoices() methodpublic Db_DataCollection list_invoices()
Returns a list of invoices.
Invoices are orders which are grouped under the given order.
¶ list_item_taxes() methodpublic array list_item_taxes()
Returns a list of taxes applied to order items.
The method returns an array of objects containing the following fields:
Applied sales taxes: <? foreach ($order->list_item_taxes() as $tax): ?> <?= ($tax->name) ?>: <?= format_currency($tax->total) ?><br/> <? endforeach ?> See Also¶ list_shipping_taxes() methodpublic array list_shipping_taxes(array $taxes=NULL)
Returns a list of taxes applied to the order shipping service.
The method returns an array of objects containing the following fields:
Applied shipping taxes: <? foreach ($order->list_shipping_taxes() as $tax): ?> <?= ($tax->name) ?>: <?= format_currency($tax->total) ?><br/> <? endforeach ?> See Also¶ output_product_file() methodpublic void output_product_file(integer $file_id, string $mode='attachment')
Outputs a file of a downloadable product.
This method allows to create custom pages for downloading product files.
This method stops the script execution in case if the file is successfully returned to the browser.
Please read the Integrating downloadable products
documentation article for the usage examples.
See Also¶ payment_processed() methodpublic boolean payment_processed(boolean $use_cached=true)
Returns TRUE if a customer has successfully paid the order.
The is_paid() and payment_processed() methods
could return opposite results in a case when a customer have paid an order (the payment_processed() method will return TRUE),
but you (a merchant) have not validated the payment and have not sent the order into the Paid status
(the is_paid() method will return FALSE). Payment methods in LemonStand can be configured
in such a way that a successful payment automatically sends an order to the Paid status. Another way is to automatically send the
order to some pending status, validate the payment manually, and then send the order to the Paid status.
The common usage for the payment_processed() method is hiding the Pay button on the order details page. The common usage for the is_paid() method is restricting customer's access to product files when you sell downloadable products. ¶ place_order() methodpublic static Shop_Order place_order(Shop_Customer $customer, boolean $register_customer=false, string $cart_name='main', array $options=array())
Creates an order from data collected during the checkout process.
The order uses data contained in Shop_CheckoutData object.
The $options array can contain the customer_password element, containing a password for the new customer.
This value is applicable only if $register_customer parameter is TRUE.
Cart content and checkout information can be altered by shop:onOrderBeforeCreate event handlers. ¶ restore_order() methodpublic void restore_order()
Restores an order previously marked as deleted with delete_order() method.
See Also¶ set_payment_processed() methodpublic void set_payment_processed()
Updates the internal flag which indicates whether the order's payment has been processed.
This method is used by payment modules internally.
|