Skip to main content

GreenTree ⇄ Magento Integration

This is the technical reference for the Ecommistry_GreenTree Magento module (app/code/Ecommistry/GreenTree/), which synchronises data between RLB's Magento (Adobe Commerce) storefront and the MYOB Greentree ERP.

The documentation is authored directly from the module source. Every claim links back to a concrete file or class under app/code/Ecommistry/GreenTree/.

What the integration does

The module runs two independent, one-directional pipelines that together give a bidirectional sync:

DirectionEntitiesTriggerQueue table
Greentree → MagentoProducts, images, product links, customers, prices / custom products, stock, order status back-syncConsole commands + hourly crongreentree_to_mage_queue
Magento → GreentreeSales orders (B2B & B2C)Order events + console commandmage_to_greentree_queue

Each pipeline is a two-phase, queue-backed flow:

  1. Fetch / capture and enqueue — pull records from the source system (or capture a Magento event) and write a JSON message row into the relevant queue table.
  2. Process / apply — read queued rows in batches and apply them to the destination system, tracking attempts and status per row.

Module facts

  • Module name: Ecommistry_GreenTree (registration.php, etc/module.xml).
  • Module dependencies (sequence): Magento_Catalog, Magento_Customer, Magento_Company (etc/module.xml).
  • File count: 112 PHP/XML files.
  • HTTP client: Model/ApiClient.php — talks to the Greentree REST endpoint through the Ecommistry\GreenTreeLibrary SDK.
  • Command dispatch: a lightweight Command/Handler pattern driven by Model/Command/CommandBus.php.

Documentation map

PageContents
ArchitectureModule layout, bidirectional-sync model, Command/Handler + CommandBus pattern.
Greentree → MagentoProducts, images, links, customers, prices/custom products, stock; the console commands and cron that drive them.
Magento → GreentreeOrder push; observers on checkout_submit_all_after (B2B) and sales_order_invoice_pay (B2C).
API clientGreentree endpoints, auth, request/response shapes.
Admin configurationsystem.xml fields and the config readers that consume them.
Data modelBoth queue tables, the log table, the order-dictionary table, statuses and retry handling.
Console commandsThe ~14 CLI commands, their arguments, and cron cadence.
Field & entity mappingMagento ↔ Greentree attribute and field mapping tables.
Scope

This is the technical reference only. Non-technical guides are tracked separately (RLB-28), and the Docusaurus site scaffolding — which renders these pages — is provided by RLB-29.