0

Field Map to add attribute to array

I am trying to add a field to each product in the products array (coming from Zoho CRM).

I have tried the following in the "products" attribute of the field map but can't seem to output the result in an array so that the merge will complete:

[
{foreach from=$products item=product}
{
  "Discount": "{$product.Discount}",
  "DiscPcnt": "{math equation="(x / y) * 100" x=$product.Discount y=$product.unit_price format="%.2f"}",
  "Tax": "{$product.Tax}",
  "book": "{$product.book}",
  "id": "{$product.id}",
  "line_tax": "{$product.line_tax}",
  "list_price": "{$product.list_price}",
  "net_total": "{$product.net_total}",
  "product": "{$product.product}",
  "product_description": "{$product.product_description}",
  "quantity": "{$product.quantity}",
  "quantity_in_stock": "{$product.quantity_in_stock}",
  "total": "{$product.total}",
  "total_after_discount": "{$product.total_after_discount}",
  "unit_price": "{$product.unit_price}"
},
{/foreach}
]

I know i'm close but just need that last finishing touch.

1 comment

Please sign in to leave a comment.