VIP & Happy Hour (or timed special) Discounts without Triggers

@QMcKay we have CSETTING (cached setting) tag that works like SETTING but keeps value in cache until cache resets. It might be better to read setting values that does not change during operation like HHEndTime with CSETTING as it will prevent to execute an SQL script everytime SETTING gets read.

2 Likes

I just learned something…How long has that been available?

I think it is available for few months but I’m not sure about the exact date :slight_smile:

1 Like

Me and Q are going to hook your brain to a hidden feature discovery device one day.

3 Likes

lol I hope it doesn’t hurts. Once a friend offered me to wire my brain to a device and give electricity to improve my coding performance. He is a medical doctor and what he talking about is a medical device he invented… Guess what I did :slight_smile:

2 Likes

Hi Guys just to let you know have done it Here’s What i DID :-
Created afternoon HH

Then ADDED 2 more HH Store HH Day and Time to the HH Reset Day Time PriceList on App Started and Named them HHstartTime2 and HHendTime2.

Then Created a Second rule to match the first rule CD Update DiscountType State for HH 2 but changed the Constraints to HHstartTime2 and HHendTime2

Original…

Added…

Then amended Given Actions With - or [=TN(‘{SETTING:HHstartTime2}’)] and [=TN(‘{SETTING:HHendTime2}’)] inside HH Update PriceList and CD Check Order Time from VIP to HP and set HH or ND

‘{DATE:ddd}’==‘{SETTING:HHstartDay}’ && [=TN(‘{DATE:HHmm}’)]>[=TN(‘{SETTING:HHstartTime}’)] or [=TN(‘{SETTING:HHstartTime2}’)] && [=TN(‘{DATE:HHmm}’)]<[=TN(‘{SETTING:HHendTime}’)] or [=TN(‘{SETTING:HHendTime2}’)]

and thats it i Think - Done…

Thank you so much guys for putting me in the right Direction…

3 Likes

Where does the tutorial for “HH Store HH DateTime” action?, i have imported the through DB Tools but the such action doesn’t exist, neither does on tutorials above.

The Action is in the Tutorial here…

Name: HH Store HH Day and Time
Action Type: Update Program Setting
Setting Name: [:HHname]
Setting Value: [:HHvalue]
Update Type: Update
Is Local: False

1 Like

Thanks, so change all “HH Store HH DateTime” action into “HH Store HH Day and Time” in all rules?.

[Edit]
I answered myself sorry, so it’s on tutorial’s image it’s “HH Store HH Day and Time”.

hello @QMcKay
Very good tutorial, I followed every step of totorial for an hour and everything worked properly, but after an hour the configuration Happy Hour stopped working suddenly.
revised every configuration step by step, as explained by the toturial, but not managed by again running the Happy Hour.
can you help me
How do I force the startTime Manually?

You can set the start/end day and time in the Rule that you are showing, then exit SambaPOS and start SambaPOS again.

Alternatively, you may want to use User Login event rather than Application Started event, so that you just need to edit the start/end, then logout and login.

You could also put together another simple flow to prompt for the start/end time and store those values immediately without needing to restart or logout.

However, you need to keep in mind that any open Tickets will be affected by the change in time. This is because when you open an un-settled ticket, the implementation will cycle through each order on the ticket and change it’s discount state based on the start/end time that you have set compared to the Order Time. This is by design in the way the Tutorial is set up to work. If you want to arbitrarily change the time throughout the day, it will not work for you because of this.

1 Like

His Happy Hour design was to work with specific Times and Days. If you want a manual start stop Happy Hour then you need to configure it differently. You could configure it to be triggered with a button but it would require extensive redesign of rules and actions and it would essentially be a different tutorial and not part of this discussion.

1 Like

Thank you, I’ll follow these steps.

@QMcKay I tried several events name, such as: work period started, login and more … but still can not succeed, again I reviewed the whole tutorial, and I for sure I’m doing everything right, but not working.

help me

apologize for the captured photo in constraint is Matches and not Equal
by equal I tried to see if it works, but also does not work.

Put a Show Message action in that Rule to display something so that we know it is firing properly in the first place. If it is, then we can go from there.

If not, you need to consider changing the constraints (i.e. why are you constraining to Administrator only? Just curious.)

Message:

HH BEG:{SETTING:HHstartDay} {SETTING:HHstartTime}\rHH END:{SETTING:HHendDay} {SETTING:HHendTime}

2 Likes

Btw if you want it running every day then no need to constrain it to days also no need to store day just do time.

1 Like

Wok Perfect

Right, so your constraint for Mon|Tue|Wed, etc would have held it back from firing, since the day is shown as “ter”, not “Tue”.

the problem is in constraint.
when I remove constraint, everything works perfect.