• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

tpjeremy
#1 Posted : Tuesday, November 24, 2015 6:51:13 PM(UTC)
tpjeremy

Rank: Member

Joined: 5/5/2015(UTC)
Posts: 9

We're trying to setup a promo for Buy 2 Get 1 and it seems to apply the free item randomly rather than to the lowest priced product. Is this a known issue, or is there a way to setup the promo so it will be applied to the lowest price item?
Aaron
#2 Posted : Wednesday, November 25, 2015 9:55:41 AM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,381
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
What version of BV Commerce are you running?
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
tpjeremy
#3 Posted : Wednesday, November 25, 2015 10:11:55 AM(UTC)
tpjeremy

Rank: Member

Joined: 5/5/2015(UTC)
Posts: 9

Hi Aaron, it is running 2015. Let me know if you need any other info.
tpjeremy
#4 Posted : Wednesday, November 25, 2015 12:50:49 PM(UTC)
tpjeremy

Rank: Member

Joined: 5/5/2015(UTC)
Posts: 9

After looking through the code, it appears that the discount is meant to be applied to the most expensive item that is less expensive than the qualifying items. So in my case, it seems that is should apply the discount to the third most expensive item, however this does not seem to be happening. It is applying to the second most expensive item.

For example, I have four items in my cart at the following prices: $79.90, $73.90, $47.90, and $6.99. The promo is set to Buy 2 Get 1, so i would think it would apply the discount to the third most expensive item ($47.90), but it is applying the discount to the second most expensive ($73.90).

I was able to get the least expensive item to discount by adjusting the sort of the sortedPromo on line 123 of /Marketing/BuyXGetYByCategory.vb in the Core.

Code:
Dim sortedPromo As List(Of LineItemData) = (From p In promoitems _
    Order By p.ItemAdjustedPrice Ascending _
    Select p).ToList()

I set the sort direction to Ascending rather than Descending.
Aaron
#5 Posted : Wednesday, November 25, 2015 2:05:10 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,381
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
We actually altered this functionality to fix a bug with the 2015 release. We'll take another look at this to see if further changes are required. Thanks for posting such detailed feedback!
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Ryan Groene
#6 Posted : Tuesday, December 1, 2015 2:51:04 PM(UTC)
Ryan Groene

Rank: Member

Joined: 10/28/2014(UTC)
Posts: 11
United States
Location: Hummelstown, PA

Was thanked: 2 time(s) in 2 post(s)
You are correct that the code discounts the most expensive item that is less than (or equal to) the qualifying items. I thought that make sense because it would be more in line with what the customer would probably expect (plus, they could force this behavior anyway by including the less expensive products in a separate order). But we figured that either way that we did it, somebody would expect it to work the other way.

That being said, there was a bug in the code. It was applying the discount to the most expensive item that was equal to or less than the least expensive qualifying item, but the problem is that in the case that the qualifying and promo items are the same, that item would be the qualifying item itself, so that is the one that would be discounted. I refactored our code for the next release, changing the algorithm that it uses to something that I think is easier to follow and works in all cases (that I have tested anyway).

Thanks again for the feedback!
Ryan Groene
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Jim Carpenter
#7 Posted : Tuesday, March 29, 2016 3:22:17 PM(UTC)
Jim Carpenter

Rank: Member

Joined: 3/18/2016(UTC)
Posts: 5

Thanks: 1 times
Hello,

I just wanted to check on the status of this update. We are working on a project using version 2015.1.1.1059 of the cart, and we are set to launch the store in 2 weeks.

I am having a similar problem to what Ryan described above. We have 2-4 products in the same category, and the promo is a basic buy one, get one of equal or lesser value free.

I tried to first create this promotion using the Buy 1 Get 1 offer, but with 4 products that would qualify, that quickly proved to be the wrong path. I then shifted to the Buy X Get Y By Category version. The scenario that I have is that the 2 most expensive items are the ones being given away for free while the 2 less expensive items are full price.

See Screenshot:
https://dl.dropboxuserco...-Commerce-BOGO-Issue.PNG

Thanks for any help!
Jim Carpenter
#8 Posted : Tuesday, March 29, 2016 4:20:24 PM(UTC)
Jim Carpenter

Rank: Member

Joined: 3/18/2016(UTC)
Posts: 5

Thanks: 1 times
If I am reading the logic correctly in the Core/Marketing/BuyXGetYByCategory.vb

The "While qualifiedQueue.Count > 0" loop, and respective function that it calls, "AttemptToApplyDiscount" and "ApplySingleDiscount" seem to have logic to prevent discounting the same item 2x (the "existsAlready" flag in ApplySingleDiscount)

However, when an item is the qualifier for another items discount, it is still "in the pool" of items that can be discounted. I think that, once an item is used as the qualifier, and discounts another item, both should be excluded from further discount consideration. When they are not, my first of 4 items is discounting my second item (which is fine) but the second item is then discounting my first (which is not okay), simply b/c I have 4 items in my cart at once.

This concept is further proven with 6 items in the cart (3 at the higher price point, 3 at the lower)... the first 3 are free, the last 3 are full price, even though you would think that one of the higher price point items would be free and 2 of the lower items would be free.

See Screen Shot:
https://dl.dropboxuserco...Commerce-BOGO-Issue2.PNG

I am thinking that if we could De-queue the items once they have either caused a promotion, or had one acted on them, it would correct the issue. (I'm way too brain fried to figure out the code for this tonight, but I wanted to check and see if you had already figured all this out)

Thanks again,
Jim Carpenter
Jim Carpenter
#9 Posted : Thursday, March 31, 2016 8:34:10 AM(UTC)
Jim Carpenter

Rank: Member

Joined: 3/18/2016(UTC)
Posts: 5

Thanks: 1 times
Just continuing to post what we came up with to solve our specific issue. Disclaimer: This logic MAY NOT be correct for your situation, but for us, in the Buy One, Get One of equal or lesser value scenario, this is what we did to make it work.

All edits were made to:
source\BVSoftware.Bvc5.Core\Marketing\BuyXGetYByCategory.vb

First, we changed the logic on the qualifiedQueue, rather than qualifying the X most expensive items, we qualified every "_QualificationQty + 1" items to follow the Buy X Get Y model.
Code:

86: 'Dim qualifyingCount As Integer = CInt(Math.Floor((sortedQualifying.Count * _QualificationQty) / (_QualificationQty + 1)))
87: 'For x As Integer = 0 To qualifyingCount - 1
88: 'qualifiedQueue.Enqueue(sortedQualifying(x))
89: 'Next
90: For i As Int32 = 0 To sortedQualifying.Count - 1 Step (_QualificationQty + 1)
91: qualifiedQueue.Enqueue(sortedQualifying(x))
92: Next
So in our example case above, the old / new code produced the following qualifiedQueue from the sortedQualifying list of [39, 39, 39, 25, 25, 25]:
Old: [39, 39, 39] (positions 0, 1, 2 in sortedQualifying)
New: [39, 39, 25] (positions 0, 2, 4 in sortedQualifying)

Now that the "viable discount" rates were what we needed, we shifted to the discounting logic itself. This was a bit more involved. The basic idea is that I created a new list of LineItemData, where each position in the list represented a single item purchase. However, I still added a handle to the SAME LineItemData values that exist in sortedPromo (Qty and all), so the logic later in the function could be largely preserved. So while it does appear that I am now purchasing 3x the number of items, this is not the case due to the logic further down. I just needed a simple list where I could "skip the first X items" based on what products have already "taken part in" the BoGo special.
For Example:
Code:

sortedPromo: [ { LineItemData price 39 - qty 3 }, { LineItemData price 25 - qty 3 } ]
lstProducts: [ { LineItemData price 39 - qty 3 }, { LineItemData price 39 - qty 3 }, { LineItemData price 39 - qty 3 }, { LineItemData price 25 - qty 3 }, { LineItemData price 25 - qty 3 }, { LineItemData price 25 - qty 3 } ]


Next, I had to keep track of how many products to skip in my new array. I just declared a var outside the "While qualifiedQueue.Count > 0" loop called numToSkipForPromo

Inside the loop, I incremented this value by the qualification qty:
numToSkipForPromo += _QualificationQty

The next change came in the signature for the AttemptToApplyDiscount function. I needed to pass in my new numToSkipForPromo value, and I changed the name of the list of LineItemData var to better describe what I was now passing in:
Private Function AttemptToApplyDiscount(ByVal amount As Decimal, ByVal lstProducts As List(Of LineItemData), ByVal numToSkipForPromo As Int32, ByVal marketingQueue As DiscountQueue) As Boolean

The last change was to the body of the AttemptToApplyDiscount function. I changed the functionality of the outer for loop to use my new list of products, but to start at the appropriate index based on how many products we are to skip for promotion consideration.
Code:

Dim result As Boolean = False
For i As Int32 = numToSkipForPromo To lstProducts.Count - 1
Dim lid As LineItemData = lstProducts.ElementAt(i)
If (lid.QtyLeft > 0) Then
If (lid.ItemAdjustedPrice <= amount) Then
ApplySingleDiscount(lid, marketingQueue)
result = True
Exit For
End If
End If
Next

That's it. Now my Buy 1 Get 1 of equal or lesser value special is returning the correct discounts. Again, full disclaimer, I have NOT tested this code in other scenarios, so take this for what it is. The BV guys may have a better solution, but I'm posting this in case it helps anyone. I will try to attach my .vb file to this post since the code above may be a little difficult to reconstruct.

Thanks!
Jim Carpenter
File Attachment(s):
BuyXGetYByCategory.vb (14kb) downloaded 0 time(s).

You cannot view/download attachments. Try to login or register.
Aaron
#10 Posted : Thursday, March 31, 2016 10:52:35 AM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,381
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Jim,

The issue that Ryan noted above was resolved in SP2 and mentioned in the release notes as shown below.

Quote:
Buy X Get Y By Category offer was not applying the discount to the most expensive item that was equal to or less than the least expensive qualifying item when a qualifying item was the same as a promo item
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012