UserLookup
extends PlatformUtility
in package
Provides user lookup functions — phone number and CVR lookups that auto-fill customer information in checkout.
Usage from a Smarty function or component: $ul = $platform->import('userlookup'); $result = $ul->lookup('phone', '12345678', 'DK'); $countries = $ul->getCountries();
The module is gated behind the "modul_user_lookup_service" access key, controlled by the admin setting "checkout.userlookup.enabled".
Tags
Table of Contents
- getCountries() : array<string|int, mixed>
- Get the available countries and search term types for user lookup.
- lookup() : array<string|int, mixed>|null
- Look up customer information by phone number or CVR number.
Methods
getCountries()
Get the available countries and search term types for user lookup.
public
getCountries([string|null $customerType = null ]) :
array<string|int, mixed>
Returns a matrix of supported countries per customer type, with the expected search term for each:
[ 'private' => ['countries' => ['DK','SE','NO'], 'searchTerm' => 'phone'], 'company' => ['countries' => ['DK','NO'], 'searchTerm' => 'cvr'], ]
Optionally filter to a single customer type by passing 'private' or 'company'.
Parameters
- $customerType : string|null = null
-
Filter to 'private' or 'company', or null for the full matrix
Tags
Return values
array<string|int, mixed> —The full matrix or a filtered subset. Empty array if the module is disabled.
lookup()
Look up customer information by phone number or CVR number.
public
lookup(string $searchTerm, string $query, string $country) :
array<string|int, mixed>|null
Maps the search term to the correct backend service: 'cvr' → Cvrapi (business lookup, supports DK, NO) 'phone' → LinkMobility (private lookup, supports DK, SE, NO)
Parameters
- $searchTerm : string
-
The type of lookup: 'phone' or 'cvr'
- $query : string
-
The phone number or CVR number to look up
- $country : string
-
Two-letter country code (DK, SE, NO)
Tags
Return values
array<string|int, mixed>|null —Customer data with keys: firstname, lastname, companyname, adress, zipcode, city, phonenumber, vatnumber (CVR only). Returns null if the module is disabled, no match is found, or the service returns an error.