# Tracking Promotions by Points

**URL:** <https://forum.sambapos.com/t/tracking-promotions-by-points/860>\
**Category:** V4 Tutorial\
**Created:** [March 26, 2014, 11:53pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860 "2014-03-26T23:53:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [March 26, 2014, 11:53pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/1 "2014-03-26T23:53:43Z")

</div>

Hello. In this tutorial I’ll show you how to create points based promotions.

> - Upgrade to at least **4.1.27** version before starting this tutorial.
> - If you have [Database Tools Module](http://forum.sambapos.com/t/how-to-use-database-tools-module/851) you can simply use this import file for easily importing this configuration to your database. [Points\_Promotion.zip](https://forum.sambapos.com/uploads/default/original/3X/3/a/3a4a9a0e14d8a73417529462a06e588200ba7107.zip) (1.6 KB) Please test it first on a safe environment before merging it to your production database.
> - For the simplicity of this tutorial I’ve skipped **Rule Mapping** steps. After creating each rule, create a default mapping by adding a mapping line and leaving it unchanged.

##Earning Points

First we’ll start by creating a custom product tag. This tag will be named as `Points`

 ![](https://forum.sambapos.com/uploads/default/original/3X/9/5/9598c7b8198620a97c26d59a56381fdfcb14a8e4.jpeg) 

After saving it I can edit products and set promotion points. We’ll give free Coffee for 6 points.

 ![](https://forum.sambapos.com/uploads/default/original/3X/5/6/56ce2ea1f6528879db145029830f3f5fb9c92d95.jpeg) 

… and free Juice for 8 points.

 ![](https://forum.sambapos.com/uploads/default/original/3X/2/5/2507fda1aeaac51eaeb59362622eaf13d8b390c2.jpeg) 

I’ll create a custom field for `Customers` to store their points. To be able to do this I’ll add a custom field.

 ![](https://forum.sambapos.com/uploads/default/original/3X/0/8/08e7040bcd7708f42c6ecefb1554054b9c8ed745.jpeg) 

I need an action to increase customer points. I’ll use `Update Entity Data` action for this.

 ![](https://forum.sambapos.com/uploads/default/original/3X/9/8/9802f5ba21874d551ddf7e57ea23e19876db325e.jpeg) 

… and another one to decrease points.

 ![](https://forum.sambapos.com/uploads/default/original/3X/2/3/23b2cbe891a61c8a284699dcc776b98a6369e6ca.jpeg) 

I need to change promotion product’s order state to track from which products customer can earn points. I’ll use `Update Order State` action to mark an order so when ticket gets paid we’ll increase customers points by using this information.

 ![](https://forum.sambapos.com/uploads/default/original/3X/b/3/b34f09dc4f4ee4b833bc8121080dc8c2b37272f6.jpeg) 

We’ll use `Order Added to Ticket` rule to check product’s promotion points and if it is greater than 0 and if a customer is selected we’ll change order’s promotion state. We are using two step here because we won’t increase Customer Points immediately as order added to ticket. We’ll do it when ticket gets paid.

 ![](https://forum.sambapos.com/uploads/default/original/3X/4/9/49205a145d3812c8d1ab862759cd2fc1a8ba254c.jpeg) 

When ticket gets paid I’ll change promotion orders state from `Points` to `Earned`. I’m using `Ticket Payment Check` rule for this. So every orders that have Points state changes to Earned and we’ll update customer points.

 ![](https://forum.sambapos.com/uploads/default/original/3X/f/7/f7d48c3a36d81ea19fc554dad2c99476a159a115.jpeg) 

When an order’s state becomes `Earned`, `Order State Changed` event fires. I can handle it with a rule to increase customer points.

 ![](https://forum.sambapos.com/uploads/default/original/3X/d/a/dad1225546396de6ad6e3ddfdc12806486112fbe.jpeg) 

For every Coffee or Juice customer buys she’ll earn 1 point.

Let’s sell 2 Coffee and 1 Juice to a customer and check how Points data changes.

 ![](https://forum.sambapos.com/uploads/default/original/3X/4/4/44d434815ef5416746e83767a5a31fe7d0cb5d18.jpeg) 

Coffee and Juice state changes. Herbal Tea does not change since it is not included.

When I settle this ticket customer points increases to 3 as shown here. Every promotion products we sell increases points by 1.

 ![](https://forum.sambapos.com/uploads/default/original/3X/8/3/83fe8b01f8bcb1f429ba6e93086bc8b8f86af9cd.jpeg) 

##Using Points

On the next step I’ll create actions for giving free items.

I’ll start by creating an `Automation Command` for `Use Points` button.

 ![](https://forum.sambapos.com/uploads/default/original/3X/c/e/ce26b412ded8ac874a0b0fbbc20174d3e38c2c8e.jpeg) 

I’ll map this command to Order Lines that have `Points` state.

 ![](https://forum.sambapos.com/uploads/default/original/3X/d/2/d2dc72a080c168f40f9d49b850329651ffe61694.jpeg) 

Notice how I’m mapping this button to `Order Line` and make it visible for promotion orders by changing `Visible State` value to `Points`.

I’ll create two rules to handle this button. If customer points is less then promotion points we’ll display a warning. If customer have enough points we’ll gift that item.

Before creating rules I’ll create an action to display messages.

 ![](https://forum.sambapos.com/uploads/default/original/3X/3/5/35d38ea41335d39cacac25432a0fda9b3d88beac.jpeg) 

First rule will check if customer have enough points.

 ![](https://forum.sambapos.com/uploads/default/original/3X/0/d/0d5890e7f54b1f2b16a2026b576dc562ba7d6f6d.jpeg) 

`[={QUANTITY}*{ITEM TAG:Points}]` is a custom expression to multiply product promotion points with order quantity. If Customer wants to use her points for 2 free coffee she need to have 12 points since a single Coffee needs 6 points.

We’ll create another rule to apply points. This rule is a little crowded so I’ll add separate screenshots to show all action parameters.

First action will decrease `Customer Points` I’m using same custom expression to calculate exact points if order quantity is more than 1.

 ![](https://forum.sambapos.com/uploads/default/original/3X/6/2/62837e43d49800657fdb4b23927fd7c37ac99262.jpeg) 

Second action will change order to a free order. Nothing special here. We only need to change `Decrease` value to True and `Calculate Price` to False.

 ![](https://forum.sambapos.com/uploads/default/original/3X/b/1/b1326b934d917e2bf02a0534d31fe17b17b18848.jpeg) 

Third action will change order’s `Gift` state to `Promotion`. Since we immediately decrease customer points we need this operation to disable `Cancel Gift` command.

 ![](https://forum.sambapos.com/uploads/default/original/3X/2/7/276d21ad2236605150ec40a13759b8850578ac0b.jpeg) 

Final action will clear order’s promotion state. We’ll just leave all values empty.

 ![](https://forum.sambapos.com/uploads/default/original/3X/5/5/55c3a3e76c039d6fcea1e74febc2984472f6d502.jpeg) 

Let’s see how it works.

If you remember `Jane White` already have 3 points. We’ll add one coffee and click `Use Points` button.

 ![](https://forum.sambapos.com/uploads/default/original/3X/4/5/45eb469b83869e4a3edaf889cb1f1555ff6af7e1.jpeg) 

We can’t give free coffee since we need at least 6 points. If I sell more coffee to increase points and try to use this function it should change order to a gift.

 ![](https://forum.sambapos.com/uploads/default/original/3X/6/6/66cd0f8b784cabd2f64a9a1eed35f2e8b877a588.jpeg)

---

<div class="post-metadata">

**Author:** ![allmixedup](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@allmixedup](https://forum.sambapos.com/u/allmixedup)\
**Post date:** [May 11, 2014, 9:34pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/2 "2014-05-11T21:34:12Z")

</div>

Hi Emre

Very good detail Tutorial.

This was happened when i test this.

if i add product first to the order and choose customer later than it doesn’t add points to customer’s account. can we do anything for this? (choose customer at any time during the order)

how i can define different point for different product? right now they all get 1 point regardless of product price. i want to make 1 point for every $ customer paid.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [May 12, 2014, 11:46am UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/3 "2014-05-12T11:46:46Z")

</div>

@allmixedup I’ve enabled promotion tracking with customer selection to avoid useless tracking for tickets that you’ll never assign a customer. You can change this by removing second constraint check on `Order Added to Ticket` rule.

---

<div class="post-metadata">

**Author:** ![allmixedup](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@allmixedup](https://forum.sambapos.com/u/allmixedup)\
**Post date:** [May 12, 2014, 12:33pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/4 "2014-05-12T12:33:30Z")

</div>

Hi emre

How to set up different point for different product?

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [May 12, 2014, 12:37pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/5 "2014-05-12T12:37:41Z")

</div>

Tutorial already shows how to set up 6 points for Coffee and 8 points for Juice. You can change Points tag for other products.

Did you meant something different?

---

<div class="post-metadata">

**Author:** ![allmixedup](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@allmixedup](https://forum.sambapos.com/u/allmixedup)\
**Post date:** [May 12, 2014, 2:45pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/6 "2014-05-12T14:45:23Z")

</div>

HI Emre

Yes I mean add point ( if they buy coffee they get 1 point if they buy salad they get 4 point)

or can we set every $ they spent = 1 point added to the account? ( right now you set as Quantity if I understand right)

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [May 12, 2014, 4:09pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/7 "2014-05-12T16:09:52Z")

</div>

OK. This tutorial assumes customer earns 1 point for every promotion item they buy. You can create an additional product tag (for example **Reward** ) to configure how many points that product will add and change `Update Customer Points...` rule to `[=TN('{ITEM TAG:Reward}') * {QUANTITY}]`.

---

<div class="post-metadata">

**Author:** ![allmixedup](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@allmixedup](https://forum.sambapos.com/u/allmixedup)\
**Post date:** [May 13, 2014, 3:49am UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/8 "2014-05-13T03:49:32Z")

</div>

Hi Emre

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

That works but I have to put reward point in every product which is lot of manual work

I tried this [=FF(TN(’{TICKET TOTAL}-{TAX TOTAL}’)-0.50,‘0’)] but no luck ☹

putting the above format I thought I can get subtotal round down to number (subtotal $5.25 --\> 5 point) but no luck

if any one can figure out, please replay this way we can configure reward point to every $ customer spent = 1 point and even slow business day business owner can offer double the point by simple adding \*{2}

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [May 13, 2014, 12:49pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/9 "2014-05-13T12:49:32Z")

</div>

@allmixedup this configuration is based on point based promotion. For configuring payment based promotion please review sample file included in [SambaPOS Loyalty Card Features](http://forum.sambapos.com/t/sambapos-loyalty-card-features/316) topic.

---

<div class="post-metadata">

**Author:** ![gerlandog](https://forum.sambapos.com/user_avatar/forum.sambapos.com/gerlandog/32/39076_2.png) [@gerlandog](https://forum.sambapos.com/u/gerlandog)\
**Post date:** [July 16, 2014, 8:50pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/10 "2014-07-16T20:50:48Z")

</div>

Dear @Emre, I am starting to use this promotional points module, but i have one silly question…  
After I redeem the points it takes a lot to see the new amount of point the customer has… as a matter of fact it does not update customer points until I create a new ticket, is that correct?

THANKS!"!!!

G.

---

<div class="post-metadata">

**Author:** ![QMcKay](https://forum.sambapos.com/user_avatar/forum.sambapos.com/qmckay/32/27925_2.png) [@QMcKay](https://forum.sambapos.com/u/QMcKay)\
**Post date:** [July 16, 2014, 10:32pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/11 "2014-07-16T22:32:32Z")

</div>

It should update the Points as soon as the Ticket is Settled (Paid). Displaying the Points that the Customer has Earned seems a little tedious though.

It could be stored in a Ticket Tag along with the Ticket, but I’d rather be able to see the Points (and Account Balance) on something like an Entity Grid.

---

<div class="post-metadata">

**Author:** ![gerlandog](https://forum.sambapos.com/user_avatar/forum.sambapos.com/gerlandog/32/39076_2.png) [@gerlandog](https://forum.sambapos.com/u/gerlandog)\
**Post date:** [July 16, 2014, 10:59pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/12 "2014-07-16T22:59:27Z")

</div>

Hi there @QMcKay, I have to open a new ticket to see the redeemed points substracted…

Thanks!!!

G.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [July 17, 2014, 8:04am UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/13 "2014-07-17T08:04:20Z")

</div>

We intentionally update points after payment to prevent fraud. If we update it immediately operator can sell free items by adding fake orders.

You can change it as you wish 🙂

---

<div class="post-metadata">

**Author:** ![smolema4](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@smolema4](https://forum.sambapos.com/u/smolema4)\
**Post date:** [October 28, 2014, 8:51am UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/14 "2014-10-28T08:51:39Z")

</div>

Great tutorial and great product @emre. But how can we prevent points from being deducted if customer does not have enough points? Example: Customer has 100 points and tries to use them for a product that requires 150 points, what happens is the warning message is shown but the 150 points are deducted anyway.

---

<div class="post-metadata">

**Author:** ![gsreddy](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/g/e9c0ed/32.png) [@gsreddy](https://forum.sambapos.com/u/gsreddy)\
**Post date:** [December 6, 2014, 7:21am UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/15 "2014-12-06T07:21:06Z")

</div>

@emre As I tried to install through tools module but there is a error , than I tried to do manually the first step product tag , There is only one product tag tab its been used by Kitchen Group , Is there any way to implement points promotion ? please

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [December 6, 2014, 2:49pm UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/16 "2014-12-06T14:49:23Z")

</div>

> [@gsreddy](#):
>
> @emre As I tried to install through tools module but there is a error , than I tried to do manually the first step product tag , There is only one product tag tab its been used by Kitchen Group , Is there any way to implement points promotion ? please

We do not know what error you mention because you have not shared this with us so it will be hard to help you with it. Your question is extremely vague with almost no supporting information. We can not understand what you want without clear explanations.

Please share with us what you are trying to do and give us more details about your system and how you have set it up so we can maybe provide suggestions.

---

<div class="post-metadata">

**Author:** ![gsreddy](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/g/e9c0ed/32.png) [@gsreddy](https://forum.sambapos.com/u/gsreddy)\
**Post date:** [December 7, 2014, 3:07am UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/17 "2014-12-07T03:07:34Z")

</div>

@kendash Hello there, I want to implement points promotion I downloaded .zip file but when importing there is a error message , so I thought do it manually as guided in this page but the first step of the setup product tag Captions been used by Kitchen group as I want the products grouped so I did that setup , I cannot type points in the product tag captions , the question was that thanks for reply

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [December 7, 2014, 3:57am UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/18 "2014-12-07T03:57:54Z")

</div>

> [@gsreddy](#):
>
> I downloaded .zip file but when importing there is a error message ,

What was the error? If you can share this we might be able to fix the import.

I am sorry but you basically just asked the same thing twice and still have not provided much information to work with. Not everyone’s system is the same and it could be something you did wrong but we have no way to know that unless you share more about your setup and or what you did to try and set this up.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [December 7, 2014, 4:05am UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/19 "2014-12-07T04:05:14Z")

</div>

I’ve reproduced the error. Sadly the code I’ve implemented to import duplicated actions caused an issue for that file. I’ll try to refresh it with a working one.

---

<div class="post-metadata">

**Author:** ![gsreddy](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/g/e9c0ed/32.png) [@gsreddy](https://forum.sambapos.com/u/gsreddy)\
**Post date:** [December 7, 2014, 5:11am UTC](https://forum.sambapos.com/t/tracking-promotions-by-points/860/20 "2014-12-07T05:11:00Z")

</div>

@emre Thank You So much u got it

[Next page](https://forum.sambapos.com/t/tracking-promotions-by-points/860.md?page=2)
