• Welcome to KonaKart Community Forum. Please login or sign up.
 

Coupon Problem

Started by bubba64, August 12, 2009, 12:35:39 am

Previous topic - Next topic

bubba64

I have a promotion for customers to save a percentage % when purchasing a minimum number of products from the same manufacturer (the customer saves 10% when buying 3+ items from the same manufacturer). Here is what I have done:

1) Promotion Type: Product Discount
2) Active: Checked    Cumulative: checked
3) Min. order value: 100   Minimum quantity for a product: 1
4) Discount: 10   Percent/Amount: True

Using rules I have:
1) Excluded all products BUT the products of this manufacturer (Manufacturer A).
2) Made promotion active on only 1 manufacturer (Manufacturer A).

Problem:
Using the $100 order minimum to ensure 3 items are purchased for the discount doesn't preclude other manufacturer items from being used to reach the order minimum and get the discount. A customer doesn't have to buy 3 products from the same manufacture, example (promo is for Manufacturer A's products):

Customer buys 1 product from manufacturer A: $50
Customer buys 2 products from manufacturer B: $60
Order Total: $110 minus the promo discount shown

The promo discount shows because one item from manufacturer A is purchased along with others from Manufacturer B and the total reaches the order minimum.

Is there a way around this? I can't seem to figure out how to set it up to work properly??? I have a production site available if you need to see this in action. Thanks!

julie

The way to fix this is to edit the promotion module. You could easily change its behavior by verifying that promotion.getApplicableProducts() >= 3.

bubba64

I guessing that the correct file to edit for this promotion is ProductDiscount.java?


bubba64

Won't this change also affect discounting on a single item (ie. discount coupon is given), disregarding any discounts on a single item (forcing purchases of 3+)?

bubba64

I tried the following:
------------------
if (minTotalOrderVal != null && promotion.getApplicableProducts().length >= 3)
{
    if (orderValue.compareTo(minTotalOrderVal) < 0)
    {
    // If we haven't reached the minimum amount then continue to the next
    // promotion
        continue;
     }
}
-------------------
I used the line of code with the minTotalOrder in order to use this particular promotion. That way, if I ever want to discount a single item I can leave the minTotalOrder field empty and the promotion would still work (by not requiring a minimum of 3 promotional items). Somehow this code is not checking to see if the promotional items are found in the order itself.

bubba64

Are there any updates to this issue in 4.1.0.0?

Would this problem be considered a configuration problem or is it a bug with promotions?

Thanks a bunch. I love to read about all the new features konakart has been releasing. You folks do a great job. We had some custom code that we paid for this summer that really worked out well. Thanks!

trevor

I've read the thread but aren't sure what the problem is  ??? You say that :

QuoteSomehow this code is not checking to see if the promotional items are found in the order itself.


What do you mean by this?

bubba64

QuoteSomehow this code is not checking to see if the promotional items are found in the order itself.

What do you mean by this?


This is what is wanted:
1) Give a customer a discount when they buy 3 or more items from the same manufacturer.
2) The only way I have seen to accomplish this is to:
    a) Create a promotion and add all the products from the selected manufacturer to this promotion.
    b) To ensure that 3 or more items are purchased from this manufacturer, I set a minimum order amount (ie $100)

What happens:
1) A customer buys just 'one' product from the promotion.
2) A customer buys additional products from other manufacturers (non promotional).
3) Order total now exceeds $100 and a discount is given on the 'one' promotional product even though the $100 threshold on promotional products (or 3+ promotional items) were not met.

It appears that the current design of promotions will not meet this need (discount based on quantity purchased from a manufacturer). Is there another way to accomplish this task???

trevor

As mentioned above, you need to edit an existing or create a new promotion module to add the extra logic that you require. KonaKart was designed to allow customers / integrators to develop and integrate promotion modules as they see fit, to implement their business needs. The ones that we supply in the download are really only an example, and give you a framework to copy in order to create your own.

bubba64

Sorry, I misunderstood the first suggestion to write my own promotion module (I couldn't break my thought of configuring an existing module)...that is a great idea.

I have been working on this module this whole weekend, it is calculating the discount correctly (I wanted a quantity discount based on the amount of items purchased from the same manufacturer). The discount works EXCEPT for the fact that it is adding in the same discount twice--two line item discounts. I have been banging my head against the wall trying to figure out why. It appears to be calling the getOrderTotal(...) method twice. I used the ProductDiscount.java as the template for my new custom module QuantityDiscount.java

Some pertinent information (I have also attached *.java source files):
1) I only have products of this promotion/manufacturer type in the shopping cart (quantities meet the level to trigger the discount)
2) I have the promotion added correctly to the admin application (it is appearing in the modules -> order total) and I have the promotion assigned to only one manufacturer.
3) The modules are in their correct package locations.

I am now at wits end trying to figure out why I am getting the discount listed twice on the view cart. It will probably be something extremely simple, but hopefully these examples will help someone else making a custom order total module. I was not able to find a whole lot of info...

bubba64

For everyone that may run into a similar problem. This is what I had wrong:

1) Had some static variables left unchanged in the konakartadmin QuantityDiscount.java. When I had installed the erred module in previous testing it had written data to the promotions tables.
2) In my test, customers were getting double quantity discounts (two lines of quantity discounts). I deleted the all promotion related tables and restored the original promotion related tables from backup (to ensure I had all erred data deleted) and then added in my new promotion module.

It works like a charm now. Basically, I needed a promotion that would give discounts based on quantity purchased from a promotional manufacturer (e.g. give a 10% discount when 3+ items are purchased from the same manufacturer).

For all who may be interested I am attaching the code for this QuantityDiscount module as it is live and working correctly on my site.