Methods

__construct()

__construct(integer  $id = null,string  $language = null)

Basket constructor.

Instance a new basket object

Parameters

integer $id

A basket id

string $language

The basket language

SetTransactionId()

SetTransactionId(  $id): \FAA\Obj\Result

Set the transaction id

Parameters

$id

Returns

\FAA\Obj\Result

GetOwner()

GetOwner(): \FAA\Obj\Generic\User|null

Get the owner of this basket

Returns

\FAA\Obj\Generic\User|null

GetTransactionId()

GetTransactionId(): string

Get the transaction id

Returns

string —

The id or, null

GetTotalPrice()

GetTotalPrice(): float

Get total price

Returns the formatted total price

Returns

float —

The total price

DeliveryAddress()

DeliveryAddress(boolean  $fallback = true): array

Get the delivery address.

When not defined, the bill address will be returned

Parameters

boolean $fallback

When true the bill address will be returned when no delivery address is set

Returns

array —

The delivery address

BillAddress()

BillAddress(): array|null

Get billing address

Return the billing address or an empty array when attribute not filled

Returns

array|null

MinimumRequiredAge()

MinimumRequiredAge(): integer

Get required age When articles with age requirement are included this function returns the minimum age in years.

If none are present it returns 0

Returns

integer —

Minimum age in years

ToPlainReducedObject()

ToPlainReducedObject(array  $fields,null  $language = null): Object|\stdClass

To plain reduced object

Parameters

array $fields
null $language

Returns

Object|\stdClass

ToPlainObject()

ToPlainObject(string  $language = null,boolean  $with_parent = true): \stdClass

Resolve to object

Convert the basket to loadable object including a resolve of the child articles

Parameters

string $language

The target language

boolean $with_parent

Include parent properties

Returns

\stdClass —

The basket as object

Currency()

Currency(boolean  $symbol = false): string

Get the currency of the basket

This is hard coded at the moment but may become dynamic in the future

Parameters

boolean $symbol

Returns

string

SetBillNumber()

SetBillNumber(): \FAA\Obj\Result

Set the billing number

Returns

\FAA\Obj\Result

CompleteOrder()

CompleteOrder(\FAA\Obj\Request  $request): \FAA\Obj\Result

Finish order Confirm the order and send the billing mails.

Parameters

\FAA\Obj\Request $request

A system request object

Returns

\FAA\Obj\Result —

A system result object

ChangeStatus()

ChangeStatus(\FAA\Obj\Request|string  $request,array  $data): \FAA\Obj\Result

Change the basket status Execute the registered changes for this status change

Parameters

\FAA\Obj\Request|string $request

The system request object or a language

array $data

The status change elements status string The target status, defined by basket object comment string The status change log entry

Returns

\FAA\Obj\Result —

A system result object

MailPreview()

MailPreview(string  $language,string  $template,string  $type = 'html'): \FAA\Obj\Result

Create mail preview

Create the text or html email based on a given template and the basket

Parameters

string $language

The request language

string $template

The template id

string $type

html/txt template

Returns

\FAA\Obj\Result —

A system result object

GetBillPdf()

GetBillPdf(string  $language): \FAA\Obj\Result

Create pdf from bill mail Create the billing pdf using the assigned template

Parameters

string $language

The request language

Returns

\FAA\Obj\Result —

A system result object

FormatTitle()

FormatTitle(string  $template,string  $language): string

Format the title Enrich the title template with additional information. Token to replace are {id}, {cid} and {name}

Parameters

string $template

The template to translate

string $language

Target language code

Returns

string —

The translated label

SearchFields()

SearchFields(): array

Return search indexer fields Convert instance to search indexer values

Returns

array —

The search indexer fields

GetPaymentMethod()

GetPaymentMethod(): \FAA\Interfaces\PaymentMethod

Get assigned payment method Get the handler of assigned payment method.

Returns

\FAA\Interfaces\PaymentMethod

A payment method handler

GetDeliveryMethod()

GetDeliveryMethod(string  $version = null): \FAA\Interfaces\DeliveryMethod

Get assigned delivery method Get the handler of assigned delivery method.

Parameters

string $version

A git hash with the used delivery method version

Returns

\FAA\Interfaces\DeliveryMethod —

A delivery method handler

HasRecurring()

HasRecurring(): boolean

Has articles witch require recurring payments?

Returns

boolean

ListRawArticles()

ListRawArticles(): array<mixed,\FAA\Obj\Generic\Article>

Get list of raw articles without relation information

Returns

array<mixed,\FAA\Obj\Generic\Article>

Articles()

Articles()

ListArticles()

ListArticles(string  $language = null): array<mixed,\FAA\Obj\Sys\ArticleAssignment>

Get list of articles relation

Parameters

string $language

The target resolve language

Returns

array<mixed,\FAA\Obj\Sys\ArticleAssignment> —

List of assignments

ChangeLog()

ChangeLog(): array

Get the change log

Returns

array —

The list entries

AddChangeLog()

AddChangeLog(array  $entry): \FAA\Obj\Result

Add a changelog entry Create and add a changelog entry to this basket

Parameters

array $entry

The change log entries based on the BasketChangeLog data type

Returns

\FAA\Obj\Result —

A system result object

CheckValidCargo()

CheckValidCargo(string  $language = null): \FAA\Obj\Result

Check if cargo is valid Test if the assigned delivery method is matching with other conditions.

Parameters

string $language

The request language

Returns

\FAA\Obj\Result —

A system result object

ChangePaymentMethod()

ChangePaymentMethod(string  $method,boolean  $store = true): \FAA\Obj\Result

Change payment method

Changes the payment method of the current basket object The given id must match an active registered payment method and the basket must be registered in the session.

Parameters

string $method

The new method name

boolean $store

Flag to tell the system to persist the change, defaults to true

Returns

\FAA\Obj\Result —

A system result object

ChangeDeliveryMethod()

ChangeDeliveryMethod(string  $method,boolean  $store = true): \FAA\Obj\Result

Change delivery method

Changes the delivery method of the current basket object The given id must match an active registered delivery method and the basket must be registered in the session. The new delivery method must be compatible with the other options inside the basket so succeed.

Parameters

string $method

The new method name

boolean $store

Flag to tell the system to persist the change, defaults to true

Returns

\FAA\Obj\Result —

A system result object

SetComment()

SetComment(string  $content): \FAA\Obj\Result

Add or, replace comment Adds a comment to the basket object and calls the object saver

Parameters

string $content

A comment string

Returns

\FAA\Obj\Result —

A system result object

AddArticle()

AddArticle(string|integer  $content_id,string  $type,integer  $amount = 1,boolean  $replace = false): \FAA\Obj\Result

Add or, replace article

Adds an article by id and type to the current basket This method can either add at the end or override the article by id and type

Parameters

string|integer $content_id

The related article object content id

string $type

The object type name

integer $amount

Amount of entries to add, defaults to 1

boolean $replace

Replace instead of add, defaults to false

Returns

\FAA\Obj\Result —

A system result object

ChangeArticleAmount()

ChangeArticleAmount(integer  $index,integer  $amount = 1,integer|string  $content_id = null,string  $content_type = null): \FAA\Obj\Result

Change article amount and article on demand

This method changes the relation amount in the assigned articles list to the given number. Method will fail when the index is out of boundaries

Parameters

integer $index

The index of the article inside the basket

integer $amount

The new amount, can be either positive or negative

integer|string $content_id

A article content id, can be used to change the assigned article at the same time

string $content_type

A article content type, must be set to change the assigned article at the same time

Returns

\FAA\Obj\Result —

A system result object

RemoveArticle()

RemoveArticle(integer  $index): \FAA\Obj\Result

Delete article from basket

Removes the element by index from array of articles and calls the object saver afterwards. Method will fail when the index is out of boundaries

Parameters

integer $index

The index of the article inside the basket

Returns

\FAA\Obj\Result —

A system result object

GetTotalPriceFormated()

GetTotalPriceFormated(boolean  $tax = false,boolean  $de = true): string

Format the price

Returns a formatted price with or without tax included. Right now it does support the german formatting by default

Parameters

boolean $tax

Include the taxes when true

boolean $de

Use the format 100.000,45

Returns

string —

The price

CheckoutConfig()

CheckoutConfig(): mixed|null

Get the checkout configuration Load and parse the configuration for baskets

Returns

mixed|null

BasketStatusChangeMail()

BasketStatusChangeMail(string  $lang,array  $payload,array  $config): \FAA\Obj\Result

Send status mail

Sed the fitting status changed mail

Parameters

string $lang

The language key

array $payload

The status change elements status string The target status, defined by basket object comment string The status change log entry

array $config

The email configuration object

Returns

\FAA\Obj\Result —

A system result object