phantomeye Posted July 8, 2011 Share Posted July 8, 2011 HI,I would like to create 1000 vouchers for groupon. However since these vouchers are like cash value, i do not want to enter sequential numbers.Ive used excel to randomly generate numbers and would like to import them directly into the database ..... than entering 1000 vouchers individually (pls dont make me do that)Im sure these is a way to directly import them into the database, if someone can just tell me the fields, that would be awesome.Thanks Link to comment Share on other sites More sharing options...
phantomeye Posted July 8, 2011 Author Share Posted July 8, 2011 Ive figured 75%, still working on the remaining 25%. Here are my steps:1) Log into PHP MySQL Admin2) Goto table "ps_discount"3) Select Import tab4) Browse to your csv file location 5) Important to set field separator etc values to csv values6) In csv Also important to set date field format to the correct format (yyyy/mm/dd hh:mm:ss)7) In csv, ensure you fill all the fields (to see all fields, you can export the table as csv with column headers)8) After import, check to make sure everything has imported (pls import only 2 rows as test, before you import all)9) Next goto table "ps_discount_category"10) Import in same way the relevant categories for each voucherYes these steps seem like what you need to do, however i have not imported the last 2 steps (9, 10) will do so tonite and let you all know how it works out. In theory it should work.Cheers and keep on Presta-shopping !!! Link to comment Share on other sites More sharing options...
phantomeye Posted July 14, 2011 Author Share Posted July 14, 2011 Okay this is 100% solved, here are the steps i used to insert 300 vouchers at one time. Total time it took was 15 minutes. Tables to be altered in phpMysql 1) ps_discount 2) ps_discount_lang 3) ps_discount_category Steps for ps_discount (id_discount id_discount_type behavior_not_exhausted id_customer id_group id_currency name value quantity quantity_per_user cumulable cumulable_reduction date_from date_to minimal active cart_display date_add date_upd) 1 in a csv file, create and update values for above fields 2 note: id_discount is the primary reference key for the other tables, so please keep track of it 3 note: for the date, the format is yyyy:mm:dd hh:mm:ss (if it is not properly set, the import will have issues) 4 next goto import (in table ps_discount), browse to your csv file and select it 5 change the options for csv (fields terminated by "," and fields enclosed by "leave blank" 6 click import and you are done Steps for ps_discount_lang (id_discount id_lang description) - in a csv file update the values for the above fields - note id_discount should be the exact same values copied from the ps_discount csv file - follow the same steps as above (4, 5, 6) Steps for ps_discount_category (id_category id_discount) -in a csv file update the values for the above fields - note id_category are the category numbers for all the categories you want the voucher to be active in - note id_discount should be the exact same values copied from the ps_discount csv file - follow the same steps as above (4,5,6) And thats it, you are done. Enjoy !! Link to comment Share on other sites More sharing options...
Saray Posted September 29, 2011 Share Posted September 29, 2011 Anyone else tried this? I have to import over 1000 vouchers it would take me 2 weeks so this is very intresting did you notice anything wrong after import? Link to comment Share on other sites More sharing options...
phantomeye Posted September 29, 2011 Author Share Posted September 29, 2011 Hi Saray, I've imported 1000 vouchers for Groupon and it worked perfectly. It did not effect my loyalty voucher module which I have running concurrently. (with cronjob) Important point to note: Make sure the date field is formatted properly as mentioned above, else it will not work. Also first import only 2 vouchers to make sure all fields are being imported properly. Then do the remaining 998. Cheers and good luck ! Link to comment Share on other sites More sharing options...
phantomeye Posted October 28, 2011 Author Share Posted October 28, 2011 Hi Guys, I just imported 8,000 vouchers using this process, took me 30 minutes, worked perfectly. Just finished our Groupon deal and everything went of perfectly !! cheers Link to comment Share on other sites More sharing options...
edzai Posted November 23, 2011 Share Posted November 23, 2011 hello, can you please show me sample of csv file you have imported, please. thanks Link to comment Share on other sites More sharing options...
phantomeye Posted November 29, 2011 Author Share Posted November 29, 2011 Hi Edzai, Attached is one excel file, which has the 3 tables in it. Note, the best way to understand these tables will be to actually export your current tables with their column headers from phpMyadmin. Also if you are using this, check out the second part to this process, here http://www.prestasho...961#entry670961 Hope these help you Cheers sorry guys for some reason it will not upload my csv file Mods any ideas ? uploaded a pdf file for now ;-) Import voucher tables.pdf Link to comment Share on other sites More sharing options...
Lucas-911 Posted November 30, 2011 Share Posted November 30, 2011 Can anyone see what is wrong with these csv files?! I keep on getting an error message when I go to import them?! I have added id_discount 6............ Not getting error message now, but voucher has invalid date in backend? I just copied the dates format from the first entry done manually via prestashop back-end!? csv .zip Link to comment Share on other sites More sharing options...
phantomeye Posted December 1, 2011 Author Share Posted December 1, 2011 You need to correct the date format in ps_discount file to yyyy:mm:dd hh:mm:ss your current format has slashes. Once you have created the required format in the csv, save the file, do not close it while uploading. Sometimes when you close the file and upload, it changes the format of the date field. Everything else looks good. To retry the same import, you will need to delete your previous imported data. Good luck! Link to comment Share on other sites More sharing options...
Meromanche Posted April 20, 2012 Share Posted April 20, 2012 Thank you so much for your help. With the multiplication of daily offer websites, you would have thought that somebody would have invented a module to upload vouchers... Link to comment Share on other sites More sharing options...
vekia Posted August 19, 2012 Share Posted August 19, 2012 Just use simple module Import Vouchers from CSV (or other file), you can find it here: http://addons.prestashop.com/en/administration-tools-prestashop-modules/5592-Import-Voucher-from-CSV.html Link to comment Share on other sites More sharing options...
gogohacker Posted November 22, 2012 Share Posted November 22, 2012 Why do You need to import Groupon vouchers into the database? The question might be dumb, but I am from Bulgaria and I would like to know the point? You sell on Groupon and after that they come to Your shop and put an order there, or...? Thank You in advance. Link to comment Share on other sites More sharing options...
vekia Posted November 22, 2012 Share Posted November 22, 2012 it's simple i think. For example I sell own stuff there for 50% off, when customer buy on groupon - it gets voucher code to use in my shop. I must add it to my shop... even if a thousand people buy my stuff on the grupon Link to comment Share on other sites More sharing options...
gogohacker Posted November 22, 2012 Share Posted November 22, 2012 I thought so, but I wanted to make sure. Because we have those kinda websites here and we are selling a lot, but no one thought of bringing the customers from those site to their own website. Thanks for the answer. Link to comment Share on other sites More sharing options...
nola_be Posted June 19, 2013 Share Posted June 19, 2013 (edited) Hi, i have a question, I did everything you wrote correctly. Then I wanted to open my website and received the message "Link to database cannot be established." Have no idea what happened. Can you help me, please? Thanks in advance Olga Edited June 19, 2013 by nola_be (see edit history) Link to comment Share on other sites More sharing options...
benjamin utterback Posted June 19, 2013 Share Posted June 19, 2013 Hi nola_be, these instructions are about 2 years old for a much older version of PrestaShop. They would not work for the later versions of PrestaShop because the database structure have changed. You can use this module to do this fast and efficiently, http://addons.prestashop.com/en/administration-tools-prestashop-modules/5592-import-voucher-from-csv.html Link to comment Share on other sites More sharing options...
nola_be Posted June 19, 2013 Share Posted June 19, 2013 The problem is now: how can I come back to the previous version of my website? It doesn't work. I know, the topic is old, I have a 1.4 version of prestashop, so I thought it would be ok. Now I know it's not. I've deleted files I've imported but nothing happened. Link to comment Share on other sites More sharing options...
benjamin utterback Posted June 19, 2013 Share Posted June 19, 2013 Hi nola_be, before you make changes to the database structure, add or delete tables, you need made a backup. So just revert to the backup you made. Link to comment Share on other sites More sharing options...
vekia Posted June 19, 2013 Share Posted June 19, 2013 im checking it with nola_be i think that the problem is related to the password (she changed it in webhosting control panel and forgot to change it in the configuration file) i suppose that the problem is related to this, tommorow I will know more (here in europe is very late now) edit: as i said, the problem was related to password change, now everything works like a charm Link to comment Share on other sites More sharing options...
ueduard Posted July 10, 2013 Share Posted July 10, 2013 In prestashop 1.5.4.1 there is no table called ps_discount. Does any know how to add 100 coupons? Link to comment Share on other sites More sharing options...
vekia Posted July 10, 2013 Share Posted July 10, 2013 you can do it with module to import vouhers from csv in ps 1.5.x there is not ps_discount tab because there is ps_cart_rule table Link to comment Share on other sites More sharing options...
Itinerant Posted January 22, 2014 Share Posted January 22, 2014 (edited) In Prestashop 1.5 you will need to work only with ps_cart_rule and ps_cart_rule_lang tables. Mechanism is even simplier: 0) create one cart rule in admin panel of your site with needed options. 1) go to ps_cart_rule in your phpMyAdmin. 2) select "export" tab and export that table as .csv file. 3) open exported file in Exel or OpenOffice Calc. note: in Calc i used RANDBETWEEN function to create exclusive codes. You have to watch for repeating codes also. The best way is to insert =COUNTIF(J$3:J4;J4) function somewhere in empty column ("description" for me). If it returns number greater than 1, you better simply delete that whole line. 4) make as many copies of your rule as you need. 5) save new .csv file 6) go to "import" tab in phpMyAdmin and upload your new .csv note: you will have to change you delimiter to ; The only thing, in new cart rules tab "name" will be empty. For naming your rules, take ps_cart_rule_lang table. Edit it in a similar way as written above. That's it! Edited January 22, 2014 by Itinerant (see edit history) 1 Link to comment Share on other sites More sharing options...
vekia Posted February 27, 2014 Share Posted February 27, 2014 my import voucher from csv supports utf8 Link to comment Share on other sites More sharing options...
Recommended Posts