sharingsunshine Posted December 2, 2013 Share Posted December 2, 2013 I am not able to use the normal csv import feature because the data I importing from is in json format. I have written a script to update the database with the product details but when I go into the back office it doesn't show the new products. So I must be missing some field(s) that the program is looking for before the new data will be considered a product. So please tell me what fields are the minimum that must be provided. Thanks, Link to comment Share on other sites More sharing options...
benjamin utterback Posted December 2, 2013 Share Posted December 2, 2013 I'm not sure about the json way of importing. I know the recommended way is through CSV. Are you able to convert you json format to csv? Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 3, 2013 Author Share Posted December 3, 2013 I asked some programmers about that and they said it was too complex. I have imported the data but for some reason the DB still needs something else so that's why I need a list of the required fields that are needed. Link to comment Share on other sites More sharing options...
ibndawood Posted December 3, 2013 Share Posted December 3, 2013 The only required field for adding a Product is Product Name. Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 3, 2013 Author Share Posted December 3, 2013 Thanks for your help. I have loaded in ps_product_lang the name of the product but it still doesn't show in the backoffice. Is there something else I need to do? Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 3, 2013 Author Share Posted December 3, 2013 Also, in ps_product_lang I have description, id_product and id_shop filled in. In ps_product I have id_product, price and wholesale price filled in. So do I need something else to get it to recognize that more products have been added? Thanks, Link to comment Share on other sites More sharing options...
ibndawood Posted December 4, 2013 Share Posted December 4, 2013 Did you just export your db ? This is how a CSV export generally looks like. You can then use field mapping to achieve proper importing. ID;Photo;Name;Reference;Category;Base price;Final price;Quantity;Status; 3;http://localhost/~ibrahim/prestashopv1.5.6.1/img/p/1/1.jpg;MacBook Air;demo_3;Laptops;1504.180602;1504.18;400;1; 6;http://localhost/~ibrahim/prestashopv1.5.6.1/img/p/1/3/13.jpg;Belkin Leather Folio for iPod nano - Black / Chocolate;demo_6;Accessories;25.041806;25.04;25;1; 1;http://localhost/~ibrahim/prestashopv1.5.6.1/img/p/1/5/15.jpg;iPod Nano;demo_1;iPods;124.581940;158.07;158;1; 4;http://localhost/~ibrahim/prestashopv1.5.6.1/img/p/6/6.jpg;MacBook;demo_4;Laptops;1170.568561;1170.57;75;1; 7;http://localhost/~ibrahim/prestashopv1.5.6.1/img/p/1/4/14.jpg;Shure SE210 Sound-Isolating Earphones for iPod and iPhone;demo_7;Accessories;124.581940;134.58;15;1; 2;http://localhost/~ibrahim/prestashopv1.5.6.1/img/p/2/3/23.jpg;iPod shuffle;demo_2;iPods;66.053500;66.05;120;1; 5;http://localhost/~ibrahim/prestashopv1.5.6.1/img/p/7/7.jpg;iPod touch;demo_5;iPods;241.638796;241.64;120;1; Link to comment Share on other sites More sharing options...
ibndawood Posted December 4, 2013 Share Posted December 4, 2013 Here is a post I made about CSV importing in another thread : http://www.prestashop.com/forums/topic/293272-csv-import-procedures-help-please/?p=1479530 1 Link to comment Share on other sites More sharing options...
prestamax Posted December 4, 2013 Share Posted December 4, 2013 sharingsunshine, you could convert your json to csv. Here is a converter http://jsfiddle.net/sturtevant/vUnF9/ 1 Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 4, 2013 Author Share Posted December 4, 2013 No, I didn't export the DB. Actually, it came from another site that didn't use MySQL that's why it was in json. Ibndawood, thanks for specifically answering in the link you provided if fields are left out that will help tremendously. Prestamax, that looks like a very good site. Although, I came to the same conclusion and converted it to csv using http://www.json2csv.com/ I had to strip out some characters through regex but it looks like it will work. I will report back if my import was successful. Thanks, Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 4, 2013 Author Share Posted December 4, 2013 none of my import is working I am getting this error. Blood Stimulator TCM Conc. (30 caps) (ID: 10) cannot be saved Property Product->link_rewrite is empty HY-C TCM Conc. (30 caps) (ID: 11) cannot be saved Property Product->name is empty I I didn't do anything with link_rewrite but I did map the name field. Do you have any ideas? On the import I ticked the following: force all id's during import. As I mentioned above, I have populated some tables already via php and I need to keep that data if at all possible. Thanks, Thanks, Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 4, 2013 Author Share Posted December 4, 2013 (edited) I noticed that even though I made all the columns in the order of the sample that when I upload the csv file it rearranges the column order. Here is a glimpse of the .csv file ID,Active,Name,Categories,On Sale,Reference #,Available for Order,Product Available Date,Show Price8,1,Blessed Thistle (100 caps),4,0,100-1,1,2013-12-04,19,1,Lung Support TCM Conc. (30 caps),4,0,1004-3,1,2013-12-04,110,1,Blood Stimulator TCM Conc. (30 caps),4,0,1005-9,1,2013-12-04,111,1,HY-C TCM Conc. (30 caps),4,0,1006-1,1,2013-12-04,112,1,IF-C TCM Conc. (30 caps),4,0,1007-2,1,2013-12-04,113,1,Liver Balance TCM Conc. (30 caps),4,0,1008-8,1,2013-12-04,114,1,Liver Cleanse Formula (100 caps),4,0,1010-3,1,2013-12-04,115,1,LIV-J (100 caps),4,0,1011-4,1,2013-12-04,116,1,KB-C TCM Conc. (30 caps),4,0,1016-0,1,2013-12-04,1 by the way, I am starting at id 8 because when I uipdated the tables I left the sample data intact. Thanks, Edited December 4, 2013 by sharingsunshine (see edit history) Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 4, 2013 Author Share Posted December 4, 2013 thought my csv file may be incorrect so I changed it to this id,Active (0/1),Name*,"Categories (x,y,z,...)",On sale (0/1),Reference #,"Available for order (0 = No, 1 = Yes)",Product available date,"Show price (0 = No, 1 = Yes)"8,1,Blessed Thistle (100 caps),4,0,100-1,1,2013-12-04,19,1,Lung Support TCM Conc. (30 caps),4,0,1004-3,1,2013-12-04,110,1,Blood Stimulator TCM Conc. (30 caps),4,0,1005-9,1,2013-12-04,111,1,HY-C TCM Conc. (30 caps),4,0,1006-1,1,2013-12-04,112,1,IF-C TCM Conc. (30 caps),4,0,1007-2,1,2013-12-04,113,1,Liver Balance TCM Conc. (30 caps),4,0,1008-8,1,2013-12-04,114,1,Liver Cleanse Formula (100 caps),4,0,1010-3,1,2013-12-04,115,1,LIV-J (100 caps),4,0,1011-4,1,2013-12-04,116,1,KB-C TCM Conc. (30 caps),4,0,1016-0,1,2013-12-04,117,1,Nervous Fatigue TCM Conc. (30 caps),4,0,1017-1,1,2013-12-04,118,1,Anti-Gas TCM Conc. (30 caps),4,0,1018-9,1,2013-12-04,119,1,Pro-Pancreas (100 caps),4,0,1027-9,1,2013-12-04,120,1,PLS II (100 caps),4,0,1029-4,1,2013-12-04,1 By the way, the fields are now in the order they should be too. Link to comment Share on other sites More sharing options...
prestamax Posted December 4, 2013 Share Posted December 4, 2013 (edited) none of my import is working I am getting this error. Blood Stimulator TCM Conc. (30 caps) (ID: 10) cannot be saved Property Product->link_rewrite is empty HY-C TCM Conc. (30 caps) (ID: 11) cannot be saved Property Product->name is empty I I didn't do anything with link_rewrite but I did map the name field. Do you have any ideas? On the import I ticked the following: force all id's during import. As I mentioned above, I have populated some tables already via php and I need to keep that data if at all possible. Thanks, Thanks, You most likely forgot to skip the first line with the headings. When importing the csv you have the option to skip a certain number of lines (default is zero). Here you have to enter the number 1 in order to skip the headings otherwise you will get the error above. See screenshot: Edited December 4, 2013 by prestamax (see edit history) Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 4, 2013 Author Share Posted December 4, 2013 Hi, Thanks for getting back to me but I have skip 1 lines activated. Link to comment Share on other sites More sharing options...
prestamax Posted December 4, 2013 Share Posted December 4, 2013 (edited) Did you check if your column headers matched the column headers of prestashop when importing csv? And did you chose the correct separator (comma or semicolon)? Edited December 4, 2013 by prestamax (see edit history) Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 4, 2013 Author Share Posted December 4, 2013 I had one wrong and I changed it (see below) but it still gives the same errors ID,Active (0/1),Name*,"Categories (x,y,z,...)",On sale (0/1),Reference #,"Available for order (0 = No, 1 = Yes)",Product available date,"Show price (0 = No, 1 = Yes)"8,1,Blessed Thistle (100 caps),4,0,100-1,1,2013-12-04,19,1,Lung Support TCM Conc. (30 caps),4,0,1004-3,1,2013-12-04,110,1,Blood Stimulator TCM Conc. (30 caps),4,0,1005-9,1,2013-12-04,111,1,HY-C TCM Conc. (30 caps),4,0,1006-1,1,2013-12-04,112,1,IF-C TCM Conc. (30 caps),4,0,1007-2,1,2013-12-04,1 Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 4, 2013 Author Share Posted December 4, 2013 For some reason Excel wanted to put some of the headings in quotes, so I changed that. However, it still gave the same error. ID,Active (0/1),Name*,Categories (x,y,z,...),On sale (0/1),Reference #,Available for order (0 = No, 1 = Yes),Product available date,Show price (0 = No, 1 = Yes)8,1,Blessed Thistle (100 caps),Nature's Sunshine Products,0,100-1,1,2013-12-04,19,1,Lung Support TCM Conc. (30 caps),Nature's Sunshine Products,0,1004-3,1,2013-12-04,110,1,Blood Stimulator TCM Conc. (30 caps),Nature's Sunshine Products,0,1005-9,1,2013-12-04,111,1,HY-C TCM Conc. (30 caps),Nature's Sunshine Products,0,1006-1,1,2013-12-04,112,1,IF-C TCM Conc. (30 caps),Nature's Sunshine Products,0,1007-2,1,2013-12-04,113,1,Liver Balance TCM Conc. (30 caps),Nature's Sunshine Products,0,1008-8,1,2013-12-04,114,1,Liver Cleanse Formula (100 caps),Nature's Sunshine Products,0,1010-3,1,2013-12-04,1 Link to comment Share on other sites More sharing options...
benjamin utterback Posted December 4, 2013 Share Posted December 4, 2013 This is a good example csv file that includes features. See if this helps. examplecsv.zip Link to comment Share on other sites More sharing options...
prestamax Posted December 4, 2013 Share Posted December 4, 2013 (edited) I would try using LibreOffice Calc instead of Excel. With LibreOffice you have much more control over your csv file.http://www.libreoffice.org/Just to give you an example (sorry, it's in German but I am sure you will see what I mean): And when editing the fields you won't have a messed line but a nice looking table. The problem is probably your apostrophe ' in the products name and you will have to choose " as text delimiter. Not sure if excel gives you the option but you will have them in libreoffice. Edited December 4, 2013 by prestamax (see edit history) Link to comment Share on other sites More sharing options...
sharingsunshine Posted December 4, 2013 Author Share Posted December 4, 2013 I went ahead and deleted the sample data and it loaded fine. So we can consider this solved. Thanks for everyone's help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now