Basket
extends Master
in package
implements
WithConfig, WithIncludes, WithNotifications
Implement interfaces for basket handling
This class provides interfaces to administrate baskets It provides interfaces for checkout handling in the frontend, these methods should not be used directly but mapped with an own checkout plugin in the data section.
Tags
Interfaces, Classes, Traits and Enums
- WithConfig
- Define implementation details for 3 configuration related endpoints
- WithIncludes
- WithNotifications
Table of Contents
- $request : Request|null
- $endpoint : Endpoint|null
- $response : Response|null
- $setup : Widget|null
- $_bookingsDb : BookingsDBAL|null
- $config : stdClass|null
- The local storage for basket configuration
- $git_repo : array<string|int, mixed>
- $root_dir : string
- Root directory for storage location folder
- __construct() : mixed
- Basket constructor.
- AddArticle() : void
- AddStorage() : mixed
- AdminAddArticle() : mixed
- AdminChangeArticle() : mixed
- AdminDeleteArticle() : mixed
- AlternativeArticles() : void
- ArticleFinder() : void
- ArticleFinderItem() : void
- ArticleMovements() : void
- ArticleMovementsShow() : void
- ArticleSales() : void
- ArticleStorages() : void
- BasketAddVoucher() : void
- BasketChanges() : void
- BasketRemoveVoucher() : mixed
- BasketStatusChange() : void
- call() : mixed
- ChangeDeliveryMethod() : void
- ChangePaymentMethod() : void
- Chart() : void
- CreateBasket() : void
- CreateIndividualVoucher() : void
- CreateIndividualVouchers() : void
- CreateVoucher() : void
- CurrentBasketAddVoucher() : void
- CurrentBasketRemoveVoucher() : mixed
- DeleteBasket() : mixed
- DeleteIndividualVoucher() : void
- DeleteVoucher() : void
- DeliveryMethodList() : mixed
- DeliveryMethodLoad() : mixed
- DeliveryMethodLoadPreset() : mixed
- DeliveryMethodUpdate() : mixed
- DownloadCSVExport() : mixed
- DropStorage() : void
- EditStorage() : void
- Endpoint() : Endpoint|null
- Get/Set endpoint
- ExportBills() : void
- ExportIndividualVouchers() : mixed
- FetchBasket() : mixed
- FetchBasketBookings() : void
- FetchBasketOverview() : mixed
- FetchBasketPaymentMethod() : void
- FetchBaskets() : void
- FetchStorage() : void
- FetchStorageReportPreset() : mixed
- GetConfig() : void
- Endpoint handler to fetch the config
- GetConfigPreset() : void
- Endpoint handler to get the config data form template
- GetIndividualVoucher() : void
- GetNotifications() : Result
- GetVoucher() : void
- GitRepo() : Git
- Git object
- ListVouchers() : void
- LoadCurrent() : void
- LoadFieldPresetStatus() : void
- LoadIndividualVouchers() : void
- ManageBundleConfig() : void
- PaymentMethodList() : mixed
- PaymentMethodLoad() : mixed
- PaymentMethodLoadPreset() : mixed
- PaymentMethodUpdate() : void
- RegisterBasket() : void
- RegisterIncludes() : array<string|int, mixed>
- Register includes on add the widget to certain page
- RegisterUserBasket() : void
- RemoveArticle() : mixed
- ReplaceSubscription() : void
- Request() : Request
- The request Sets or gets the widget request object
- ResolveVoucherByCode() : mixed
- Response() : Response
- Response object Get / Set the widget response
- SaveConfig() : void
- Endpoint handler to update the config
- SearchStorageArticles() : void
- Setup() : Widget|null
- Get/Set the widget context
- ShowBasketPreview() : mixed
- ShowBill() : void
- StorageArticle() : void
- StorageArticleAdd() : mixed
- StorageArticleAddImage() : mixed
- StorageArticleDeleteImage() : mixed
- StorageArticleDrop() : mixed
- StorageArticleEdit() : mixed
- StorageArticleEditData() : mixed
- StorageArticleEditImage() : mixed
- StorageCorrection() : void
- StorageMovement() : void
- StorageReport() : void
- StorageTreeLimb() : mixed
- UpdateArticle() : mixed
- UpdateIndividualVoucher() : void
- UpdateVoucher() : void
- bindVouchers() : Result
- Bind newly added vouchers to the basket Can resolve automatically added bundle vouchers based on the article set
- ConfigGet() : void
- Get a configuration by name
- ConfigGetPreset() : void
- Get the configuration preset data
- ConfigGetRaw() : Result
- Get configuration data as object from setup handler
- ConfigSave() : void
- Store a configuration with values from body and a given name
- CopyEntity() : void
- copy a single content links the frontend to the copy handler for single contents identified by rest end point argument
- CreateEntity() : mixed
- create new object
- deleteEntity() : void
- Delete a single content
- fetchAssignedEntityList() : mixed
- fetchEntityList() : void
- Fetch list of entries Use the direct loader method to retrieve a list obf objects
- fetchEntityListFiltered() : void
- Fetch filtered list
- fetchObject() : BaseContent|bool|null
- Retrieve an object from storage
- handleSubViewList() : mixed
- Handle the list/object loading for sub view of contents
- loadSingleEntity() : void
- load a single content implements the loader for single contents identified by rest end point argument
- prepareObjectLogs() : void
- Prepare the object comment and arguments for changes in diff
- UpdateEntity() : void
- Update a single content
- _filterHandler() : array<string|int, mixed>
- Filter methods list
- bookingsDb() : BookingsDBAL
- fetchIndividualVouchers() : Result
- Fetch a list of individual vouchers
- fetchStorageByPath() : Storage|null
- Get storage location
- getBasket() : Basket|null
- Get the basket
- getNameFromNumber() : string
- Number to excel col name
- loadStorageFolder() : Storage|null
- Get storage location
- loadStorageRelation() : AmountRelation|null
- Get the relation item from storage
Properties
$request
public
Request|null
$request
= null
$endpoint
protected
Endpoint|null
$endpoint
= null
$response
protected
Response|null
$response
= null
$setup
protected
Widget|null
$setup
= null
$_bookingsDb
private
BookingsDBAL|null
$_bookingsDb
= null
$config
The local storage for basket configuration
private
stdClass|null
$config
= null
$git_repo
private
array<string|int, mixed>
$git_repo
= array()
$root_dir
Root directory for storage location folder
private
string
$root_dir
= 'media/storage/'
Methods
__construct()
Basket constructor.
public
__construct() : mixed
Init this widget and load the basket configuration
Return values
mixed —AddArticle()
public
AddArticle() : void
Return values
void —AddStorage()
public
AddStorage() : mixed
Return values
mixed —AdminAddArticle()
public
AdminAddArticle() : mixed
Return values
mixed —AdminChangeArticle()
public
AdminChangeArticle() : mixed
Return values
mixed —AdminDeleteArticle()
public
AdminDeleteArticle() : mixed
Return values
mixed —AlternativeArticles()
public
AlternativeArticles() : void
Return values
void —ArticleFinder()
public
ArticleFinder() : void
Return values
void —ArticleFinderItem()
public
ArticleFinderItem() : void
Return values
void —ArticleMovements()
public
ArticleMovements() : void
Return values
void —ArticleMovementsShow()
public
ArticleMovementsShow() : void
Return values
void —ArticleSales()
public
ArticleSales() : void
Return values
void —ArticleStorages()
public
ArticleStorages() : void
Return values
void —BasketAddVoucher()
public
BasketAddVoucher([mixed $id = null ]) : void
Parameters
- $id : mixed = null
Return values
void —BasketChanges()
public
BasketChanges() : void
Return values
void —BasketRemoveVoucher()
public
BasketRemoveVoucher([mixed $id = null ]) : mixed
Parameters
- $id : mixed = null
Return values
mixed —BasketStatusChange()
public
BasketStatusChange() : void
Return values
void —call()
public
call() : mixed
Return values
mixed —ChangeDeliveryMethod()
public
ChangeDeliveryMethod() : void
Return values
void —ChangePaymentMethod()
public
ChangePaymentMethod() : void
Return values
void —Chart()
public
Chart() : void
Return values
void —CreateBasket()
public
CreateBasket() : void
Return values
void —CreateIndividualVoucher()
public
CreateIndividualVoucher() : void
Return values
void —CreateIndividualVouchers()
public
CreateIndividualVouchers() : void
Return values
void —CreateVoucher()
public
CreateVoucher() : void
Return values
void —CurrentBasketAddVoucher()
public
CurrentBasketAddVoucher() : void
Return values
void —CurrentBasketRemoveVoucher()
public
CurrentBasketRemoveVoucher() : mixed
Return values
mixed —DeleteBasket()
public
DeleteBasket() : mixed
Return values
mixed —DeleteIndividualVoucher()
public
DeleteIndividualVoucher() : void
Return values
void —DeleteVoucher()
public
DeleteVoucher() : void
Return values
void —DeliveryMethodList()
public
DeliveryMethodList() : mixed
Return values
mixed —DeliveryMethodLoad()
public
DeliveryMethodLoad() : mixed
Return values
mixed —DeliveryMethodLoadPreset()
public
DeliveryMethodLoadPreset() : mixed
Return values
mixed —DeliveryMethodUpdate()
public
DeliveryMethodUpdate() : mixed
Return values
mixed —DownloadCSVExport()
public
DownloadCSVExport() : mixed
Return values
mixed —DropStorage()
public
DropStorage() : void
Return values
void —EditStorage()
public
EditStorage() : void
Return values
void —Endpoint()
Get/Set endpoint
public
Endpoint([Endpoint|null $endpoint = null ]) : Endpoint|null
Sets or gets the widget arguments, they contain the endpoint this widget was called at
Parameters
- $endpoint : Endpoint|null = null
-
A system request list
Return values
Endpoint|null —A system endpoint object
ExportBills()
public
ExportBills() : void
Return values
void —ExportIndividualVouchers()
public
ExportIndividualVouchers() : mixed
Return values
mixed —FetchBasket()
public
FetchBasket() : mixed
Return values
mixed —FetchBasketBookings()
public
FetchBasketBookings() : void
Return values
void —FetchBasketOverview()
public
FetchBasketOverview() : mixed
Return values
mixed —FetchBasketPaymentMethod()
public
FetchBasketPaymentMethod() : void
Return values
void —FetchBaskets()
public
FetchBaskets() : void
Return values
void —FetchStorage()
public
FetchStorage() : void
Return values
void —FetchStorageReportPreset()
public
FetchStorageReportPreset() : mixed
Return values
mixed —GetConfig()
Endpoint handler to fetch the config
public
GetConfig() : void
Return values
void —GetConfigPreset()
Endpoint handler to get the config data form template
public
GetConfigPreset() : void
Return values
void —GetIndividualVoucher()
public
GetIndividualVoucher() : void
Return values
void —GetNotifications()
public
GetNotifications(User $user) : Result
Parameters
- $user : User
Tags
Return values
Result —GetVoucher()
public
GetVoucher() : void
Return values
void —GitRepo()
Git object
public
GitRepo([string $path = 'data' ]) : Git
Gets the widget git instance, either for config or, for data repo
Parameters
- $path : string = 'data'
-
The target repo, default is data
Return values
Git —A system git object with data folder as start point
ListVouchers()
public
ListVouchers() : void
Return values
void —LoadCurrent()
public
LoadCurrent() : void
Return values
void —LoadFieldPresetStatus()
public
LoadFieldPresetStatus() : void
Return values
void —LoadIndividualVouchers()
public
LoadIndividualVouchers() : void
Return values
void —ManageBundleConfig()
public
ManageBundleConfig() : void
Return values
void —PaymentMethodList()
public
PaymentMethodList() : mixed
Return values
mixed —PaymentMethodLoad()
public
PaymentMethodLoad() : mixed
Return values
mixed —PaymentMethodLoadPreset()
public
PaymentMethodLoadPreset() : mixed
Return values
mixed —PaymentMethodUpdate()
public
PaymentMethodUpdate() : void
Return values
void —RegisterBasket()
public
RegisterBasket([mixed $settings = array() ]) : void
Parameters
- $settings : mixed = array()
Return values
void —RegisterIncludes()
Register includes on add the widget to certain page
public
RegisterIncludes(Request $request) : array<string|int, mixed>
Parameters
- $request : Request
Tags
Return values
array<string|int, mixed> —RegisterUserBasket()
public
RegisterUserBasket() : void
Return values
void —RemoveArticle()
public
RemoveArticle() : mixed
Return values
mixed —ReplaceSubscription()
public
ReplaceSubscription() : void
Return values
void —Request()
The request Sets or gets the widget request object
public
Request([Request|null $request = null ]) : Request
Parameters
- $request : Request|null = null
-
A system request object
Return values
Request —A system request object
ResolveVoucherByCode()
public
ResolveVoucherByCode() : mixed
Return values
mixed —Response()
Response object Get / Set the widget response
public
Response([Response|null $response = null ]) : Response
Parameters
- $response : Response|null = null
Return values
Response —A system response object
SaveConfig()
Endpoint handler to update the config
public
SaveConfig() : void
Return values
void —SearchStorageArticles()
public
SearchStorageArticles() : void
Return values
void —Setup()
Get/Set the widget context
public
Setup([Widget|null $setup = null ]) : Widget|null
Parameters
- $setup : Widget|null = null
Return values
Widget|null —ShowBasketPreview()
public
ShowBasketPreview() : mixed
Return values
mixed —ShowBill()
public
ShowBill() : void
Return values
void —StorageArticle()
public
StorageArticle() : void
Return values
void —StorageArticleAdd()
public
StorageArticleAdd() : mixed
Return values
mixed —StorageArticleAddImage()
public
StorageArticleAddImage() : mixed
Return values
mixed —StorageArticleDeleteImage()
public
StorageArticleDeleteImage() : mixed
Return values
mixed —StorageArticleDrop()
public
StorageArticleDrop() : mixed
Return values
mixed —StorageArticleEdit()
public
StorageArticleEdit() : mixed
Return values
mixed —StorageArticleEditData()
public
StorageArticleEditData() : mixed
Return values
mixed —StorageArticleEditImage()
public
StorageArticleEditImage() : mixed
Return values
mixed —StorageCorrection()
public
StorageCorrection() : void
Return values
void —StorageMovement()
public
StorageMovement() : void
Return values
void —StorageReport()
public
StorageReport() : void
Return values
void —StorageTreeLimb()
public
StorageTreeLimb() : mixed
Return values
mixed —UpdateArticle()
public
UpdateArticle() : mixed
Return values
mixed —UpdateIndividualVoucher()
public
UpdateIndividualVoucher() : void
Return values
void —UpdateVoucher()
public
UpdateVoucher() : void
Return values
void —bindVouchers()
Bind newly added vouchers to the basket Can resolve automatically added bundle vouchers based on the article set
protected
bindVouchers(Basket $basket, array<string|int, mixed> $payload) : Result
Parameters
- $basket : Basket
- $payload : array<string|int, mixed>
Return values
Result —ConfigGet()
Get a configuration by name
protected
ConfigGet(string $name) : void
Parameters
- $name : string
-
The name of the config file
Return values
void —ConfigGetPreset()
Get the configuration preset data
protected
ConfigGetPreset(string $name) : void
Parameters
- $name : string
-
The name of the config file
Return values
void —ConfigGetRaw()
Get configuration data as object from setup handler
protected
ConfigGetRaw(string $name) : Result
Parameters
- $name : string
-
The name of the config file
Return values
Result —ConfigSave()
Store a configuration with values from body and a given name
protected
ConfigSave(string $name) : void
Parameters
- $name : string
-
The name of the config file
Return values
void —CopyEntity()
copy a single content links the frontend to the copy handler for single contents identified by rest end point argument
protected
CopyEntity(array<string|int, mixed>|string $type, int|string $epIndex) : void
Parameters
- $type : array<string|int, mixed>|string
-
The requested content type
- $epIndex : int|string
-
Parse this parameter as id
Return values
void —CreateEntity()
create new object
protected
CreateEntity(string $type) : mixed
this method creates a new instance of a specific system content type
Parameters
- $type : string
-
A registered system content type
Return values
mixed —deleteEntity()
Delete a single content
protected
deleteEntity(string|array<string|int, string> $type, int|string $epIndex) : void
Implements the delete handler for single contents identified by rest end point argument
Parameters
- $type : string|array<string|int, string>
-
The requested content type
- $epIndex : int|string
-
Parse this parameter as id
Return values
void —fetchAssignedEntityList()
protected
fetchAssignedEntityList( $list[, null $language = null ]) : mixed
Parameters
Tags
Return values
mixed —fetchEntityList()
Fetch list of entries Use the direct loader method to retrieve a list obf objects
protected
fetchEntityList(string $type[, bool $raw = false ]) : void
Parameters
- $type : string
-
Fetch list of elements
- $raw : bool = false
-
Return as raw object and not plain
Return values
void —fetchEntityListFiltered()
Fetch filtered list
protected
fetchEntityListFiltered(string|array<string|int, string> $type[, array<string|int, mixed>|null $extra_payload = null ]) : void
Implements the server side data tables processing functions Supports free text search, paging and ordering at the moment
Parameters
- $type : string|array<string|int, string>
-
The requested content type(s)
- $extra_payload : array<string|int, mixed>|null = null
-
Additional filter operators
Return values
void —fetchObject()
Retrieve an object from storage
protected
fetchObject(int|string $id, string|array<string|int, string> $type[, string $right = 'view' ]) : BaseContent|bool|null
Load a single content from storage as instance If object was not found it will set the 404 error code
Parameters
- $id : int|string
-
A object id
- $type : string|array<string|int, string>
-
A object type
- $right : string = 'view'
-
An access level to test against
Return values
BaseContent|bool|null —A base content or null when not found or false when not access
handleSubViewList()
Handle the list/object loading for sub view of contents
protected
handleSubViewList(array<string|int, mixed> $payload) : mixed
Parameters
- $payload : array<string|int, mixed>
-
The request payload parent_type string Name of the parent type to manage inside parent string/int The id of the parent content attr string The attribute name to manage type string Type of the content to assign elements array List of elements when type is __multi content int Id when a direct content edit is performed (e.g. in child contents)
Tags
Return values
mixed —loadSingleEntity()
load a single content implements the loader for single contents identified by rest end point argument
protected
loadSingleEntity(string $type, int|string $epIndex[, string|null $language = null ]) : void
Parameters
- $type : string
-
The requested content type
- $epIndex : int|string
-
Parse this parameter as id
- $language : string|null = null
-
Language code to fetch element in
Return values
void —prepareObjectLogs()
Prepare the object comment and arguments for changes in diff
protected
prepareObjectLogs(BaseContent $item) : void
Parameters
- $item : BaseContent
Return values
void —UpdateEntity()
Update a single content
protected
UpdateEntity(string|array<string|int, string> $type, int|string $epIndex[, bool $return = false ]) : void
Implements the update handler for single contents identified by rest end point argument Does return the values when config option says so
Parameters
- $type : string|array<string|int, string>
-
The requested content type or, a list of allowed types
- $epIndex : int|string
-
Parse this parameter as id
- $return : bool = false
Return values
void —_filterHandler()
Filter methods list
private
_filterHandler( $handlers[, string $type = '' ]) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —bookingsDb()
private
bookingsDb() : BookingsDBAL
Return values
BookingsDBAL —fetchIndividualVouchers()
Fetch a list of individual vouchers
private
fetchIndividualVouchers(array<string|int, mixed> $payload) : Result
Parameters
- $payload : array<string|int, mixed>
Return values
Result —fetchStorageByPath()
Get storage location
private
fetchStorageByPath(string $path, string $right) : Storage|null
Parameters
- $path : string
-
The storage location path
- $right : string
-
The load mode
Return values
Storage|null —getBasket()
Get the basket
private
getBasket() : Basket|null
Get a raw basket object based on the request arguments Support the usage of named segments and position in segments list with index 3 Will set 404 when basket could not be opened
Return values
Basket|null —A system basket or, null
getNameFromNumber()
Number to excel col name
private
getNameFromNumber(int $num) : string
Parameters
- $num : int
Return values
string —loadStorageFolder()
Get storage location
private
loadStorageFolder([string $mode = 'view' ]) : Storage|null
Parameters
- $mode : string = 'view'
-
The load mode
Return values
Storage|null —loadStorageRelation()
Get the relation item from storage
private
loadStorageRelation([string $right = 'view' ], int $pop) : AmountRelation|null
Parameters
- $right : string = 'view'
- $pop : int