class OrderItem implements OrderItemInterface, PrimaryKeyInterface, Serializable

Class OrderItem

Properties

protected int $id
protected Order $order
protected Product $product Added product
protected string $state State of order item. One of the predefined(COMPLETE, STATE_PARTIAL or STATE_UNCOMPLETE)
protected int $quantity Number of products
protected int $numInStock
protected int $quantityObtained Number of products obtained.
protected float $unitPrice Price of single product
protected ArrayCollection $adjustments Collection of adjustments used for combination of user and this product
protected float $adjustmentsTotal Total adjustment, represented in percentage
protected float $fixedAdjustmentsTotal Fixed total adjustment, represented in default currency
protected float $taxValue Tax value, represented in percentage
protected float $vatValue Tax value, already calculated in price
protected int $total Total cost of all products in order item including adjustments, represented in default currency
protected ArrayCollection $productAttValues Collection of product attribute values
protected string $productSku Sku of product. In case that product is deleted we can track which product was in order
protected string $productName Name of product. In case that product is deleted we can track which product was in order

Methods

float|int
getCalculatedBaseItemPrice()

No description

float|int
getPriceWithAdjustment(null $type = null, bool|false $useQty = false)

No description

float|int
calculateOnlyAdjustmentsForType(string $type, bool $useQty = false)

No description

string
getState()

No description

setState(string $state)

No description

int
getNumInStock()

No description

setNumInStock(int $numInStock)

No description

float|int
getPriceWithAdjustmentAndTax(null $type = null, bool|false $useQty = false)

No description

float
getAdjustmentTotalPrice(bool $useQty = false)

No description

float
getFullAdjustmentTotalPrice()

No description

array
getPriceWithAdjustmentForEachType(bool $useQty = false)

No description

array
float|int
getFullPriceWithAdjustment(string|null $type = null)

No description

float
getUnitPriceWithQuantity()

No description

setTaxValue()

No description

__construct()

No description

setId(int $id)

No description

integer
getId()

Get id

int
getQuantity()

Get item quantity.

setQuantity(int $quantity)

Set quantity.

incrementQuantity(int $quantity = 1)

No description

decrementQuantity(int $quantity = 1)

No description

getOrder()

Return the order.

setOrder(OrderInterface $order = null)

Set the order.

int
getUnitPrice()

Get unit price of item.

setUnitPrice(int $unitPrice)

Define the unit price of item.

getActiveAdjustments()

{@inheritdoc}

Collection|AdjustmentInterface[]
getAdjustments(null|string $type = null)

No description

addAdjustment(AdjustmentInterface $adjustment)

Add adjustment.

removeAdjustment(AdjustmentInterface $adjustment)

Remove adjustment.

hasAdjustment(AdjustmentInterface $adjustment)

{@inheritdoc}

integer
getAdjustmentsTotal(null|string $type = null)

Get adjustments total.

removeAdjustments(string $type)

Remove adjustment.

clearAdjustments()

Clears all adjustments.

float|int|mixed
getTaxValue()

No description

setAdjustmentsTotal(float $adjustmentsTotal)

No description

calculateAdjustmentsTotal()

Calculate adjustments total.

setFixedAdjustmentsTotal(float $fixedAdjustmentsTotal)

No description

float
getFixedAdjustmentsTotal()

No description

int
getTotal()

Get item total.

setTotal(int $total)

Set item total.

calculateTotal()

Calculate total based on quantity and unit price.

bool
equals(OrderItemInterface $orderItem)

Checks whether the item given as argument corresponds to the same cart item. Can be overwritten to enable merge quantities.

merge(OrderItemInterface $orderItem, bool $throwOnInvalid = true, float $qty)

Merge the item given as argument corresponding to the same cart item.

getProduct()

Get item product.

setProduct(Product $product)

Set product.

Collection
getProductAttValues()

No description

setProductAttValues(mixed $productAttValues)

No description

addProductAttValue(ProductAttributeValues $productAttValue)

No description

removeProductAttValue(ProductAttributeValues $productAttValue)

No description

string
getProductSku()

No description

setProductSku(string $productSku)

No description

string
getProductName()

No description

setProductName(string $productName)

No description

int
getQuantityObtained()

No description

setQuantityObtained(int $quantityObtained)

No description

float
getVatValue()

No description

setVatValue(float $vatValue)

No description

float|int
getTotalVatValue()

No description

int
getAppropriateQuantity()

No description

serialize()

{@inheritdoc}

unserialize($serialized)

{@inheritdoc}

string
getErpCode()

No description

Details

at line 232
float|int getCalculatedBaseItemPrice()

Return Value

float|int

at line 243
float|int getPriceWithAdjustment(null $type = null, bool|false $useQty = false)

Parameters

null $type
bool|false $useQty

Return Value

float|int

at line 268
float|int calculateOnlyAdjustmentsForType(string $type, bool $useQty = false)

Parameters

string $type
bool $useQty

Return Value

float|int

at line 287
string getState()

Return Value

string

at line 297
OrderItem setState(string $state)

Parameters

string $state

Return Value

OrderItem

at line 307
int getNumInStock()

Return Value

int

at line 317
OrderItem setNumInStock(int $numInStock)

Parameters

int $numInStock

Return Value

OrderItem

at line 330
float|int getPriceWithAdjustmentAndTax(null $type = null, bool|false $useQty = false)

Parameters

null $type
bool|false $useQty

Return Value

float|int

at line 354
float getAdjustmentTotalPrice(bool $useQty = false)

Parameters

bool $useQty

Return Value

float

at line 367
float getFullAdjustmentTotalPrice()

Return Value

float

at line 377
array getPriceWithAdjustmentForEachType(bool $useQty = false)

Parameters

bool $useQty

Return Value

array

at line 404
array getFullPriceWithAdjustmentForEachType()

Return Value

array

at line 414
float|int getFullPriceWithAdjustment(string|null $type = null)

Parameters

string|null $type

Return Value

float|int

at line 422
float getUnitPriceWithQuantity()

Return Value

float

at line 430
OrderItem setTaxValue()

Return Value

OrderItem

at line 463
__construct()

at line 474
OrderItem setId(int $id)

Parameters

int $id

Return Value

OrderItem

at line 484
integer getId()

Get id

Return Value

integer

at line 492
int getQuantity()

Get item quantity.

Return Value

int

at line 500
setQuantity(int $quantity)

Set quantity.

Parameters

int $quantity

at line 516
OrderItem incrementQuantity(int $quantity = 1)

Parameters

int $quantity

Return Value

OrderItem

at line 532
OrderItem decrementQuantity(int $quantity = 1)

Parameters

int $quantity

Return Value

OrderItem

at line 546
OrderInterface getOrder()

Return the order.

Return Value

OrderInterface

at line 554
setOrder(OrderInterface $order = null)

Set the order.

Parameters

OrderInterface $order

at line 564
int getUnitPrice()

Get unit price of item.

Return Value

int

at line 572
setUnitPrice(int $unitPrice)

Define the unit price of item.

Parameters

int $unitPrice

at line 582
getActiveAdjustments()

{@inheritdoc}

at line 596
Collection|AdjustmentInterface[] getAdjustments(null|string $type = null)

Parameters

null|string $type

Return Value

Collection|AdjustmentInterface[]

at line 612
addAdjustment(AdjustmentInterface $adjustment)

Add adjustment.

Parameters

AdjustmentInterface $adjustment

at line 625
removeAdjustment(AdjustmentInterface $adjustment)

Remove adjustment.

Parameters

AdjustmentInterface $adjustment

at line 638
hasAdjustment(AdjustmentInterface $adjustment)

{@inheritdoc}

Parameters

AdjustmentInterface $adjustment

at line 646
integer getAdjustmentsTotal(null|string $type = null)

Get adjustments total.

Parameters

null|string $type

Return Value

integer

at line 666
getAdjustmentsTotalForEachType()

{@inheritdoc}

at line 688
removeAdjustments(string $type)

Remove adjustment.

Parameters

string $type

at line 705
clearAdjustments()

Clears all adjustments.

at line 715
float|int|mixed getTaxValue()

Return Value

float|int|mixed

at line 730
OrderItem setAdjustmentsTotal(float $adjustmentsTotal)

Parameters

float $adjustmentsTotal

Return Value

OrderItem

at line 740
calculateAdjustmentsTotal()

Calculate adjustments total.

at line 772
OrderItem setFixedAdjustmentsTotal(float $fixedAdjustmentsTotal)

Parameters

float $fixedAdjustmentsTotal

Return Value

OrderItem

at line 782
float getFixedAdjustmentsTotal()

Return Value

float

at line 790
int getTotal()

Get item total.

Return Value

int

at line 798
setTotal(int $total)

Set item total.

Parameters

int $total

at line 808
calculateTotal()

Calculate total based on quantity and unit price.

Take adjustments into account.

at line 842
bool equals(OrderItemInterface $orderItem)

Checks whether the item given as argument corresponds to the same cart item. Can be overwritten to enable merge quantities.

Parameters

OrderItemInterface $orderItem

Return Value

bool

at line 865
merge(OrderItemInterface $orderItem, bool $throwOnInvalid = true, float $qty)

Merge the item given as argument corresponding to the same cart item.

Parameters

OrderItemInterface $orderItem
bool $throwOnInvalid
float $qty

at line 880
Product getProduct()

Get item product.

Return Value

Product

at line 888
setProduct(Product $product)

Set product.

Parameters

Product $product

at line 900
Collection getProductAttValues()

Return Value

Collection

at line 910
OrderItem setProductAttValues(mixed $productAttValues)

Parameters

mixed $productAttValues

Return Value

OrderItem

at line 922
OrderItem addProductAttValue(ProductAttributeValues $productAttValue)

Parameters

ProductAttributeValues $productAttValue

Return Value

OrderItem

at line 935
OrderItem removeProductAttValue(ProductAttributeValues $productAttValue)

Parameters

ProductAttributeValues $productAttValue

Return Value

OrderItem

at line 946
string getProductSku()

Return Value

string

at line 956
OrderItem setProductSku(string $productSku)

Parameters

string $productSku

Return Value

OrderItem

at line 966
string getProductName()

Return Value

string

at line 976
OrderItem setProductName(string $productName)

Parameters

string $productName

Return Value

OrderItem

at line 986
int getQuantityObtained()

Return Value

int

at line 996
OrderItem setQuantityObtained(int $quantityObtained)

Parameters

int $quantityObtained

Return Value

OrderItem

at line 1006
float getVatValue()

Return Value

float

at line 1016
OrderItem setVatValue(float $vatValue)

Parameters

float $vatValue

Return Value

OrderItem

at line 1026
float|int getTotalVatValue()

Return Value

float|int

at line 1034
int getAppropriateQuantity()

Return Value

int

at line 1042
serialize()

{@inheritdoc}

at line 1066
unserialize($serialized)

{@inheritdoc}

Parameters

$serialized

at line 1089
string getErpCode()

Return Value

string