Automatic discount based on customer discount-level with set amounts per product

What I want to do is add the amount to the ticket tag instead of just replacing it like now.
But I think the dynamic parameter construction still doesn’t work as it should.
This is what I have now:

[=TN(’{TICKET TAG:D{ENTITY DATA:客人:Discount-level}}’)+(TN(’{ITEM TAG:D{ENTITY DATA:客人:Discount-level}}’) * {QUANTITY})]

But it’s still just replacing the value of the Ticket tag instead of adding to it…
It seems like the ticket tag is still not being used (=0) in the action parameter. Same thing as in the ShowMessage, it works for ITEM TAG but not for TICKET TAG…

I just realize I’m doing it all wrong anyway!
I wanted to follow the outline I described before:

  • whenever an order is added to the ticket
    – you get the amounts for each discount-level, and add them to a program setting or ticket tag
    – if there’s already a customer entity linked to the ticket, you apply the appropriate discount to the ticket, based on the customer’s custom data
  • whenever an order is removed from the ticket
    – you get the amounts for each discount-level, and distract them from the program setting or ticket tag
    – if there’s already a customer entity linked to the ticket, you apply the appropriate discount to the ticket, based on the customer’s custom data
  • when the Ticket Entity Changed event is fired:
    – if there’s a customer entity, you apply the appropriate discount to the ticket, based on the customer’s custom data
    – if there’s no customer entity (the customer has been removed), you discard any ticket discount that was already there

So obviously I have to take the discount for every discount-level!
I think I’m too tired, I’m really messing up now!

This is what I should have done from the start:

and that works perfectly!

1 Like

… and I immediately see another problem, which I already had before, trying to implement something else (which is when I first started thinking I need an order looper):
I cannot catch the clicking of the plus and minus sign to increase/decrease the order quantity, so this method is again going to be useless…

So it’s back to start again…

Cumulative Tag working using Update Program Setting:


SettingName: D{ENTITY DATA:Customer:DiscountLevel}
SettingValue: [=TN('{ITEM TAG:D{ENTITY DATA:Customer:DiscountLevel}}')*{QUANTITY} +TN('{SETTING:D{ENTITY DATA:Customer:DiscountLevel}}')]

TagName: D{ENTITY DATA:Customer:DiscountLevel}
TagValue: [=TN('{SETTING:D{ENTITY DATA:Customer:DiscountLevel}}')]

Yes, but no matter how you do it, the problem is still:
You need to add to the number every time an order is added or increased, and distract when an order is removed/cancelled/voided/decreased. Most of these are not a problem, but the increase/decrease order quantity (plus and minus sign) cannot be caught with an event, so it’s impossible to implement this way…

I had the same problem here:

and found nothing to solve that then…

Pfffffffffffffffffffffffffffffff…

Order looper where are you? :smile:

1 Like

Try handling Ticket Total Changed Event… it is raised on click of +/-.

Your method looks cleaner, even if it is not dynamic, it is easier to understand.

1 Like

Any idea how to get the selected order’s price in the Ticket Total Changed rule?
I tried {PRICE}, but that just shows “{PRICE}”…

This might work…

[=Order.Model.GetVisiblePrice()]

This should work in certain cases too…

[=Order.Price]
1 Like

I’m not sure how to use Ticket Total Change to detect that the plus/minus buttons have been pressed.

I first thought something like this:
if [:TicketTotal] Equals [:PreviousTotal] - {PRICE}
then
[=TN(’{TICKET TAG:D1}’)-TN(’{ITEM TAG:D1}’)]
[=TN(’{TICKET TAG:D2}’)-TN(’{ITEM TAG:D2}’)]
[=TN(’{TICKET TAG:D3}’)-TN(’{ITEM TAG:D3}’)]

if [:TicketTotal] Equals [:PreviousTotal] + {PRICE}
then
[=TN(’{TICKET TAG:D1}’)+TN(’{ITEM TAG:D1}’)]
[=TN(’{TICKET TAG:D2}’)+TN(’{ITEM TAG:D2}’)]
[=TN(’{TICKET TAG:D3}’)+TN(’{ITEM TAG:D3}’)]

… but that could also be another order added to the ticket…

Hmm…
[=Order.Model.GetVisiblePrice()] and [=Order.Price]
both show 0

Maybe the order data is just not accessible in Ticket Total Changed?
EDIT: they’re also not accessible when I add an order (and Ticket Total Changed is also triggered)

Yah, that appears to be the case… even {ITEM NAME} isn’t available, so we can’t tell which Product is being updated.

The +/- buttons have always been a strange one to capture with meaningful data… it was worth a shot.

I think @emre was planning to throw them out anyway, or was that only the select/change entity buttons?

We need an Order Looper… I’m not happy with storing these as Ticket Tags in the first place - they should be Order Tags instead.

1 Like

That would definitely be the best… But it’s probably not an easy feat, since @emre is staying very quiet about it…

Yes, @emre has mentioned getting rid of some of the hard-coded buttons, such as Change Price, maybe Ticket Note… not certain what his plans are for +/-.

You can already hide the Select Entity buttons if you don’t map them to the Ticket Type

… and this has something to do with Entities too, but I haven’t played with it…

I see… Is there a way to add them again with an automation button then?

Yes, with Change Ticket Entity Action… a bit of a hidden feature:

Nice!
Does that mean you can open new tickets without having to close (and lock) the previous ticket?
Or will this just change the table for the current ticket when you click on another table?