Class Mage_Wishlist_Model_Item

Description

Implements interfaces:

Wishlist item model

Located in /Wishlist/Model/Item.php (line 35)

Varien_Object
   |
   --Mage_Core_Model_Abstract
      |
      --Mage_Wishlist_Model_Item
Class Constant Summary
Variable Summary
Method Summary
bool addToCart ( $cart, [bool $delete = false])
bool canHaveQty ()
bool compareOptions (array $options1, array $options2)
Varien_Object getBuyRequest ()
array getDataForSave ()
null|Varien_Object getFileDownloadParams ()
array getOptions ()
array getOptionsByCode ()
string getProductUrl ()
bool isRepresent (Mage_Catalog_Model_Product $product, Varien_Object $buyRequest)
Mage_Wishlist_Model_Item loadByProductWishlist (int $wishlistId, int $productId, array $sharedStores)
Mage_Wishlist_Model_Item loadWithOptions (int $id, [null|string|array $optionsFilter = null])
void save ()
Mage_Wishlist_Model_Item setBuyRequest (Varien_Object $buyRequest)
void setCustomDownloadUrl ( $url)
bool validate ()
bool _compareOptions (array $options1, array $options2)
void _construct ()
boolean _hasModelChanged ()
Variables
string $_customOptionDownloadUrl = 'wishlist/index/downloadCustomOption' (line 46)

Custom path to download attached file

  • access: protected
string $_eventObject = 'item' (line 62)

Parameter name in event

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

  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::$_eventObject
Parameter name in event
string $_eventPrefix = 'wishlist_item' (line 53)

Prefix of model events names

  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::$_eventPrefix
Prefix of model events names
mixed $_flagOptionsSaved = null (line 89)

Flag stating that options were successfully saved

  • access: protected
array $_notRepresentOptions = array('info_buyRequest') (line 83)

Not Represent options

  • access: protected
array $_options = array() (line 69)

Item options array

  • access: protected
array $_optionsByCode = array() (line 76)

Item options by code cache

  • access: protected

Inherited Variables

Inherited from Mage_Core_Model_Abstract

Mage_Core_Model_Abstract::$_cacheTag
Mage_Core_Model_Abstract::$_dataSaveAllowed
Mage_Core_Model_Abstract::$_isObjectNew
Mage_Core_Model_Abstract::$_resource
Mage_Core_Model_Abstract::$_resourceCollectionName
Mage_Core_Model_Abstract::$_resourceName
Methods
addOption (line 550)

Add option to item

  • access: public
addToCart (line 330)

Add or Move item product to shopping cart

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

  • throws: Mage_Core_Exception
  • access: public
bool addToCart ( $cart, [bool $delete = false])
canHaveQty (line 609)

Returns whether Qty field is valid for this item

  • access: public
bool canHaveQty ()
compareOptions (line 494)

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

  • access: public
bool compareOptions (array $options1, array $options2)
  • array $options1
  • array $options2
getBuyRequest (line 399)

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

  • access: public
Varien_Object getBuyRequest ()
getCustomDownloadUrl (line 618)

Get current custom option download url

  • access: public
void getCustomDownloadUrl ()
getDataForSave (line 261)

Retrieve wishlist item data as array

  • deprecated: since 1.4.0.0
  • access: public
array getDataForSave ()
getFileDownloadParams (line 639)

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

Needed to implement Mage_Catalog_Model_Product_Configuration_Item_Interface.

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

  • access: public
null|Varien_Object getFileDownloadParams ()
getOptionByCode (line 596)

Get item option by code

  • return: || null
  • access: public
Mage_Wishlist_Model_Item_Option getOptionByCode (string $code)
  • string $code
getOptions (line 529)

Get all item options

  • access: public
array getOptions ()
getOptionsByCode (line 539)

Get all item options as array with codes in array key

  • access: public
array getOptionsByCode ()
getProduct (line 296)

Retrieve item product instance

  • throws: Mage_Core_Exception
  • access: public
getProductUrl (line 381)

Retrieve Product View Page URL

If product has required options add special key to URL

  • access: public
string getProductUrl ()
isRepresent (line 430)

Check product representation in item

  • access: public
bool isRepresent (Mage_Catalog_Model_Product $product, Varien_Object $buyRequest)
loadByProductWishlist (line 281)

Load item by product, wishlist and shared stores

  • access: public
Mage_Wishlist_Model_Item loadByProductWishlist (int $wishlistId, int $productId, array $sharedStores)
  • int $wishlistId
  • int $productId
  • array $sharedStores
loadWithOptions (line 656)

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

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

  • access: public
Mage_Wishlist_Model_Item loadWithOptions (int $id, [null|string|array $optionsFilter = null])
  • int $id
  • null|string|array $optionsFilter
removeOption (line 581)

Remove option from item options

  • access: public
Mage_Wishlist_Model_Item removeOption (string $code)
  • string $code
representProduct (line 466)

Check product representation in item

  • access: public
bool representProduct (Mage_Catalog_Model_Product $product)
save (line 189)

Save model plus its options

Ensures saving options in case when resource model was not changed

  • access: public
void save ()

Redefinition of:
Mage_Core_Model_Abstract::save()
Save object data
setBuyRequest (line 414)

Set buy request - object, holding request received from

product view page with keys and options for configured product

  • access: public
Mage_Wishlist_Model_Item setBuyRequest (Varien_Object $buyRequest)
  • Varien_Object $buyRequest
setCustomDownloadUrl (line 626)

Sets custom option download url

  • access: public
void setCustomDownloadUrl ( $url)
  • $url
setOptions (line 516)

Initialize item options

  • access: public
Mage_Wishlist_Model_Item setOptions (array $options)
  • array $options
validate (line 218)

Validate wish list item data

  • throws: Mage_Core_Exception
  • access: public
bool validate ()
_addOptionCode (line 137)

Register option code

  • access: protected
_afterSave (line 206)

Save item options after item saved

  • access: protected
Mage_Wishlist_Model_Item _afterSave ()

Redefinition of:
Mage_Core_Model_Abstract::_afterSave()
Processing object after save data
_beforeSave (line 235)

Check required data

  • access: protected
Mage_Wishlist_Model_Item _beforeSave ()

Redefinition of:
Mage_Core_Model_Abstract::_beforeSave()
Processing object before save data
_compareOptions (line 117)

Check if two options array are identical

  • access: protected
bool _compareOptions (array $options1, array $options2)
  • array $options1
  • array $options2
_construct (line 95)

Initialize resource model

  • access: protected
void _construct ()
_getResource (line 105)

Retrieve resource instance wrapper

  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::_getResource()
Get resource instance
_hasModelChanged (line 154)

Checks that item model has data changes.

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

  • access: protected
boolean _hasModelChanged ()

Redefinition of:
Mage_Core_Model_Abstract::_hasModelChanged()
Check whether model has changed data.
_saveItemOptions (line 168)

Save item options

  • access: protected
Mage_Wishlist_Model_Item _saveItemOptions ()

Inherited Methods

Inherited From Mage_Core_Model_Abstract

Mage_Core_Model_Abstract::afterCommitCallback()
Mage_Core_Model_Abstract::afterLoad()
Mage_Core_Model_Abstract::cleanModelCache()
Mage_Core_Model_Abstract::clearInstance()
Mage_Core_Model_Abstract::delete()
Mage_Core_Model_Abstract::getCacheIdTags()
Mage_Core_Model_Abstract::getCacheTags()
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::isObjectNew()
Mage_Core_Model_Abstract::load()
Mage_Core_Model_Abstract::save()
Mage_Core_Model_Abstract::setId()
Mage_Core_Model_Abstract::_afterDelete()
Mage_Core_Model_Abstract::_afterDeleteCommit()
Mage_Core_Model_Abstract::_afterLoad()
Mage_Core_Model_Abstract::_afterSave()
Mage_Core_Model_Abstract::_afterSaveCommit()
Mage_Core_Model_Abstract::_beforeDelete()
Mage_Core_Model_Abstract::_beforeLoad()
Mage_Core_Model_Abstract::_beforeSave()
Mage_Core_Model_Abstract::_clearData()
Mage_Core_Model_Abstract::_clearReferences()
Mage_Core_Model_Abstract::_getEventData()
Mage_Core_Model_Abstract::_getResource()
Mage_Core_Model_Abstract::_hasModelChanged()
Mage_Core_Model_Abstract::_init()
Mage_Core_Model_Abstract::_protectFromNonAdmin()
Mage_Core_Model_Abstract::_setResourceModel()
Class Constants
EXCEPTION_CODE_HAS_REQUIRED_OPTIONS = 902 (line 39)
EXCEPTION_CODE_IS_GROUPED_PRODUCT = 903 (line 40)
EXCEPTION_CODE_NOT_SALABLE = 901 (line 38)

Documentation generated on Fri, 11 Feb 2011 17:07:13 +0200 by phpDocumentor 1.4.3