Documentation

Mage_Wishlist_Model_Item extends Mage_Core_Model_Abstract
in package
implements Mage_Catalog_Model_Product_Configuration_Item_Interface

Wishlist item model

Table of Contents

Interfaces

Mage_Catalog_Model_Product_Configuration_Item_Interface

Constants

EXCEPTION_CODE_HAS_REQUIRED_OPTIONS  : mixed = 902
EXCEPTION_CODE_NOT_SALABLE  : mixed = 901
EXCEPTION_CODE_NOT_SPECIFIED_PRODUCT  : mixed = 904

Properties

$_cacheTag  : string|bool|array<string|int, mixed>
Model cache tag for clear cache in after save and after delete
$_customOptionDownloadUrl  : string
Custom path to download attached file
$_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  : string
Parameter name in event
$_eventPrefix  : string
Prefix of model events names
$_flagOptionsSaved  : mixed
Flag stating that options were successfully saved
$_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)
$_notRepresentOptions  : array<string|int, mixed>
Not Represent options
$_oldFieldsMap  : array<string|int, mixed>
Map short fields names to its full names
$_options  : array<string|int, mixed>
Item options array
$_optionsByCode  : array<string|int, mixed>
Item options by code cache
$_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
$_syncFieldsMap  : mixed
Map of fields to sync to other fields upon changing their data
$_underscoreCache  : array<string|int, mixed>
Setter/Getter underscore transformation cache

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_Wishlist_Model_Resource_Item
Get resource instance
addData()  : $this
Add data to the object.
addOption()  : $this
Add option to item
addToCart()  : bool
Add or Move item product to shopping cart
afterCommitCallback()  : $this
Callback function which called after transaction commit in resource model
afterLoad()  : $this
Object after load processing. Implemented as public interface for supporting objects after load in collections
canHaveQty()  : bool
Returns whether Qty field is valid for this item
cleanModelCache()  : $this
Remove model object related cache
clearInstance()  : $this
Clearing object for correct deleting by garbage collector
compareOptions()  : bool
Check if two options array are identical First options array is prerogative Second options array checked against first one
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
flagDirty()  : $this
getAddedAt()  : string|null
getBillingAddress()  : Mage_Customer_Model_Address_Abstract|null
getBuyRequest()  : DataObject
Returns formatted buy request - object, holding request received from product view page with keys and options for configured product
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.
getCollection()  : Mage_Wishlist_Model_Resource_Item_Collection
getCreatedAt()  : string|null
getCustomDownloadUrl()  : mixed
Get current custom option download url
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
getDescription()  : string|null
getEntityId()  : int
getFileDownloadParams()  : DataObject
Returns special download params (if needed) for custom option with type = 'file'.
getHasError()  : bool|null
getId()  : int|string|null
Retrieve model object identifier
getIdFieldName()  : string
Retrieve identifier field name for model
getMessage()  : string|null
getOptionByCode()  : Mage_Wishlist_Model_Item_Option|null
Get item option by code
getOptions()  : array<string|int, mixed>
Get all item options
getOptionsByCode()  : array<string|int, mixed>
Get all item options as array with codes in array key
getOrigData()  : mixed
Get object loaded data (original data)
getProduct()  : Mage_Catalog_Model_Product
Retrieve item product instance
getProductId()  : int|null
getProductUrl()  : string
Retrieve Product View Page URL
getQty()  : float|null
Get quantity with proper float casting DBAL returns DECIMAL as string, so we cast to float
getResource()  : Mage_Wishlist_Model_Resource_Item
Retrieve model resource
getResourceCollection()  : Mage_Core_Model_Resource_Db_Collection_Abstract
Get collection instance
getResourceName()  : string
Retrieve model resource name
getShippingAddress()  : Mage_Customer_Model_Address_Abstract|null
getStoreId()  : int|null
getWishlistId()  : int|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
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
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
isRepresent()  : bool
Check product representation in item
jsonSerialize()  : array<string|int, mixed>
Implementation of JsonSerializable::jsonSerialize()
load()  : $this
Load object data
loadByProductWishlist()  : $this
Load item by product, wishlist and shared stores
loadWithOptions()  : $this
Loads item together with its options (default load() method doesn't load options).
mergeBuyRequest()  : $this
Merge data to item info_buyRequest option
offsetExists()  : bool
Implementation of ArrayAccess::offsetExists()
offsetGet()  : mixed
Implementation of ArrayAccess::offsetGet()
offsetSet()  : void
Implementation of ArrayAccess::offsetSet()
offsetUnset()  : void
Implementation of ArrayAccess::offsetUnset()
removeOption()  : $this
Remove option from item options
representProduct()  : bool
Check product representation in item
save()  : $this
Save model plus its options Ensures saving options in case when resource model was not changed
serialize()  : string
serialize object attributes
setAddedAt()  : static
setAttribute()  : $this
setBuyRequest()  : $this
Set buy request - object, holding request received from product view page with keys and options for configured product
setCreatedAt()  : static
setCustomDownloadUrl()  : mixed
Sets custom option download url
setData()  : $this
Overwrite data in the object.
setDataChanges()  : $this
Clears data changes status
setDataUsingMethod()  : $this
Set object data with calling setter method
setDescription()  : static
setId()  : $this
Declare model object identifier value
setIdFieldName()  : $this
set name of object id field
setOptions()  : $this
Initialize item options
setOrigData()  : $this
Initialize object original data
setProduct()  : static
setProductId()  : static
setQty()  : $this
Set quantity. If quantity is less than 0 - set it to 1
setStoreId()  : static
setUpdatedAt()  : static
setWishlist()  : static
setWishlistId()  : 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.
unsProduct()  : $this
validate()  : bool
Validate wish list item data
__toJson()  : string
Convert object attributes to JSON
__toXml()  : string
Convert object attributes to XML
_addFullNames()  : mixed
_addOptionCode()  : $this
Register option code
_afterDelete()  : $this
Processing object after delete data
_afterDeleteCommit()  : $this
Processing manipulation after main transaction commit
_afterLoad()  : $this
Processing object after load data
_afterSave()  : $this
Save item options after item saved
_beforeDelete()  : $this
Processing object before delete data
_beforeLoad()  : $this
Processing object before load data
_beforeSave()  : $this
Check required data
_camelize()  : string
_clearData()  : $this
Clearing object's data
_clearReferences()  : $this
Clearing cyclic references
_compareOptions()  : bool
Check if two options array are identical
_construct()  : void
Internal constructor not depended on params. Can be used for object initialization
_getData()  : mixed
Get value from _data array without parse key
_getEventData()  : array<string|int, mixed>
Get array of objects transferred to default events processing
_hasModelChanged()  : bool
Checks that item model has data changes.
_init()  : mixed
Standard model initialization
_initOldFieldsMap()  : mixed
Inits mapping array of object's previously used fields to new fields.
_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
_saveItemOptions()  : $this
Save item options
_setResourceModel()  : mixed
Set resource names
_underscore()  : string
Converts field names for setters and getters

Constants

EXCEPTION_CODE_HAS_REQUIRED_OPTIONS

public mixed EXCEPTION_CODE_HAS_REQUIRED_OPTIONS = 902

EXCEPTION_CODE_NOT_SALABLE

public mixed EXCEPTION_CODE_NOT_SALABLE = 901

EXCEPTION_CODE_NOT_SPECIFIED_PRODUCT

public mixed EXCEPTION_CODE_NOT_SPECIFIED_PRODUCT = 904

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

$_customOptionDownloadUrl

Custom path to download attached file

protected string $_customOptionDownloadUrl = 'wishlist/index/downloadCustomOption'

$_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

Parameter name in event

protected string $_eventObject = 'item'

In observe method you can use $observer->getEvent()->getItem() in this case

Attributes
#[Override]

$_eventPrefix

Prefix of model events names

protected string $_eventPrefix = 'wishlist_item'
Attributes
#[Override]

$_flagOptionsSaved

Flag stating that options were successfully saved

protected mixed $_flagOptionsSaved = \null

$_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

$_notRepresentOptions

Not Represent options

protected array<string|int, mixed> $_notRepresentOptions = ['info_buyRequest']

$_oldFieldsMap

Map short fields names to its full names

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

$_options

Item options array

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

$_optionsByCode

Item options by code cache

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

$_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

$_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 = []

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

addToCart()

Add or Move item product to shopping cart

public addToCart(Mage_Checkout_Model_Cart $cart[, bool $delete = false ]) : bool

Return true if product was successful added or exception with code Return false for disabled or unvisible products

Parameters
$cart : Mage_Checkout_Model_Cart
$delete : bool = false

delete the item after successful add to cart

Tags
throws
Mage_Core_Exception
Return values
bool

afterCommitCallback()

Callback function which called after transaction commit in resource model

public afterCommitCallback() : $this
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

canHaveQty()

Returns whether Qty field is valid for this item

public canHaveQty() : bool
Return values
bool

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

compareOptions()

Check if two options array are identical First options array is prerogative Second options array checked against first one

public compareOptions(array<string|int, mixed> $options1, array<string|int, mixed> $options2) : bool
Parameters
$options1 : array<string|int, mixed>
$options2 : array<string|int, mixed>
Return values
bool

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

flagDirty()

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

getAddedAt()

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

getBuyRequest()

Returns formatted buy request - object, holding request received from product view page with keys and options for configured product

public getBuyRequest() : DataObject
Return values
DataObject

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

getCreatedAt()

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

getCustomDownloadUrl()

Get current custom option download url

public getCustomDownloadUrl() : mixed

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

getDescription()

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

getEntityId()

public getEntityId() : int
Return values
int

getFileDownloadParams()

Returns special download params (if needed) for custom option with type = 'file'.

public getFileDownloadParams() : DataObject

Needed to implement Mage_Catalog_Model_Product_Configuration_Item_Interface.

We have to customize only controller url, so return it.

Attributes
#[Override]
Return values
DataObject

getHasError()

public getHasError() : bool|null
Return values
bool|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

getMessage()

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

getOptions()

Get all item options

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

getOptionsByCode()

Get all item options as array with codes in array key

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

getOrigData()

Get object loaded data (original data)

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

getProductId()

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

getProductUrl()

Retrieve Product View Page URL

public getProductUrl() : string

If product has required options add special key to URL

Return values
string

getQty()

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

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

getResourceName()

Retrieve model resource name

public getResourceName() : string
Return values
string

getStoreId()

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

getWishlistId()

public getWishlistId() : int|null
Return values
int|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

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

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

loadByProductWishlist()

Load item by product, wishlist and shared stores

public loadByProductWishlist(int $wishlistId, int $productId, array<string|int, mixed> $sharedStores) : $this
Parameters
$wishlistId : int
$productId : int
$sharedStores : array<string|int, mixed>
Return values
$this

loadWithOptions()

Loads item together with its options (default load() method doesn't load options).

public loadWithOptions(int $id[, null|string|array<string|int, mixed> $optionsFilter = null ]) : $this

If we need to load only some of options, then option code or array of option codes can be provided in $optionsFilter.

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

mergeBuyRequest()

Merge data to item info_buyRequest option

public mergeBuyRequest(array<string|int, mixed>|DataObject $buyRequest) : $this
Parameters
$buyRequest : array<string|int, mixed>|DataObject
Return values
$this

removeOption()

Remove option from item options

public removeOption(string $code) : $this
Parameters
$code : string
Return values
$this

save()

Save model plus its options Ensures saving options in case when resource model was not changed

public save() : $this
Attributes
#[Override]
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

setAddedAt()

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

setBuyRequest()

Set buy request - object, holding request received from product view page with keys and options for configured product

public setBuyRequest(DataObject $buyRequest) : $this
Parameters
$buyRequest : DataObject
Return values
$this

setCreatedAt()

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

setCustomDownloadUrl()

Sets custom option download url

public setCustomDownloadUrl(string $url) : mixed
Parameters
$url : string

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

setDescription()

public setDescription(string|null $value) : static
Parameters
$value : string|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

setOptions()

Initialize item options

public setOptions(array<string|int, mixed> $options) : $this
Parameters
$options : array<string|int, mixed>
Return values
$this

setOrigData()

Initialize object original data

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

setProductId()

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

setQty()

Set quantity. If quantity is less than 0 - set it to 1

public setQty(float $qty) : $this
Parameters
$qty : float
Return values
$this

setStoreId()

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

setUpdatedAt()

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

setWishlistId()

public setWishlistId(int|null $value) : static
Parameters
$value : int|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

unsProduct()

public unsProduct() : $this
Return values
$this

__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()

Save item options after item saved

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

_beforeDelete()

Processing object before delete data

protected _beforeDelete() : $this
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()

Check required data

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

_compareOptions()

Check if two options array are identical

protected _compareOptions(array<string|int, mixed> $options1, array<string|int, mixed> $options2) : bool
Parameters
$options1 : array<string|int, mixed>
$options2 : array<string|int, mixed>
Return values
bool

_construct()

Internal constructor not depended on params. Can be used for object initialization

protected _construct() : void
Attributes
#[Override]

_getData()

Get value from _data array without parse key

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

_getEventData()

Get array of objects transferred to default events processing

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

_hasModelChanged()

Checks that item model has data changes.

protected _hasModelChanged() : bool

Call save item options if model isn't need to save in DB

Attributes
#[Override]
Return values
bool

_init()

Standard model initialization

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

_initOldFieldsMap()

Inits mapping array of object's previously used fields to new fields.

protected _initOldFieldsMap() : mixed

Must be overloaded by descendants to set concrete fields map.

_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

_saveItemOptions()

Save item options

protected _saveItemOptions() : $this
Return values
$this

_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