[solved] ListIt2 - Import CSV "File is not CSV file"

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
curlypinky
Forum Members
Forum Members
Posts: 109
Joined: Thu Sep 04, 2008 3:49 am

[solved] ListIt2 - Import CSV "File is not CSV file"

Post by curlypinky »

I am attempting to import a csv into my ListIt2-built module. I created all the fields, added a few entries via the admin then exported a CSV from the system to use as my template to enter the data.

Now I have attempted to import the CSV and it is giving me an error "File is not CSV file"
I've tried removing the headers, changing the delimiters and enclosure marks but always the same error. It also gives the same error when attempting to import its own unmodified export csv file.

CMSMS v 1.11.6
Listit2 v 1.4-beta1

I'm not sure if my import file needs something or am I experiencing a bug? Any ideas would be appreciated, thanks!
Alane

This the first few rows of my csv file, the forum won't let me upload a csv file:

Code: Select all

"item_id";"alias";"title";"position";"active";"create_time";"modified_time";"start_time";"end_time";"key1";"key2";"key3";"categories";"lot_no";"parcel_no";"acres";"status";"lot_map";"key_map";"pdf_handout";"notes";"imgmap_coords"
"1";"1-1";"1-1";"1";"1";"2013-05-19 14:58:07";"2013-05-19 15:32:15";;;;;;"1";"1";"406";;"Reserved";;;;;"502,233,477,217,515,208,502,233,502,233"
"2";"1-2";"1-2";"2";"1";"2013-05-19 15:06:14";"2013-05-19 15:32:56";;;;;;"1";"2";"407";;"Sold";;;;;"571,223,521,235,528,218,533,210,540,205,571,223,571,223"
"3";"1-3";"1-3";"3";"1";"2013-05-19 15:06:14";"2013-05-19 15:32:56";;;;;;"1";"3";"408";"1.0";"Available";;;;;"628,250,609,256,569,232,587,227,628,250,628,250"
"4";"1-4";"1-4";"4";"1";"2013-05-19 15:06:14";"2013-05-19 15:32:56";;;;;;"1";"4";"409";"1.0";"Available";;;;;"604,257,584,262,544,238,563,233,604,257,604,257"
"5";"1-5";"1-5";"5";"1";"2013-05-19 15:06:14";"2013-05-19 15:32:56";;;;;;"1";"5";"410";"1.0";"Available";;;;;"580,263,559,269,520,245,539,239,580,263,580,263"
Last edited by curlypinky on Tue May 21, 2013 10:59 pm, edited 1 time in total.
Stikki

Re: ListIt2 - Import CSV "File is not CSV file"

Post by Stikki »

Yo,

MIME type is not valid when it comes from browser to server, something alters it. This is not first time i see this happening, so probably gotta figure something out for future.

How ever:

file: modules/ListIt2/framework/action.admin_importitems.php

line: 212

Comment out:

if(!in_array($_file['type'], $csv_mimetypes)) {

$errors[] = $this->ModLang('error_file_nocsv');
}

Removes CSV MIME type check.

PS: Tested your "file" in my system and it seems to work just fine.
curlypinky
Forum Members
Forum Members
Posts: 109
Joined: Thu Sep 04, 2008 3:49 am

Re: ListIt2 - Import CSV "File is not CSV file"

Post by curlypinky »

Thanks Stikki!
When you said you could get it to work on your system I wondered if it might work for me if I tried a different browser.
It did - I was getting the error in FireFox version 20.0.1 and I just tried the import in Internet Explorer 9 and it worked in IE without modifying Listit.

Thought I should mention - the import doesn't seem to be picking up the category value. In the export file it just refers to the category by number (presently I have only 1 category in the system). Import of new records ignored the category and an update of existing manually entered records cleared their category field.

I have "Enable subcategory option, will show inherited items in category and it's children:" enabled in my module, I'm not sure if that has any bearing on it.

Thanks!
Alane
Stikki

Re: ListIt2 - Import CSV "File is not CSV file"

Post by Stikki »

As of 1.4-beta1 changed categories, there is no more default category, so you have to assign item into category if you want it into one.

If you don't want to edit/modify some field on import, simply don't assign col from file to that field.

And yes currently importer dosen't understand anything else but raw values, so if you try to give name in import file, it dosen't recognize this. I am aware.

It suits my needs currently, so i didn't saw point reviewing this matter, might change it in future tho.
curlypinky
Forum Members
Forum Members
Posts: 109
Joined: Thu Sep 04, 2008 3:49 am

Re: ListIt2 - Import CSV "File is not CSV file"

Post by curlypinky »

Am I setting the value for categories wrong in the csv? In my import csv the categories value for each record is set to "1" (in the system the category is named "Phase 1", alias= "phase1" id="1").

I set all records categories to 1 and imported.
In the import I made sure to match the categories Item/Fielddef alias with the File header/alias categories

But importing an update cleared the categories value for all the records and emptied the _item_categories table in the DB.

I edited a few records through the admin to set their category back, checked to make sure my import file had a value in the categories field then tried the import again, made sure to match the categories fieldef alias to the fileheader alias but it cleared all the categories.

Thanks!

First lines of the CSV:

Code: Select all

"item_id";"alias";"title";"position";"active";"modified_time";"categories";"lot_no";"parcel_no";"acres";"status";"imgmap_coords";"lot_map";"key_map";"pdf_handout";"notes"
"1";"1-1";"1-1";"1";"1";"2013-05-19 19:16:54";"1";"1";"460";;"Reserved";"502,233,477,217,515,208,502,233,502,233";;;;
"2";"1-2";"1-2";"2";"1";"2013-05-19 19:17:32";"1";"2";"407";;"Sold";"571,223,521,235,528,218,533,210,540,205,571,223,571,223";;;;
"3";"1-3";"1-3";"3";"1";"2013-05-19 19:18:09";"1";"3";"408";"1.0";"Available";"628,250,609,256,569,232,587,227,628,250,628,250";;;;
"4";"1-4";"1-4";"4";"1";"2013-05-19 19:18:57";"1";"4";"409";"1.0";"Available";"604,257,584,262,544,238,563,233,604,257,604,257";;;;
"5";"1-5";"1-5";"5";"1";"2013-05-19 19:19:32";"1";"5";"410";"1.0";"Available";"580,263,559,269,520,245,539,239,580,263,580,263";;;;
Stikki

Re: ListIt2 - Import CSV "File is not CSV file"

Post by Stikki »

First line headers dosen't have to be exact. Those can be anything, as long first line of headers exists.

Categories work just like they are supposed, tested that.

It's most likely some of the user side error in this case.

Can't really help much more as there is nothing wrong.
curlypinky
Forum Members
Forum Members
Posts: 109
Joined: Thu Sep 04, 2008 3:49 am

Re: ListIt2 - Import CSV "File is not CSV file"

Post by curlypinky »

Well I am not sure where I am going wrong. Importing seems very straightforward. Creating or updating the items works great for me for all the fields, well, except applying categories.
I set the category value for each record to the categoryID# in the system (e.g. "1") (following the example of how it exports that value).

I even tried an update with a file that just held the fields necessary (itemid, category, title and status) for an update. The importer detects the file's header when matching the fields aliases to the import's headers.

I installed ListIt2 through the module manager. Just in case it was my installation I downloaded the XML from the forge and installed it: 1.4-beta1 Released On: 2013-02-28
No change.

I'd give you the file and admin access if you want to see it first hand.
Attachments
ImportExample.jpg
Stikki

Re: ListIt2 - Import CSV "File is not CSV file"

Post by Stikki »

Yo,

I don't do system checks anymore, it costs :)

But you are right, it wont assign categories, seems i tested with current production version, there it worked, but with beta1 didn't.

That's why it's called beta :)

Currently it's not safe to pull GIT cause 1.4 development is going on, so you can either go to 1.3.2 or do it manually, but i don't start to look at this point where problem was as it's already fixed.
curlypinky
Forum Members
Forum Members
Posts: 109
Joined: Thu Sep 04, 2008 3:49 am

Re: ListIt2 - Import CSV "File is not CSV file"

Post by curlypinky »

Ah well there's the culprit!

Even with that little bit the beta in the forge is very good, it's an incredible module.
I can use it as-is and work around the categories until the new version comes out then I'll update the records.

Thanks!
Alane
Post Reply

Return to “Modules/Add-Ons”