Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 7 of 7

Thread: Multiple Coupon Codes via Import

  1. #1
    baba is offline Senior Member
    Join Date
    Dec 2008
    Posts
    123

    Default Multiple Coupon Codes via Import

    Is there a way to import many Coupon Codes at one time, via an upload tool? Or is it only possible to manually create each Coupon for use in the Cart?
    Take Care

    B-A-B-A

  2. #2
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    There aren't any built-in bulk import tools for coupons, however their structure is pretty simple in the DB. You could just do a basic SQL query to do that.

  3. #3
    art_r is offline Junior Member
    Join Date
    Jan 2010
    Posts
    20

    Default

    Quote Originally Posted by AspDotNetStorefront Staff - Scott View Post
    There aren't any built-in bulk import tools for coupons, however their structure is pretty simple in the DB. You could just do a basic SQL query to do that.
    Hi Scott,
    So, would we need to put anything into the CouponGUID column?

    I think we need to do a bulk coupon insert as we want to offer around $100 coupons that can only be used once but not via the option of once per customer as it would be easy enough for someone to re-sign up.

    So was thinking of using a random string generator to give us a few hundred codes and insert them direct into the table for sending out to specific clients.

    Any help would be appreciated.

  4. #4
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    Nope you don't. Sql will auto generate it once a new record is inserted based on (newid()) binding.

  5. #5
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    Usual provisos, make a backup of the database first and try it out on a development database

    What you want is something like this:

    Code:
    INSERT INTO [AspDotNetStorefront].[dbo].[Coupon]
               ([CouponGUID]
               ,[CouponCode]
               ,[Description]
               ,[ExpirationDate]
               ,[DiscountPercent]
               ,[DiscountAmount]
               ,[DiscountIncludesFreeShipping]
               ,[ExpiresOnFirstUseByAnyCustomer]
               ,[ExpiresAfterOneUsageByEachCustomer]
               ,[ExpiresAfterNUses]
               ,[RequiresMinimumOrderAmount]
               ,[ValidForCustomers]
               ,[ValidForProducts]
               ,[ValidForManufacturers]
               ,[ValidForCategories]
               ,[ValidForSections]
               ,[CouponType]
               ,[NumUses]
               ,[ExtensionData]
               ,[Deleted]
               ,[CreatedOn])
    SELECT newid(),
    	'COUP' + convert(varchar(10),customerid),
    	'coupon for customer ' + convert(varchar(10),customerid),
    	'31-Dec-2010 23:59:59.999',
    	0,
    	100,
    	1,
    	1,
    	1,
    	1,
    	0,
    	convert(varchar(10),customerid),
    	null,
    	null,
    	null,
    	null,
    	0,
    	0,
    	null,
    	0,
    	getdate()
    from customer
    where isregistered=1
    This will insert a coupon named after the customer's unique id for all registered customers.

    Alter as you see fit!
    Last edited by esedirect; 08-03-2010 at 09:11 AM. Reason: CouponType should probably be 0
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!

  6. #6
    stevenwong is offline Junior Member
    Join Date
    Jan 2012
    Posts
    2

    Default

    Quote Originally Posted by AspDotNetStorefront Staff - Scott View Post
    There aren't any built-in bulk import tools for coupons, however their structure is pretty simple in the DB. You could just do a basic SQL query to do that.
    Is there a dummy proof way of doing this? I have no idea where to begin and I need to upload 500 coupon codes. Any help would greatly be appreciated.

  7. #7
    art_r is offline Junior Member
    Join Date
    Jan 2010
    Posts
    20

    Default

    stevenwong, do you have access to SQL Management Studio? As always, do a backup of SQL plus if possible test on a dev db.

    The way I did my testing and worked from memory is, first a created a coupon like what i needed from the ADNSF admin area.
    Then in SQL Management Studio, I opened the Coupon table to view and edit results.
    I checked the coupon I created to see what details were there.

    This ain't pretty, but I'm sure i just did a copy of my coupon codes from my notepad file and pasted the column into the next empty row, under CouponCode. After that I copied the other fields except CouponGUID down to fill the rest of the columns.

    Checked admin area and all were there.

    This was a while ago though.