Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Protected Member Functions | |
_construct () | |
_prepareQty ($qty) | |
_addOptionCode ($option) | |
_hasModelChanged () | |
_setHasError ($flag) | |
_clearErrorInfo () | |
![]() | |
filterCustomAttributes ($data) | |
initializeCustomAttributes () | |
convertCustomAttributeValues (array &$customAttributes) | |
getCustomAttributesCodes () | |
_setExtensionAttributes (\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes) | |
_getExtensionAttributes () | |
![]() | |
_construct () | |
_init ($resourceModel) | |
_setResourceModel ($resourceName, $collectionName=null) | |
_getResource () | |
_getEventData () | |
_beforeLoad ($modelId, $field=null) | |
_afterLoad () | |
_hasModelChanged () | |
_getValidatorBeforeSave () | |
_createValidatorBeforeSave () | |
_getValidationRulesBeforeSave () | |
_clearReferences () | |
_clearData () | |
![]() | |
_getData ($key) | |
_underscore ($name) | |
Additional Inherited Members | |
![]() | |
const | CUSTOM_ATTRIBUTES = 'custom_attributes' |
![]() | |
const | EXTENSION_ATTRIBUTES_KEY = 'extension_attributes' |
![]() | |
const | KEY_ITEM_ID = 'item_id' |
const | KEY_SKU = 'sku' |
const | KEY_QTY = 'qty' |
const | KEY_NAME = 'name' |
const | KEY_PRICE = 'price' |
const | KEY_PRODUCT_TYPE = 'product_type' |
const | KEY_QUOTE_ID = 'quote_id' |
const | KEY_PRODUCT_OPTION = 'product_option' |
![]() | |
static | $_underscoreCache = [] |
@api @method string getCreatedAt() @method \Magento\Quote\Model\Quote\Item setCreatedAt(string $value) @method string getUpdatedAt() @method \Magento\Quote\Model\Quote\Item setUpdatedAt(string $value) @method int getStoreId() @method \Magento\Quote\Model\Quote\Item setStoreId(int $value) @method int getParentItemId() @method \Magento\Quote\Model\Quote\Item setParentItemId(int $value) @method int getIsVirtual() @method \Magento\Quote\Model\Quote\Item setIsVirtual(int $value) @method string getDescription() @method \Magento\Quote\Model\Quote\Item setDescription(string $value) @method string getAdditionalData() @method \Magento\Quote\Model\Quote\Item setAdditionalData(string $value) @method int getFreeShipping() @method \Magento\Quote\Model\Quote\Item setFreeShipping(int $value) @method int getIsQtyDecimal() @method \Magento\Quote\Model\Quote\Item setIsQtyDecimal(int $value) @method int getNoDiscount() @method \Magento\Quote\Model\Quote\Item setNoDiscount(int $value) @method float getWeight() @method \Magento\Quote\Model\Quote\Item setWeight(float $value) @method float getBasePrice() @method \Magento\Quote\Model\Quote\Item setBasePrice(float $value) @method float getCustomPrice() @method float getTaxPercent() @method \Magento\Quote\Model\Quote\Item setTaxPercent(float $value) @method \Magento\Quote\Model\Quote\Item setTaxAmount(float $value) @method \Magento\Quote\Model\Quote\Item setBaseTaxAmount(float $value) @method \Magento\Quote\Model\Quote\Item setRowTotal(float $value) @method \Magento\Quote\Model\Quote\Item setBaseRowTotal(float $value) @method float getRowTotalWithDiscount() @method \Magento\Quote\Model\Quote\Item setRowTotalWithDiscount(float $value) @method float getRowWeight() @method \Magento\Quote\Model\Quote\Item setRowWeight(float $value) @method float getBaseTaxBeforeDiscount() @method \Magento\Quote\Model\Quote\Item setBaseTaxBeforeDiscount(float $value) @method float getTaxBeforeDiscount() @method \Magento\Quote\Model\Quote\Item setTaxBeforeDiscount(float $value) @method float getOriginalCustomPrice() @method \Magento\Quote\Model\Quote\Item setOriginalCustomPrice(float $value) @method string getRedirectUrl() @method \Magento\Quote\Model\Quote\Item setRedirectUrl(string $value) @method float getBaseCost() @method \Magento\Quote\Model\Quote\Item setBaseCost(float $value) @method \Magento\Quote\Model\Quote\Item setPriceInclTax(float $value) @method float getBasePriceInclTax() @method \Magento\Quote\Model\Quote\Item setBasePriceInclTax(float $value) @method \Magento\Quote\Model\Quote\Item setRowTotalInclTax(float $value) @method float getBaseRowTotalInclTax() @method \Magento\Quote\Model\Quote\Item setBaseRowTotalInclTax(float $value) @method int getGiftMessageId() @method \Magento\Quote\Model\Quote\Item setGiftMessageId(int $value) @method string getWeeeTaxApplied() @method \Magento\Quote\Model\Quote\Item setWeeeTaxApplied(string $value) @method float getWeeeTaxAppliedAmount() @method \Magento\Quote\Model\Quote\Item setWeeeTaxAppliedAmount(float $value) @method float getWeeeTaxAppliedRowAmount() @method \Magento\Quote\Model\Quote\Item setWeeeTaxAppliedRowAmount(float $value) @method float getBaseWeeeTaxAppliedAmount() @method \Magento\Quote\Model\Quote\Item setBaseWeeeTaxAppliedAmount(float $value) @method float getBaseWeeeTaxAppliedRowAmnt() @method \Magento\Quote\Model\Quote\Item setBaseWeeeTaxAppliedRowAmnt(float $value) @method float getWeeeTaxDisposition() @method \Magento\Quote\Model\Quote\Item setWeeeTaxDisposition(float $value) @method float getWeeeTaxRowDisposition() @method \Magento\Quote\Model\Quote\Item setWeeeTaxRowDisposition(float $value) @method float getBaseWeeeTaxDisposition() @method \Magento\Quote\Model\Quote\Item setBaseWeeeTaxDisposition(float $value) @method float getBaseWeeeTaxRowDisposition() @method \Magento\Quote\Model\Quote\Item setBaseWeeeTaxRowDisposition(float $value) @method float getDiscountTaxCompensationAmount() @method \Magento\Quote\Model\Quote\Item setDiscountTaxCompensationAmount(float $value) @method float getBaseDiscountTaxCompensationAmount() @method \Magento\Quote\Model\Quote\Item setBaseDiscountTaxCompensationAmount(float $value) @method null|bool getHasConfigurationUnavailableError() @method \Magento\Quote\Model\Quote\Item setHasConfigurationUnavailableError(bool $value) @method \Magento\Quote\Model\Quote\Item unsHasConfigurationUnavailableError() @SuppressWarnings(PHPMD.CouplingBetweenObjects) @SuppressWarnings(PHPMD.ExcessivePublicCount) @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
__construct | ( | \Magento\Framework\Model\Context | $context, |
\Magento\Framework\Registry | $registry, | ||
ExtensionAttributesFactory | $extensionFactory, | ||
AttributeValueFactory | $customAttributeFactory, | ||
\Magento\Catalog\Api\ProductRepositoryInterface | $productRepository, | ||
\Magento\Framework\Pricing\PriceCurrencyInterface | $priceCurrency, | ||
\Magento\Sales\Model\Status\ListFactory | $statusListFactory, | ||
\Magento\Framework\Locale\FormatInterface | $localeFormat, | ||
\Magento\Quote\Model\Quote\Item\OptionFactory | $itemOptionFactory, | ||
\Magento\Quote\Model\Quote\Item\Compare | $quoteItemCompare, | ||
\Magento\CatalogInventory\Api\StockRegistryInterface | $stockRegistry, | ||
\Magento\Framework\Model\ResourceModel\AbstractResource | $resource = null , |
||
\Magento\Framework\Data\Collection\AbstractDb | $resourceCollection = null , |
||
array | $data = [] , |
||
\Magento\Framework\Serialize\Serializer\Json | $serializer = null |
||
) |
\Magento\Framework\Model\Context | $context | |
\Magento\Framework\Registry | $registry | |
ExtensionAttributesFactory | $extensionFactory | |
AttributeValueFactory | $customAttributeFactory | |
\Magento\Catalog\Api\ProductRepositoryInterface | $productRepository | |
\Magento\Framework\Pricing\PriceCurrencyInterface | $priceCurrency | |
\Magento\Sales\Model\Status\ListFactory | $statusListFactory | |
\Magento\Framework\Locale\FormatInterface | $localeFormat | |
Item\OptionFactory | $itemOptionFactory | |
Item\Compare | $quoteItemCompare | |
\Magento\CatalogInventory\Api\StockRegistryInterface | $stockRegistry | |
\Magento\Framework\Model\ResourceModel\AbstractResource | $resource | |
\Magento\Framework\Data\Collection\AbstractDb | $resourceCollection | |
array | $data | |
\Magento\Framework\Serialize\Serializer\Json | $serializer | @SuppressWarnings(PHPMD.ExcessiveParameterList) |
Definition at line 204 of file Item.php.
|
protected |
|
protected |
|
protected |
|
protected |
Checks that item model has data changes. Call save item options if model isn't need to save in DB
Definition at line 726 of file Item.php.
|
protected |
|
protected |
Sets flag, whether this quote item has some error associated with it.
bool | $flag |
Definition at line 839 of file Item.php.
addErrorInfo | ( | $origin = null , |
|
$code = null , |
|||
$message = null , |
|||
$additionalData = null |
|||
) |
Adds error information to the quote item. Automatically sets error flag.
string | null | $origin | Usually a name of module, that embeds error |
int | null | $code | Error code, unique for origin, that sets it |
string | null | $message | Error message |
\Magento\Framework\DataObject | null | $additionalData | Any additional data, that caller would like to store |
Definition at line 887 of file Item.php.
addOption | ( | $option | ) |
addQty | ( | $qty | ) |
Adding quantity to quote item
float | $qty |
We can't modify quantity of existing items which have parent This qty declared just once during add process and is not editable
Definition at line 327 of file Item.php.
afterSave | ( | ) |
beforeSave | ( | ) |
compare | ( | $item | ) |
compareOptions | ( | $options1, | |
$options2 | |||
) |
getAddress | ( | ) |
getBuyRequest | ( | ) |
Returns formatted buy request - object, holding request received from product view page with keys and options for configured product
Definition at line 821 of file Item.php.
getErrorInfos | ( | ) |
getExtensionAttributes | ( | ) |
{Retrieve existing extension attributes object or create a new one.
Implements CartItemInterface.
Definition at line 1058 of file Item.php.
getItemId | ( | ) |
@codeCoverageIgnoreStart
{#- Returns the item ID.
Implements CartItemInterface.
Definition at line 937 of file Item.php.
getName | ( | ) |
{Returns the product name.
Implements CartItemInterface.
Definition at line 977 of file Item.php.
getOptionByCode | ( | $code | ) |
Get item option by code
string | $code |
Implements ItemInterface.
Definition at line 712 of file Item.php.
getOptions | ( | ) |
getOptionsByCode | ( | ) |
getPrice | ( | ) |
{Returns the product price.
Implements CartItemInterface.
Definition at line 993 of file Item.php.
getProductOption | ( | ) |
Returns product option
Implements CartItemInterface.
Definition at line 1035 of file Item.php.
getProductType | ( | ) |
Get item product type
Implements CartItemInterface.
Definition at line 524 of file Item.php.
getQty | ( | ) |
{Returns the product quantity.
Implements CartItemInterface.
Definition at line 969 of file Item.php.
getQuote | ( | ) |
getQuoteId | ( | ) |
{Returns Quote id.
Implements CartItemInterface.
Definition at line 1017 of file Item.php.
getRealProductType | ( | ) |
getSku | ( | ) |
{Returns the product SKU.
Implements CartItemInterface.
Definition at line 953 of file Item.php.
isOptionsSaved | ( | ) |
removeErrorInfosByParams | ( | $params | ) |
Removes error infos, that have parameters equal to passed in $params. $params can have following keys (if not set - then any item is good for this key): 'origin', 'code', 'message'
array | $params |
Definition at line 916 of file Item.php.
removeOption | ( | $code | ) |
representProduct | ( | $product | ) |
Check product representation in item
\Magento\Catalog\Model\Product | $product |
Check maybe product is planned to be a child of some quote item - in this case we limit search only within same parent item
Definition at line 454 of file Item.php.
setExtensionAttributes | ( | \Magento\Quote\Api\Data\CartItemExtensionInterface | $extensionAttributes | ) |
{}
\Magento\Quote\Api\Data\CartItemExtensionInterface | $extensionAttributes |
Definition at line 1069 of file Item.php.
setHasError | ( | $flag | ) |
Sets flag, whether this quote item has some error associated with it. When TRUE - also adds 'unknown' error information to list of quote item errors. When FALSE - clears whole list of quote item errors. It's recommended to use addErrorInfo() instead - to be able to remove error statuses later.
bool | $flag |
Definition at line 854 of file Item.php.
setIsOptionsSaved | ( | $flag | ) |
setItemId | ( | $itemID | ) |
{Sets the item ID.
int | $itemId |
Implements CartItemInterface.
Definition at line 945 of file Item.php.
setName | ( | $name | ) |
{Sets the product name.
string | $name |
Implements CartItemInterface.
Definition at line 985 of file Item.php.
setOptions | ( | $options | ) |
setPrice | ( | $price | ) |
{Sets the product price.
float | $price |
Implements CartItemInterface.
Definition at line 1001 of file Item.php.
setProduct | ( | $product | ) |
Setup product for quote item
\Magento\Catalog\Model\Product | $product |
Definition at line 422 of file Item.php.
setProductOption | ( | \Magento\Quote\Api\Data\ProductOptionInterface | $productOption | ) |
Sets product option
\Magento\Quote\Api\Data\ProductOptionInterface | $productOption |
Definition at line 1046 of file Item.php.
setProductType | ( | $productType | ) |
{Sets the product type.
string | $productType |
Implements CartItemInterface.
Definition at line 1009 of file Item.php.
setQty | ( | $qty | ) |
Declare quote item quantity
float | $qty |
Implements CartItemInterface.
Definition at line 347 of file Item.php.
setQtyOptions | ( | $qtyOptions | ) |
Set option product with Qty
@codeCoverageIgnore
array | $qtyOptions |
Definition at line 411 of file Item.php.
setQuote | ( | \Magento\Quote\Model\Quote | $quote | ) |
setQuoteId | ( | $quoteId | ) |
{Sets Quote id.
string | $quoteId |
Implements CartItemInterface.
Definition at line 1025 of file Item.php.
setSku | ( | $sku | ) |
{Sets the product SKU.
string | $sku |
Implements CartItemInterface.
Definition at line 961 of file Item.php.
toArray | ( | array | $arrAttributes = [] | ) |
updateQtyOption | ( | \Magento\Framework\DataObject | $option, |
$value | |||
) |
Can specify specific actions for ability to change given quote options values Example: cataloginventory decimal qty validation may change qty to int, so need to change quote item qty option value.
\Magento\Framework\DataObject | $option | |
int | float | null | $value |
Definition at line 653 of file Item.php.
|
protected |