CustomerService

This service class contains functions related to the customer.
All public functions are available in the Twig template renderer.

Namespace

IO\Services

Properties
Type Name Description

ContactAccountRepositoryContract

$accountRepository

ContactRepositoryContract

$coreContactRepository

ContactRepositoryContract

$contactRepository

ContactAddressRepositoryContract

$contactAddressRepository

AddressRepositoryContract

$addressRepository

ContactClassRepositoryContract

$contactClassRepository

SessionStorageRepositoryContract

$sessionStorageRepository

``

$cache

Methods
public __construct($accountRepository, $coreContactRepository, $contactRepository, $contactAddressRepository, $addressRepository, $contactClassRepository, $sessionStorageRepository)

CustomerService constructor.

Parameters

Type

Name

Description

ContactAccountRepositoryContract

$accountRepository

ContactRepositoryContract

$coreContactRepository

ContactRepositoryContract

$contactRepository

ContactAddressRepositoryContract

$contactAddressRepository

AddressRepositoryContract

$addressRepository

ContactClassRepositoryContract

$contactClassRepository

SessionStorageRepositoryContract

$sessionStorageRepository

public getContactId():int
Deprecated!

since 5.0.0 will be removed in 6.0.0

Get the ID of the current contact from the session

public getContactClassData($contactClassId):array
Deprecated!

since 5.0.0 will be removed in 6.0.0

Get the data of a contact class

Parameters

Type

Name

Description

int

$contactClassId

Unique id of a contact class

public showNetPrices():bool
Deprecated!

since 5.0.0 will be removed in 6.0.0

Check if net prices should be shown

public showNetPricesByContactId($contactId):bool

Check if net prices should be shown for this contact

Parameters

Type

Name

Description

int

$contactId

Unique id of a contact

public getContactClassMinimumOrderQuantity():int

Gets the minimum order quantity of the current contacts contact class

public registerCustomer($contactData, $billingAddressData = [], $deliveryAddressData = []):Contact

Create a contact with addresses if specified

Parameters

Type

Name

Description

array

$contactData

The contacts data

array

$billingAddressData

The contacts billing address

array

$deliveryAddressData

The contacts delivery address

public createAccount($accountData):Account

Creates an user account

Parameters

Type

Name

Description

array

$accountData

User account data

public createContact($contactData):Contact \| array

Create a new contact

Parameters

Type

Name

Description

array

$contactData

The contacts data

public getContact():Contact
Deprecated!

since 5.0.0 will be removed in 6.0.0

Find the current contact

public getContactClassId():int
Deprecated!

since 5.0.0 will be removed in 6.0.0

Gets the current contact's contact class id

public updateContact($contactData):Contact

Update a contact

Parameters

Type

Name

Description

array

$contactData

New contact data

public updatePassword($newPassword, $contactId, $hash = ""):mixed

Update a customers password

Parameters

Type

Name

Description

string

$newPassword

The new password

int

$contactId

Id of the contact

string

$hash

Optional: Security hash

public getAddresses($typeId = null):array \| Collection

List the addresses of a contact

Parameters

Type

Name

Description

int

$typeId

Type of address

public getAddress($addressId, $typeId):Address

Get an address by ID

Parameters

Type

Name

Description

int

$addressId

Unique id of address

int

$typeId

Type of address

public createAddress($addressData, $typeId):Address

Create an address with the specified address type

Parameters

Type

Name

Description

array

$addressData

The address data

int

$typeId

Type of address

public updateAddress($addressId, $addressData, $typeId):Address

Update an address

Parameters

Type

Name

Description

int

$addressId

Id of address to update

array

$addressData

Updated address data

int

$typeId

Type of address to update

public deleteAddress($addressId, $typeId)

Delete an address

Parameters

Type

Name

Description

int

$addressId

Id of address to delete

int

$typeId

Type of address to delete

public getOrders($page = 1, $items = 10, $filters = []):array \| PaginatedResult

Get a list of orders for the current contact

Parameters

Type

Name

Description

int

$page

Optional: What page to get

int

$items

Optional: How many items per page

array

$filters

Optional: Additional filters

public hasReturns():bool

Check if a contact has made return orders

public getReturns($page = 1, $items = 10, $filters = [], $wrapped = true):PaginatedResult

Get a list of return orders for the current contact

Parameters

Type

Name

Description

int

$page

int

$items

array

$filters

bool

$wrapped

public getLatestOrder():LocalizedOrder

Get the last order created by the current contact

public resetGuestAddresses()

Resets the baskets current addresses if current contact is a guest

public getEmail():string

Gets the email address of the current contact

public getContactNumber($contactId):string

Gets a contacts contact number

Parameters

Type

Name

Description

int

$contactId

Unique id of a contact

public deleteGuestAddresses()

Delete adresses that are not bound to a contact

public fromMemoryCache()
public resetMemoryCache($key = null)
Parameters

Type

Name

Description

``

$key