Trying to Multiply {ORDER STATE TOTAL:(My defined Order State}

Hi Guys hope you can help I am in the middle of setting up an employee discount system on Sambapos. Here is a a brief layout of how it works for me.

I have added a product tag for staff discount and its rate for example 10% or 25%.

I then created an order update status rule to mark items that needed to be discounted this all works fine.

I then use a update ticket calculation to total up the items all marked the same and minus a discount using this

{ORDER STATE TOTAL:defined state} this on its own will add up everything marked under my defined status.

I need to multiply this by 0.10 and 0.25 so that I can use the figure to calculate a fixed amount discount.

however whenever I type the following into the ticket calculation nothing happens.

{ORDER STATE TOTAL:SDRINK} * 0.10

(SDRINK is the status of all my orders that need to be discounted)

Have I got this wrong can somebody please advise me.

It might be better idea to show us how you use that (eg. the screenshot of the rule) but in general forcing it to process tag as a number with TN function might be needed.

[=TN('{ORDER STATE TOTAL:SDRINK}') * 0.10]
2 Likes

Hi Emre

Thanks for your reply.

Am I right in thinking that {ORDER STATE TOTAL:SDRINK} will just total all the orders that have the status SDRINK.

for example Ive got:

2 x Coffee (both with the status of SDRINK) 2.00 each

Order state total would be 4.00.

I then need to take that 4.00 and multiply it by .10 to work out the 10% discount.

When I tried you idea above it doesn’t do anything.

regards

craig

Hello craig.

It will be awesome if you can also let us know how you tried it :wink: I mean where you typed it? How did you configured your calculations? How you’re triggering it?

You have 2 mistakes.

  1. You can’t execute expressions in actions. You should type [:Discount Amount] to configure amount parameter as a variable.
  2. You need to edit rule that you execute that action from. First remove that action from your rule, save it and re-add this action. When you expand the action box you’ll see Discount Amount added as an editor under action.
  3. You’ll type your expression there but you also have a syntax mistake. You shouldn’t have curly brace in front of expression.
1 Like

My Friend many thanks for the help it works as I need I too however it has raised another issue.

It doesn’t apply any discount if there is only one item on the ticket it only activates after a second item it added.

Any ideas

Cheers

Craig

Whats your rule look like?

what would be the correct constraint to make this only execute when order status = SDRINK

Regards

Craig

How is the state being set?

I have a product tag that determines what level of discount either 10% or 25% and changes the order state to SDRINK for 10% and SFOOD for 25% when these items are ordered.

Doesnt seem right to me, whats the * 0.1 if its set in the state.
Show a products or two with the tag and the rule which makes the state.

the expression is working fine just doesn’t calculate discount if there is only one item on order.

Im just trying to work out your flow…