Support forums

Please check @brandnewbox_uk for support status updates.

Search     Advanced Search
Some categories (with names such as “40” do not get imported  
Posted: 11 January 2018 03:42 PM —  
Newbie
Rank
Total Posts:  4
Joined  2017-06-16

Hi all,

I’m importing a csv with datagrab. In the csv there is a field like “40, 36, 32, 24, 16, 8”
I need to get those values as categories, and the entries have the proper category selected. However, while setting categories for other fields works like a dream, this field is not. Can it be because it’s numerical?

Oh yeah: ee 3.5.11 and datagrab 3.0.0

Profile
 
Posted: 11 January 2018 06:55 PM —   [ # 1 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  1331
Joined  2006-04-12

Hi,

This was something of a compromise I used in DataGrab. If the category names were numeric it assumed that you were trying to use existing category id’s rather than category names. This obviously does not work in your case.

To fix this, you can edit the file aww_datagrab/models/datagrab_model.php and edit the lines 1433:

if( is_numeric( $cat_default ) ) {
 // Assume numeric categories are cat_id's
 $entry_categories[] = $cat_default;
} else {
 $entry_categories[] = $this->_create_category( $cat_default, $cat_group, $site_id );
}

to:

$entry_categories[] = $this->_create_category( $cat_default, $cat_group, $site_id );

I think that should work but I have not tested… If you’d like me to send a new version of the file let me know.

Andrew

Profile
 
Posted: 11 January 2018 08:11 PM —   [ # 2 ]  
Newbie
Rank
Total Posts:  4
Joined  2017-06-16

ok. but would that explain also that, when i created the categories manually, the entries didn’t get the proper categories assigned?

Profile
 
Posted: 12 January 2018 08:56 AM —   [ # 3 ]  
Newbie
Rank
Total Posts:  4
Joined  2017-06-16

Hi!

Saw another if statement with numerical a bit further down. Commenten it out, seems to work somewhat. However got an error in the logs:
[12-Jan-2018 09:59:59 Europe/Amsterdam] PHP Parse error:  syntax error, unexpected ‘return’ (T_RETURN), expecting function (T_FUNCTION) or const (T_CONST) in /home/ccc/xxx/system/user/addons/ajw_datagrab/models/datagrab_model.php on line 1478

Profile
 

‹‹ Import to matrix with datagrab 2.2 or 3.0 on EE 3.5+ not working correctly      error importing ››

Select A Theme