Documentation

Mage_Sales_Model_Order_Invoice extends Mage_Sales_Model_Abstract
in package

Sales abstract model Provide date processing functionality

Table of Contents

Constants

CAPTURE_OFFLINE  : mixed = 'offline'
CAPTURE_ONLINE  : mixed = 'online'
HISTORY_ENTITY_NAME  : mixed = 'invoice'
Identifier for order history item
NOT_CAPTURE  : mixed = 'not_capture'
REPORT_DATE_TYPE_INVOICE_CREATED  : mixed = 'invoice_created'
REPORT_DATE_TYPE_ORDER_CREATED  : mixed = 'order_created'
STATE_CANCELED  : mixed = 3
STATE_OPEN  : mixed = 1
Invoice states
STATE_PAID  : mixed = 2
XML_PATH_EMAIL_ATTACH_PDF  : mixed = 'sales_email/invoice/attach_pdf'
XML_PATH_EMAIL_COPY_METHOD  : mixed = 'sales_email/invoice/copy_method'
XML_PATH_EMAIL_COPY_TO  : mixed = 'sales_email/invoice/copy_to'
XML_PATH_EMAIL_ENABLED  : mixed = 'sales_email/invoice/enabled'
XML_PATH_EMAIL_GUEST_TEMPLATE  : mixed = 'sales_email/invoice/guest_template'
XML_PATH_EMAIL_IDENTITY  : mixed = 'sales_email/invoice/identity'
XML_PATH_EMAIL_TEMPLATE  : mixed = 'sales_email/invoice/template'
XML_PATH_UPDATE_EMAIL_COPY_METHOD  : mixed = 'sales_email/invoice_comment/copy_method'
XML_PATH_UPDATE_EMAIL_COPY_TO  : mixed = 'sales_email/invoice_comment/copy_to'
XML_PATH_UPDATE_EMAIL_ENABLED  : mixed = 'sales_email/invoice_comment/enabled'
XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE  : mixed = 'sales_email/invoice_comment/guest_template'
XML_PATH_UPDATE_EMAIL_IDENTITY  : mixed = 'sales_email/invoice_comment/identity'
XML_PATH_UPDATE_EMAIL_TEMPLATE  : mixed = 'sales_email/invoice_comment/template'

Properties

$_cacheTag  : string|bool|array<string|int, mixed>
Model cache tag for clear cache in after save and after delete
$_comments  : Mage_Sales_Model_Resource_Order_Invoice_Comment_Collection|array<string|int, Mage_Sales_Model_Order_Invoice_Comment>|null
$_data  : array<string|int, mixed>|null
Object attributes
$_dataSaveAllowed  : bool
Flag which can stop data saving after before save Can be used for next sequence: we check data in _beforeSave, if data are not valid - we can set this flag to false value and save process will be stopped
$_dirty  : array<string|int, mixed>
$_eventObject  : mixed
$_eventPrefix  : mixed
$_hasDataChanges  : bool
Data changes flag (true after setData|unsetData call)
$_idFieldName  : string
Name of object id field
$_isDeleted  : bool
Object delete flag
$_isObjectNew  : bool|null
Flag which allow detect object state: is it new object (without id) or existing one (with id)
$_items  : Mage_Sales_Model_Resource_Order_Invoice_Item_Collection|array<string|int, Mage_Sales_Model_Order_Invoice_Item>|null
$_oldFieldsMap  : array<string|int, mixed>
Map short fields names to its full names
$_order  : Mage_Sales_Model_Order|null
$_origData  : array<string|int, mixed>|null
Original data that was loaded
$_resource  : Mage_Core_Model_Resource_Db_Abstract
Resource model instance
$_resourceCollectionName  : string
Name of the resource collection model
$_resourceName  : string
Name of the resource model
$_rounders  : array<string|int, mixed>
Calculator instances for delta rounding of prices
$_saveBeforeDestruct  : mixed
$_states  : mixed
$_syncFieldsMap  : mixed
Map of fields to sync to other fields upon changing their data
$_underscoreCache  : array<string|int, mixed>
Setter/Getter underscore transformation cache
$_wasPayCalled  : bool
Whether the pay() was called

Methods

__call()  : mixed
Set/Get attribute wrapper
__construct()  : mixed
Constructor
__get()  : mixed
Attribute getter (deprecated)
__set()  : mixed
Attribute setter (deprecated)
__toArray()  : array<string|int, mixed>
Convert object attributes to array
_getResource()  : Mage_Sales_Model_Resource_Order_Invoice
Get resource instance
addComment()  : $this
Adds comment to invoice with additional possibility to send it to customer via email and show it in customer account
addData()  : $this
Add data to the object.
addItem()  : $this
afterCommitCallback()  : Mage_Core_Model_Abstract
Processing object after save data Updates relevant grid table records.
afterLoad()  : $this
Object after load processing. Implemented as public interface for supporting objects after load in collections
canCancel()  : bool
Check invoice cancel action availability
canCapture()  : bool
Check invice capture action availability
cancel()  : $this
Cancel invoice action
canRefund()  : bool
Check invoice refund action availability
canVoid()  : bool
Check invice void action availability
capture()  : $this
Capture invoice
cleanModelCache()  : $this
Remove model object related cache
clearInstance()  : $this
Clearing object for correct deleting by garbage collector
collectTotals()  : $this
Invoice totals collecting
dataHasChangedFor()  : bool
Compare object data with original data
debug()  : string|array<string|int, mixed>
Present object data as string in debug mode
delete()  : $this
Delete object from database
destruct()  : mixed
Uploader clean on shutdown
flagDirty()  : $this
getAllItems()  : array<string|int, Mage_Sales_Model_Order_Invoice_Item>
getBackUrl()  : string|null
getBaseCost()  : float|null
getBaseCurrencyCode()  : string|null
getBaseDiscountAmount()  : float|null
getBaseGrandTotal()  : float|null
getBaseHiddenTaxAmount()  : float|null
getBaseShippingAmount()  : float|null
getBaseShippingHiddenTaxAmount()  : float|null
getBaseShippingInclTax()  : float|null
getBaseShippingTaxAmount()  : float|null
getBaseSubtotal()  : float|null
getBaseSubtotalInclTax()  : float|null
getBaseTaxAmount()  : float|null
getBaseToGlobalRate()  : float|null
getBaseToOrderRate()  : float|null
getBaseTotalRefunded()  : float|null
getBillingAddress()  : Mage_Sales_Model_Order_Address|null
Retrieve billing address
getBillingAddressId()  : int|null
getCacheIdTags()  : array<string|int, mixed>|false
Get cache tags associated with object id
getCacheTags()  : array<string|int, mixed>|false
Get list of cache tags applied to model object.
getCanVoidFlag()  : bool|null
getCollection()  : Mage_Core_Model_Resource_Db_Collection_Abstract|false
getCommentsCollection()  : Mage_Sales_Model_Resource_Order_Comment_Collection_Abstract
getConfig()  : Mage_Sales_Model_Order_Invoice_Config
Retrieve invoice configuration model
getCreatedAt()  : string|null
getCreatedAtDate()  : DateTimeImmutable
Get object created at date affected current active store timezone
getCreatedAtStoreDate()  : DateTimeImmutable
Get object created at date affected with object store timezone
getCybersourceToken()  : string|null
getData()  : mixed
Object data getter
getDataByKey()  : mixed
Get object data by particular key
getDataByPath()  : mixed
Get object data by path
getDataSetDefault()  : mixed
Fast get data or set default if value is not available
getDataUsingMethod()  : mixed
Get object data by key with calling getter method
getDiscountAmount()  : float|null
Get discount amount with proper float casting DBAL returns DECIMAL as string, so we cast to float
getEmailSent()  : bool|null
getEntityId()  : int
getForceUpdateGridRecords()  : bool|null
getGlobalCurrencyCode()  : string|null
getGrandTotal()  : float|null
getHiddenTaxAmount()  : float|null
getId()  : int|string|null
Retrieve model object identifier
getIdFieldName()  : string
Retrieve identifier field name for model
getIncrementId()  : string|null
getIsPaid()  : bool|null
getIsUsedForRefund()  : bool|null
getItemById()  : false|Mage_Sales_Model_Order_Invoice_Item
getItemsCollection()  : Mage_Sales_Model_Resource_Order_Invoice_Item_Collection
Get invoice items collection
getOrder()  : Mage_Sales_Model_Order
Retrieve the order the invoice for created for
getOrderCurrencyCode()  : string|null
getOrderId()  : int|null
getOrderIncrementId()  : string
Retrieve the increment_id of the order
getOrigData()  : mixed
Get object loaded data (original data)
getRequestedCaptureCase()  : string|null
getResource()  : Mage_Sales_Model_Resource_Order_Invoice
Retrieve model resource
getResourceCollection()  : Mage_Core_Model_Resource_Db_Collection_Abstract
Get collection instance
getResourceName()  : string
Retrieve model resource name
getShippingAddress()  : Mage_Sales_Model_Order_Address|null
Retrieve shipping address
getShippingAddressId()  : int|null
getShippingAmount()  : float|null
Get shipping amount with proper float casting DBAL returns DECIMAL as string, so we cast to float
getShippingHiddenTaxAmount()  : float|null
getShippingInclTax()  : float|null
getShippingTaxAmount()  : float|null
getState()  : int|null
getStateName()  : string
Retrieve invoice state name by state identifier
getStates()  : array<string|int, mixed>
Retrieve invoice states array
getStore()  : Mage_Core_Model_Store
Retrieve store model instance
getStoreCurrencyCode()  : string|null
getStoreId()  : int|null
getStoreToBaseRate()  : float|null
getStoreToOrderRate()  : float|null
getSubtotal()  : float|null
getSubtotalInclTax()  : float|null
getTaxAmount()  : float|null
getTotalQty()  : float|null
Get total quantity with proper float casting DBAL returns DECIMAL as string, so we cast to float
getUpdatedAt()  : string|null
hasData()  : bool
If $key is empty, checks whether there's any data in the object Otherwise checks if the specified attribute is set.
hasDataChanges()  : bool
Get data change status
hasErrors()  : bool
isCanceled()  : bool
Check invoice cancel state
isDeleted()  : bool
Set _isDeleted flag value (if $isDeleted param is defined) and return current flag value
isDirty()  : bool
isEmpty()  : bool
checks whether the object is empty
isLast()  : bool
Checking if the invoice is last
isModuleEnabled()  : bool
isObjectNew()  : bool
Check object state (true - if it is object without id on object just created) This method can help detect if object just created in _afterSave method problem is what in after save object has id and we can't detect what object was created in this transaction
jsonSerialize()  : array<string|int, mixed>
Implementation of JsonSerializable::jsonSerialize()
load()  : $this
Load object data
loadByIncrementId()  : $this
Load invoice by increment id
offsetExists()  : bool
Implementation of ArrayAccess::offsetExists()
offsetGet()  : mixed
Implementation of ArrayAccess::offsetGet()
offsetSet()  : void
Implementation of ArrayAccess::offsetSet()
offsetUnset()  : void
Implementation of ArrayAccess::offsetUnset()
pay()  : $this
Pay invoice
register()  : $this
Register invoice
reset()  : $this
Reset invoice object
roundPrice()  : float
Round price considering delta
save()  : $this
Save object data
sendEmail()  : $this
Send email with invoice data
sendUpdateEmail()  : $this
Send email with invoice update information
serialize()  : string
serialize object attributes
setAttribute()  : $this
setBaseCost()  : static
setBaseCurrencyCode()  : static
setBaseDiscountAmount()  : static
setBaseGrandTotal()  : static
setBaseHiddenTaxAmount()  : static
setBaseShippingAmount()  : static
setBaseShippingHiddenTaxAmount()  : static
setBaseShippingInclTax()  : static
setBaseShippingTaxAmount()  : static
setBaseSubtotal()  : static
setBaseSubtotalInclTax()  : static
setBaseTaxAmount()  : static
setBaseToGlobalRate()  : static
setBaseToOrderRate()  : static
setBaseTotalRefunded()  : static
setBillingAddressId()  : static
setCanVoidFlag()  : static
setCreatedAt()  : static
setCustomerId()  : static
setCybersourceToken()  : static
setData()  : $this
Overwrite data in the object.
setDataChanges()  : $this
Clears data changes status
setDataUsingMethod()  : $this
Set object data with calling setter method
setDiscountAmount()  : static
setEmailSent()  : static
setGlobalCurrencyCode()  : static
setGrandTotal()  : static
setHiddenTaxAmount()  : static
setId()  : $this
Declare model object identifier value
setIdFieldName()  : $this
set name of object id field
setIncrementId()  : static
setIsPaid()  : static
setIsUsedForRefund()  : static
setOrder()  : $this
Declare order for invoice
setOrderCurrencyCode()  : static
setOrderId()  : static
setOrigData()  : $this
Initialize object original data
setShippingAddressId()  : static
setShippingAmount()  : static
setShippingHiddenTaxAmount()  : static
setShippingInclTax()  : static
setShippingTaxAmount()  : static
setState()  : static
setStoreCurrencyCode()  : static
setStoreId()  : static
setStoreToBaseRate()  : static
setStoreToOrderRate()  : static
setSubtotal()  : static
setSubtotalInclTax()  : static
setTaxAmount()  : static
setTotalQty()  : static
setTransactionId()  : static
setUpdatedAt()  : static
toArray()  : array<string|int, mixed>
Public wrapper for __toArray
toJson()  : string
Public wrapper for __toJson
toString()  : string
Public wrapper for __toString
toXml()  : string
Public wrapper for __toXml
unsetData()  : $this
Unset data from the object.
unsetOldData()  : $this
Unset old fields data from the object.
void()  : $this
Void invoice
wasPayCalled()  : bool
Whether pay() method was called (whether order and payment totals were updated)
__toJson()  : string
Convert object attributes to JSON
__toXml()  : string
Convert object attributes to XML
_addFullNames()  : mixed
_addPdfAttachment()  : void
Attach a PDF copy of this document to the given email info, if it has a PDF form
_afterDelete()  : $this
Processing object after delete data
_afterDeleteCommit()  : $this
Processing manipulation after main transaction commit
_afterLoad()  : $this
Processing object after load data
_afterSave()  : $this
Processing object after save data
_beforeDelete()  : Mage_Sales_Model_Abstract
Processing object before delete data
_beforeLoad()  : $this
Processing object before load data
_beforeSave()  : $this
Before object save manipulations
_camelize()  : string
_clearData()  : $this
Clearing object's data
_clearReferences()  : $this
Clearing cyclic references
_construct()  : void
Initialize invoice resource model
_getData()  : mixed
Get value from _data array without parse key
_getEmails()  : array<string|int, mixed>|bool
_getEventData()  : array<string|int, mixed>
Get array of objects transferred to default events processing
_getPdfAttachmentInfo()  : array{source_model: string, entity_model: string, filename_prefix: string}|null
Descriptor for attaching this document as a PDF to an email, or null when the document has no printable PDF form. Overridden by invoice/shipment/creditmemo.
_hasModelChanged()  : bool
Check whether model has changed data.
_init()  : mixed
Standard model initialization
_initOldFieldsMap()  : $this
Init mapping array of short fields to its full names
_prepareArray()  : array<string|int, mixed>
Set required array elements
_prepareSyncFieldsMap()  : $this
Called after old fields are inited. Forms synchronization map to sync old fields and new fields between each other.
_protectFromNonAdmin()  : mixed
Safeguard func that will check, if we are in admin area
_setResourceModel()  : mixed
Set resource names
_underscore()  : string
Converts field names for setters and getters

Constants

CAPTURE_OFFLINE

public mixed CAPTURE_OFFLINE = 'offline'

CAPTURE_ONLINE

public mixed CAPTURE_ONLINE = 'online'

HISTORY_ENTITY_NAME

Identifier for order history item

public mixed HISTORY_ENTITY_NAME = 'invoice'

NOT_CAPTURE

public mixed NOT_CAPTURE = 'not_capture'

REPORT_DATE_TYPE_INVOICE_CREATED

public mixed REPORT_DATE_TYPE_INVOICE_CREATED = 'invoice_created'

REPORT_DATE_TYPE_ORDER_CREATED

public mixed REPORT_DATE_TYPE_ORDER_CREATED = 'order_created'

STATE_CANCELED

public mixed STATE_CANCELED = 3

STATE_OPEN

Invoice states

public mixed STATE_OPEN = 1

STATE_PAID

public mixed STATE_PAID = 2

XML_PATH_EMAIL_ATTACH_PDF

public mixed XML_PATH_EMAIL_ATTACH_PDF = 'sales_email/invoice/attach_pdf'

XML_PATH_EMAIL_COPY_METHOD

public mixed XML_PATH_EMAIL_COPY_METHOD = 'sales_email/invoice/copy_method'

XML_PATH_EMAIL_COPY_TO

public mixed XML_PATH_EMAIL_COPY_TO = 'sales_email/invoice/copy_to'

XML_PATH_EMAIL_ENABLED

public mixed XML_PATH_EMAIL_ENABLED = 'sales_email/invoice/enabled'

XML_PATH_EMAIL_GUEST_TEMPLATE

public mixed XML_PATH_EMAIL_GUEST_TEMPLATE = 'sales_email/invoice/guest_template'

XML_PATH_EMAIL_IDENTITY

public mixed XML_PATH_EMAIL_IDENTITY = 'sales_email/invoice/identity'

XML_PATH_EMAIL_TEMPLATE

public mixed XML_PATH_EMAIL_TEMPLATE = 'sales_email/invoice/template'

XML_PATH_UPDATE_EMAIL_COPY_METHOD

public mixed XML_PATH_UPDATE_EMAIL_COPY_METHOD = 'sales_email/invoice_comment/copy_method'

XML_PATH_UPDATE_EMAIL_COPY_TO

public mixed XML_PATH_UPDATE_EMAIL_COPY_TO = 'sales_email/invoice_comment/copy_to'

XML_PATH_UPDATE_EMAIL_ENABLED

public mixed XML_PATH_UPDATE_EMAIL_ENABLED = 'sales_email/invoice_comment/enabled'

XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE

public mixed XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE = 'sales_email/invoice_comment/guest_template'

XML_PATH_UPDATE_EMAIL_IDENTITY

public mixed XML_PATH_UPDATE_EMAIL_IDENTITY = 'sales_email/invoice_comment/identity'

XML_PATH_UPDATE_EMAIL_TEMPLATE

public mixed XML_PATH_UPDATE_EMAIL_TEMPLATE = 'sales_email/invoice_comment/template'

Properties

$_cacheTag

Model cache tag for clear cache in after save and after delete

protected string|bool|array<string|int, mixed> $_cacheTag = \false

When you use true - all cache will be clean

$_data

Object attributes

protected array<string|int, mixed>|null $_data = []

$_dataSaveAllowed

Flag which can stop data saving after before save Can be used for next sequence: we check data in _beforeSave, if data are not valid - we can set this flag to false value and save process will be stopped

protected bool $_dataSaveAllowed = \true

$_dirty

protected array<string|int, mixed> $_dirty

$_eventObject

protected mixed $_eventObject = 'invoice'
Attributes
#[Override]

$_eventPrefix

protected mixed $_eventPrefix = 'sales_order_invoice'
Attributes
#[Override]

$_hasDataChanges

Data changes flag (true after setData|unsetData call)

protected bool $_hasDataChanges = false

$_idFieldName

Name of object id field

protected string $_idFieldName = null

$_isDeleted

Object delete flag

protected bool $_isDeleted = false

$_isObjectNew

Flag which allow detect object state: is it new object (without id) or existing one (with id)

protected bool|null $_isObjectNew = \null

$_oldFieldsMap

Map short fields names to its full names

protected array<string|int, mixed> $_oldFieldsMap = []

$_origData

Original data that was loaded

protected array<string|int, mixed>|null $_origData

$_resourceCollectionName

Name of the resource collection model

protected string $_resourceCollectionName

$_resourceName

Name of the resource model

protected string $_resourceName

$_rounders

Calculator instances for delta rounding of prices

protected array<string|int, mixed> $_rounders = []

$_saveBeforeDestruct

protected mixed $_saveBeforeDestruct = \false

$_states

protected static mixed $_states

$_syncFieldsMap

Map of fields to sync to other fields upon changing their data

protected mixed $_syncFieldsMap = []

$_underscoreCache

Setter/Getter underscore transformation cache

protected static array<string|int, mixed> $_underscoreCache = []

$_wasPayCalled

Whether the pay() was called

protected bool $_wasPayCalled = \false

Methods

__call()

Set/Get attribute wrapper

public __call(string $method, array<string|int, mixed> $args) : mixed
Parameters
$method : string
$args : array<string|int, mixed>

__construct()

Constructor

public __construct() : mixed

By default, is looking for first argument as array and assigns it as object attributes This behaviour may change in child classes

__get()

Attribute getter (deprecated)

public __get(string $var) : mixed
Parameters
$var : string

__set()

Attribute setter (deprecated)

public __set(string $var, mixed $value) : mixed
Parameters
$var : string
$value : mixed

__toArray()

Convert object attributes to array

public __toArray([array<string|int, mixed> $arrAttributes = [] ]) : array<string|int, mixed>
Parameters
$arrAttributes : array<string|int, mixed> = []

array of required attributes

Return values
array<string|int, mixed>

addData()

Add data to the object.

public addData(array<string|int, mixed> $arr) : $this

Retains previous data in the object.

Parameters
$arr : array<string|int, mixed>
Return values
$this

afterLoad()

Object after load processing. Implemented as public interface for supporting objects after load in collections

public afterLoad() : $this
Return values
$this

canCancel()

Check invoice cancel action availability

public canCancel() : bool
Return values
bool

canCapture()

Check invice capture action availability

public canCapture() : bool
Return values
bool

cancel()

Cancel invoice action

public cancel() : $this
Return values
$this

canRefund()

Check invoice refund action availability

public canRefund() : bool
Return values
bool

canVoid()

Check invice void action availability

public canVoid() : bool
Return values
bool

capture()

Capture invoice

public capture() : $this
Return values
$this

cleanModelCache()

Remove model object related cache

public cleanModelCache() : $this
Return values
$this

clearInstance()

Clearing object for correct deleting by garbage collector

public final clearInstance() : $this
Return values
$this

collectTotals()

Invoice totals collecting

public collectTotals() : $this
Return values
$this

dataHasChangedFor()

Compare object data with original data

public dataHasChangedFor(string $field) : bool
Parameters
$field : string
Return values
bool

debug()

Present object data as string in debug mode

public debug([mixed $data = null ][, array<string|int, mixed> &$objects = [] ]) : string|array<string|int, mixed>
Parameters
$data : mixed = null
$objects : array<string|int, mixed> = []
Return values
string|array<string|int, mixed>

delete()

Delete object from database

public delete() : $this
Tags
throws
Throwable
Return values
$this

destruct()

Uploader clean on shutdown

public destruct() : mixed

flagDirty()

public flagDirty(string $field[, bool $flag = true ]) : $this
Parameters
$field : string
$flag : bool = true
Return values
$this

getBackUrl()

public getBackUrl() : string|null
Return values
string|null

getBaseCost()

public getBaseCost() : float|null
Return values
float|null

getBaseCurrencyCode()

public getBaseCurrencyCode() : string|null
Return values
string|null

getBaseDiscountAmount()

public getBaseDiscountAmount() : float|null
Return values
float|null

getBaseGrandTotal()

public getBaseGrandTotal() : float|null
Return values
float|null

getBaseHiddenTaxAmount()

public getBaseHiddenTaxAmount() : float|null
Return values
float|null

getBaseShippingAmount()

public getBaseShippingAmount() : float|null
Return values
float|null

getBaseShippingHiddenTaxAmount()

public getBaseShippingHiddenTaxAmount() : float|null
Return values
float|null

getBaseShippingInclTax()

public getBaseShippingInclTax() : float|null
Return values
float|null

getBaseShippingTaxAmount()

public getBaseShippingTaxAmount() : float|null
Return values
float|null

getBaseSubtotal()

public getBaseSubtotal() : float|null
Return values
float|null

getBaseSubtotalInclTax()

public getBaseSubtotalInclTax() : float|null
Return values
float|null

getBaseTaxAmount()

public getBaseTaxAmount() : float|null
Return values
float|null

getBaseToGlobalRate()

public getBaseToGlobalRate() : float|null
Return values
float|null

getBaseToOrderRate()

public getBaseToOrderRate() : float|null
Return values
float|null

getBaseTotalRefunded()

public getBaseTotalRefunded() : float|null
Return values
float|null

getBillingAddressId()

public getBillingAddressId() : int|null
Return values
int|null

getCacheIdTags()

Get cache tags associated with object id

public getCacheIdTags() : array<string|int, mixed>|false
Return values
array<string|int, mixed>|false

getCacheTags()

Get list of cache tags applied to model object.

public getCacheTags() : array<string|int, mixed>|false

Return false if cache tags are not supported by model

Return values
array<string|int, mixed>|false

getCanVoidFlag()

public getCanVoidFlag() : bool|null
Return values
bool|null

getCreatedAt()

public getCreatedAt() : string|null
Return values
string|null

getCreatedAtDate()

Get object created at date affected current active store timezone

public getCreatedAtDate() : DateTimeImmutable
Return values
DateTimeImmutable

getCreatedAtStoreDate()

Get object created at date affected with object store timezone

public getCreatedAtStoreDate() : DateTimeImmutable
Return values
DateTimeImmutable

getCybersourceToken()

public getCybersourceToken() : string|null
Return values
string|null

getData()

Object data getter

public getData([string $key = '' ][, string|int $index = null ]) : mixed

If $key is not defined will return all the data as an array. Otherwise, it will return value of the element specified by $key. It is possible to use keys like a/b/c for access nested array data

If $index is specified it will assume that attribute data is an array and retrieve corresponding member. If data is the string - it will be explode by new line character and converted to array.

Parameters
$key : string = ''
$index : string|int = null

getDataByKey()

Get object data by particular key

public getDataByKey(string $key) : mixed
Parameters
$key : string

getDataByPath()

Get object data by path

public getDataByPath(string $path) : mixed

Method consider the path as chain of keys: a/b/c => ['a']['b']['c']

Parameters
$path : string

getDataSetDefault()

Fast get data or set default if value is not available

public getDataSetDefault(string $key, mixed $default) : mixed
Parameters
$key : string
$default : mixed

getDataUsingMethod()

Get object data by key with calling getter method

public getDataUsingMethod(string $key[, mixed $args = null ]) : mixed
Parameters
$key : string
$args : mixed = null

getDiscountAmount()

Get discount amount with proper float casting DBAL returns DECIMAL as string, so we cast to float

public getDiscountAmount() : float|null
Return values
float|null

getEmailSent()

public getEmailSent() : bool|null
Return values
bool|null

getEntityId()

public getEntityId() : int
Return values
int

getForceUpdateGridRecords()

public getForceUpdateGridRecords() : bool|null
Return values
bool|null

getGlobalCurrencyCode()

public getGlobalCurrencyCode() : string|null
Return values
string|null

getGrandTotal()

public getGrandTotal() : float|null
Return values
float|null

getHiddenTaxAmount()

public getHiddenTaxAmount() : float|null
Return values
float|null

getId()

Retrieve model object identifier

public getId() : int|string|null
Attributes
#[Override]
Return values
int|string|null

getIdFieldName()

Retrieve identifier field name for model

public getIdFieldName() : string
Attributes
#[Override]
Return values
string

getIncrementId()

public getIncrementId() : string|null
Return values
string|null

getIsPaid()

public getIsPaid() : bool|null
Return values
bool|null

getIsUsedForRefund()

public getIsUsedForRefund() : bool|null
Return values
bool|null

getOrderCurrencyCode()

public getOrderCurrencyCode() : string|null
Return values
string|null

getOrderId()

public getOrderId() : int|null
Return values
int|null

getOrderIncrementId()

Retrieve the increment_id of the order

public getOrderIncrementId() : string
Return values
string

getOrigData()

Get object loaded data (original data)

public getOrigData([string $key = null ]) : mixed
Parameters
$key : string = null

getRequestedCaptureCase()

public getRequestedCaptureCase() : string|null
Return values
string|null

getResourceName()

Retrieve model resource name

public getResourceName() : string
Return values
string

getShippingAddressId()

public getShippingAddressId() : int|null
Return values
int|null

getShippingAmount()

Get shipping amount with proper float casting DBAL returns DECIMAL as string, so we cast to float

public getShippingAmount() : float|null
Return values
float|null

getShippingHiddenTaxAmount()

public getShippingHiddenTaxAmount() : float|null
Return values
float|null

getShippingInclTax()

public getShippingInclTax() : float|null
Return values
float|null

getShippingTaxAmount()

public getShippingTaxAmount() : float|null
Return values
float|null

getState()

public getState() : int|null
Return values
int|null

getStateName()

Retrieve invoice state name by state identifier

public getStateName([int $stateId = null ]) : string
Parameters
$stateId : int = null
Return values
string

getStates()

Retrieve invoice states array

public static getStates() : array<string|int, mixed>
Return values
array<string|int, mixed>

getStoreCurrencyCode()

public getStoreCurrencyCode() : string|null
Return values
string|null

getStoreId()

public getStoreId() : int|null
Return values
int|null

getStoreToBaseRate()

public getStoreToBaseRate() : float|null
Return values
float|null

getStoreToOrderRate()

public getStoreToOrderRate() : float|null
Return values
float|null

getSubtotal()

public getSubtotal() : float|null
Return values
float|null

getSubtotalInclTax()

public getSubtotalInclTax() : float|null
Return values
float|null

getTaxAmount()

public getTaxAmount() : float|null
Return values
float|null

getTotalQty()

Get total quantity with proper float casting DBAL returns DECIMAL as string, so we cast to float

public getTotalQty() : float|null
Return values
float|null

getUpdatedAt()

public getUpdatedAt() : string|null
Return values
string|null

hasData()

If $key is empty, checks whether there's any data in the object Otherwise checks if the specified attribute is set.

public hasData([string $key = '' ]) : bool
Parameters
$key : string = ''
Return values
bool

hasDataChanges()

Get data change status

public hasDataChanges() : bool
Return values
bool

hasErrors()

public hasErrors() : bool
Return values
bool

isCanceled()

Check invoice cancel state

public isCanceled() : bool
Return values
bool

isDeleted()

Set _isDeleted flag value (if $isDeleted param is defined) and return current flag value

public isDeleted([bool $isDeleted = null ]) : bool
Parameters
$isDeleted : bool = null
Return values
bool

isDirty()

public isDirty([string $field = null ]) : bool
Parameters
$field : string = null
Return values
bool

isEmpty()

checks whether the object is empty

public isEmpty() : bool
Return values
bool

isLast()

Checking if the invoice is last

public isLast() : bool
Return values
bool

isModuleEnabled()

public isModuleEnabled(string $moduleName[, string $helperAlias = 'core' ]) : bool
Parameters
$moduleName : string
$helperAlias : string = 'core'
Return values
bool

isObjectNew()

Check object state (true - if it is object without id on object just created) This method can help detect if object just created in _afterSave method problem is what in after save object has id and we can't detect what object was created in this transaction

public isObjectNew([bool $flag = null ]) : bool
Parameters
$flag : bool = null
Return values
bool

jsonSerialize()

Implementation of JsonSerializable::jsonSerialize()

public jsonSerialize() : array<string|int, mixed>

Prepares the object data for JSON serialization. Returns all object data as an array, with special handling for nested DataObject instances:

  • If a nested DataObject has a custom jsonSerialize() implementation, it's preserved as-is
  • If a nested DataObject has a custom toJson() method, it's converted to JSON string
  • If a nested DataObject uses only the base implementations, it's excluded from output

This prevents infinite recursion and circular references when serializing object hierarchies.

Attributes
#[Override]
Return values
array<string|int, mixed>

load()

Load object data

public load(string|null|int $id[, string|null $field = null ]) : $this
Parameters
$id : string|null|int
$field : string|null = null
Return values
$this

loadByIncrementId()

Load invoice by increment id

public loadByIncrementId(string $incrementId) : $this
Parameters
$incrementId : string
Return values
$this

pay()

Pay invoice

public pay() : $this
Return values
$this

register()

Register invoice

public register() : $this

Apply to order, order items etc.

Return values
$this

reset()

Reset invoice object

public reset() : $this
Return values
$this

roundPrice()

Round price considering delta

public roundPrice(float $price[, string $type = 'regular' ][, bool $negative = false ]) : float
Parameters
$price : float
$type : string = 'regular'
$negative : bool = false

Indicates if we perform addition (true) or subtraction (false) of rounded value

Return values
float

save()

Save object data

public save() : $this
Tags
throws
Throwable
Return values
$this

sendEmail()

Send email with invoice data

public sendEmail([bool $notifyCustomer = true ][, string $comment = '' ]) : $this
Parameters
$notifyCustomer : bool = true
$comment : string = ''
Return values
$this

sendUpdateEmail()

Send email with invoice update information

public sendUpdateEmail([bool $notifyCustomer = true ][, string $comment = '' ]) : $this
Parameters
$notifyCustomer : bool = true
$comment : string = ''
Return values
$this

serialize()

serialize object attributes

public serialize([array<string|int, mixed> $attributes = [] ][, string $valueSeparator = '=' ][, string $fieldSeparator = ' ' ][, string $quote = '"' ]) : string
Parameters
$attributes : array<string|int, mixed> = []
$valueSeparator : string = '='
$fieldSeparator : string = ' '
$quote : string = '"'
Return values
string

setBaseCost()

public setBaseCost(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseCurrencyCode()

public setBaseCurrencyCode(string|null $value) : static
Parameters
$value : string|null
Return values
static

setBaseDiscountAmount()

public setBaseDiscountAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseGrandTotal()

public setBaseGrandTotal(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseHiddenTaxAmount()

public setBaseHiddenTaxAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseShippingAmount()

public setBaseShippingAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseShippingHiddenTaxAmount()

public setBaseShippingHiddenTaxAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseShippingInclTax()

public setBaseShippingInclTax(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseShippingTaxAmount()

public setBaseShippingTaxAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseSubtotal()

public setBaseSubtotal(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseSubtotalInclTax()

public setBaseSubtotalInclTax(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseTaxAmount()

public setBaseTaxAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseToGlobalRate()

public setBaseToGlobalRate(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseToOrderRate()

public setBaseToOrderRate(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBaseTotalRefunded()

public setBaseTotalRefunded(float|null $value) : static
Parameters
$value : float|null
Return values
static

setBillingAddressId()

public setBillingAddressId(int|null $value) : static
Parameters
$value : int|null
Return values
static

setCanVoidFlag()

public setCanVoidFlag([bool|null $value = true ]) : static
Parameters
$value : bool|null = true
Return values
static

setCreatedAt()

public setCreatedAt(string|null $value) : static
Parameters
$value : string|null
Return values
static

setCustomerId()

public setCustomerId(int|null $value) : static
Parameters
$value : int|null
Return values
static

setCybersourceToken()

public setCybersourceToken(string|null $value) : static
Parameters
$value : string|null
Return values
static

setData()

Overwrite data in the object.

public setData(string|array<string|int, mixed> $key[, mixed $value = null ]) : $this

$key can be string or array. If $key is string, the attribute value will be overwritten by $value

If $key is an array, it will overwrite all the data in the object.

Parameters
$key : string|array<string|int, mixed>
$value : mixed = null
Return values
$this

setDataChanges()

Clears data changes status

public setDataChanges(bool $value) : $this
Parameters
$value : bool
Return values
$this

setDataUsingMethod()

Set object data with calling setter method

public setDataUsingMethod(string $key[, mixed $args = [] ]) : $this
Parameters
$key : string
$args : mixed = []
Return values
$this

setDiscountAmount()

public setDiscountAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setEmailSent()

public setEmailSent([bool|null $value = true ]) : static
Parameters
$value : bool|null = true
Return values
static

setGlobalCurrencyCode()

public setGlobalCurrencyCode(string|null $value) : static
Parameters
$value : string|null
Return values
static

setGrandTotal()

public setGrandTotal(float|null $value) : static
Parameters
$value : float|null
Return values
static

setHiddenTaxAmount()

public setHiddenTaxAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setId()

Declare model object identifier value

public setId(mixed $id) : $this
Parameters
$id : mixed
Attributes
#[Override]
Return values
$this

setIdFieldName()

set name of object id field

public setIdFieldName(string $name) : $this
Parameters
$name : string
Return values
$this

setIncrementId()

public setIncrementId(string|null $value) : static
Parameters
$value : string|null
Return values
static

setIsPaid()

public setIsPaid([bool|null $value = true ]) : static
Parameters
$value : bool|null = true
Return values
static

setIsUsedForRefund()

public setIsUsedForRefund([bool|null $value = true ]) : static
Parameters
$value : bool|null = true
Return values
static

setOrderCurrencyCode()

public setOrderCurrencyCode(string|null $value) : static
Parameters
$value : string|null
Return values
static

setOrderId()

public setOrderId(int|null $value) : static
Parameters
$value : int|null
Return values
static

setOrigData()

Initialize object original data

public setOrigData([string $key = null ][, mixed $data = null ]) : $this
Parameters
$key : string = null
$data : mixed = null
Return values
$this

setShippingAddressId()

public setShippingAddressId(int|null $value) : static
Parameters
$value : int|null
Return values
static

setShippingAmount()

public setShippingAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setShippingHiddenTaxAmount()

public setShippingHiddenTaxAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setShippingInclTax()

public setShippingInclTax(float|null $value) : static
Parameters
$value : float|null
Return values
static

setShippingTaxAmount()

public setShippingTaxAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setState()

public setState(int|null $value) : static
Parameters
$value : int|null
Return values
static

setStoreCurrencyCode()

public setStoreCurrencyCode(string|null $value) : static
Parameters
$value : string|null
Return values
static

setStoreId()

public setStoreId(int|null $value) : static
Parameters
$value : int|null
Return values
static

setStoreToBaseRate()

public setStoreToBaseRate(float|null $value) : static
Parameters
$value : float|null
Return values
static

setStoreToOrderRate()

public setStoreToOrderRate(float|null $value) : static
Parameters
$value : float|null
Return values
static

setSubtotal()

public setSubtotal(float|null $value) : static
Parameters
$value : float|null
Return values
static

setSubtotalInclTax()

public setSubtotalInclTax(float|null $value) : static
Parameters
$value : float|null
Return values
static

setTaxAmount()

public setTaxAmount(float|null $value) : static
Parameters
$value : float|null
Return values
static

setTotalQty()

public setTotalQty(float|null $value) : static
Parameters
$value : float|null
Return values
static

setTransactionId()

public setTransactionId(string|null $value) : static
Parameters
$value : string|null
Return values
static

setUpdatedAt()

public setUpdatedAt(string|null $value) : static
Parameters
$value : string|null
Return values
static

toArray()

Public wrapper for __toArray

public toArray([array<string|int, mixed> $arrAttributes = [] ]) : array<string|int, mixed>
Parameters
$arrAttributes : array<string|int, mixed> = []
Return values
array<string|int, mixed>

toJson()

Public wrapper for __toJson

public toJson([array<string|int, mixed> $arrAttributes = [] ]) : string
Parameters
$arrAttributes : array<string|int, mixed> = []
Return values
string

toString()

Public wrapper for __toString

public toString([string $format = '' ]) : string

Will use $format as an template and substitute {{key}} for attributes

Parameters
$format : string = ''
Return values
string

toXml()

Public wrapper for __toXml

public toXml([array<string|int, mixed> $arrAttributes = [] ][, string $rootName = 'item' ][, bool $addOpenTag = false ][, bool $addCdata = true ]) : string
Parameters
$arrAttributes : array<string|int, mixed> = []
$rootName : string = 'item'
$addOpenTag : bool = false
$addCdata : bool = true
Return values
string

unsetData()

Unset data from the object.

public unsetData([string $key = null ]) : $this

$key can be a string only. Array will be ignored.

Parameters
$key : string = null
Return values
$this

unsetOldData()

Unset old fields data from the object.

public unsetOldData([string $key = null ]) : $this

$key can be a string only. Array will be ignored.

Parameters
$key : string = null
Return values
$this

void()

Void invoice

public void() : $this
Return values
$this

wasPayCalled()

Whether pay() method was called (whether order and payment totals were updated)

public wasPayCalled() : bool
Return values
bool

__toJson()

Convert object attributes to JSON

protected __toJson([array<string|int, mixed> $arrAttributes = [] ]) : string
Parameters
$arrAttributes : array<string|int, mixed> = []

array of required attributes

Return values
string

__toXml()

Convert object attributes to XML

protected __toXml([array<string|int, mixed> $arrAttributes = [] ][, string $rootName = 'item' ][, bool $addOpenTag = false ][, bool $addCdata = true ]) : string
Parameters
$arrAttributes : array<string|int, mixed> = []

array of required attributes

$rootName : string = 'item'

name of the root element

$addOpenTag : bool = false
$addCdata : bool = true
Return values
string

_addFullNames()

protected _addFullNames() : mixed

_afterDelete()

Processing object after delete data

protected _afterDelete() : $this
Return values
$this

_afterDeleteCommit()

Processing manipulation after main transaction commit

protected _afterDeleteCommit() : $this
Return values
$this

_afterLoad()

Processing object after load data

protected _afterLoad() : $this
Return values
$this

_afterSave()

Processing object after save data

protected _afterSave() : $this
Attributes
#[Override]
Return values
$this

_beforeLoad()

Processing object before load data

protected _beforeLoad(int $id[, string|null $field = null ]) : $this
Parameters
$id : int
$field : string|null = null
Return values
$this

_beforeSave()

Before object save manipulations

protected _beforeSave() : $this
Attributes
#[Override]
Return values
$this

_camelize()

protected _camelize(string $name) : string
Parameters
$name : string
Return values
string

_clearData()

Clearing object's data

protected _clearData() : $this
Return values
$this

_clearReferences()

Clearing cyclic references

protected _clearReferences() : $this
Return values
$this

_construct()

Initialize invoice resource model

protected _construct() : void
Attributes
#[Override]

_getData()

Get value from _data array without parse key

protected _getData(string $key) : mixed
Parameters
$key : string

_getEmails()

protected _getEmails(string $configPath) : array<string|int, mixed>|bool
Parameters
$configPath : string
Return values
array<string|int, mixed>|bool

_getEventData()

Get array of objects transferred to default events processing

protected _getEventData() : array<string|int, mixed>
Return values
array<string|int, mixed>

_getPdfAttachmentInfo()

Descriptor for attaching this document as a PDF to an email, or null when the document has no printable PDF form. Overridden by invoice/shipment/creditmemo.

protected _getPdfAttachmentInfo() : array{source_model: string, entity_model: string, filename_prefix: string}|null
Attributes
#[Override]
Return values
array{source_model: string, entity_model: string, filename_prefix: string}|null

_hasModelChanged()

Check whether model has changed data.

protected _hasModelChanged() : bool

Can be overloaded in child classes to perform advanced check whether model needs to be saved e.g. using resourceModel->hasDataChanged() or any other technique

Return values
bool

_init()

Standard model initialization

protected _init(string $resourceModel) : mixed
Parameters
$resourceModel : string

_initOldFieldsMap()

Init mapping array of short fields to its full names

protected _initOldFieldsMap() : $this
Attributes
#[Override]
Return values
$this

_prepareArray()

Set required array elements

protected _prepareArray(array<string|int, mixed> &$arr[, array<string|int, mixed> $elements = [] ]) : array<string|int, mixed>
Parameters
$arr : array<string|int, mixed>
$elements : array<string|int, mixed> = []
Return values
array<string|int, mixed>

_prepareSyncFieldsMap()

Called after old fields are inited. Forms synchronization map to sync old fields and new fields between each other.

protected _prepareSyncFieldsMap() : $this
Return values
$this

_protectFromNonAdmin()

Safeguard func that will check, if we are in admin area

protected _protectFromNonAdmin() : mixed
Tags
throws
Mage_Core_Exception

_setResourceModel()

Set resource names

protected _setResourceModel(string $resourceName[, string|null $resourceCollectionName = null ]) : mixed

If collection name is omitted, resource name will be used with _collection appended

Parameters
$resourceName : string
$resourceCollectionName : string|null = null

_underscore()

Converts field names for setters and getters

protected _underscore(string $name) : string

$this->setMyField($value) === $this->setData('my_field', $value) Uses cache to eliminate unnecessary preg_replace

Parameters
$name : string
Return values
string
On this page

Search results