Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: 2 or more category groups gives PHP warning

Status Resolved
Add-on / Version DataGrab 4.0.5
Severity
EE Version 6.3.5

Andrew Gunstone

Sep 13, 2022

Hey Brian,

I’ve setup an import with multiple category groups (2 columns in the CSV, column 1 imports into Category 1, column 2 imports into Category 2). All very basic set up.

When running the import, it gives a PHP warning:

Warning
Array to string conversion
ee/ExpressionEngine/Model/Channel/ChannelEntry.php, line 917
Severity: E_WARNING

Warning
Array to string conversion
ee/ExpressionEngine/Model/Channel/ChannelEntry.php, line 918
Severity: E_WARNING

The issue seems to be on line 1571 in the datagrab_model.php file.

$entry_categories["cat_group_id_" . $cat_group_id] = array_merge($entry_categories, $new);

It combines the first category_group_id into the second one (and so on and so on). It outputs like this:

Array
(
    [cat_group_id_12] => Array
        (
            [0] => 98
            [1] => 98
        )
)

Array
(
    [cat_group_id_5] => Array
        (
            [0] => 96
        )
    [cat_group_id_12] => Array
        (
            [cat_group_id_5] => Array
                (
                    [0] => 96
                )
            [0] => 99
            [1] => 99
        )
)

I’ve not done too much testing, but this seems to work:

$entry_categories["cat_group_id_" . $cat_group_id] = $new;

Cheers.

 

#1

BoldMinded (Brian)

Hi, Andrew. Can you please share an example of the import file you’re using. It only needs to have 1-3 entries in it, not a full import file. Also please share screenshots of how you’ve configured this import. Thanks.

#2

Andrew Gunstone

Comment has been marked private.

#3

Andrew Gunstone

Comment has been marked private.

#4

BoldMinded (Brian)

Andrew, try changing that line to this instead:

$entry_categories["cat_group_id_" . $cat_group_id] = array_merge($entry_categories["cat_group_id_" . $cat_group_id], $new);
#5

BoldMinded (Brian)

Comment has been marked private.

Login to reply