Ecomail
Ecomail connects yStore to Ecomail, a CZ/SK email marketing service. It keeps a mailing list on the connected Ecomail account in sync with store activity: a customer is automatically subscribed and tagged when they sign up and again when one of their orders is fulfilled, with tags reflecting purchase value and product category.
Key features
- Automatic contact sync on customer sign-up and on order fulfilment, each independently toggleable.
- Configurable tags: a base sign-up tag, a base purchase tag, an optional high-value tag applied once an order's grand total reaches a configurable threshold, and a per-product-category tag (one tag per purchased product type, using a configurable prefix).
- A single Ecomail mailing list ID to sync contacts to, overridable per site on multi-site installs.
- CP dashboard showing the Ecomail connection status, the number of mailing lists on the account, and a per-list subscriber overview.
Requirements
- Craft CMS 5+.
yui/craft-plugin(yStore) ^2.yui/craft-core^1.- An Ecomail account with an API key.
Installation
Install through Composer, using the credentials granted by your yStore license:
composer require yui/craft-ecomail
Then enable the plugin from Settings → Plugins and configure the API key and mailing list under Ecomail → Settings -- see Settings.
How contact sync works
- Customer sign-up. When a customer registers, if Sync on customer sign-up is enabled, the plugin subscribes the customer's email to the configured mailing list and applies the Sign-up tag.
- Order fulfilment. When an order is fulfilled, if Sync on order
fulfilment is enabled, the plugin subscribes the ordering customer's
email to the same list and applies:
- the Purchase tag,
- the High-value tag, if the order's grand total is at or above the configured High-value order threshold (the tag is skipped entirely if no threshold is set),
- one tag per purchased product category, built from the Product
category tag prefix and each line item's product type handle (e.g.
category-electronics).
- Both sync points reuse the same mailing list (Mailing list ID); a
contact can end up with tags from both a sign-up and one or more
fulfilled orders over time, since Ecomail's
subscribecall updates an existing subscriber rather than replacing them.
A sync is skipped silently (no error surfaced to the customer or the order) whenever the plugin is disabled, the relevant sync toggle is off, no mailing list ID is configured, or the record has no usable email address; failures calling the Ecomail API are logged rather than raised to the storefront/CP request that triggered the sync.
Admin / Craft CP
The plugin adds an Ecomail navigation item to the Craft control panel with two pages:
| Page | Purpose |
|---|---|
| Dashboard | Connection status (API key configured / connection test result), the number of mailing lists on the account, and a list-by-list subscriber overview. |
| Settings | API key and contact sync configuration -- see Settings. |
Developer notes
- Services (available on the plugin instance as
Yui\Ecomail\Plugin::getInstance()->...):getApi()(connection test, list lookup),getClient()(rawEcomailClientHTTP wrapper for the Ecomail API v2),getContactSync()(ContactSyncService, the sign-up/ order-fulfilment sync logic),getDashboard(),getLicense(). - Events consumed. Contact sync listens for yStore's own core events:
CustomerService::EVENT_AFTER_CUSTOMER_SIGN_UPandOrdersService::EVENT_ORDER_FULFILLED. Listeners are only registered when the plugin is enabled and the request is not a console request. ContactSyncServiceexposessyncSignUp(int $customerId, string $email)andsyncOrderFulfilled(int $orderId), plus the pure tag-building helpersbuildSignUpTags()andbuildOrderTags(), which can be called directly to preview what tags a given order/settings combination would produce.EcomailClientwraps the Ecomail API v2 (https://api2.ecomailapp.cz):getLists(),getList(),getSubscriber(),subscribe(),unsubscribe(),deleteSubscriber(), andtestConnection(). It also exposessendTransactionalEmail()for the Ecomail transactional email endpoint, but no plugin feature calls it yet as of this release -- transactional email delivery is a separate, not-yet released integration and is not covered by this documentation.- Site-level settings.
apiKeyandcontactSyncListIdare site-overridable (Settings::siteOverridableAttributes()); the rest of the contact-sync configuration (toggles, tags, threshold) is shared across sites.