Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,155 of 9,155 pages
About the help in other languages
All help pages

Shop account handlers

Writing a shop account handler for an Exponential store to collect different customer data at checkout - the five methods, how data is stored with the order, the form view and templates, registration in shopaccount.ini…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/e-commerce/extending/shop-account-handlers.md

On this page

Shop account handlers

This page is for developers who need the checkout to ask for different customer data: a company name, a VAT number, a separate delivery address, a phone number. The shop account handler decides which form the customer fills in and how the order's customer data is read back. The shipped handlers are described in shopaccount.ini walkthrough.

Contents

  1. The five methods
  2. Where the data lives
  3. Writing one
  4. Registering it
  5. Checklist

The five methods

The shipped handlers in kernel/classes/shopaccounthandlers/ all implement:

MethodCalledReturns
verifyAccountInformation()On Checkout in the baskettrue if checkout can go on without a form
fetchAccountInformation( &$module )When verification failedRedirects to the form (or to sign in)
email( $order )Order mail, order list, customer listThe customer's e-mail address
accountName( $order )Order list, customer listThe customer's name
accountInformation( $order )Order view, receipt, mail templatesAn array of the customer's data

eZShopAccountHandler::instance() (kernel/classes/ezshopaccounthandler.php) loads the handler named in [AccountSettings] Handler, as class <name>ShopAccountHandler, falling back to eZDefaultShopAccountHandler.

Where the data lives

The ezuser, ezsimple and bcusauser handlers keep the form's data in the order itself, as XML in ezorder.data_text_1, and parse it back in email(), accountName() and accountInformation(). Keeping the data in the order means it stays as entered even if the customer's account changes later. bcusauser shows how to add fields on top of an existing handler with almost no code: it extends eZUserShopAccountHandler.

Writing one

  1. Copy the form view you start from: shop/userregister creates the temporary order and stores the XML (kernel/private/classes/views/shop/userregister.php). Put your own view in your extension's module, with the extra fields, validation and the same order creation.
  2. Write the handler: fetchAccountInformation() redirects to your view; email(), accountName() and accountInformation() read your XML, including the new fields.
  3. Templates: the order view and receipts include an account template per handler from design/standard/templates/shop/accounthandlers/ (html/ and ascii/); add yours in your design.
  4. If VAT depends on the country, give the form a country field and keep it where eZVATManager finds it (Product categories and VAT rules).

Protect the form like any form (Forms, CSRF and HTTP input) and keep only the data you need (GDPR requests).

Registering it

# extension/mystore_shop/settings/shopaccount.ini.append.php
[HandlerSettings]
ExtensionRepositories[]=mystore_shop

[AccountSettings]
Handler=mystore

with the class in extension/mystore_shop/shopaccounthandlers/mystoreshopaccounthandler.php. The ezauthorize extension ships an example of this layout (shopaccounthandlers/ezcustomshopaccounthandler.php).

Checklist

  • To do: Guest and signed-in checkout both reach the confirmation page.
  • To do: Every new field appears in the order view, receipt, order mail and customer list.
  • To do: Old orders made with the previous handler still display.
  • To do: Invalid input is refused with a clear, accessible message (Store accessibility).

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x