Skip to main content
Version: 2.0.0

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

  1. 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.
  2. 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).
  3. 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 subscribe call 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:

PagePurpose
DashboardConnection status (API key configured / connection test result), the number of mailing lists on the account, and a list-by-list subscriber overview.
SettingsAPI 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() (raw EcomailClient HTTP 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_UP and OrdersService::EVENT_ORDER_FULFILLED. Listeners are only registered when the plugin is enabled and the request is not a console request.
  • ContactSyncService exposes syncSignUp(int $customerId, string $email) and syncOrderFulfilled(int $orderId), plus the pure tag-building helpers buildSignUpTags() and buildOrderTags(), which can be called directly to preview what tags a given order/settings combination would produce.
  • EcomailClient wraps the Ecomail API v2 (https://api2.ecomailapp.cz): getLists(), getList(), getSubscriber(), subscribe(), unsubscribe(), deleteSubscriber(), and testConnection(). It also exposes sendTransactionalEmail() 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. apiKey and contactSyncListId are site-overridable (Settings::siteOverridableAttributes()); the rest of the contact-sync configuration (toggles, tags, threshold) is shared across sites.