Sum Of Product Tag

I have a product tag named NumOfItems for all of my products which has a number. This represents the number of items are in that product, i.e chicken balls will have 2 in that field for the sauce and the chicken balls.

Just wondering if I can get the sum of this field to print on the printer templates.

Sorry if this has been asked before.

Show a screenshot of your Product.

Create a mockup of what you want to see on the Print.

You can see I have the product tag with “Items”
Lets say chicken balls and Pork Curry was ordered on one order I need to print the total be 3, because chicken balls has 2 Items and Pork Curry Has 1 Item.

First of all you need to store quantities within orders. After that you can use Ticket Expressions to calculate totals. For example we can use Order State Values for that. I think this is an undocumented feature so let me explain that.

Create an action to update Order State Value. I’m using a state named as RQuantity, state is Quantity and state value will taken from Product Tag.

Execute this when an order is added to ticket.

Now when you add an order you should see item counts under order lines.

To print totals you can use {TICKET ORDER STATE VALUE TOTAL EXP:RQuantity} tag to read sum of items.

5 Likes

I have implemented your suggestion but when there is more than one of a product ordered it does not count the other product.

Should be 4 not 3

Please show your sceenshot like this with Administrator account

For the above I have two portions of chicken balls.

Each portion has 2 items, sauce and the chicken.

If there are two portions the quantity is meant to be 4.

In Update Order Quantity Tag action, multiply item tag with quantity.

[=TN (’{ITEM TAG:Items}’) * TN (’{QUANTITY’}’)]

Can you show me where to put that please

In the action you have which is setting your quality state value.

Here:

Thanks I think there is one more step because the quantity does not update when I use the increase + button

It wont update if you use those buttons. Those buttons are only for updating actual product not states. Your not using products… your using states.

If you use correct calculation on template of qty X tag state value it doesn’t matter, the state is a ‘per product’ value which will be multiplied on the print…

1 Like