|
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
| __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Catalog\Helper\Product $catalogProduct, \Magento\Wishlist\Helper\Data $wishlistData, ResourceWishlist $resource, Collection $resourceCollection, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Stdlib\DateTime\DateTime $date, ItemFactory $wishlistItemFactory, CollectionFactory $wishlistCollectionFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Framework\Math\Random $mathRandom, \Magento\Framework\Stdlib\DateTime $dateTime, ProductRepositoryInterface $productRepository, $useCurrentWebsite=true, array $data=[], Json $serializer=null) | |
| loadByCustomerId ($customerId, $create=false) | |
| getName () | |
| generateSharingCode () | |
| loadByCode ($code) | |
| beforeSave () | |
| afterSave () | |
| getItemCollection () | |
| getItem ($itemId) | |
| addItem (Item $item) | |
| addNewItem ($product, $buyRequest=null, $forciblySetQty=false) | |
| setCustomerId ($customerId) | |
| getCustomerId () | |
| getDataForSave () | |
| getSharedStoreIds () | |
| setSharedStoreIds ($storeIds) | |
| getStore () | |
| setStore ($store) | |
| getItemsCount () | |
| isSalable () | |
| isOwner ($customerId) | |
| updateItem ($itemId, $buyRequest, $params=null) | |
| getIdentities () | |
Public Member Functions inherited from AbstractModel | |
| __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[]) | |
| __sleep () | |
| __wakeup () | |
| setIdFieldName ($name) | |
| getIdFieldName () | |
| getId () | |
| setId ($value) | |
| isDeleted ($isDeleted=null) | |
| hasDataChanges () | |
| setData ($key, $value=null) | |
| unsetData ($key=null) | |
| setDataChanges ($value) | |
| getOrigData ($key=null) | |
| setOrigData ($key=null, $data=null) | |
| dataHasChangedFor ($field) | |
| getResourceName () | |
| getResourceCollection () | |
| getCollection () | |
| load ($modelId, $field=null) | |
| beforeLoad ($identifier, $field=null) | |
| afterLoad () | |
| isSaveAllowed () | |
| setHasDataChanges ($flag) | |
| save () | |
| afterCommitCallback () | |
| isObjectNew ($flag=null) | |
| beforeSave () | |
| validateBeforeSave () | |
| getCacheTags () | |
| cleanModelCache () | |
| afterSave () | |
| delete () | |
| beforeDelete () | |
| afterDelete () | |
| afterDeleteCommit () | |
| getResource () | |
| getEntityId () | |
| setEntityId ($entityId) | |
| clearInstance () | |
| getStoredData () | |
| getEventPrefix () | |
Public Member Functions inherited from DataObject | |
| __construct (array $data=[]) | |
| addData (array $arr) | |
| setData ($key, $value=null) | |
| unsetData ($key=null) | |
| getData ($key='', $index=null) | |
| getDataByPath ($path) | |
| getDataByKey ($key) | |
| setDataUsingMethod ($key, $args=[]) | |
| getDataUsingMethod ($key, $args=null) | |
| hasData ($key='') | |
| toArray (array $keys=[]) | |
| convertToArray (array $keys=[]) | |
| toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true) | |
| convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true) | |
| toJson (array $keys=[]) | |
| convertToJson (array $keys=[]) | |
| toString ($format='') | |
| __call ($method, $args) | |
| isEmpty () | |
| serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"') | |
| debug ($data=null, &$objects=[]) | |
| offsetSet ($offset, $value) | |
| offsetExists ($offset) | |
| offsetUnset ($offset) | |
| offsetGet ($offset) | |
Data Fields | |
| const | CACHE_TAG = 'wishlist' |
Protected Member Functions | |
| _getSharingRandomCode () | |
| _addCatalogProduct (\Magento\Catalog\Model\Product $product, $qty=1, $forciblySetQty=false) | |
Protected Member Functions inherited from AbstractModel | |
| _construct () | |
| _init ($resourceModel) | |
| _setResourceModel ($resourceName, $collectionName=null) | |
| _getResource () | |
| _getEventData () | |
| _beforeLoad ($modelId, $field=null) | |
| _afterLoad () | |
| _hasModelChanged () | |
| _getValidatorBeforeSave () | |
| _createValidatorBeforeSave () | |
| _getValidationRulesBeforeSave () | |
| _clearReferences () | |
| _clearData () | |
Protected Member Functions inherited from DataObject | |
| _getData ($key) | |
| _underscore ($name) | |
Protected Attributes | |
| $_eventPrefix = 'wishlist' | |
| $_itemCollection | |
| $_store | |
| $_storeIds | |
| $_wishlistData | |
| $_catalogProduct | |
| $_storeManager | |
| $_date | |
| $_wishlistItemFactory | |
| $_wishlistCollectionFactory | |
| $_productFactory | |
| $mathRandom | |
| $dateTime | |
| $_useCurrentWebsite | |
| $productRepository | |
Protected Attributes inherited from AbstractModel | |
| $_eventPrefix = 'core_abstract' | |
| $_eventObject = 'object' | |
| $_idFieldName = 'id' | |
| $_hasDataChanges = false | |
| $_origData | |
| $_isDeleted = false | |
| $_resource | |
| $_resourceCollection | |
| $_resourceName | |
| $_collectionName | |
| $_cacheTag = false | |
| $_dataSaveAllowed = true | |
| $_isObjectNew = null | |
| $_validatorBeforeSave = null | |
| $_eventManager | |
| $_cacheManager | |
| $_registry | |
| $_logger | |
| $_appState | |
| $_actionValidator | |
| $storedData = [] | |
Protected Attributes inherited from DataObject | |
| $_data = [] | |
Additional Inherited Members | |
Static Protected Attributes inherited from DataObject | |
| static | $_underscoreCache = [] |
Wishlist model
@method int getShared() @method \Magento\Wishlist\Model\Wishlist setShared(int $value) @method string getSharingCode() @method \Magento\Wishlist\Model\Wishlist setSharingCode(string $value) @method string getUpdatedAt() @method \Magento\Wishlist\Model\Wishlist setUpdatedAt(string $value) @SuppressWarnings(PHPMD.CouplingBetweenObjects) @SuppressWarnings(PHPMD.TooManyFields)
@api
Definition at line 33 of file Wishlist.php.
| __construct | ( | \Magento\Framework\Model\Context | $context, |
| \Magento\Framework\Registry | $registry, | ||
| \Magento\Catalog\Helper\Product | $catalogProduct, | ||
| \Magento\Wishlist\Helper\Data | $wishlistData, | ||
| ResourceWishlist | $resource, | ||
| Collection | $resourceCollection, | ||
| \Magento\Store\Model\StoreManagerInterface | $storeManager, | ||
| \Magento\Framework\Stdlib\DateTime\DateTime | $date, | ||
| ItemFactory | $wishlistItemFactory, | ||
| CollectionFactory | $wishlistCollectionFactory, | ||
| \Magento\Catalog\Model\ProductFactory | $productFactory, | ||
| \Magento\Framework\Math\Random | $mathRandom, | ||
| \Magento\Framework\Stdlib\DateTime | $dateTime, | ||
| ProductRepositoryInterface | $productRepository, | ||
$useCurrentWebsite = true, |
|||
| array | $data = [], |
||
| Json | $serializer = null |
||
| ) |
Constructor
| \Magento\Framework\Model\Context | $context | |
| \Magento\Framework\Registry | $registry | |
| \Magento\Catalog\Helper\Product | $catalogProduct | |
| \Magento\Wishlist\Helper\Data | $wishlistData | |
| ResourceWishlist | $resource | |
| Collection | $resourceCollection | |
| \Magento\Store\Model\StoreManagerInterface | $storeManager | |
| \Magento\Framework\Stdlib\DateTime\DateTime | $date | |
| ItemFactory | $wishlistItemFactory | |
| CollectionFactory | $wishlistCollectionFactory | |
| \Magento\Catalog\Model\ProductFactory | $productFactory | |
| \Magento\Framework\Math\Random | $mathRandom | |
| \Magento\Framework\Stdlib\DateTime | $dateTime | |
| ProductRepositoryInterface | $productRepository | |
| bool | $useCurrentWebsite | |
| array | $data | |
| Json | null | $serializer | @SuppressWarnings(PHPMD.ExcessiveParameterList) |
Definition at line 154 of file Wishlist.php.
|
protected |
Add catalog product object data to wishlist
| \Magento\Catalog\Model\Product | $product | |
| int | $qty | |
| bool | $forciblySetQty |
Definition at line 299 of file Wishlist.php.
|
protected |
| addItem | ( | Item | $item | ) |
Adding item to wishlist
| Item | $item |
Definition at line 371 of file Wishlist.php.
| addNewItem | ( | $product, | |
$buyRequest = null, |
|||
$forciblySetQty = false |
|||
| ) |
Adds new product to wishlist.
Returns new item or string on error.
| int | \Magento\Catalog\Model\Product | $product | |
| \Magento\Framework\DataObject | array | string | null | $buyRequest | |
| bool | $forciblySetQty |
Error message
If prepare process return one object
Definition at line 394 of file Wishlist.php.
| afterSave | ( | ) |
| beforeSave | ( | ) |
| generateSharingCode | ( | ) |
Set random sharing code
Definition at line 231 of file Wishlist.php.
| getCustomerId | ( | ) |
| getDataForSave | ( | ) |
| getIdentities | ( | ) |
Return unique ID(s) for each object in system
Implements IdentityInterface.
Definition at line 704 of file Wishlist.php.
| getItem | ( | $itemId | ) |
Retrieve wishlist item collection
| int | $itemId |
Definition at line 357 of file Wishlist.php.
| getItemCollection | ( | ) |
Retrieve wishlist item collection
Definition at line 338 of file Wishlist.php.
| getItemsCount | ( | ) |
| getName | ( | ) |
| getSharedStoreIds | ( | ) |
Retrieve shared store ids for current website or all stores if $current is false
Definition at line 524 of file Wishlist.php.
| getStore | ( | ) |
Retrieve wishlist store object
Definition at line 558 of file Wishlist.php.
| isOwner | ( | $customerId | ) |
Check customer is owner this wishlist
| int | $customerId |
Definition at line 609 of file Wishlist.php.
| isSalable | ( | ) |
| loadByCode | ( | $code | ) |
Load by sharing code
| string | $code |
Definition at line 243 of file Wishlist.php.
| loadByCustomerId | ( | $customerId, | |
$create = false |
|||
| ) |
Load wishlist by customer id
| int | $customerId | |
| bool | $create | Create wishlist if don't exists |
Definition at line 195 of file Wishlist.php.
| setCustomerId | ( | $customerId | ) |
Set customer id
| int | $customerId |
Definition at line 490 of file Wishlist.php.
| setSharedStoreIds | ( | $storeIds | ) |
Set shared store ids
| array | $storeIds |
Definition at line 547 of file Wishlist.php.
| setStore | ( | $store | ) |
Set wishlist store
| \Magento\Store\Model\Store | $store |
Definition at line 572 of file Wishlist.php.
| updateItem | ( | $itemId, | |
| $buyRequest, | |||
$params = null |
|||
| ) |
Update wishlist Item and set data from request
The $params sets how current item configuration must be taken into account and additional options. It's passed to \Magento\Catalog\Helper\Product->addParamsToBuyRequest() to compose resulting buyRequest.
Basically it can hold
For more options see \Magento\Catalog\Helper\Product->addParamsToBuyRequest()
| int | Item | $itemId | |
| \Magento\Framework\DataObject | $buyRequest | |
| null | array | \Magento\Framework\DataObject | $params |
Error message
Definition at line 638 of file Wishlist.php.
|
protected |
Definition at line 80 of file Wishlist.php.
|
protected |
Definition at line 90 of file Wishlist.php.
|
protected |
Definition at line 45 of file Wishlist.php.
|
protected |
Definition at line 52 of file Wishlist.php.
|
protected |
Definition at line 105 of file Wishlist.php.
|
protected |
Definition at line 59 of file Wishlist.php.
|
protected |
Definition at line 66 of file Wishlist.php.
|
protected |
Definition at line 85 of file Wishlist.php.
|
protected |
Definition at line 120 of file Wishlist.php.
|
protected |
Definition at line 100 of file Wishlist.php.
|
protected |
Definition at line 73 of file Wishlist.php.
|
protected |
Definition at line 95 of file Wishlist.php.
|
protected |
Definition at line 115 of file Wishlist.php.
|
protected |
Definition at line 110 of file Wishlist.php.
|
protected |
Definition at line 125 of file Wishlist.php.
| const CACHE_TAG = 'wishlist' |
Cache tag
Definition at line 38 of file Wishlist.php.