Only imports first record, and no categories
Posted: 02 June 2010 06:31 PM   [ Ignore ]  
Newbie
Rank
Total Posts:  5
Joined  2010-06-02

Hi All. This plugin looks great, but am stuck on something:

When I try to import, I only get the first entry. Strangely, it also adds the start of the next line to the last field of the 1st. Here’s my CSV:

Tabula Europae III [France] (1st edition!),375,France,Munster,1542,"Shows are remarkable depiction of the region, as known in Ptolemy's time.  This is the 1st edition, second state of Munster's map, which can be distinguished by the inclusion of the 2nd printer's device in the title.  Munster's Geographia (1st issued in 1540) and Cosmographia (1548) are the most important and widely copied geographical works of the middle part of the 16th Century and represented for most Europeans the first accessible imagery (maps and views) of the World. "
America Sive Novus Orbis,975,America,Ortelius  Vrients,1602,"Detailed miniature map of America, from the first Vrients edition of Ortelius' Epitome." 

And my update template:

{exp:csvgrab url="http://eeshop.dev/uploads/catalogue.csv"
    
delimiter=","
    
encloser="QUOTE"
    
weblog="2"
    
category_group="12"
    
title="1"
    
category_field="3"
    
use="2|6"
    
fields="catalogue-price|catalogue-description"

When I run this template, one entry is created, based on the 1st line of the CSV. The title and custom fields do get mapped to the right fields, but the catalogue-description field includes the 2nd entry’s title at its end.

Also, although the update template says that it’s found the category (“Category France exists”), it isn’t then selected when I view the entry in the CP. I’ve tried with un-nested categories and with creating a new category, but that also doesn’t seem to work.

Any help would be gratefully received!

Profile
 
 
Posted: 06 June 2010 05:07 PM   [ Ignore ]   [ # 1 ]  
Administrator
RankRankRankRank
Total Posts:  179
Joined  2006-04-12

This might be a problem with the type of line ending that the file has. Different systems traditionally used different characters to mark the end of a line - http://en.wikipedia.org/wiki/Newline#Common_problems

If you can open the file in a text editor, see if you can save the file with LF or Unix/Linux line endings rather than CR.

Andrew

Profile
 
 
Posted: 07 June 2010 03:41 AM   [ Ignore ]   [ # 2 ]  
Newbie
Rank
Total Posts:  5
Joined  2010-06-02

Thanks Andrew - I’ll give that a go. Apologies also for the very long line lengths from my post above - was thinking they’d wrap!

Profile
 
 
Posted: 07 June 2010 04:04 PM   [ Ignore ]   [ # 3 ]  
Newbie
Rank
Total Posts:  5
Joined  2010-06-02

Yep that’s fixed the issue with number of imports: it was indeed the line endings.

However, categories still don’t seem to be working. Using the code from my first post, running the update script returns “Category France exists” or “Try to add category Italy” for example, but then in the CP the weblog entries don’t have a category selected. I’ve tried setting a default category with, say, category=“12”, but that just sets all of them to category 12 and ignores the categories in the CSV. Any ideas what could be going wrong?

Also, (and apologies: this is slightly off topic), is there a way to overwrite the entire weblog on each import? I’m going to be starting each import with a fresh export of the whole database, so want to get the EE weblog to match it exactly. At the moment CSVGrab would just add the CSV values to the existing weblog. And if I can do this, would the weblog be available to the site while it’s happening? (I’m concerned that while importing around 2000 entries from a CSV, the site might show no results from the weblog?)

Thanks again for your help!

Profile
 
 
Posted: 08 June 2010 01:50 AM   [ Ignore ]   [ # 4 ]  
Administrator
RankRankRankRank
Total Posts:  179
Joined  2006-04-12

Hi Frank,

Is this a MSM site?

Andrew

Profile
 
 
Posted: 08 June 2010 02:56 AM   [ Ignore ]   [ # 5 ]  
Newbie
Rank
Total Posts:  5
Joined  2010-06-02

Hi Andrew

No - just a normal EE site.

Profile