Hello everyone,
I am trying to create a "invoice" section with Couch.
I have set a mosaic with 2 tiles.
One being linked to some products in another page, and the other being to insert custom products with custom name, pricing and description.
I managed to make the calculation between all the fields to get the total of the invoice, with Javascript.
But I need to store the total amount in a couch variable to use it else where.
Here's the code I have right now for the operations :
Which outputs :
In my example. The plus signs are because I have added a "+" symbol avec each oprations in the captured variable, as you can see up there.
The code to ouput that line is :
Since there's multiple tiles in the same mosaic, I can't just do :
This would output "1050".
Because it only takes the first iteration of each tiles.
How can I make this work so that it ouputs the real total, which would be "1605.25", and store it in a couch variable?
I have worked on this for hours and can't figure it out.
Thanks a lot!
I am trying to create a "invoice" section with Couch.
I have set a mosaic with 2 tiles.
One being linked to some products in another page, and the other being to insert custom products with custom name, pricing and description.
I managed to make the calculation between all the fields to get the total of the invoice, with Javascript.
But I need to store the total amount in a couch variable to use it else where.
Here's the code I have right now for the operations :
- Code: Select all
<cms:capture into='operation_1' scope='global'>
<cms:show_mosaic 'invoice_content'>
<cms:if k_tile_name='invoice_items' >
<cms:related_pages 'invoice_product' >
<cms:mul product_pricing invoice_item_qty />+
</cms:related_pages>
</cms:if>
</cms:show_mosaic>
</cms:capture>
<cms:capture into='operation_2' scope='global'>
<cms:show_mosaic 'invoice_content'>
<cms:if k_tile_name='invoice_items_custom' >
<cms:mul invoice_item_pricing_custom invoice_item_qty_custom />+
</cms:if>
</cms:show_mosaic>
</cms:capture>
Which outputs :
- Code: Select all
50+ 55.25+1000+ 500+
In my example. The plus signs are because I have added a "+" symbol avec each oprations in the captured variable, as you can see up there.
The code to ouput that line is :
- Code: Select all
<cms:show operation_1/><cms:show operation_2/>
Since there's multiple tiles in the same mosaic, I can't just do :
- Code: Select all
<cms:set total="<cms:add operation_1 operation_2/>"/>
This would output "1050".
Because it only takes the first iteration of each tiles.
How can I make this work so that it ouputs the real total, which would be "1605.25", and store it in a couch variable?
I have worked on this for hours and can't figure it out.
Thanks a lot!