Package DE_EPAGES::Order::API::Object::LineItemContainer
object interface for LineItemContainer.
Base |
DE_EPAGES::Object::API::Object::Object |
Functions
- addLineItemPayment
- addLineItemShipping
- addLineItemTax
- businessContainer
- className
- container
- customer
- dbPackage
- formatter
- insertLineItem
- needPayment
- needShipping
- recalculate
- setLineItem
- taxRate
- user
addLineItemPayment
Adds a payment lineitem, if not exists yet and payment is required.
Syntax |
$PaymentLineItem = $Container->addLineItemPayment($LineItems); |
Input |
|
Return |
|
addLineItemShipping
Adds a shipping lineitem, if not exists yet and shipping is required.
Syntax |
$ShippingLineItem = $Container->addLineItemShipping($LineItems); |
Input |
|
Return |
|
addLineItemTax
Adds a tax lineitem for the given tax class, if not exists yet.
Syntax |
$TaxLineItem = $Container->addLineItemTax($TaxClass); |
Input |
|
Return |
|
businessContainer
Returns the container it self if container is not child of a lineitem. DE_EPAGES::Order::API::Object::LineItem::container.
Syntax |
$Me = $businessContainer->container; |
Return |
|
className
Returns the class name, used for DAL access.
Syntax |
$ClassName = $LineItemContainer->className; |
Return |
|
container
Returns the container it self. Used for line item method DE_EPAGES::Order::API::Object::LineItem::container.
Syntax |
$Me = $Container->container; |
Return |
|
customer
returns customer of this container
Syntax |
$Container->customer(); |
Return |
|
dbPackage
Returns the database package, used for DAL access.
Syntax |
$DbPackage = $LineItemContainer->dbPackage; |
Return |
|
formatter
Returns the shop money formatter for the currency of container.
Syntax |
$Formatter = $Container->formatter; |
Return |
|
insertLineItem
Returns the inserted lineitem. Generates the Alias and GUID of new lineitem.
Syntax |
$LineItem = $Container->insertLineItem($Class, $hLineItem); |
Example |
$LineItem = $Container->insertLineItem(LoadClassByAlias('LineItemProduct'), { 'Quantity' => 4, 'Name' => 'epages merchant 5.0', 'LineItemPrice' => 20000, 'TaxRate' => 0.16, }); |
Input |
|
Return |
|
needPayment
Returns true if the container need a payment lineitem (LineItemPrice !=0).
Syntax |
$NeedPaymentLineItem = $Container->needPayment( $LineItems ); |
Input |
|
Return |
|
needShipping
Returns true if the container need a shipping lineitem.
Syntax |
$NeedShippingLineItem = $Container->needShipping( $LineItems ); |
Input |
|
Return |
|
recalculate
Call this function if lineitem prices has been changed, to recalculate
GrandTotal, TotalTax and TotalBeforeTax. Before all lineitems of the container
will be recalculated. The hValues will be forwarded to these lineitems.
GrandTotal = SUM (children.LineItemPrice)
TotalTax = SUM (children.TaxAmount)
TotalBeforeTax = GrandTotal - TotalTax
Syntax |
$Container->recalculate($hValues); |
Input |
|
setLineItem
Creates a line item if this line item not exist, all keys of the line item will be compared with existing items.
Syntax |
$LineItem = $Container->setLineItem($Class, $hLineItem); |
Example |
$LineItem = $Container->setLineItem(LoadClassByAlias('LineItemProduct'), { 'Quantity' => 4, 'Name' => 'epages merchant 5.0', 'LineItemPrice' => 20000, 'TaxRate' => 0.16, }); |
Input |
|
Return |
|
taxRate
returns the tax rate for the given class, the area is saved at this container
Syntax |
$Rate = $Container->taxRate($TaxClass); |
Input |
|
Return |
|
user
returns user of this container
Syntax |
$Container->user(); |
Return |
|