Created by potrace 1.16, written by Peter Selinger 2001-2019

Miva Developer Docs

Values are computed by scheduled tasks. Data Builder doesn’t install any; create them for each field, or let a ready-made provisioning file create them.

The task settings#

Create a task under Settings > Store Settings > Scheduled Tasks:

Setting Value
Module MivaLabs Feed Builder
Operation Recompute Data Builder Field
Data Builder The field this task computes
Generation Queued Records or All Records (whole-store refresh)
Generation What a run does
Queued Records Computes the records waiting in the field’s queue: the ones that changed
All Records (whole-store refresh) Queues every record, then computes them

Two tasks per field#

Use two tasks for each field:

Task Generation Enabled Trigger Used for
Update X Data (Queued Products) Queued Records Yes The field’s trigger name Recomputing changed products, and finishing a refresh
Rebuild X Data (All Products) All Records No None The first fill, and a whole-store refresh after you change the mapping

The All Products task stays disabled. Run it by hand: select it under Scheduled Tasks and click Run Scheduled Task(s).

How a refresh runs#

Each run works for up to 4 minutes, or less if the request would time out first. A large catalog takes several runs.

  1. The All Products task queues every record, then computes for 4 minutes.
  2. If records are left, it fires the field’s trigger. That starts the Queued Products task.
  3. The Queued Products task computes for 4 minutes and fires the trigger again, until the queue is empty.

So the Queued Products task running right after the All Products task is expected. The refresh is done when the Queued Products task stops starting itself. On a test store with 56,983 products and variants it took about 11 minutes.

Running the All Products task again during a refresh doesn’t start over. It continues the refresh already in the queue.

Product changes made during a refresh are computed first.

Triggers#

The field’s Trigger (on the field’s Settings tab) and the Queued Products task’s Trigger must be the same name, for example google_merchant_data_trig. The module fires it:

  • when a product, its stock, variants, images or category assignments change
  • at the end of a task run that left records in the queue

Each distinct trigger name fires once per change, even if several fields share it.

If the field has no Trigger, nothing starts the Queued task. Changes wait until the task runs on its own schedule.

Mapping changes#

A task run first copies the field’s latest saved settings, so a mapping changed by a provisioning import is used on the next run. Changing the mapping doesn’t recompute stored values. Run the All Products task to apply it to every record.

Refresh All Records#

Refresh All Records on the field’s Settings tab also starts a refresh when you click Update. It queues every record and fires the field’s Trigger, so the Queued Records task computes them. A field without a Trigger waits for its task to run.

Changes that queue a product#

Change Queues
Product added, edited or copied That product
Product made inactive Deletes its stored values
Product or category deleted Deletes its stored values
Category assignment added or removed That product
Stock count or product inventory settings changed, including by orders and imports That product, and the products that use it as a variant part
Variants added, changed, generated or deleted That product and its variant parts
Product image added, changed or deleted That product and its variant parts
Category added or edited That category, for category fields

These don’t queue anything: store-wide inventory settings, price group changes, attribute edits, and renaming or moving a category (which changes product Category Paths). Run the All Products task after changes like these.