Bug in coupons that may apply to Gold?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Bug in coupons that may apply to Gold?

Post by NC Software » Sun Mar 27, 2016 3:54 am

I'll report this here but I haven't tested a GOLD demo store yet to see if it applies, you may want to test.

I have category on my site called 20% off bundles. They are kit products that have products attached and I use the pricing delta such as in Kit Price: "Modify Product Price" and then I set Price Modifier to -20.00.

I then created a store coupon and added this kit product as once of the exclusions of the coupon, i.e. the coupon does NOT APPLY to this product.

People are applying the coupon and getting the discount on these kit products but they should be excluded! So I'm giving them 20% off and then they are applying the coupon for a further discount aka I'm losing money due to this bug.

I have disabled purchase of all products in this category until the sale is over. It also would be a nice feature to have disable purchase at the category level so I can kill the entire category in one switch and turn it all back on in one switch.

Please verify this bug does not occur in GOLD r.latest...
Neal Culiner
NC Software, Inc.

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Bug in coupons that may apply to Gold?

Post by Katie » Mon Mar 28, 2016 7:16 am

If you apply the coupon exclusion to the Kit product (and not one of it's components), then it should work. I tested in Gold.

I'm not sure if this is intentional or not, but I can see some potentials problems if you have Kit component products that are adjusting the Kit price and how to apply a coupon that is a % off or set amount to only the excluded item. I think it makes more sense to look at a Kitted product as a whole instead of looking at each product individually.

In any case, if it has been working this way since AC7, then I doubt we would want to change the behavior at this point.

Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Bug in coupons that may apply to Gold?

Post by NC Software » Mon Mar 28, 2016 7:19 am

I added the kit product as the exclusion, not the components, and the coupon was applied to the kit which it should not have been.
Neal Culiner
NC Software, Inc.

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Bug in coupons that may apply to Gold?

Post by Katie » Mon Mar 28, 2016 7:29 am

Ok. In Gold, it is working when the Kit product is excluded from the coupon. Upgrade? ;)
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Bug in coupons that may apply to Gold?

Post by NC Software » Mon Mar 28, 2016 7:46 am

I guess I'll grab a demo store and try to repro - yeah, I'd love to. I'm still waiting on approval for 36 hour days with no DST :)
Neal Culiner
NC Software, Inc.

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Bug in coupons that may apply to Gold?

Post by NC Software » Fri Sep 02, 2016 3:29 am

I have confirmed this bug to exist in GOLD R12 SR1 9266. I have a kit "bundle" with various components. In GOLD when I exclude the kit product from the sale and apply a coupon at checkout it IS applying the discount to the entire order including this product with a kit (bundle).
Neal Culiner
NC Software, Inc.

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Bug in coupons that may apply to Gold?

Post by Katie » Fri Sep 02, 2016 8:54 am

Hello Neal,

I'm a little backed up on work right now, but I'll test this as soon as I can. Are you trying to use a product coupon or an order coupon?

Thanks,
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Bug in coupons that may apply to Gold?

Post by NC Software » Fri Sep 02, 2016 9:00 am

Order coupon. No rush, just something I'd like to have fixed at some point as I have to hide a category and its products during a sale to avoid double-discounting. I can give you more details or configs as needed, email me if desired. I couldn't figure out how/where to send a bug report and screenshots but it's just a basic kit product set to bundled.
Neal Culiner
NC Software, Inc.

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Bug in coupons that may apply to Gold?

Post by NC Software » Sat Sep 03, 2016 5:03 am

Let me try to give concise details for your testing Katie when you get to it:

1) Create a category labeled 20% Off Bundles
2) Create a product in this category. Add kit components (bundled config). I configured each kit item to be 20% off as this bundle deal discounts each kit item if bought in the combined kit product. i.e. Buy this, this and this and we'll give you 20% off each item in this order item.
3) Create an order coupon for 15% off and select the option to not include products. Add the kit product created in #2 to exclude this product
4) Create a new order adding one other product and then also this kit product. Apply your coupon code and see if the 15% off includes the kit product which was set to be excluded.

I think the issue is that the order coupon is discounting each kit component/item in the master kit product not seeing that the kit product (parent) is an exclusion.
Neal Culiner
NC Software, Inc.

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Bug in coupons that may apply to Gold?

Post by Katie » Tue Sep 06, 2016 5:41 am

Hello Neal,

I'm still unable to reproduce the issue. I created an order coupon and excluded the Kit master product. In my test, I just used the sample computer system. If I tried to purchase the computer system with no other products, the coupon was denied. If I purchased the computer system with other valid products, then the discounted amount was only on the valid items for the coupon.

I tried making a copy of the computer system and changed it to the "itemized" display. Same result.

I also tried excluding the individual component products from the coupon. Same result.

I doubt the coupon behavior changes depending on whether a discount was applied to the category, but I'll give it a try next and let you know.

Thanks,
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Bug in coupons that may apply to Gold?

Post by NC Software » Tue Sep 06, 2016 5:45 am

Odd...would be nice if there was a test store we could both access. I don't apply coupons to categories, I just create an order coupon and exclude products.
Neal Culiner
NC Software, Inc.

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Bug in coupons that may apply to Gold?

Post by Katie » Tue Sep 06, 2016 5:55 am

That's what I did too. I created an order coupon and excluded the kit products.

Coupons can't be applied to categories, only discounts can. I thought that maybe having a discount assigned to the category might have been the issue.

I have an install we can both access. I am sending you a PM now.
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Bug in coupons that may apply to Gold?

Post by Katie » Wed Sep 07, 2016 3:47 am

With Neal's help, I have confirmed there is a bug in Gold with Order coupons and Kits.

To reproduce, the Kit master product must have $0.00 for the base price.
None of the component products are excluded from the order coupon, only the main Kit product.

Purchasing the Kit will allow the order coupon to be used when it was excluded.

Now, if you wanted, you can exclude any of the Kit Component products from the coupon's use and it will work. This may not be desirable if the Kit component products are available for sale separately or within a different kit that is eligible for the coupon.

Using a Product coupon still works in this scenario.

I'll get the issue reported today.

Thanks for your help Neal.
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Bug in coupons that may apply to Gold?

Post by NC Software » Wed Sep 07, 2016 3:53 am

Thank you for the web site to set this up for you. The other part of this is the kit items have modified pricing as this kit is a bundle offer, i.e. 20% off all items if you buy this kit product. This is why I cannot exclude the kit items as when purchased in another kit or individually they can accept the coupon discount.

This issue affects 707 and as I'm in the process of moving to GOLD I verified it's there too. So in my 707 situation I have to hide the kit products that I want excluded during the order coupon time period, i.e. all of my 20% off bundle products have to be hidden.
Neal Culiner
NC Software, Inc.

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Bug in coupons that may apply to Gold?

Post by NC Software » Sat Oct 22, 2016 3:45 am

Any chance of a patch for GOLD to resolve this prior to holiday shopping season, i.e. Black Friday up next?
Neal Culiner
NC Software, Inc.

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Bug in coupons that may apply to Gold?

Post by Katie » Wed Oct 26, 2016 3:47 am

Hello Neal,

After spending considerable time on this issue, the developers are not wanting to create a hot patch. More time is needed to examine the intended changes and how it will impact other features. For example, within the BasketCalculator, it may need updating to ensure that we look inside kitted products to make sure their parents are not excluded. Also, what about include filter? That will need additional code changes and testing of scenarios where kit masters and childs have overlapping rules.

So, after some discussion this morning, we decided not to change the behavior at this time. It's been this way since AC7, and even now 4 years later, this is the first we've heard of the problem.

The change related to enforce this exclusion itself is simple and can be done only in the coupon codes. Mazhar provided the code changes for you.

In order to apply this change you have to edit CommerceBuilder.Marketing.Coupon.cs file and locate following code in AppliesToProduct function.

Code: Select all

// WE MUST HAVE AN EXCLUDE FILTER, THE PRODUCT MUST NOT BE IN THE LIST
                    result = true;
                    foreach (Product product in this.Products)
                    {
                        if (productId == product.Id)
                        {
                            result = false;
                            break;
                        }
                    }
Now update it like this:

Code: Select all

// WE MUST HAVE AN EXCLUDE FILTER, THE PRODUCT MUST NOT BE IN THE LIST
                    Product productToTest = ProductDataSource.Load(productId);
                    result = true;
                    foreach (Product product in this.Products)
                    {
                        if (productId == product.Id)
                        {
                            result = false;
                            break;
                        }
                        else if (product.KitStatus == KitStatus.Master 
                            && productToTest.KitStatus == KitStatus.Member)
                        {
                            int count = DomainModel.NHibernateHelper.CreateCriteria<KitProduct>("KP")
                                .CreateCriteria("KP.KitComponent", "KC", NHibernate.SqlCommand.JoinType.InnerJoin)
                                .CreateCriteria("KC.ProductKitComponents", "PKC", NHibernate.SqlCommand.JoinType.InnerJoin)
                                .Add(NHibernate.Criterion.Restrictions.Eq("KP.Product.Id", productId))
                                .Add(NHibernate.Criterion.Restrictions.Eq("PKC.Product.Id", product.Id))
                                .SetProjection(NHibernate.Criterion.Projections.Count("PKC.Product.Id"))
                                .UniqueResult<int>();

                            if (count > 0)
                            {
                                result = false;
                                break;
                            }
                        }
                    }
That's it. Save changes, build Commercebuilder and ablecommerce project. Now repeat your test. This time, the coupon won't discount kit which is already on discount.

Thanks,
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Bug in coupons that may apply to Gold?

Post by NC Software » Wed Oct 26, 2016 9:23 am

Thank you, I'll review. I guess people don't use kits or don't do coupons or don't realize really what happened due to higher volume of sales or less attention to detail of the situation. Regardless, it's a significant financial loss scenario especially for higher volume stores so I wouldn't brush this off as "X years and no one..." - it's a serious issue that needs to be resolved. In my land of software (accounting for pilots) I take data loss seriously, in this land of ecommerce, it's financial loss the same. But I'll run with it as I have the source and can look further as required.
Neal Culiner
NC Software, Inc.

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2649
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Bug in coupons that may apply to Gold?

Post by Katie » Wed Oct 26, 2016 10:39 am

I really don't think it's a matter of customers not using kits or coupons. It's more about the very unique scenario that you are working with:

- The Kit master product must have $0.00 for the base price.
- None of the component products are excluded from the order coupon, only the main Kit product.

- You can exclude any of the Kit Component products from the coupon's use and it will work.
- Using a Product coupon still works in this scenario.

We still have an open bug report, but felt that the changes required were not typical of what we 'hot patch' for.
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Bug in coupons that may apply to Gold?

Post by NC Software » Wed Oct 26, 2016 11:41 am

It seems to me the kit component/item should check if it's parent (kit product) is excluded in a coupon or not. Kit components should not discount in isolation, they need to respect their kit parent product.
Neal Culiner
NC Software, Inc.

Post Reply