Coupons


https://forum.kartris.com/Topic6468.aspx
Print Topic | Close Window

By Supermac - Tue 10 May 2016
I'd like to create a coupon of 10€ for customers who order a minimal amount of 50€.
This Coupon should/could be used just one time by every user.
Is it possible to do that?
By Paul - Tue 10 May 2016
Should be possible by creating a coupon to enable a promotion:

http://userguide.kartris.com/Default.aspx?headID=202
By Supermac - Wed 11 May 2016
Thank you Paul for yoour reply.
Is not completely clear to me how this works:
I create a promotion and set it as inactive.
Then I create a Promotion type coupon ... but how has coupon to be configured to be utilizable only with a given order amount minimum?
By Paul - Fri 13 May 2016
Sorry, I think I misunderstood, was thinking it was coupon for 10 EUR discount of user spends 50 EUR or above. It's not possible to create coupons automatically in response to orders.
By Supermac - Fri 13 May 2016
No no you understand correctly, it's only I don't understand how to do that :-)

I would tell to potential customer "for your first order you have available a coupon of 10€ you can use on 50€ minimum basket value, use 'promotion' in coupon field in basket!" (but if discount is automatic is the same)
By Tiggywiggler - Sat 14 May 2016
Hello,

Have you managed to get this to work now? Was the guidance from Paul clear?
By Supermac - Mon 16 May 2016
No I'm still in the dark...

I made a not-live promo in wich spending 50€ user will get a 10€ discount, then I created a promo-type coupon with "PRIMO" as coupon code...
Then I tested it: I composed a cart >50€ and used the coupon code: cart accepted coupon but it didn't apply any discount (cart shows €0.00 in coupon's row).

?
By Tiggywiggler - Mon 16 May 2016
Well I have just tried exactly what you have said. I have loaded up a development system I have and stepped through your instructions, added the promotion code and it worked perfectly well.

Maybe you missed a step and didn't realise it. Can you try again, and make sure that the from date and to date are correct so that neither the promotion, nor the coupon are expired.

Another thing to be careful of is when you create the promotion and you select "When order > €50" you click the "Add" button, same again for the "Subtract €10".
By Supermac - Tue 17 May 2016
I tried doing again a promo and then a coupon as suggested but I confirm the coupon's import -when used in cart- results alway 0.
By Supermac - Tue 17 May 2016
Note that normal coupon amount (by value or by %) are calculated correctly in cart, only the promotion linked coupon has this problem... may you indicate me the code portion where this type of coupon's amount is calculated?
By Tiggywiggler - Tue 17 May 2016
It will probably be calculated in BasketBLL somewhere (I would need to follow it through, by the nature of being open source several people contribute to the project), however, it is important to me that we can reproduce this fault so that I can see it as well as I would like to remove this issue if possible.

http://forum.kartris.com/Uploads/Images/970f9046-585e-4f2f-aa3f-6a90.png

As you can see from the image above, when I do it everything works fine. Can you show the result you get when you do it? Where is the coupon on the display?

Which version are you running?
By Supermac - Wed 18 May 2016
I'm running 2.8004

This is the promotion I created
http://forum.kartris.com/Uploads/Images/28a1a994-ef45-4cf0-b0b8-c03c.PNG

This is the result when I insert the coupon code in cart:
http://forum.kartris.com/Uploads/Images/5e19f075-d893-430d-afe7-e143.PNG

And this is the result when order is submitted:

http://forum.kartris.com/Uploads/Images/4a40b8fc-8224-4e76-a274-d3d0.PNG

Consider (but I think this shouldn't be related to the issue) that I customized kartris in a way that now prices of items are not stored in Kartris db with produtc's versions but are read on-the-fly from an external db...
By Supermac - Wed 18 May 2016
Start and end dates of coupon are the same of the promotion.
The following is not the coupon of previous order (I used it and cannot re-open) but it's identical to that one
http://forum.kartris.com/Uploads/Images/586a83c5-af92-470c-bcfc-b3f9.PNG
By Supermac - Wed 18 May 2016
This is the couponsdatatable that BasketBLL.GetCouponDiscount builds when called...



Image is small however it shows discountvalue=1 and discounttype= 't'
By Supermac - Wed 18 May 2016
It seems that discounttype= 't' result in coupon considered as dodgy and ignored by CalculateCoupon sub
By Tiggywiggler - Wed 18 May 2016
The coupon being rejected is normal behaviour. The coupon is false because the coupon is just used to apply the promotion. The code you are looking for is in BasketBLL.CalculatePromotions() and the real work begins on line 2117 in version 2.9003.

The start of the code block looks like this:

If InStr(strPromoIDs, vPromoID) = 0 Then
vPromoID = drSpend("PROM_ID")
For Each drSpend As DataRow In drwSpends
drwSpends = tblPromotions.Select(strList)
strList = "PP_PartNo='a' and PP_ItemType='a'"
Dim vSpend As Double'get spend value from basket

There are multiple accesses of the back end. I would assume that even though you have your own database connection method it should still work okay, however, it may be work stepping through the code to ensure everything is being read okay.

you want to ensure that by the time you get to row 2292 that the variables vIncTax or vExcTax have a negative value in them (e.g. vIncTax = -9.99)
By Supermac - Thu 19 May 2016
Thank you Tiggywinkler for your patience.
I verified, inctax/extax have correctly negative value but maybe we got it: I think the following code in BasketBLL.CalculatePromotions() is wrong.

Case "a" 'Total spend promotion
If GetKartConfig("general.tax.pricesinctax") = "y" Then
numTotalBasketAmount = TotalIncTax
vQuantity = CInt(TotalIncTax / vSpend)
Else
vQuantity = CInt(TotalExTax / vSpend)
End If

'If total in basket (inc or ex, depending on settings)
'is more than the vSpend required, Qty will be above zero
vQuantity = CInt(numTotalBasketAmount / vSpend)

.....and should be changed as following:

Case "a" 'Total spend promotion
If GetKartConfig("general.tax.pricesinctax") = "y" Then
numTotalBasketAmount = TotalIncTax
Else
numTotalBasketAmount = TotalExTax
End If

'If total in basket (inc or ex, depending on settings)
'is more than the vSpend required, Qty will be above zero
vQuantity = CInt(numTotalBasketAmount / vSpend)


What do you think?
In the original version it works only when general.tax.pricesinctax is set to "y" (I got it set to "n" and I have the troubles I described)
By Supermac - Thu 19 May 2016
Hmmm now after above modifications coupon is applied correctly (inc/extax) but I still got some problem in BasketView about functioning of coupons.

This is my cart with coupon applied:
http://forum.kartris.com/Uploads/Images/d265b9a8-3d42-40f8-b9ab-ec61.PNG
It correctly counts the value of coupon and subtract it from total order amount... but it strangely creates two rows in cart view, one for the promotion (with discount applied) and one for the coupon (with 0 import).

When I delete the coupon clicking on the bin icon I obtain this situation:
http://forum.kartris.com/Uploads/Images/842568e5-74ee-4bb2-a0d7-c403.PNG

It removes the row of coupon (the one with 0 import) but it doesn't remove the promotion row and it doesn't update cart's total.
If I reload the page by browser I see the correct situation with coupon/promotion removed and total amount correct, but I can't say if it is a refreh problem or a basketview layout/codebehind problem...