Skip to content

8. Magento sync

LexiScor does not own the book catalog. The source of truth for books and the packages they belong to is the EDG Magento bookstore. The Magento Sync page at /admin/magento-sync is how you pull a fresh copy of that catalog into LexiScor.

You will run a sync whenever:

  • A new book has been added to the Editura Gama bookstore.
  • A book's metadata (title, cover, description, points, packages) has changed in the bookstore.
  • A new package has been published or an existing package has been rearranged.

What gets synced — and what doesn't

Synced Not synced
Book title, ISBN, cover image, description Quizzes (those live only in LexiScor)
Book class (clasa), module (modul) Quiz attempts
Book points value Anything pupils have done
Packages and which books belong to which packages Administrators

Quizzes are LexiScor-only content and are never affected by a sync — even if the bookstore is wiped, your quizzes stay safe.


How a sync behaves

Three important guarantees:

  1. Sync only adds and updates — it never deletes. If a book disappears from EDG, the LexiScor copy stays put (and so do its quizzes and attempts). This is intentional, to make sure historical data is never lost by accident. If you genuinely need to remove a book, do it manually with database tooling.
  2. Sync is idempotent. Running it twice in a row is safe; the second run sees that nothing has changed and reports zero updates.
  3. Sync is field-aware. When a book changes in EDG, only the fields that actually changed are written back to LexiScor — the audit trail shows you precisely what was different.

The Magento Sync page step by step

Recent syncs (top of the page)

If at least one sync has ever run, a card lists the most recent runs in reverse chronological order. Each row shows:

  • A green check or red ✗ icon (success or failure).
  • The exact time it ran and how long it took.
  • Which administrator triggered it.
  • Two count badges — "N created" and "N updated" — combining packages and books.
  • For failed runs, the underlying error message.

Triggering a new sync

A second card holds a single big Start Sync button. Click it and:

  1. The button changes to "Syncing…" with a spinning icon. The page stays on screen — do not refresh it. A typical sync takes anywhere from a few seconds to a couple of minutes depending on how much has changed.
  2. When the sync is done a green "Sync Complete" banner appears together with the duration.
  3. The summary card below shows two columns of counters:
Packages Books
Created 2 17
Updated 1 4
Unchanged 38 412
Total 41 433
  1. The View Details toggle expands the summary into a full field-by-field breakdown:
  2. Newly created packages and books are listed by name and ISBN/SKU.
  3. For updated rows, you see the field that changed and its previous value (e.g. "title changed from 'Vechi titlu' to 'Titlu nou'").

When a sync fails

If anything goes wrong (network error, EDG credentials expired, bookstore returned an unexpected response, etc.) the page shows a red alert box with the error message and the failure is recorded in the sync history.

The most common causes:

  • Bookstore credentials missing or wrong — check the production environment variables MAGENTO_API_URL, MAGENTO_API_USERNAME, and MAGENTO_API_PASSWORD.
  • Bookstore unreachable — the EDG site itself may be down or in maintenance. Wait a few minutes and try again.

A failed sync leaves the LexiScor catalog exactly as it was before the attempt, so retrying is always safe.


After a sync

  • Reload the Dashboard to see new packages and books appear.
  • For any new book you should now prepare and import a quiz — see Importing quizzes from Excel.
  • If a book's class, module or packages changed, the dashboard filters and groupings will reflect the new values immediately.

How often should you run a sync?

There is currently no automatic schedule — every sync is triggered manually from this page. As a rule of thumb:

  • Run one before preparing a batch of quiz imports for a new school module, so the right ISBNs are present.
  • Run one after the bookstore team confirms a catalog change.
  • A weekly sync during the school year is plenty for routine maintenance.