Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Item Class Reference
Inheritance diagram for Item:
AbstractExtensibleObject TotalsItemInterface AbstractSimpleObject CustomAttributesDataInterface ExtensibleDataInterface ExtensibleDataInterface

Public Member Functions

 setItemId ($id)
 
 getItemId ()
 
 getPrice ()
 
 setPrice ($price)
 
 getBasePrice ()
 
 setBasePrice ($basePrice)
 
 getQty ()
 
 setQty ($qty)
 
 getRowTotal ()
 
 setRowTotal ($rowTotal)
 
 getBaseRowTotal ()
 
 setBaseRowTotal ($baseRowTotal)
 
 getRowTotalWithDiscount ()
 
 setRowTotalWithDiscount ($rowTotalWithDiscount)
 
 getTaxAmount ()
 
 setTaxAmount ($taxAmount)
 
 getBaseTaxAmount ()
 
 setBaseTaxAmount ($baseTaxAmount)
 
 getTaxPercent ()
 
 setTaxPercent ($taxPercent)
 
 getDiscountAmount ()
 
 setDiscountAmount ($discountAmount)
 
 getBaseDiscountAmount ()
 
 setBaseDiscountAmount ($baseDiscountAmount)
 
 getDiscountPercent ()
 
 setDiscountPercent ($discountPercent)
 
 getPriceInclTax ()
 
 setPriceInclTax ($priceInclTax)
 
 getBasePriceInclTax ()
 
 setBasePriceInclTax ($basePriceInclTax)
 
 getRowTotalInclTax ()
 
 setRowTotalInclTax ($rowTotalInclTax)
 
 getBaseRowTotalInclTax ()
 
 setBaseRowTotalInclTax ($baseRowTotalInclTax)
 
 getOptions ()
 
 setOptions ($options)
 
 getWeeeTaxAppliedAmount ()
 
 setWeeeTaxAppliedAmount ($weeeTaxAppliedAmount)
 
 getWeeeTaxApplied ()
 
 setWeeeTaxApplied ($weeeTaxApplied)
 
 getName ()
 
 setName ($name)
 
 getExtensionAttributes ()
 
 setExtensionAttributes (\Magento\Quote\Api\Data\TotalsItemExtensionInterface $extensionAttributes)
 
- Public Member Functions inherited from AbstractExtensibleObject
 __construct (\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $attributeValueFactory, $data=[])
 
 getCustomAttribute ($attributeCode)
 
 getCustomAttributes ()
 
 setCustomAttributes (array $attributes)
 
- Public Member Functions inherited from AbstractSimpleObject
 __construct (array $data=[])
 
 setData ($key, $value)
 
 __toArray ()
 
- Public Member Functions inherited from CustomAttributesDataInterface
 setCustomAttribute ($attributeCode, $attributeValue)
 
- Public Member Functions inherited from TotalsItemInterface
 setExtensionAttributes (\Magento\Quote\Api\Data\TotalsItemExtensionInterface $extensionAttributes)
 

Additional Inherited Members

- Data Fields inherited from AbstractExtensibleObject
const CUSTOM_ATTRIBUTES_KEY = 'custom_attributes'
 
- Data Fields inherited from CustomAttributesDataInterface
const CUSTOM_ATTRIBUTES = 'custom_attributes'
 
- Data Fields inherited from ExtensibleDataInterface
const EXTENSION_ATTRIBUTES_KEY = 'extension_attributes'
 
- Data Fields inherited from TotalsItemInterface
const KEY_ITEM_ID = 'item_id'
 
const KEY_PRICE = 'price'
 
const KEY_BASE_PRICE = 'base_price'
 
const KEY_QTY = 'qty'
 
const KEY_ROW_TOTAL = 'row_total'
 
const KEY_BASE_ROW_TOTAL = 'base_row_total'
 
const KEY_ROW_TOTAL_WITH_DISCOUNT = 'row_total_with_discount'
 
const KEY_DISCOUNT_AMOUNT = 'discount_amount'
 
const KEY_BASE_DISCOUNT_AMOUNT = 'base_discount_amount'
 
const KEY_DISCOUNT_PERCENT = 'discount_percent'
 
const KEY_TAX_AMOUNT = 'tax_amount'
 
const KEY_BASE_TAX_AMOUNT = 'base_tax_amount'
 
const KEY_TAX_PERCENT = 'tax_percent'
 
const KEY_PRICE_INCL_TAX = 'price_incl_tax'
 
const KEY_BASE_PRICE_INCL_TAX = 'base_price_incl_tax'
 
const KEY_ROW_TOTAL_INCL_TAX = 'row_total_incl_tax'
 
const KEY_BASE_ROW_TOTAL_INCL_TAX = 'base_row_total_incl_tax'
 
const KEY_OPTIONS = 'options'
 
const KEY_WEEE_TAX_APPLIED_AMOUNT = 'weee_tax_applied_amount'
 
const KEY_WEEE_TAX_APPLIED = 'weee_tax_applied'
 
const KEY_NAME = 'name'
 
- Protected Member Functions inherited from AbstractExtensibleObject
 getCustomAttributesCodes ()
 
 _getExtensionAttributes ()
 
 _setExtensionAttributes (\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
 
- Protected Member Functions inherited from AbstractSimpleObject
 _get ($key)
 
- Protected Attributes inherited from AbstractExtensibleObject
 $extensionFactory
 
 $attributeValueFactory
 
 $customAttributesCodes
 
- Protected Attributes inherited from AbstractSimpleObject
 $_data
 

Detailed Description

Cart item totals.

@codeCoverageIgnore

Definition at line 16 of file Item.php.

Member Function Documentation

◆ getBaseDiscountAmount()

getBaseDiscountAmount ( )

Returns the discount amount in base currency.

Returns
float|null Discount amount in base currency. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 254 of file Item.php.

255  {
256  return $this->_get(self::KEY_BASE_DISCOUNT_AMOUNT);
257  }

◆ getBasePrice()

getBasePrice ( )

Returns the item price in base currency.

Returns
float Item price in base currency.

Implements TotalsItemInterface.

Definition at line 65 of file Item.php.

66  {
67  return $this->_get(self::KEY_BASE_PRICE);
68  }

◆ getBasePriceInclTax()

getBasePriceInclTax ( )

Returns the price including tax in base currency.

Returns
float|null Price including tax in base currency. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 317 of file Item.php.

318  {
319  return $this->_get(self::KEY_BASE_PRICE_INCL_TAX);
320  }

◆ getBaseRowTotal()

getBaseRowTotal ( )

Returns the row total in base currency.

Returns
float Row total in base currency.

Implements TotalsItemInterface.

Definition at line 128 of file Item.php.

129  {
130  return $this->_get(self::KEY_BASE_ROW_TOTAL);
131  }

◆ getBaseRowTotalInclTax()

getBaseRowTotalInclTax ( )

Returns the row total including tax in base currency.

Returns
float|null Row total including tax in base currency. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 359 of file Item.php.

360  {
361  return $this->_get(self::KEY_BASE_ROW_TOTAL_INCL_TAX);
362  }

◆ getBaseTaxAmount()

getBaseTaxAmount ( )

Returns the tax amount in base currency.

Returns
float|null Tax amount in base currency. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 191 of file Item.php.

192  {
193  return $this->_get(self::KEY_BASE_TAX_AMOUNT);
194  }

◆ getDiscountAmount()

getDiscountAmount ( )

Returns the discount amount in quote currency.

Returns
float|null Discount amount in quote currency. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 233 of file Item.php.

234  {
235  return $this->_get(self::KEY_DISCOUNT_AMOUNT);
236  }

◆ getDiscountPercent()

getDiscountPercent ( )

Returns the discount percent.

Returns
int|null Discount percent. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 275 of file Item.php.

276  {
277  return $this->_get(self::KEY_DISCOUNT_PERCENT);
278  }

◆ getExtensionAttributes()

getExtensionAttributes ( )

{Retrieve existing extension attributes object or create a new one.

Returns
\Magento\Quote\Api\Data\TotalsItemExtensionInterface|null
}

Returns
\Magento\Quote\Api\Data\TotalsItemExtensionInterface|null

Implements TotalsItemInterface.

Definition at line 459 of file Item.php.

◆ getItemId()

getItemId ( )

Get totals item id

Returns
int Item id

Implements TotalsItemInterface.

Definition at line 34 of file Item.php.

35  {
36  return $this->_get(self::KEY_ITEM_ID);
37  }

◆ getName()

getName ( )

{Returns the product name.

Returns
string|null Product name. Otherwise, null.
}

Implements TotalsItemInterface.

Definition at line 441 of file Item.php.

442  {
443  return $this->_get(self::KEY_NAME);
444  }

◆ getOptions()

getOptions ( )

Returns the item options data.

Returns
string[] Item price in quote currency.

Implements TotalsItemInterface.

Definition at line 380 of file Item.php.

381  {
382  return $this->_get(self::KEY_OPTIONS);
383  }

◆ getPrice()

getPrice ( )

Returns the item price in quote currency.

Returns
float Item price in quote currency.

Implements TotalsItemInterface.

Definition at line 44 of file Item.php.

45  {
46  return $this->_get(self::KEY_PRICE);
47  }

◆ getPriceInclTax()

getPriceInclTax ( )

Returns the price including tax in quote currency.

Returns
float|null Price including tax in quote currency. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 296 of file Item.php.

297  {
298  return $this->_get(self::KEY_PRICE_INCL_TAX);
299  }

◆ getQty()

getQty ( )

Returns the item quantity.

Returns
int Item quantity.

Implements TotalsItemInterface.

Definition at line 86 of file Item.php.

87  {
88  return $this->_get(self::KEY_QTY);
89  }

◆ getRowTotal()

getRowTotal ( )

Returns the row total in quote currency.

Returns
float Row total in quote currency.

Implements TotalsItemInterface.

Definition at line 107 of file Item.php.

108  {
109  return $this->_get(self::KEY_ROW_TOTAL);
110  }

◆ getRowTotalInclTax()

getRowTotalInclTax ( )

Returns the row total including tax in quote currency.

Returns
float|null Row total including tax in quote currency. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 338 of file Item.php.

339  {
340  return $this->_get(self::KEY_ROW_TOTAL_INCL_TAX);
341  }

◆ getRowTotalWithDiscount()

getRowTotalWithDiscount ( )

Returns the row total with discount in quote currency.

Returns
float|null Row total with discount in quote currency. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 149 of file Item.php.

150  {
151  return $this->_get(self::KEY_ROW_TOTAL_WITH_DISCOUNT);
152  }

◆ getTaxAmount()

getTaxAmount ( )

Returns the tax amount in quote currency.

Returns
float|null Tax amount in quote currency. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 170 of file Item.php.

171  {
172  return $this->_get(self::KEY_TAX_AMOUNT);
173  }

◆ getTaxPercent()

getTaxPercent ( )

Returns the tax percent.

Returns
int|null Tax percent. Otherwise, null.

Implements TotalsItemInterface.

Definition at line 212 of file Item.php.

213  {
214  return $this->_get(self::KEY_TAX_PERCENT);
215  }

◆ getWeeeTaxApplied()

getWeeeTaxApplied ( )

Returns the item weee tax applied in quote currency.

Returns
string[] Item weee tax applied in quote currency.

Implements TotalsItemInterface.

Definition at line 422 of file Item.php.

423  {
424  return $this->_get(self::KEY_WEEE_TAX_APPLIED);
425  }

◆ getWeeeTaxAppliedAmount()

getWeeeTaxAppliedAmount ( )

Returns the item weee tax applied amount in quote currency.

Returns
float Item weee tax applied amount in quote currency.

Implements TotalsItemInterface.

Definition at line 401 of file Item.php.

402  {
403  return $this->_get(self::KEY_WEEE_TAX_APPLIED_AMOUNT);
404  }

◆ setBaseDiscountAmount()

setBaseDiscountAmount (   $baseDiscountAmount)

Sets the discount amount in base currency.

Parameters
float$baseDiscountAmount
Returns
$this

Implements TotalsItemInterface.

Definition at line 265 of file Item.php.

266  {
267  return $this->setData(self::KEY_BASE_DISCOUNT_AMOUNT, $baseDiscountAmount);
268  }

◆ setBasePrice()

setBasePrice (   $basePrice)

Sets the item price in base currency.

Parameters
float$basePrice
Returns
$this

Implements TotalsItemInterface.

Definition at line 76 of file Item.php.

77  {
78  return $this->setData(self::KEY_BASE_PRICE, $basePrice);
79  }

◆ setBasePriceInclTax()

setBasePriceInclTax (   $basePriceInclTax)

Sets the price including tax in base currency.

Parameters
float$basePriceInclTax
Returns
$this

Implements TotalsItemInterface.

Definition at line 328 of file Item.php.

329  {
330  return $this->setData(self::KEY_BASE_PRICE_INCL_TAX, $basePriceInclTax);
331  }

◆ setBaseRowTotal()

setBaseRowTotal (   $baseRowTotal)

Sets the row total in base currency.

Parameters
float$baseRowTotal
Returns
$this

Implements TotalsItemInterface.

Definition at line 139 of file Item.php.

140  {
141  return $this->setData(self::KEY_BASE_ROW_TOTAL, $baseRowTotal);
142  }

◆ setBaseRowTotalInclTax()

setBaseRowTotalInclTax (   $baseRowTotalInclTax)

Sets the row total including tax in base currency.

Parameters
float$baseRowTotalInclTax
Returns
$this

Implements TotalsItemInterface.

Definition at line 370 of file Item.php.

371  {
372  return $this->setData(self::KEY_BASE_ROW_TOTAL_INCL_TAX, $baseRowTotalInclTax);
373  }

◆ setBaseTaxAmount()

setBaseTaxAmount (   $baseTaxAmount)

Sets the tax amount in base currency.

Parameters
float$baseTaxAmount
Returns
$this

Implements TotalsItemInterface.

Definition at line 202 of file Item.php.

203  {
204  return $this->setData(self::KEY_BASE_TAX_AMOUNT, $baseTaxAmount);
205  }

◆ setDiscountAmount()

setDiscountAmount (   $discountAmount)

Sets the discount amount in quote currency.

Parameters
float$discountAmount
Returns
$this

Implements TotalsItemInterface.

Definition at line 244 of file Item.php.

245  {
246  return $this->setData(self::KEY_DISCOUNT_AMOUNT, $discountAmount);
247  }

◆ setDiscountPercent()

setDiscountPercent (   $discountPercent)

Sets the discount percent.

Parameters
int$discountPercent
Returns
$this

Implements TotalsItemInterface.

Definition at line 286 of file Item.php.

287  {
288  return $this->setData(self::KEY_DISCOUNT_PERCENT, $discountPercent);
289  }

◆ setExtensionAttributes()

setExtensionAttributes ( \Magento\Quote\Api\Data\TotalsItemExtensionInterface  $extensionAttributes)

{}

Parameters
\Magento\Quote\Api\Data\TotalsItemExtensionInterface$extensionAttributes
Returns
$this

Definition at line 470 of file Item.php.

471  {
473  }
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)

◆ setItemId()

setItemId (   $id)

Set totals item id

Parameters
int$id
Returns
$this

Implements TotalsItemInterface.

Definition at line 24 of file Item.php.

25  {
26  return $this->setData(self::KEY_ITEM_ID, $id);
27  }
$id
Definition: fieldset.phtml:14

◆ setName()

setName (   $name)

{Sets the product name.

Parameters
string$name
Returns
$this
}

Implements TotalsItemInterface.

Definition at line 449 of file Item.php.

450  {
451  return $this->setData(self::KEY_NAME, $name);
452  }
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ setOptions()

setOptions (   $options)

Sets the item options data.

Parameters
string$options
Returns
$this

Implements TotalsItemInterface.

Definition at line 391 of file Item.php.

392  {
393  return $this->setData(self::KEY_OPTIONS, $options);
394  }

◆ setPrice()

setPrice (   $price)

Sets the item price in quote currency.

Parameters
float$price
Returns
$this

Implements TotalsItemInterface.

Definition at line 55 of file Item.php.

56  {
57  return $this->setData(self::KEY_PRICE, $price);
58  }
$price

◆ setPriceInclTax()

setPriceInclTax (   $priceInclTax)

Sets the price including tax in quote currency.

Parameters
float$priceInclTax
Returns
$this

Implements TotalsItemInterface.

Definition at line 307 of file Item.php.

308  {
309  return $this->setData(self::KEY_PRICE_INCL_TAX, $priceInclTax);
310  }

◆ setQty()

setQty (   $qty)

Sets the item quantity.

Parameters
int$qty
Returns
$this

Implements TotalsItemInterface.

Definition at line 97 of file Item.php.

98  {
99  return $this->setData(self::KEY_QTY, $qty);
100  }

◆ setRowTotal()

setRowTotal (   $rowTotal)

Sets the row total in quote currency.

Parameters
float$rowTotal
Returns
$this

Implements TotalsItemInterface.

Definition at line 118 of file Item.php.

119  {
120  return $this->setData(self::KEY_ROW_TOTAL, $rowTotal);
121  }

◆ setRowTotalInclTax()

setRowTotalInclTax (   $rowTotalInclTax)

Sets the row total including tax in quote currency.

Parameters
float$rowTotalInclTax
Returns
$this

Implements TotalsItemInterface.

Definition at line 349 of file Item.php.

350  {
351  return $this->setData(self::KEY_ROW_TOTAL_INCL_TAX, $rowTotalInclTax);
352  }

◆ setRowTotalWithDiscount()

setRowTotalWithDiscount (   $rowTotalWithDiscount)

Sets the row total with discount in quote currency.

Parameters
float$rowTotalWithDiscount
Returns
$this

Implements TotalsItemInterface.

Definition at line 160 of file Item.php.

161  {
162  return $this->setData(self::KEY_ROW_TOTAL_WITH_DISCOUNT, $rowTotalWithDiscount);
163  }

◆ setTaxAmount()

setTaxAmount (   $taxAmount)

Sets the tax amount in quote currency.

Parameters
float$taxAmount
Returns
$this

Implements TotalsItemInterface.

Definition at line 181 of file Item.php.

182  {
183  return $this->setData(self::KEY_TAX_AMOUNT, $taxAmount);
184  }

◆ setTaxPercent()

setTaxPercent (   $taxPercent)

Sets the tax percent.

Parameters
int$taxPercent
Returns
$this

Implements TotalsItemInterface.

Definition at line 223 of file Item.php.

224  {
225  return $this->setData(self::KEY_TAX_PERCENT, $taxPercent);
226  }

◆ setWeeeTaxApplied()

setWeeeTaxApplied (   $weeeTaxApplied)

Sets the item weee tax applied in quote currency.

Parameters
string$weeeTaxApplied
Returns
$this

Implements TotalsItemInterface.

Definition at line 433 of file Item.php.

434  {
435  return $this->setData(self::KEY_WEEE_TAX_APPLIED, $weeeTaxApplied);
436  }

◆ setWeeeTaxAppliedAmount()

setWeeeTaxAppliedAmount (   $weeeTaxAppliedAmount)

Sets the item weee tax applied amount in quote currency.

Parameters
float$weeeTaxAppliedAmount
Returns
$this

Implements TotalsItemInterface.

Definition at line 412 of file Item.php.

413  {
414  return $this->setData(self::KEY_WEEE_TAX_APPLIED_AMOUNT, $weeeTaxAppliedAmount);
415  }

The documentation for this class was generated from the following file: