Support forums

Please check @brandnewbox_uk for support status updates.

Search     Advanced Search
XMLGrab basic question  
Posted: 03 October 2013 06:08 AM —  
Newbie
Rank
Total Posts:  25
Joined  2011-04-07

Hi Andrew,

I have an older 1.7.1 site that needs data imported into an existing weblog using XMLGrab.

The test feed itself is fairly simple:

http://petfoodexpress.com/export_pets

And the template has the following code:

{exp:xmlgrab url="http://petfoodexpress.com/import_pets/import_01.xml" 
    itempath="/root/item"
    weblog="34" 
    title="title"
    use="adult_size"
    fields="adult_size_new"
    unique="title"
}

When I hit the template, the page just spins and no action is taken. When I stop the browser the rest of the site (including the control panel) goes into a bit of a slowdown before it picks up speed again.

I think I’m missing something basic—could you help?

Thanks!

Profile
 
Posted: 10 October 2013 06:18 AM —   [ # 1 ]  
Newbie
Rank
Total Posts:  25
Joined  2011-04-07

Hi Andrew,

We’d love to get back to our client on this. Would you mind taking a look whenever you have a minute?

Thanks so much!

Profile
 
Posted: 10 October 2013 08:21 AM —   [ # 2 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  1357
Joined  2006-04-12

Hi,

Sorry for not replying sooner - I totally missed your first post…

I’ve just taken a very quick look and I started by checking the file you were trying to import: http://petfoodexpress.com/import_pets/import_01.xml

This file takes a long time to load for me, and then does not seem to be a valid data file. It displays:

Fetching: http://petfoodexpress.com/import_pets/import_01.xml

Did you mean to use http://petfoodexpress.com/export_pets as the url= parameter?

Andrew

Profile
 
Posted: 15 October 2013 01:23 AM —   [ # 3 ]  
Newbie
Rank
Total Posts:  25
Joined  2011-04-07

Hi Andrew,

Thanks so much for looking at this!

Now I’ve fixed the import location where:

http://petfoodexpress.com/import_pets/import < has the {exp:xmlgrab} tag
http://petfoodexpress.com/import_pets/import_test < has the sample XML data

But now results in another error:

Deprecated: Function split() is deprecated in /www/eh13549/public_html/pfeengine/plugins/pi.xmlgrab.php on line 110 Deprecated: Function split() is deprecated in /www/eh13549/public_html/pfeengine/plugins/pi.xmlgrab.php on line 116 Fetching: http://petfoodexpress.com/import_pets/import_test
Checking: Pixie
Deprecated: Function split() is deprecated in /www/eh13549/public_html/pfeengine/plugins/pi.xmlgrab.php on line 1033 Found existing entry: Pixie

Could you take a look at it again?

Much appreciated sir!

Profile
 
Posted: 15 October 2013 10:02 AM —   [ # 4 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  1357
Joined  2006-04-12

Hi,

The split function no longer exists in new versions of PHP. If you replace it with explode it should work.

I’ll try and update the version asap but I’m out of the office today.

Andrew

Profile
 
Posted: 16 October 2013 10:10 AM —   [ # 5 ]  
Newbie
Rank
Total Posts:  25
Joined  2011-04-07

That’d be awesome!

Let me know when there’s the update. Much appreciate you jumping on this :D

Profile
 
Posted: 22 October 2013 01:59 AM —   [ # 6 ]  
Newbie
Rank
Total Posts:  25
Joined  2011-04-07
Andrew Weaver - 15 October 2013 10:02 AM

Hi,

The split function no longer exists in new versions of PHP. If you replace it with explode it should work.

I’ll try and update the version asap but I’m out of the office today.

Andrew

Hey Andrew,

Just checking to see if the new version is released.

Thanks so much for supporting this!

Jae

Profile
 
Posted: 25 October 2013 09:17 AM —   [ # 7 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  1357
Joined  2006-04-12

Hi Jae,

Can you try te attached version and see if that works?

Andrew

Profile
 
Posted: 28 October 2013 11:37 PM —   [ # 8 ]  
Newbie
Rank
Total Posts:  25
Joined  2011-04-07

Thanks Andrew!

Unfortunately now I’m getting the following error when pointing to: http://petfoodexpress.com/import_pets/import

Notice: Undefined property: Controller::$TMPL in /www/eh13549/public_html/pfeengine/plugins/pi.xmlgrab.php on line 61 Fatal error: Call to a member function fetch_param() on a non-object in /www/eh13549/public_html/pfeengine/plugins/pi.xmlgrab.php on line 61

Here’s the tag used in the http://petfoodexpress.com/import_pets/import URL:

{exp:xmlgrab url="http://petfoodexpress.com/import_pets/import_test" 
    itempath="/root/item"
    weblog="34" 
    title="title"
    use="adult_size"
    fields="adult_size_new"
    unique="title"
}

I cleared the cache and re-uploaded the plugin just to make sure, but the same Undefined property error. Would you mind taking a look again?

Much appreciated it!

Profile
 
Posted: 30 October 2013 11:54 AM —   [ # 9 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  1357
Joined  2006-04-12

Hi,

Which versions of EE and PHP are you using? I’ll see if I can reproduce the problem.

Is the import doing anything?

Andrew

Profile
 
Posted: 30 October 2013 12:25 PM —   [ # 10 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  1357
Joined  2006-04-12

Can you try the version here:

https://bitbucket.org/ajweaver/xmlgrab/overview

Finally got a chance to test it and this version seems to be working for me…

Andrew

Profile
 
Posted: 04 November 2013 06:38 PM —   [ # 11 ]  
Newbie
Rank
Total Posts:  25
Joined  2011-04-07

Thanks Andrew! Very much appreciate the continued support here.

Now the PHP error is gone, but nothing is updated. This could be a syntax/tag usage issue, but could you take a quick look?

The source XML is here: http://petfoodexpress.com/import_pets/import_test and has the following:

<root>
 <item>
  <title>Kooma</title>
  <new>x-large</new>
 </item>
</root>

The {exp:xmlgrab} tag is at: http://petfoodexpress.com/import_pets/import and has the following:

{exp:xmlgrab url="http://petfoodexpress.com/import_pets/import_test" 
    itempath="/root/item"
    weblog="34" 
    title="title"
    use="new"
    fields="adult_size_new"
    unique="title"
}

So the value for the XML item “new” should replace the field “adult_size_new”, but is not happening.

Also, is there a way to update by entry id? We have a lot of entries (out of 30k or so) with the exact same name.

BTW this is for a non-profit that finds homes for over tens of thousands of dogs, cats, and other pets, and it sends its heartfelt thanks to you as well.

Thanks!

Profile
 
Posted: 06 November 2013 10:32 AM —   [ # 12 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  1357
Joined  2006-04-12

i think you need to use the update=“true” parameter to tell it to update matching entries (rather than just ignore).

You could try adding:

case 'entry_id': {
     $sql .= " AND t.entry_id =\"" . $DB->escape_str( $post[ $value ] ) . "\"";
     break;
    }

to line 1037 to give:

switch ( $value ) {
    case 'entry_id': {
     $sql .= " AND t.entry_id =\"" . $DB->escape_str( $post[ $value ] ) . "\"";
     break;
    }
    case 'title': {
     $sql .= " AND " . $value . "=\"" . $DB->escape_str( $post[ $value ] ) . "\"";
     break;
    }
    case 'date': {
     $sql .= " AND entry_date=\"" . $DB->escape_str( $post[ $value ] ) . "\"";
     break;
    }
    default: {
     if ( $weblog_to_feed[ $value ][ "is_custom" ] ) {
      $name = "field_id_" . $weblog_to_feed[ $value ][ "id" ];
      $sql .= " AND " . $name . "=\"" . $DB->escape_str( $post[ $value ] ) . "\"";
     }
    }
   }

to get unique=“entry_id” working (I’ve not tested this, though).

Andrew

Profile
 
Posted: 07 November 2013 09:56 PM —   [ # 13 ]  
Newbie
Rank
Total Posts:  25
Joined  2011-04-07

Hi Andrew,

I think we’re really close - thanks again!

So the entry now updates with the update=“true” parameter. I’ve also added the entry_id case to line 1037.

However, I get an undefined index error when my exp:xmlgrab tag looks like this:

{exp:xmlgrab url="http://petfoodexpress.com/import_pets/import_test"
itempath="/root/item"
weblog="34"
entry_id="entry_id"
use="new"
fields="adult_size_new"
unique="entry_id"
update="true"
}

Fetching: http://petfoodexpress.com/import_pets/import_test
Checking:
Notice: Undefined index: entry_id in /www/eh13549/public_html/pfeengine/plugins/pi.xmlgrab.php on line 1039 Found new entry:

New entries: 1

I must have the entry_id parameter wrong?

Profile
 
Posted: 14 November 2013 04:16 PM —   [ # 14 ]  
Newbie
Rank
Total Posts:  25
Joined  2011-04-07

Hi Andrew,

Hope you’re well. Would you mind taking the issue above for us? Greatly appreciated!!!

Profile
 
Posted: 25 November 2013 01:35 AM —   [ # 15 ]  
Newbie
Rank
Total Posts:  25
Joined  2011-04-07

Hi Andrew,

We’re getting a lot of pressure from our client to get this resolved, as we can’t move forward without a fix.

If you could take a look as soon as you can that’d be really appreciated.

Thank you very much!

Profile
 

‹‹ XMLGrab and php 5.3      XML Import from Jobvite, forms incorrect Structure Listing URLs for many of the entries created ››

Select A Theme