Skip to content

Admin Customer Management

Flow ID: AD-04 Module(s): eshop, audience Complexity: Medium Last Updated: 2026-04-03

Business Context

Admin customer management provides CRUD for customer profiles with dual-address support (billing + shipping), order history viewing, loyalty points management, behavioral analytics (referrer, payment preferences, order frequency), GDPR data export/deletion, and audience tag assignment. Customers are segmented into registered, guest, and B2B types with separate listing views.

Entry Points

TypePath / TriggerControllerMethod
AdminCustomer listingecommercen/eshop/controllers/Adv_customers_admin.phpindex()
AdminRegistered onlysameregistered()
AdminGuests onlysameunregistered()
AdminB2B onlysameb2b()
AdminCustomer detailsameview($id)
AdminOrder historysameorder_history($customerId)
AJAXCustomer searchsamesearch() — JSON autocomplete for order creation

Key Operations

Customer Listing (index() line 49-124): Paginated grid (default 50 rows) with search/filter persisted in session. Supports sorting by any column. Attaches latest admin note to each customer. Four parallel views for customer types: all, registered, guest, B2B — each with cross-redirect logic if filter doesn't match the view.

Customer Detail/Edit (view() line 206-284):

  • Dual address: billing (name, address, city, postal, county, phone) + shipping (sendto_* fields) + company/invoice fields
  • Order matching: by customer ID (default) or by email (across duplicate accounts, via ?joined=false)
  • Loyalty points: if POINT_SYSTEM.IS_ENABLED, admin can set points directly
  • Behavioral analytics (if Smart Recommendations enabled): referrer chart, payment method chart, payment way chart, average days between orders + predicted next order date
  • Customer class: tiered loyalty grade based on total spend (3 configurable thresholds in registry)
  • Matomo visitor profile: async-loaded analytics from Matomo if enabled

Related Data (viewExtras() line 286-294): Email history, top purchased products, wishlist items, admin notes (with authorship), audience tags, personality analytics.

GDPR Compliance:

  • deleteUser() (line 347): Anonymizes via Sanitize_model->sanitizeAll()
  • exportData() (line 354): Downloads all customer data as JSON (user_data.json)

Exports:

  • exportSearchedCustomers(): CSV with BOM (ID, guest flag, name, email, phone, points, orders, total spend, creation date)
  • exportViberCustomers(): CSV for Viber marketing campaigns (customer ID, phone, creation date)

Business Rules

RuleDescription
Customer types: registered/guest/B2BSeparate listing views with cross-redirect validation
Order matching dual modeBy ID (exact) or by email (across accounts) — toggled via ?joined param
Customer class = tiered by spend3 tiers from registry: ESHOP_CUSTOMER_GRADE_{1,2,3}_VALUE
Loyalty points admin-editableOnly if POINT_SYSTEM.IS_ENABLED
Audience tags conditionalOnly if SMART_RECOMMENDATIONS.IS_ENABLED_CUSTOMER_TAG
Predicted next orderAverage days between orders + last order date = prediction
Auth: ADVISABLE, ADMIN, or ORDERS roleLine 18-24
Pagination persisted in sessioncrLimit, crPage, customersSearch session keys

Data Model

TablePurpose
shop_customerCustomer profiles (billing + shipping + company fields) — 50 columns
shop_orderOrder history per customer
shop_customer_tagAudience/behavioral tags — 6.8M rows, 9 tag groups, avg 25.6 tags per tagged customer
shop_customer_message_historyEmail/SMS communication history with 30-day retention cleanup
shop_customer_sms_marketingSMS/Viber consent tracking with provider_id field
shop_customer_campaignCampaign assignment infrastructure — exists but currently unused (0 rows)
eshop_notesAdmin-authored internal notes
shop_wishlistCustomer wishlist items

shop_customer B2B fields

The shop_customer table includes dedicated B2B columns beyond the standard profile fields:

ColumnPurpose
company_nameBusiness/company name
company_afmTax identification number (AFM — Greek VAT number)
company_doyTax office (DOY — Greek tax authority branch)
professionCustomer's profession/business activity

shop_customer_tag — Behavioral tagging system

The tagging system is high-volume (6.8M tags in production) with 9 tag groups averaging 25.6 tags per tagged customer. Tags are used for audience segmentation (AD-22), personalized recommendations, and campaign targeting. The volume indicates aggressive automated tagging from browsing behavior, purchase history, and recommendation engine signals.

Tracks opt-in consent for SMS and Viber marketing channels. The provider_id field links to the SMS/Viber delivery provider, enabling multi-provider dispatch.

shop_customer_campaign — Campaign infrastructure (unused)

The table schema and model code exist but contain 0 rows in production. This suggests planned but unimplemented campaign assignment functionality, or a deprecated feature that was never activated.

shop_customer_message_history — Communication log

Stores email and SMS message history per customer. A 30-day retention cleanup job periodically purges old records to manage table size.

Client Customization Points

Override TypeBase FileOverride In
Customer admin controllerecommercen/eshop/controllers/Adv_customers_admin.phpapplication/modules/eshop/controllers/
viewExtras() methodSameClient override — add custom data to detail view
Customer modelecommercen/eshop/models/Adv_customer_model.phpapplication/modules/eshop/models/
Registry tier valuesregistry tablePer-client DB

REST API Endpoints

All REST endpoints require JWT authentication. Routes support an optional (\w{2})/ language prefix (e.g., /el/rest/...). POST is used for both create and update operations (not PUT).

Customer (9 operations)

MethodPathAuthDescription
GET/rest/customer/meJWTGet authenticated customer's own profile
POST/rest/customer/meJWTUpdate authenticated customer's own profile
POST/rest/customer/me/passwordJWTChange authenticated customer's password
GET/rest/customer/customerJWTList customers (paginated, filterable)
GET/rest/customer/customer/itemJWTGet customer field metadata (schema introspection)
GET/rest/customer/customer/{id}JWTGet single customer by ID
POST/rest/customer/customerJWTCreate new customer
POST/rest/customer/customer/{id}JWTUpdate existing customer
DELETE/rest/customer/customer/{id}JWTDelete customer

CustomerTag (6 operations)

MethodPathAuthDescription
GET/rest/customer/customer-tagJWTList customer tags (paginated, filterable)
GET/rest/customer/customer-tag/itemJWTGet customer tag field metadata
GET/rest/customer/customer-tag/{id}JWTGet single customer tag by ID
POST/rest/customer/customer-tagJWTCreate new customer tag
POST/rest/customer/customer-tag/{id}JWTUpdate existing customer tag
DELETE/rest/customer/customer-tag/{id}JWTDelete customer tag

CustomerSmsMarketing (6 operations)

MethodPathAuthDescription
GET/rest/customer/customer-sms-marketingJWTList SMS/Viber marketing consents (paginated, filterable)
GET/rest/customer/customer-sms-marketing/itemJWTGet SMS marketing field metadata
GET/rest/customer/customer-sms-marketing/{id}JWTGet single SMS marketing record by ID
POST/rest/customer/customer-sms-marketingJWTCreate new SMS marketing consent record
POST/rest/customer/customer-sms-marketing/{id}JWTUpdate existing SMS marketing consent record
DELETE/rest/customer/customer-sms-marketing/{id}JWTDelete SMS marketing consent record

CustomerReview (6 operations)

MethodPathAuthDescription
GET/rest/customer/customer-reviewJWTList customer reviews (paginated, filterable)
GET/rest/customer/customer-review/itemJWTGet customer review field metadata
GET/rest/customer/customer-review/{id}JWTGet single customer review by ID
POST/rest/customer/customer-reviewJWTCreate new customer review
POST/rest/customer/customer-review/{id}JWTUpdate existing customer review
DELETE/rest/customer/customer-review/{id}JWTDelete customer review

CustomerCampaign (6 operations)

Note: The shop_customer_campaign table has 0 rows in production. This is unused infrastructure for a planned/deprecated campaign assignment feature.

MethodPathAuthDescription
GET/rest/customer/customer-campaignJWTList customer campaigns (paginated, filterable)
GET/rest/customer/customer-campaign/itemJWTGet customer campaign field metadata
GET/rest/customer/customer-campaign/{id}JWTGet single customer campaign by ID
POST/rest/customer/customer-campaignJWTCreate new customer campaign assignment
POST/rest/customer/customer-campaign/{id}JWTUpdate existing customer campaign assignment
DELETE/rest/customer/customer-campaign/{id}JWTDelete customer campaign assignment

CustomerMessageHistory (6 operations)

MethodPathAuthDescription
GET/rest/customer/customer-message-historyJWTList customer message history (paginated, filterable)
GET/rest/customer/customer-message-history/itemJWTGet message history field metadata
GET/rest/customer/customer-message-history/{id}JWTGet single message history record by ID
POST/rest/customer/customer-message-historyJWTCreate new message history record
POST/rest/customer/customer-message-history/{id}JWTUpdate existing message history record
DELETE/rest/customer/customer-message-history/{id}JWTDelete message history record

Route config: application/config/rest_routes.php lines 598-698. Controllers: src/Rest/Customer/Controllers/Customer, CustomerTag, CustomerSmsMarketing, CustomerReview, CustomerCampaign, CustomerMessageHistory.