VOOZH about

URL: https://deepwiki.com/gp247net/shop/5.3-customer-administration

⇱ Customer Administration | gp247net/shop | DeepWiki


Loading...
Menu

Customer Administration

Purpose and Scope

This document describes the administrative interface for managing customers in the GP247/Shop e-commerce package. It covers how administrators can view, create, edit, and manage customer accounts and their associated addresses through the admin panel. For information about customer authentication and self-service account management, see pages 5.1 and 5.2.

Overview

The Customer Administration system provides store administrators with comprehensive tools to manage customer accounts, including creating new customers, editing customer information, managing multiple addresses, and viewing customer activity. The system respects multi-store isolation, ensuring administrators only see customers belonging to their assigned store.


Sources: src/Admin/Models/AdminCustomer.php48-73 src/Views/admin/screen/customer_edit.blade.php src/Views/admin/component/new_customer.blade.php

System Components

The Customer Administration system consists of several key components that work together to provide comprehensive customer management capabilities:


Sources: src/Admin/Models/AdminCustomer.php1-141 src/Views/admin/screen/customer_edit.blade.php src/Views/admin/component/new_customer.blade.php src/DB/migrations/00_00_00_create_tables_shop.php320-347 src/DB/migrations/00_00_00_create_tables_shop.php350-367

AdminCustomer Model

The AdminCustomer model extends ShopCustomer and provides specialized methods for administrative operations. It implements multi-store isolation by filtering queries based on the session('adminStoreId').

Key Methods:

MethodPurposeReturns
getCustomerAdmin($id)Retrieve customer with addresses for admin viewCustomer with relationships
getCustomerListAdmin($dataSearch)Get paginated list with search/sortPaginated collection
getAddress($id)Find specific address by IDShopCustomerAddress
deleteAddress($id)Delete address by IDBoolean
getTotalCustomer()Count total customersInteger
getTopCustomer()Get 10 most recent customersCollection
getListAll()Get all customers (cached, keyed by ID)Collection

Sources: src/Admin/Models/AdminCustomer.php20-141

Customer List Management

Administrators can view and search through customers using the getCustomerListAdmin method, which provides filtering, sorting, and pagination capabilities.

Customer List Query Flow


Search and Filter Parameters

The customer list supports the following search parameters:

ParameterDescriptionImplementation
keywordSearches email, first_name, last_nameUses LIKE operator with wildcard matching
sort_orderSpecifies field and directionFormat: field__direction, validates against arrSort
store_idMulti-store isolationAutomatically filtered by session('adminStoreId')

The default sort order is created_at DESC, showing newest customers first. Pagination is set to 20 customers per page.

Sources: src/Admin/Models/AdminCustomer.php48-73

Customer Edit Interface

The customer edit interface (customer_edit.blade.php) provides a comprehensive form for managing all aspects of a customer's profile. The form adapts its fields based on configuration settings, allowing different stores to collect different information.

Form Structure


Sources: src/Views/admin/screen/customer_edit.blade.php1-452

Configurable Customer Fields

The admin interface uses gp247_config_admin() to determine field visibility. This allows per-store customization of which customer fields are collected and displayed.

Field GroupConfiguration FlagLinesDescription
Name Structurecustomer_lastname24-80If true, splits into first_name/last_name; otherwise single name field
Name Kanacustomer_name_kana82-119Japanese phonetic name (first_name_kana, last_name_kana)
Phonecustomer_phone121-140Contact phone number
Postcodecustomer_postcode142-162Postal/ZIP code
Address Linescustomer_address2, customer_address3203-241Additional address fields beyond address1
Countrycustomer_country244-266Country selection dropdown
Sexcustomer_sex268-288Gender selection (radio buttons)
Birthdaycustomer_birthday290-310Date of birth picker
Groupcustomer_group312-332Customer group/tier number

Email (lines 164-182) and address1 (lines 184-201) are always displayed and required.

Sources: src/Views/admin/screen/customer_edit.blade.php24-332

Password Management in Admin

Administrators can set or reset customer passwords through the edit form:


The password field (lines 335-356) includes help text indicating that leaving it blank will preserve the existing password for existing customers.

Sources: src/Views/admin/screen/customer_edit.blade.php335-356

Address Management

The customer edit interface includes a comprehensive address management section that displays all addresses associated with the customer and allows administrators to edit or delete them.

Address List Display

The address list section (lines 399-447) displays each address with all configured fields and provides action buttons:


Sources: src/Views/admin/screen/customer_edit.blade.php399-447

Address Fields Display Logic

The address display respects the same configuration flags as the main form:

FieldConfiguration CheckLines
First/Last Namecustomer_lastname406-411
Phonecustomer_phone413-415
Postcodecustomer_postcode417-419
Address1Always shown421
Address2customer_address2423-425
Address3customer_address3427-429
Countrycustomer_country431-433

Sources: src/Views/admin/screen/customer_edit.blade.php406-433

Address Deletion with AJAX

The delete functionality uses client-side JavaScript with AJAX to remove addresses without page reload:


The JavaScript handler (lines 467-487) includes a confirmation dialog and displays a loading indicator during the operation.

Sources: src/Views/admin/screen/customer_edit.blade.php467-488 src/Admin/Models/AdminCustomer.php92-95

Default Address Indicator

A customer can have one default address stored in the customer.address_id field. The list view displays a bank icon (line 442) next to the default address for visual identification.

Sources: src/Views/admin/screen/customer_edit.blade.php441-443 src/DB/migrations/00_00_00_create_tables_shop.php332

Multi-Store Isolation

The admin customer management system enforces strict multi-store isolation. All queries automatically filter by session('adminStoreId') to ensure administrators only see customers belonging to their assigned store.

Store Filtering Implementation


Implementation Examples:

  • getCustomerAdmin: Lines 22-26 - ->where('store_id', session('adminStoreId'))
  • getCustomerListAdmin: Line 55 - ->where('store_id', session('adminStoreId'))
  • getListAll: Line 136 - ->where('store_id', session('adminStoreId'))

This ensures that in a multi-vendor marketplace, vendor administrators can only access their own customers, while root store administrators (if configured) could potentially access all customers.

Sources: src/Admin/Models/AdminCustomer.php20-26 src/Admin/Models/AdminCustomer.php48-73 src/Admin/Models/AdminCustomer.php133-140 src/DB/migrations/00_00_00_create_tables_shop.php340

Template Customization

The account management views utilize a template processing system to allow for customization of the UI. This is implemented through the gp247_shop_process_view() function.


Sources: src/Views/front/account/change_infomation.blade.php10-13 src/Views/front/account/change_password.blade.php9-12 src/Views/front/account/update_address.blade.php11-14

Integration with Custom Fields

The system also supports custom fields for customer profiles, which are rendered through a dedicated template inclusion.


Sources: src/Views/front/account/change_infomation.blade.php256-260

Multilingual Support

The account management system provides multilingual support through the gp247_language_render() function, which translates field labels and button text according to the current language setting.

Sources: src/Views/front/account/change_infomation.blade.php22 src/Views/front/account/change_password.blade.php22 src/Views/front/account/update_address.blade.php23