VolumePrices transformer

Prepares volume prices for storing it in spy_price_product_store.price_data column:

  1. JSON-decodes data inside fromField

  2. Encodes it in a new JSON inside of the volume_prices key

  3. Stores it to the toField.

Source data:

[{"quantity":5,"net_price":400,"gross_price":480},{"quantity":10,"net_price":350,"gross_price":420},{"quantity":20,"net_price":250,"gross_price":300}]

Usage:

<volume-prices from="price_data.volume_prices" to="prices.priceData"/>

Target data:

{"volume_prices":[{"quantity":5,"net_price":400,"gross_price":480},{"quantity":10,"net_price":350,"gross_price":420},{"quantity":20,"net_price":250,"gross_price":300}]}

Attributes:

  • from - name of the field to get volume prices (JSON)

  • to - name of the field to set price data (JSON)