Zen Cart Logo
Forums / Discounts/Coupons, Gift Certificates, Newsletters, Ads / How to perform bulk import of coupon codes? Getting error code 1054.

How to perform bulk import of coupon codes? Getting error code 1054.

Views: 9,110

Results 1 to 20 of 26
11 Nov 2010, 8:35 PM
#1
rmickus avatar

rmickus

New Zenner

Join Date:
Nov 2010
Posts:
7
Plugin Contributions:
0

How to perform bulk import of coupon codes? Getting error code 1054.

I am trying to figure out how to import a bulk number of coupons as we get ready for an upcoming GroupOn special.

Based on the forum articles I have read, I understand that this can be accomplished by importing a new file into the "coupons" table.

I have been trying to test this out and I keep getting the following error message:

#1054 - Unknown column 'A' in 'field list'

Does anyone have any suggestions on how to overcome this error?

Thanks....from a new non-technical zenner...

11 Nov 2010, 9:09 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How to perform bulk import of coupon codes? Getting error code 1054.

What are you trying to upload and what are you using to do so?

I mean the actual sql content as your error indicates a not found for column "A"

11 Nov 2010, 9:30 PM
#3
rmickus avatar

rmickus

New Zenner

Join Date:
Nov 2010
Posts:
7
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

I exported the "coupons" table using phpMyAdmin and specified the file format type to be "Excel 97-2003 XLS Workbook". I then opened this file on my computer using Excel, and performed a copy of one of the rows in the spreadsheet and then editted the new row in order to create a new coupon code. I then saved the file and used the import feature on phpMyAdmin to try and upload, but it keeps generating the 1054 error message. I also tried to export in an Open Office format (ODS) and then import the ODS file back, but this results in yet another type of error message.

11 Nov 2010, 10:46 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How to perform bulk import of coupon codes? Getting error code 1054.

I exported the "coupons" table using phpMyAdmin and specified the file format type to be "Excel 97-2003 XLS Workbook
I could not get that to work either
But exported as a sql in proper format just the coupon table and edited in a code editor and this was a success

12 Nov 2010, 4:32 PM
#5
rmickus avatar

rmickus

New Zenner

Join Date:
Nov 2010
Posts:
7
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

Thanks for the suggestion. I exported the coupons table as an SQL file and then added a new record into the file and imported it back as an SQL file......and now it's giving me the following message:

MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0001 sec )

Thanks for any further suggestions....

12 Nov 2010, 4:39 PM
#6
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How to perform bulk import of coupon codes? Getting error code 1054.

Post yoour edit to the sql

Here is what I did with success

-- Dumping data for table `coupons`
--

INSERT INTO `coupons` (`coupon_id`, `coupon_type`, `coupon_code`, `coupon_amount`, `coupon_minimum_order`, `coupon_start_date`, `coupon_expire_date`, `uses_per_coupon`, `uses_per_user`, `restrict_to_products`, `restrict_to_categories`, `restrict_to_customers`, `coupon_active`, `date_created`, `date_modified`, `coupon_zone_restriction`) VALUES
(1, 'F', '892a088998', '10.0000', '20.0000', '2010-11-11 00:00:00', '2011-11-11 00:00:00', 100, 1, '', '', NULL, 'Y', '2010-11-11 16:32:39', '2010-11-11 16:32:39', 0);
INSERT INTO `coupons` (`coupon_id`, `coupon_type`, `coupon_code`, `coupon_amount`, `coupon_minimum_order`, `coupon_start_date`, `coupon_expire_date`, `uses_per_coupon`, `uses_per_user`, `restrict_to_products`, `restrict_to_categories`, `restrict_to_customers`, `coupon_active`, `date_created`, `date_modified`, `coupon_zone_restriction`) VALUES
(2, 'F', '892a088999', '20.0000', '40.0000', '2010-11-11 00:00:00', '2011-11-11 00:00:00', 100, 1, '', '', NULL, 'Y', '2010-11-11 16:32:39', '2010-11-11 16:32:39', 0);
12 Nov 2010, 5:07 PM
#7
rmickus avatar

rmickus

New Zenner

Join Date:
Nov 2010
Posts:
7
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

Here's the SQL code for what I am trying to do. I am using the import function on phpMyAdmin. Should I perhaps be using a different method?

INSERT INTO coupons (coupon_id, coupon_type, coupon_code, coupon_amount, coupon_minimum_order, coupon_start_date, coupon_expire_date, uses_per_coupon, uses_per_user, restrict_to_products, restrict_to_categories, restrict_to_customers, coupon_active, date_created, date_modified, coupon_zone_restriction) VALUES
(1, 'F', 'datz15', '15.0000', '45.0000', '2009-08-08 00:00:00', '2010-08-08 00:00:00', 0, 1, '', '', NULL, 'Y', '2009-08-13 18:33:34', '2009-08-13 18:33:34', 0),

12 Nov 2010, 5:09 PM
#8
rmickus avatar

rmickus

New Zenner

Join Date:
Nov 2010
Posts:
7
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

One other thing.....I noticed on the import options that there is a drop-down menu for the field called "SQL Compatibility Mode". It is currently set to "NONE". Do I perhaps need to select something different here?

12 Nov 2010, 5:17 PM
#9
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How to perform bulk import of coupon codes? Getting error code 1054.

You are missing the ending semi-colon

INSERT INTO `coupons` (`coupon_id`, `coupon_type`, `coupon_code`, `coupon_amount`, `coupon_minimum_order`, `coupon_start_date`, `coupon_expire_date`, `uses_per_coupon`, `uses_per_user`, `restrict_to_products`, `restrict_to_categories`, `restrict_to_customers`, `coupon_active`, `date_created`, `date_modified`, `coupon_zone_restriction`) VALUES
(1, 'F', 'datz15', '15.0000', '45.0000', '2009-08-08 00:00:00', '2010-08-08 00:00:00', 0, 1, '', '', NULL, 'Y', '2009-08-13 18:33:34', '2009-08-13 18:33:34', 0), 
12 Nov 2010, 6:08 PM
#10
rmickus avatar

rmickus

New Zenner

Join Date:
Nov 2010
Posts:
7
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

Ahhh, thanks for catching this. So, I was able to successfully execute the below SQL insert command under the SQL tab of the phpMyAdmin (i.e. not the import tab).

The message indicated that a new row was successfully inserted.

However, when I go to my ZenCart admin portal and look under the coupon admin section, I don't see the new coupon listed. Do you know if there is perhaps something else that also needs to be done, such as making an insert into the coupons_description table?

INSERT INTO coupons (coupon_id, coupon_type, coupon_code, coupon_amount, coupon_minimum_order, coupon_start_date, coupon_expire_date, uses_per_coupon, uses_per_user, restrict_to_products, restrict_to_categories, restrict_to_customers, coupon_active, date_created, date_modified, coupon_zone_restriction) VALUES

(26, 'G', 'groupon01', '50.0000', '0.0000', '2010-09-23 00:00:00', '2011-09-23 00:00:00', 0, 0, '', '', NULL, 'Y', '2010-09-23 13:06:02', '2010-09-23 13:06:02', 0);

12 Nov 2010, 6:13 PM
#11
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How to perform bulk import of coupon codes? Getting error code 1054.

when I go to my ZenCart admin portal and look under the coupon admin section, I don't see the new coupon listed. Do you know if there is perhaps something else that also needs to be done, such as making an insert into the coupons_description table?

I didn't and it showed in the admin???

Not positive but you have "0's" for these
uses_per_coupon, uses_per_user
and maybe as there are no uses it does not show???

12 Nov 2010, 7:30 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to perform bulk import of coupon codes? Getting error code 1054.

Are you trying to create Discount Coupons or Gift Certificates (cash for people) ...

coupon_type G

is for Gift Certificates ... meaning you are giving away cash that never expires to people ...

15 Nov 2010, 9:50 AM
#13
angeline12 avatar

angeline12

New Zenner

Join Date:
Nov 2010
Posts:
2
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

For an advanced chore since you have done a wonderful work here, let me share you something. When I needed to import bulk of codes into another site, my friend told me to use iMacros for the Firefox to be able to read in the CSV. As a result, I was able to import the 800 coupon codes in Groupon in just 15 minutes.

1 Dec 2010, 6:07 PM
#14
thegoodlifestore avatar

thegoodlifestore

New Zenner

Join Date:
Oct 2007
Location:
North Carolina
Posts:
102
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

Wow, angeline12.

Thanks for the pointer in the direction of that iMacros plug-in for Firefox.

Once I got the Macro set up properly, it works like a charm on importing a lot of coupon codes!!!

:bigups: and :bigups:

1 Sep 2011, 7:35 PM
#15
wakenine avatar

wakenine

New Zenner

Join Date:
Nov 2006
Posts:
26
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

I have just figured out how to successfully bulk-import coupon codes for events like Groupon, Jasmere, etc. If anyone is interested in a pretty quick and easy run-down on how to do it, let me know. If enough people are needing help with this, I might do a write-up that could possibly be added to the FAQs or something. Either way, I am glad to help.

19 Sep 2011, 1:25 PM
#16
marleyman avatar

marleyman

New Zenner

Join Date:
Mar 2007
Posts:
31
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

Wakenine - I would be VERY interested in your "How To"!! I need to implement Groupon on my Zen Cart 1.3.9 Site. Thanks so much!

20 Oct 2011, 8:31 AM
#17
jansuh_nl avatar

jansuh_nl

New Zenner

Join Date:
Aug 2008
Posts:
30
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

marleyman:

Wakenine - I would be VERY interested in your "How To"!! I need to implement Groupon on my Zen Cart 1.3.9 Site. Thanks so much!

Count me in also!!

Just got a call to deliver 80.000 vouchercodes that are going to be printed on packages........ sigh/cheer

If nessecary i'll do it by hand but i hope there is a way to automate this

31 Oct 2011, 7:49 PM
#18
carlvt88 avatar

carlvt88

Zen Follower

Join Date:
Aug 2007
Location:
Williston, Vermont
Posts:
180
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

I ended up creating a vbs script file that would generate the necessary sql command. This was because:1. I received a list of ascii string codes from dealChicken
2. I already had existing coupons in the database
3. I couldn't use autoincrement because
4. I had coupon restrictions (only useful for certain items)
It worked great, but I don't know if this is the best way to go about this. The UI in Zencart doesn't seem to work well for many (>100) coupon codes - it can't sort, or filter, or do batch manipulations. This makes me wonder if I'm overcomplicating things and there's an easier way.

23 Jan 2012, 3:46 AM
#19
familynow avatar

familynow

Zen Follower

Join Date:
Aug 2011
Location:
Near Ottawa, Ontario, Canada
Posts:
321
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

Hi.

I'm working on a WagJag campaign and would be very intersted in working out a simple bulk import solution as mentioned above. Was the "how-to" pm'd or something? There's no follow-up to this thread...

10 Apr 2012, 4:22 PM
#20
knownonesince avatar

knownonesince

New Zenner

Join Date:
Dec 2009
Posts:
22
Plugin Contributions:
0

Re: How to perform bulk import of coupon codes? Getting error code 1054.

carlvt88:

I ended up creating a vbs script file that would generate the necessary sql command.
Would you mind to share your vbs script? I'm trying to do the same.
Thank you very much!