Discount for first-time buyers?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
wave_werks
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 91
Joined: Mon Sep 22, 2008 8:37 pm
Location: Northeast Ohio
Contact:

Discount for first-time buyers?

Post by wave_werks » Mon Feb 02, 2009 7:49 pm

Is it possible to have a discount that is applied to an order only the first time that a customer buys from the store? I'm looking to have a message appear in our advertising and on the home page of our website that says "10% off of your first purchase!!!"

If the above can be achieved, is there then a way to limit the discount to certain categories or products? This would allow for first time buyers to receive an automatic discount only for our CD Duplication packages and our Full Color Printing packages but not on our Apparel Printing packages or Sticker Printing packages.

I'd rather not use a coupon to do the work but instead would like for it to be seamless for the customer.
- Jeff
Wave Werks

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Discount for first-time buyers?

Post by mazhar » Tue Feb 03, 2009 8:19 am

One solution could be to create a user group for example let say it First Time Buyers and then create volume discount for this newly created user group. Now when ever a user signsup you need to place this user in First Time Buyers group through code. By doing so when user will try to checkout he will get the discount. The next job is to remove the user from this group as soon as he places his first order. For this you need to put some code in the CheckedOut method of the OnePageCheckout control's code file. The code for removing the user form user group would be something like

Code: Select all

UserGroup userGroup = UserGroupDataSource.Load(Token.Instance.User.UserId,groupId);
        int index = Token.Instance.User.UserGroups.IndexOf(userGroup);
        if (index > 0)
        {
            Token.Instance.User.UserGroups.DeleteAt(index);
            Token.Instance.User.Save();
        }
Where groupId means the id of First Time Buyers group. You can find out this id from ac_Groups table of database.
Have a look at the following thread about how to automatically assign user to some group on sign up.
viewtopic.php?f=42&t=8712

Post Reply