Class Mage_Sales_Model_Order

Description

Order model

Supported events: sales_order_load_after sales_order_save_before sales_order_save_after sales_order_delete_before sales_order_delete_after

Located in /Sales/Model/Order.php (line 39)

Varien_Object
   |
   --Mage_Core_Model_Abstract
      |
      --Mage_Sales_Model_Abstract
         |
         --Mage_Sales_Model_Order
Class Constant Summary
 STATE_CANCELED = 'canceled'
 STATE_CLOSED = 'closed'
 STATE_COMPLETE = 'complete'
 STATE_HOLDED = 'holded'
 STATE_NEW = 'new'
 STATE_PENDING_PAYMENT = 'pending_payment'
 STATE_PROCESSING = 'processing'
 XML_PATH_EMAIL_COPY_METHOD = 'sales_email/order/copy_method'
 XML_PATH_EMAIL_COPY_TO = 'sales_email/order/copy_to'
 XML_PATH_EMAIL_ENABLED = 'sales_email/order/enabled'
 XML_PATH_EMAIL_GUEST_TEMPLATE = 'sales_email/order/guest_template'
 XML_PATH_EMAIL_IDENTITY = 'sales_email/order/identity'
 XML_PATH_EMAIL_TEMPLATE = 'sales_email/order/template'
 XML_PATH_UPDATE_EMAIL_COPY_METHOD = 'sales_email/order_comment/copy_method'
 XML_PATH_UPDATE_EMAIL_COPY_TO = 'sales_email/order_comment/copy_to'
 XML_PATH_UPDATE_EMAIL_ENABLED = 'sales_email/order_comment/enabled'
 XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE = 'sales_email/order_comment/guest_template'
 XML_PATH_UPDATE_EMAIL_IDENTITY = 'sales_email/order_comment/identity'
 XML_PATH_UPDATE_EMAIL_TEMPLATE = 'sales_email/order_comment/template'
Variable Summary
Method Summary
Mage_Sales_Model_Order addStatusToHistory (string $status, [ $comment = ''], [ $isCustomerNotified = false], string $comments, boolean $is_customer_notified)
bool canCancel ()
bool canCreditmemo ()
bool canEdit ()
bool canHold ()
bool canInvoice ()
bool canReorder ()
bool canShip ()
bool canUnhold ()
void formatBasePrice ( $price)
string formatPrice (float $price, [bool $addBrackets = false])
string formatPriceTxt (float $price)
void getAddressById ( $addressId)
void getAllItems ()
void getAllPayments ()
float getBaseTotalDue ()
string getCreatedAtFormated (string $format)
void getCustomerName ()
void getData ([ $key = ''], [ $index = null])
void getFullTaxInfo ()
void getIsNotVirtual ()
void getItemById ( $itemId)
void getItemByQuoteItemId ( $quoteItemId)
void getItemsCollection ([ $filterByTypes = array()], [ $nonChildrenOnly = false])
void getItemsRandomCollection ([ $limit = 1])
void getPaymentById ( $paymentId)
string getRealOrderId ()
void getStatusHistoryById ( $statusId)
string getStatusLabel ()
float getTotalDue ()
unknown getTracksCollection ()
bool hasCreditmemos ()
bool hasInvoices ()
bool hasShipments ()
void hold ()
void loadByAttribute ( $attribute,  $value)
void loadByIncrementId ( $incrementId)
Mage_Sales_Model_Order sendOrderUpdateEmail ([ $notifyCustomer = true], [ $comment = ''])
Mage_Sales_Model_Order setState (string $state, [string $status = false], [string $comment = ''], [bool $isCustomerNotified = false])
void unhold ()
void unsetData ([ $key = null])
void _beforeDelete ()
void _checkState ()
void _construct ()
void _getEmails ( $configPath)
bool _needToAddDummy (Mage_Sales_Model_Order_Item $item, [array $qtys = array()])
Variables
mixed $_addresses (line 72)
  • access: protected
mixed $_baseCurrency = null (line 82)
  • access: protected
mixed $_creditmemos (line 79)
  • access: protected
mixed $_eventObject = 'order' (line 70)
  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::$_eventObject
Parameter name in event
mixed $_eventPrefix = 'sales_order' (line 69)
  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::$_eventPrefix
Prefix of model events names
mixed $_invoices (line 76)
  • access: protected
mixed $_items (line 73)
  • access: protected
mixed $_orderCurrency = null (line 81)
  • access: protected
mixed $_payments (line 74)
  • access: protected
mixed $_relatedObjects = array() (line 80)
  • access: protected
mixed $_shipments (line 78)
  • access: protected
mixed $_statusHistory (line 75)
  • access: protected
mixed $_tracks (line 77)
  • access: protected

Inherited Variables

Inherited from Mage_Core_Model_Abstract

Mage_Core_Model_Abstract::$_cacheTag
Mage_Core_Model_Abstract::$_dataSaveAllowed
Mage_Core_Model_Abstract::$_resource
Mage_Core_Model_Abstract::$_resourceCollectionName
Mage_Core_Model_Abstract::$_resourceName
Methods
addAddress (line 767)
  • access: public
void addAddress (Mage_Sales_Model_Order_Address $address)
addItem (line 858)
  • access: public
void addItem (Mage_Sales_Model_Order_Item $item)
addPayment (line 907)
  • access: public
void addPayment (Mage_Sales_Model_Order_Payment $payment)
addRelatedObject (line 1272)

Add New object to related array

  • access: public
Mage_Sales_Model_Order addRelatedObject ( $object)
addStatusHistory (line 993)
  • access: public
void addStatusHistory (Mage_Sales_Model_Order_Status_History $status)
addStatusToHistory (line 457)

Add status change information to history

  • access: public
Mage_Sales_Model_Order addStatusToHistory (string $status, [ $comment = ''], [ $isCustomerNotified = false], string $comments, boolean $is_customer_notified)
  • string $status
  • string $comments
  • boolean $is_customer_notified
  • $comment
  • $isCustomerNotified
canCancel (line 139)

Retrieve order cancel availability

  • access: public
bool canCancel ()
cancel (line 504)

Cancel order

  • access: public
canCreditmemo (line 192)

Retrieve order credit memo (refund) availability

  • access: public
bool canCreditmemo ()
canEdit (line 270)

Retrieve order edit availability

  • access: public
bool canEdit ()
canHold (line 220)

Retrieve order hold availability

  • access: public
bool canHold ()
canInvoice (line 168)

Retrieve order invoice availability

  • access: public
bool canInvoice ()
canReorder (line 293)

Retrieve order reorder availability

  • access: public
bool canReorder ()
canShip (line 247)

Retrieve order shipment availability

  • access: public
bool canShip ()
canUnhold (line 237)

Retrieve order unhold availability

  • access: public
bool canUnhold ()
formatBasePrice (line 1080)
  • access: public
void formatBasePrice ( $price)
  • $price
formatPrice (line 1040)

Retrieve formated price value includeing order rate

  • access: public
string formatPrice (float $price, [bool $addBrackets = false])
  • float $price
  • bool $addBrackets
formatPriceTxt (line 1051)

Retrieve text formated price value includeing order rate

  • access: public
string formatPriceTxt (float $price)
  • float $price
getAddressById (line 757)
  • access: public
void getAddressById ( $addressId)
  • $addressId
getAddressesCollection (line 740)

********************* ADDRESSES **************************

  • access: public
void getAddressesCollection ()
getAllItems (line 821)
  • access: public
void getAllItems ()
getAllPayments (line 885)
  • access: public
void getAllPayments ()
getAllStatusHistory (line 956)

Enter description here...

  • access: public
array getAllStatusHistory ()
getAllVisibleItems (line 832)
  • access: public
void getAllVisibleItems ()
getBaseCurrency (line 1061)

Retrieve order website currency for working with base prices

  • access: public
Mage_Directory_Model_Currency getBaseCurrency ()
getBaseTotalDue (line 1107)

Retrieve order total due value

  • access: public
float getBaseTotalDue ()
getBillingAddress (line 393)

Retrieve order billing address

  • access: public
Mage_Sales_Model_Order_Address getBillingAddress ()
getConfig (line 325)

Retrieve order configuration model

  • access: public
getCreatedAtFormated (line 1284)

Get formated order created date in store timezone

  • access: public
string getCreatedAtFormated (string $format)
  • string $format: date format type (short|medium|long|full)
getCreditmemosCollection (line 1178)

Retrieve order creditmemos collection

  • access: public
unknown getCreditmemosCollection ()
getCustomerName (line 1255)
  • access: public
void getCustomerName ()
getData (line 1114)
  • access: public
void getData ([ $key = ''], [ $index = null])
  • $key
  • $index
getEmailCustomerNote (line 1289)
  • access: public
void getEmailCustomerNote ()
getFullTaxInfo (line 1395)
  • access: public
void getFullTaxInfo ()
getInvoiceCollection (line 1130)

Retrieve order invoices collection

  • access: public
unknown getInvoiceCollection ()
getIsNotVirtual (line 1390)
  • access: public
void getIsNotVirtual ()
getItemById (line 843)
  • access: public
void getItemById ( $itemId)
  • $itemId
getItemByQuoteItemId (line 848)
  • access: public
void getItemByQuoteItemId ( $quoteItemId)
  • $quoteItemId
getItemsCollection (line 776)
  • access: public
void getItemsCollection ([ $filterByTypes = array()], [ $nonChildrenOnly = false])
  • $filterByTypes
  • $nonChildrenOnly
getItemsRandomCollection (line 797)
  • access: public
void getItemsRandomCollection ([ $limit = 1])
  • $limit
getOrderCurrency (line 1025)

Retrieve order currency model instance

  • access: public
Mage_Directory_Model_Currency getOrderCurrency ()
getPayment (line 346)

Retrieve order payment model object

  • access: public
getPaymentById (line 897)
  • access: public
void getPaymentById ( $paymentId)
  • $paymentId
getPaymentsCollection (line 869)

********************* PAYMENTS **************************

  • access: public
void getPaymentsCollection ()
getRealOrderId (line 1011)

Enter description here...

  • access: public
string getRealOrderId ()
getRelatedObjects (line 1250)

Retrieve array of related objects

Used for order saving

  • access: public
array getRelatedObjects ()
getShipmentsCollection (line 1151)

Retrieve order shipments collection

  • access: public
unknown getShipmentsCollection ()
getShippingAddress (line 408)

Retrieve order shipping address

  • access: public
Mage_Sales_Model_Order_Address getShippingAddress ()
getShippingCarrier (line 550)
  • access: public
void getShippingCarrier ()
getStatusHistoryById (line 983)
  • access: public
void getStatusHistoryById ( $statusId)
  • $statusId
getStatusHistoryCollection (line 933)

Enter description here...

  • access: public
Mage_Sales_Model_Entity_Order_Status_History_Collection getStatusHistoryCollection ([ $reload = false])
  • $reload
getStatusLabel (line 444)

Retrieve label of order status

  • access: public
string getStatusLabel ()
getStore (line 126)

Retrieve store model instance

  • access: public
Mage_Core_Model_Store getStore ()

Redefinition of:
Mage_Sales_Model_Abstract::getStore()
Get object store identifier
getStoreCurrency (line 1075)

Retrieve order website currency for working with base prices Deprecated method, please use getBaseCurrency instead.

  • access: public
Mage_Directory_Model_Currency getStoreCurrency ()
getStoreGroupName (line 1357)
  • access: public
void getStoreGroupName ()
getTotalDue (line 1095)

Retrieve order total due value

  • access: public
float getTotalDue ()
getTrackingNumbers (line 542)

Retrieve tracking numbers

  • access: public
array getTrackingNumbers ()
getTracksCollection (line 1198)

Retrieve order tracking numbers collection

  • access: public
unknown getTracksCollection ()
getVisibleStatusHistory (line 972)

Enter description here...

  • access: public
array getVisibleStatusHistory ()
hasCreditmemos (line 1237)

Check order creditmemos availability

  • access: public
bool hasCreditmemos ()
hasInvoices (line 1217)

Check order invoices availability

  • access: public
bool hasInvoices ()
hasShipments (line 1227)

Check order shipments availability

  • access: public
bool hasShipments ()
hold (line 480)
  • access: public
void hold ()
isCurrencyDifferent (line 1085)
  • access: public
void isCurrencyDifferent ()
loadByAttribute (line 106)
  • access: public
void loadByAttribute ( $attribute,  $value)
  • $attribute
  • $value
loadByIncrementId (line 101)
  • access: public
void loadByIncrementId ( $incrementId)
  • $incrementId
place (line 473)

Place order

  • access: public
prepareInvoice (line 1406)

Create new invoice with maximum qty for invoice for each item

  • access: public
Mage_Sales_Model_Order_Invoice prepareInvoice ([ $qtys = array()])
  • $qtys
prepareShipment (line 1441)

Create new shipment with maximum qty for shipping for each item

  • access: public
Mage_Sales_Model_Order_Shipment prepareShipment ([ $qtys = array()])
  • $qtys
reset (line 1372)

Resets all data in object so after another load it will be complete new object

  • access: public
sendNewOrderEmail (line 576)

Sending email with order data

  • access: public
Mage_Sales_Model_Order sendNewOrderEmail ()
sendOrderUpdateEmail (line 649)

Sending email with order update information

  • access: public
Mage_Sales_Model_Order sendOrderUpdateEmail ([ $notifyCustomer = true], [ $comment = ''])
  • $notifyCustomer
  • $comment
setBillingAddress (line 362)

Declare order billing address

  • access: public
setPayment (line 917)
  • access: public
void setPayment (Mage_Sales_Model_Order_Payment $payment)
setShippingAddress (line 378)

Declare order shipping address

  • access: public
setState (line 427)

Declare order state

  • access: public
Mage_Sales_Model_Order setState (string $state, [string $status = false], [string $comment = ''], [bool $isCustomerNotified = false])
  • string $state
  • string $status
  • string $comment
  • bool $isCustomerNotified
unhold (line 491)
  • access: public
void unhold ()
unsetData (line 92)
  • access: public
void unsetData ([ $key = null])
  • $key
_beforeDelete (line 1513)
  • access: protected
void _beforeDelete ()

Redefinition of:
Mage_Core_Model_Abstract::_beforeDelete()
Processing object before delete data
_beforeSave (line 1302)

Processing object before save data

  • access: protected
Mage_Core_Model_Abstract _beforeSave ()

Redefinition of:
Mage_Core_Model_Abstract::_beforeSave()
Processing object before save data
_checkState (line 1326)
  • access: protected
void _checkState ()
_construct (line 87)

Initialize resource model

  • access: protected
void _construct ()
_getEmails (line 729)
  • access: protected
void _getEmails ( $configPath)
  • $configPath
_needToAddDummy (line 1485)

Decides if we need to create dummy invoice item or not for eaxample we don't need create dummy parent if all children are not in process

  • access: protected
bool _needToAddDummy (Mage_Sales_Model_Order_Item $item, [array $qtys = array()])
_placePayment (line 335)

Place order payments

  • access: protected
Mage_Sales_Model_Order _placePayment ()

Inherited Methods

Inherited From Mage_Sales_Model_Abstract

Mage_Sales_Model_Abstract::getCreatedAtDate()
Mage_Sales_Model_Abstract::getCreatedAtStoreDate()
Mage_Sales_Model_Abstract::getStore()

Inherited From Mage_Core_Model_Abstract

Mage_Core_Model_Abstract::afterLoad()
Mage_Core_Model_Abstract::delete()
Mage_Core_Model_Abstract::getCollection()
Mage_Core_Model_Abstract::getEntityId()
Mage_Core_Model_Abstract::getId()
Mage_Core_Model_Abstract::getIdFieldName()
Mage_Core_Model_Abstract::getResource()
Mage_Core_Model_Abstract::getResourceCollection()
Mage_Core_Model_Abstract::getResourceName()
Mage_Core_Model_Abstract::load()
Mage_Core_Model_Abstract::save()
Mage_Core_Model_Abstract::setId()
Mage_Core_Model_Abstract::_afterDelete()
Mage_Core_Model_Abstract::_afterLoad()
Mage_Core_Model_Abstract::_afterSave()
Mage_Core_Model_Abstract::_beforeDelete()
Mage_Core_Model_Abstract::_beforeSave()
Mage_Core_Model_Abstract::_getResource()
Mage_Core_Model_Abstract::_init()
Mage_Core_Model_Abstract::_protectFromNonAdmin()
Mage_Core_Model_Abstract::_setResourceModel()
Class Constants
STATE_CANCELED = 'canceled' (line 66)
STATE_CLOSED = 'closed' (line 65)
STATE_COMPLETE = 'complete' (line 64)
STATE_HOLDED = 'holded' (line 67)
STATE_NEW = 'new' (line 61)

Order states

STATE_PENDING_PAYMENT = 'pending_payment' (line 62)
STATE_PROCESSING = 'processing' (line 63)
XML_PATH_EMAIL_COPY_METHOD = 'sales_email/order/copy_method' (line 48)
XML_PATH_EMAIL_COPY_TO = 'sales_email/order/copy_to' (line 47)
XML_PATH_EMAIL_ENABLED = 'sales_email/order/enabled' (line 49)
XML_PATH_EMAIL_GUEST_TEMPLATE = 'sales_email/order/guest_template' (line 45)
XML_PATH_EMAIL_IDENTITY = 'sales_email/order/identity' (line 46)
XML_PATH_EMAIL_TEMPLATE = 'sales_email/order/template' (line 44)

XML configuration paths

XML_PATH_UPDATE_EMAIL_COPY_METHOD = 'sales_email/order_comment/copy_method' (line 55)
XML_PATH_UPDATE_EMAIL_COPY_TO = 'sales_email/order_comment/copy_to' (line 54)
XML_PATH_UPDATE_EMAIL_ENABLED = 'sales_email/order_comment/enabled' (line 56)
XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE = 'sales_email/order_comment/guest_template' (line 52)
XML_PATH_UPDATE_EMAIL_IDENTITY = 'sales_email/order_comment/identity' (line 53)
XML_PATH_UPDATE_EMAIL_TEMPLATE = 'sales_email/order_comment/template' (line 51)

Documentation generated on Wed, 04 Feb 2009 03:28:55 +0200 by phpDocumentor 1.4.2