I am building a simple email module where I want to list the line items of a deal.
I have set up a workflow to update 3 custom properties of a deal with Line Items Name, Price, Quantity, but I separate them by ‘;’ so far the workflow worflow works fine, I get values like this:
Property name: custom_line_items_name
Value: name1;name2;name3
Property name: custom_line_items_quantity
Value: 1;1;1
Property name: custom_line_items_price
Value: $30;$35;$40
When I get these values in the email module by this refference
deal.custom_line_items_name
deal.custom_line_items_quantity
deal.custom_line_items_price
I get the same values as above witch is what I want.
The problem arrives when I try to split them by ‘;’ and loop them though to place them correctly in a table. it seems that the split filter does not work at all, and neither replaceing the ‘;’ with something else, Anyone can help?
Below is the code I use:
{% set line_items_raw = deal.custom_line_items_name|string|trim %}
{% set quantities_raw = deal.custom_line_items_quantity|string|trim %}
{% set prices_raw = deal.custom_line_items_price|string|trim %}
{% set line_items = line_items_raw|split(‘;’) %}
{% set quantities = quantities_raw|split(‘;’) %}
{% set prices = prices_raw|split(‘;’) %}
The values I get from all the sets are similar to the ones without spliting at all.