7 of 14
7
Plugin: CSVGrab
Posted: 25 April 2008 10:28 AM   [ Ignore ]   [ # 109 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  112
Joined  03-21-2007

I’ve succesfully imported more than 3,000 entries using the following code:

{exp:csvgrab url="http://www.domain.com/grab/memberlist-OG-25-04-2008.csv"
                          
site_id="4"
                          
weblog="26"
                          
title="2"
                          
delimiter="TAB"
                          
encloser="QUOTE"
                          
use="1|8|3|4|5|6|7"
                          
fields="member-number|member-type|MAddress1|MAddress2|MAddress3|MAddress4|MSubRegion" }
}

However when I go to view entries in a template I get the following:

Bob SMITH
{member-number} {member-type} {MAddress1} {MAddress2} {MAddress3} {MAddress4} {MSubRegion}

None of my custom fields seem to be rendering. I have checked all associations and groups and they are correct. If I manually enter data then the entry displays correctly:

test name
10010 Member test test test test test

The template code i am using is:

{exp:weblog:entries weblog="{my_weblog}" limit="100"}

<div class="entry">

<
h2>{title}</h2>

{member-number}
{member
-type}
{MAddress1}
{MAddress2}
{MAddress3}
{MAddress4}
{MSubRegion}

</div>

{/exp:weblog:entries}

Any ideas on how to fix this greatly appreciated.

Profile
 
 
Posted: 25 April 2008 10:59 AM   [ Ignore ]   [ # 110 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12393
Joined  04-29-2002

Nardog, the plugin is not site aware. There isn’t any code in the current version of the plugin to actually set the right site_id.

Edit one of these entries in the back end to use site_id = 4 instead of site_id = 1 and see if it fixes that particular one.

Disclaimer: Unless Andrew modified the plugin in the last few days..

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 25 April 2008 11:13 AM   [ Ignore ]   [ # 111 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  112
Joined  03-21-2007

Hi Sue,

Thanks for replying. I understood from Andrew’s site that site_id= does work.

Step 5: Set up the import template and plugin

Create a new template called go and add the call to the plugin:

{exp:csvgrab url=“http://ee.bnb-dev.co.uk/grab/golf.csv”
  delimiter=”,”
  encloser=“QUOTE”
  site_id=“2”
  weblog=“4”
  category_group=“2”
  title=“2”
  category_field=“3”
  use=“7|8|9|10|11”
  fields=“golf_addr|golf_city|golf_state|golf_zip|golf_phone”
  unique=“golf_phone”
}

In my case the import worked fine but the problem is with the display of the custom fields. When I check a random entry in the CP edit tab all the fields are populated correctly. Yet when I view that entry through the template the custom fields do not display although they are present in the entry.

Profile
 
 
Posted: 25 April 2008 11:35 AM   [ Ignore ]   [ # 112 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12393
Joined  04-29-2002

Good, he’s changed it then. smile

Is that all you have in the template? What happens if you reduce the template to just the exp:entries tag (hard coding the weblog field name).

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 25 April 2008 11:51 AM   [ Ignore ]   [ # 113 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  112
Joined  03-21-2007

Hi Sue,

That is all I have in the template and I have tried hard coding the the weblog field name. What’s wierd is that the content is all there in the CP yet the template does not pick up the custom fields unless the entry was manually entered rather than imported with csvgrab.

Profile
 
 
Posted: 27 April 2008 09:15 PM   [ Ignore ]   [ # 114 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  422
Joined  12-15-2005

This is weird. All of a sudden CSVGrab only processes around 1400 entries at a time before quitting on me. Each time, it ranges from successfully processing anywhere from 1390 to 1410 or so. Any clues on that one?!

 Signature 

System Info: Production

EE Version:  1.66
Build
:       20081114
PHP Version
: 5.2.5

Profile
 
 
Posted: 27 April 2008 11:25 PM   [ Ignore ]   [ # 115 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15380
Joined  05-15-2004

Running out of memory? Turn on error reporting, and/or check the logs.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 27 April 2008 11:34 PM   [ Ignore ]   [ # 116 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  422
Joined  12-15-2005

From the error log:

PHP Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/domain.com/httpdocs/system/plugins/pi.csvgrab.php:577) in Unknown on line 0

Edit: Also, I had the PHP mem_limit set to 128M

 Signature 

System Info: Production

EE Version:  1.66
Build
:       20081114
PHP Version
: 5.2.5

Profile
 
 
Posted: 27 April 2008 11:41 PM   [ Ignore ]   [ # 117 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15380
Joined  05-15-2004

So, why is it only kicking in after 1400 entries? Are those imported fine? The “connot modify header inforamtion” error is quite often caused by additional whitespace at the beginning of your plugin or code, you might want to check that.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 27 April 2008 11:44 PM   [ Ignore ]   [ # 118 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  422
Joined  12-15-2005

That’s what’s so strange. Not sure where to start looking in the code as it’s the CSVGrab plugin. Maybe I’ll reupload it and see if that does anything…?

 Signature 

System Info: Production

EE Version:  1.66
Build
:       20081114
PHP Version
: 5.2.5

Profile
 
 
Posted: 27 April 2008 11:48 PM   [ Ignore ]   [ # 119 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15380
Joined  05-15-2004

Can’t hurt. What I meant was making doubly sure that <?php is in the first line of the plugin, and not perhaps a linebreak or so. It’s happened to me. If that does not help, yes, re-uploading a fresh version certainly would not hurt.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 28 April 2008 12:31 AM   [ Ignore ]   [ # 120 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  422
Joined  12-15-2005

Thanks Ingmar, will give that a go. I’m also re-exporting my CSV file as well just to cover all the bases…

 Signature 

System Info: Production

EE Version:  1.66
Build
:       20081114
PHP Version
: 5.2.5

Profile
 
 
Posted: 28 April 2008 01:21 AM   [ Ignore ]   [ # 121 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  422
Joined  12-15-2005

Hitting the sack for now. No errors in the plugin it seems, and this load crapped out at around 11,000 entries. This is the pattern: it gets to 10k-ish entries imported then tanks. Then each subsequent attempt after that only gets to around that 1500 number before dying. I’m wondering if it’s a mysql issue, or even perhaps something more specific to EE.

 Signature 

System Info: Production

EE Version:  1.66
Build
:       20081114
PHP Version
: 5.2.5

Profile
 
 
Posted: 28 April 2008 01:56 PM   [ Ignore ]   [ # 122 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  422
Joined  12-15-2005

...and back. After changing further things, still getting the exact same result. Thinking there’s a memory leak somewhere, either in the plugin or in EE itself, that manifests after hitting that 10,000 entry marker…

 Signature 

System Info: Production

EE Version:  1.66
Build
:       20081114
PHP Version
: 5.2.5

Profile
 
 
Posted: 30 April 2008 03:44 PM   [ Ignore ]   [ # 123 ]  
Summer Student
Total Posts:  7
Joined  02-26-2007

I had the same issue that it would drop out at about the 10,000 record mark, the only thing I did was chop my csv file into 10,000 record chunks. I’m assuming it’s a timeout problem but as I was in a rush I didn’t have time to play about with Andrew’s code. I did successfully import 560,000 records over the course of weekend though while managing to keep the kids amused at the same time!

Another alternative is to store the data external to the EE tables and then use PHPMyAdmin with the LOAD DATA command. This is a lot faster although I had to reconfigure PHP to load up 10MB CSV files. I loaded up 720,000 records in about 20 mins.

 Signature 

Stuart Whitman

Web Developer - Newcastle upon Tyne. UK.

Profile
 
 
Posted: 30 April 2008 05:08 PM   [ Ignore ]   [ # 124 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  422
Joined  12-15-2005

Hi collateit,
I did the same thing, splitting the csv down into 5,000 row files. Stil died, but got down to 1400 records at a time. Sheesh. I am/was on Media Temple’s dedicated virtual server package, but their support is slow and offered little in the way of new knowledge. I couldn’t do any db loads from the command line either, as apparently we’re not given those permissions. Ugh. I basically elected to change providers and move to a fully dedicated box now

 Signature 

System Info: Production

EE Version:  1.66
Build
:       20081114
PHP Version
: 5.2.5

Profile
 
 
Posted: 02 May 2008 12:24 PM   [ Ignore ]   [ # 125 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  422
Joined  12-15-2005

Update: This is a PHP configuration issue I have since addressed. Feel free to ignore this post.
The adventure continues… I have changed hosting providers and am now running on PHP 5 instead of 4. Now I get the following error when I try to run the script:

Fatal error: Call to undefined function mb_convert_encoding() in /path/to/site/plugins/pi.csvgrab.php on line 213

 Signature 

System Info: Production

EE Version:  1.66
Build
:       20081114
PHP Version
: 5.2.5

Profile
 
 
Posted: 06 May 2008 07:23 AM   [ Ignore ]   [ # 126 ]  
Lab Assistant
RankRank
Total Posts:  141
Joined  03-05-2008

As a new EE user, I’m still confused by the conventions for posting plug-ins in threads.

Some authors update the first post to include a link when a newer version becomes available. Others post the new versions throughout.

This thread, which has many pages, has the newer versions sprinkled throughout.

If there isn’t a convention, could I vote for updating the first post with the current version?

Profile
 
 
   
7 of 14
7
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64944 Total Logged-in Users: 72
Total Topics: 81925 Total Anonymous Users: 53
Total Replies: 440355 Total Guests: 303
Total Posts: 522280    
Members ( View Memberlist )