Promotion Set by Quantity Issue

ok so this is what i want to achieve
1 bottle = 38
if 2 bottle purchased
2 bottle = 70

so any link for reference

I have not looked into this since september and I was not planning on using it so I have no data to show you atm. If I were building it I would probably start with a Custom Product Tag called Promotion X or something similar. I would flag it as Y or N and then write the constraint so it flags the item based on QTY when order added. I would then use a constraint that looks for that flag and update order for price if it is Y.

Heck might use states for this…Order states might work better. Lots of options. I really do not want to spend time building it atm because its not something I am using.

ok i understand…can i know how can i subtract from the Visible price

like
[={PRICE} - 8]

[=F(TN('{PRICE}')-8)] Should work Maybe just [=TN('{PRICE}')-8] will work I cant remember exactly.

ok thanks i will try and let you know then

in this post i asked about that

if you finally get it, plese guide me to do it too

It was working just fine for me when I was playing with it back in September… I did not save it because I do not use it. But I do not see any reason why it cant be done now. Matter of fact I am confident it can be done. Put your heads together and start trying some stuff I can help you through the process if you provide some details of what you have gotten so far

2 Likes

@kendash i have try your approach
its working if i put 2 only but by pressing twice the menu button


not if i add quantity 2 from numberpad

then i wanted to use another approach
count the quantity of product and if divisible by 2 reduce the price


in this scenario if i add 1 quantity it will reduce the prize and if i enter 2 no action taken

How to use MOD (%) operator in Constraint?

using this:
input 1
output: 1

trying to multiple of 2

Understand that you need to make some kind of comparison in order for a Constraint to work, which you are not currently doing. Since the Mod operator will return the REMAINDER of a division, your Constraint could be this…

[=TN('{TICKET QUANTITY SUM:White Wine}') % 2] == 0

or depending on what you’re going for, inversely, this:

[=TN('{TICKET QUANTITY SUM:White Wine}') % 2] != 0

EDIT: a safer comparison might be to not use the Mod operator (%) at all, and instead use the Integer Division operator (\), and compare it against the Regular Division operator (/):

[=TN('{TICKET QUANTITY SUM:White Wine}') / 2] == [=TN('{TICKET QUANTITY SUM:White Wine}') \ 2]

Inversely:

[=TN('{TICKET QUANTITY SUM:White Wine}') / 2] != [=TN('{TICKET QUANTITY SUM:White Wine}') \ 2]

EDIT2: you can disregard the notion of using the Integer Division operator (\) since it does not seem to be available - it does not produce a result.

@emre, I remember you mentioning that you might be switching to a different Scripting Engine with expanded function support in some regard. Are there other functions we could use, like casting values, for example [=int(x/y)], or using something like Floor()?


EDIT3: this should do the trick:

[=FF('{TICKET TOTAL}','#')] … Strips decimal parts from numbers.

In your case:

[=FF((TN('{TICKET QUANTITY SUM:White Wine}')/2),'#')]

So you could compare decimal division to “integer” division like this:

[=TN('{TICKET QUANTITY SUM:White Wine}') / 2] == [=FF((TN('{TICKET QUANTITY SUM:White Wine}') / 2),'#')]

Inversely:

[=TN('{TICKET QUANTITY SUM:White Wine}') / 2] != [=FF((TN('{TICKET QUANTITY SUM:White Wine}') / 2),'#')]

The message below shows:

Quantity (Q): 5
Divide Decimal (Quantity/2) (D): 2.5
FF(Q/2,'#') (I): 3

Q:[=TN('{TICKET QUANTITY SUM:Cookie Signature}')] D:[=TN('{TICKET QUANTITY SUM:Cookie Signature}')/2] I:[=FF((TN('{TICKET QUANTITY SUM:Cookie Signature}')/2),'#')]
1 Like

thanks @QMcKay after posting i realized i had to make a comparison but didnt get the time to work on it.

thankyou for providing different solutions but i need to know integer division returns an integer after rounding the quotient?

i will work on it later and will update

I would try the above as a constraint. It is essentially testing “decimal” division against “integer” division. If "decimal" == "integer" then you have a Quantity that is evenly divisible by 2, so you would apply the discount. If they are not equal, the Action will not fire, meaning that the Quantity is not evenly divisible by 2.

@QMcKay now that i have tried this the same problem that i was facing earlier with different method exists

that is if i enter White Wine five times the effect doesnot take place
and if enter 5 from numberpad the constraint is working

maybe refresh ticket might work here let me try!!!

no it didnt

i think it need a counter to know how much quantity has been ordered

the TICKET QUANTITY SUM tag doesnot seem to work on entering X times the product

I have to guess there is something else going on with your Rules and Actions for the effect you are trying to achieve. In basic theory, it works just as expected, no matter if you add 1 item at a time, or 4x Items. The Tag {TICKET QUANTITY SUM:X} appears to work properly in either scenario.

These screenshots show it functioning properly:

  • add 1 item … Quantity 1 … not divisible by 2
  • add 1 item … Quantity 2 … divisible by 2
  • add 3 item … Quantity 5 … not divisible by 2
  • add 3 item … Quantity 8 … divisible by 2

promo:
1 bottle = $5
5 bottle = $24

rule

action:

hmmm there was some problem in action i had the calculate price set to true

but i still facing problem for setting the price

as you can see if i enter quantity from numberpad it will calculate properly
if i add product it will only change the price on the last item

how to tackle this?

Ok, so yes, you will need a little more configuration for this to work as you want it to, because when you add 1 item at a time, it will not change the price of any of the previous items.

You will to need to use Order States and discounting Order Tags to accomplish this, rather than trying to use a simple Price Change. The setup is quite a bit more complex, but it can be done… I know this from some things I learned when putting together my Happy Hour and VIP Discounts.

I can try to put something together for you, but it won’t be today. So for now, you can try to study the methodology that is discussed in the above Topic. When you understand how it works, you will understand why you need to use States and Tags to get your desired behavior. When you use States, you can check for Order State Changed Event and then apply Order Tag Discounts based on your chosen criteria, and it will “loop” through previous order lines accordingly and apply or remove the Tags.

ya understand need to keep track of the quantity…anyways i will wait for the solution thanks alot

For time being i am using this solution for the promotion
i am using two portions
1 Bottle
5 Bottle

there were some other method also as suggested in @juanpitti article

but i wanted to handle inventory also i preferred this way.