Extending the shop
This part is for developers who need the shop to do something it does not do out of the box. The Exponential shop is
built around replaceable handlers: a setting names a handler, the kernel finds its file by a naming convention and
calls it in place of its own. Everything on these pages goes into an extension of your own, never into kernel/.
Contents
All extension points
| Extension point | Selected by | File in your extension | Page |
|---|---|---|---|
| Shipping handler | shop.ini [ShippingSettings] Handler, ExtensionDirectories[] | shippinghandlers/<name>shippinghandler.php | Custom shipping handler |
| VAT handler | shop.ini [VATSettings] Handler, ExtensionDirectories[] | vathandlers/<name>vathandler.php | Custom VAT handler |
| Payment gateway | an active extension, or paymentgateways.ini | classes/<extension>gateway.php | Payment gateway development |
| Shop account handler | shopaccount.ini [AccountSettings] Handler, [HandlerSettings] ExtensionRepositories[] | shopaccounthandlers/<name>shopaccounthandler.php | Shop account handlers |
| Basket info handler | shop.ini [BasketInfoSettings] Handler, ExtensionDirectories[] | basketinfohandlers/<name>basketinfohandler.php | Basket info and confirm order handlers |
| Confirm order handler | shopaccount.ini [ConfirmOrderSettings] Handler | confirmorderhandlers/<name>confirmorderhandler.php | same |
| Exchange rates handler | shop.ini [ExchangeRatesSettings] ExchangeRatesUpdateHandler, ExtensionDirectories[] | exchangeratehandlers/<name>/<name>handler.php | Exchange rate handlers |
| Price datatype | site.ini [ShopSettings] ProductDatatypeStringList[] | datatypes/<name>/<name>type.php | Custom price datatypes |
| Workflow event | workflow.ini [EventSettings] | workflowtypes/event/<name>/<name>type.php | Workflows on shop triggers |
The handler pattern
- A setting names the handler, for example
Handler=mystore. - The kernel searches the repository directories and the listed extensions for
<name><suffix>.php. - It includes the file and instantiates
<name><Suffix>, for examplemystoreShippingHandler(PHP class names are not case sensitive, soMyStoreShippingHandlerworks too). - If the file is missing, an error is written to the debug log and the kernel falls back or does nothing; it does not stop the request. Check the log after every change.
The RAD tool Setup > RAD has a handler wizard (setup/handlerextension/<kind>) with recipes for payment gateways,
VAT, shipping, basket info and exchange rate handlers; it writes the class, the setting and an extension around them
(Extensions).
A payment gateway made by the wizard is written to extension/<name>/paymentgateways/<alias>/classes/<alias>gateway.php,
the path the gateway loader reads through paymentgateways.ini [PaymentGatewaySettings] GatewaysDirectories[]. A
gateway generated before 6.0.15 sits one level higher and is not loaded: move it as the
RAD extension points note explains.
Packaging
- One extension per store or per integration, for example
mystore_shop, with its ownsettings/*.ini.append.php(Packaging as an extension). - Regenerate autoloads after adding classes (
php bin/php/ezpgenerateautoloads.php -e) and check that every class loads (php bin/php/checkclasses.php --quiet-ok). - Keep provider credentials out of the extension: read them from
settings/override/(Environment settings and secrets). - If the extension is useful to others, consider contributing it back.
Testing an extension of the shop
- Unit tests for calculations (shipping, VAT) without a database: DB-less PHPUnit tests.
- A full test order for each path the extension changes: Testing a store.
- The Store dashboard's "How your shop works" after deployment: it names the handlers and workflows in effect.
Related pages
- Developer path
- Extension anatomy
- Settings and ini files
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
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.