We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: CSVGrab

Development and Programming

Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil
Exported it from Excel and than searched and replaced a lot of stuff which I couldn’t in Excel.

Quite. But Dreamweaver?

Can I add some headers into the csv or doesn’t it work like that? I know litte about this stuff.

I don’t think it works like that, no. The characters actually need to be converted, I think.

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil

Actually, “save with type unicode text (*.txt)” might be what you are looking for.

       
Martin de Wit's avatar
Martin de Wit
150 posts
17 years ago
Martin de Wit's avatar Martin de Wit

Hmmmm… I only have the option to save as unitext utf-16. And I see no big difference. If I upload the problem remains.

How does that textfile know it is unitext? 🐛

       
DEA's avatar
DEA
257 posts
17 years ago
DEA's avatar DEA
Sue: I have a new version of CSVGrab (& Feedgrab) that obeys the Multiple Site Manager settings - I’ll hopefully release it very soon once tested. DEA: it does not respect the parent category setting at the moment, but it is on my to do list…

Ah, thanks. Any idea of when you’d be doing that part?

       
Bluebloc's avatar
Bluebloc
111 posts
17 years ago
Bluebloc's avatar Bluebloc

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.

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
17 years ago
Sue Crocker's avatar Sue Crocker

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..

       
Bluebloc's avatar
Bluebloc
111 posts
17 years ago
Bluebloc's avatar Bluebloc

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.

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
17 years ago
Sue Crocker's avatar Sue Crocker

Good, he’s changed it then. 😊

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).

       
Bluebloc's avatar
Bluebloc
111 posts
17 years ago
Bluebloc's avatar Bluebloc

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.

       
DEA's avatar
DEA
257 posts
17 years ago
DEA's avatar DEA

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?!

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil

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

       
DEA's avatar
DEA
257 posts
17 years ago
DEA's avatar DEA

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

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil

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.

       
DEA's avatar
DEA
257 posts
17 years ago
DEA's avatar DEA

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…?

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil

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.

       
First 6 7 8 9 10 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.