All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

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: Importing data into Matrix field with Assets and Fieldpack checkbox column

Status Resolved
Add-on / Version DataGrab 4.2.1
Severity
EE Version 7.2.6

John Faulds

Jan 19, 2023

Hi Brian, now that I’ve got past the point of setting up the import, I’m finding it’s all working fine except for importing data into a Matrix field which includes Assets and Fieldpack checkbox columns. All the other columns that have plain text fields have the data imported correctly, but the assets and checkbox columns are empty.

This is what I have in my XML template:

<product_styles>
  {product_styles}
  <row>
    <title>{title}</title>
    <code>{code}
    {image} // This is the Assets field
    {colours backspace="1"}{option_name},{/colours} // This is the checkbox field
  
  {/product_styles}


Have I got the export template structured correctly?

#1

BoldMinded (Brian)

Hi John. I don’t support the Matrix ft or any of the field pack stuff. https://docs.boldminded.com/datagrab/docs/installation-and-upgrading

#2

John Faulds

Sorry to reopen this but do you have any suggestions on how to get Matrix content into Grid fields if the site is already on EE 6.x? The Matrix/Playa importer tool only works for EE 2.

#3

BoldMinded (Brian)

I started updating that importer to work in newer versions of EE, but I haven’t been able to fully test it. You’re welcome to give it a shot though https://github.com/litzinger/PlayaMatrixImporter

Or ask Packet Tide/EE team to update the add-on so it’ll run in later versions of EE.

#4

John Faulds

Great, thanks. I’ll give it a go.

#5

John Faulds

I was finally able to convert all my matrix fields to grid fields using the updated importer by Sy Andersohn and have nearly got everything working as intended except for Assets fields in the grid field.

In the XML template, which value should I be passing? At the moment, I have <image>{image}{image:url}{image}</image>. I can see the file URL in the rendered output but no images are showing. That’s the only piece of data that’s missing.

#6

John Faulds

I should explain that a bit better: I can see the file URL in the XML file, but after importing, the grid rows are created with other data, i.e. text and checkbox fields, but the assets field is empty.

#7

BoldMinded (Brian)

Hi John. What is the actual value in the xml for the file value you’re trying to import? Did you check the log to see if there are any errors? Have you tried importing the file into a normal field first instead of a Grid field to see if that works?

#8

John Faulds

The value is something like /path/to/image.jpg Probably worth mentioning that because we’re using Assets, the path to the asset is different than the path to the uploads directory because Assets allows you to create subfolders within your file upload directories.

There are no errors in the log. The log says:

02:00:38 03/31/2023 Import #1 Started 02:00:39 03/31/2023 Import #1 Initialized 02:00:39 03/31/2023 Begin Importing [Product Title] 02:00:39 03/31/2023 [Zuta] is a new entry 02:00:40 03/31/2023 Added 1 entries 02:00:40 03/31/2023 Clearing all cache 02:00:40 03/31/2023 Import #1 End

I tried adding a normal file field to the grid as well as assets and file fields outside the grid all mapped to the same image in the first row and after import, all of them are empty.

#9

BoldMinded (Brian)

It should probably be a full http path to the file, otherwise it doesn’t know where to grab the file from. Or a full path to where the actual file resides when the import is run. If /path/to/image.jpg is the intended final path after import/upload that won’t work. The import process for files needs to basically upload the image.

#10

John Faulds

What I’m trying to do is rebuild the database of an existing EE2 site from scratch because too many bugs have crept into it over the years. The live site has several gigabytes of images which I don’t have on the local file system I’m working on and was hoping to avoid having to download or import along with the entries.

But I’ve just tried adding the full path on my local file system in front of the assets image URL and also the full URL of the images on the production site but got the same result in both cases.

One thing I notice about the Datagrab interface though is that if I include a native file field to import into, there are dropdowns for choosing the upload folder and whether to fetch files from URLs, but those don’t exist for Assets fields, whether in a grid or stand-alone.

#11

BoldMinded (Brian)

John, can you please provide an example import file with 3 or 4 entries to import, as well as screenshots of how you have the import configured so I can try to replicate it locally?

#12

BoldMinded (Brian)

Looking at the code that handles importing the Assets fields, it is assuming the file already exists in Assets, and you’re just assigning it to a field, which is different than how the default File field works. If you’re looking to have the file actually uploaded to Assets when imported, then unfortunately it’s going to be awhile before I can look into this, and likely longer until I can maybe get it to work. We’re talking weeks or longer. This is part of the DataGrab codebase that existed before me and I haven’t had a chance or reason to have to look at it more until now.

#13

BoldMinded (Brian)

Basically if the file exists in Assets already, and you know the directory and file name, you should be able to add {filedir_X}my-file.jpg to the field value in your import file and it should work. Or just the file name without the the path. So just my-file.jpg. If it finds a file with that name it will save the file ID to the Assets field when importing.

#14

John Faulds

Comment has been marked private.

#15

BoldMinded (Brian)

Looking at this again I think I brain farted and missed a crucial piece here. It’s an Assets field inside of Grid, and there does not appear to be any consideration for that in DataGrabs code. It only considers standalone Assets fields, not ones nested in Grid.

Unfortunately it’s going to be days or a couple weeks before I can look into fixing this, sorry. This is part of DG’s legacy code that never supported Assets inside of Grid.

#16

John Faulds

That’s fine. This process has actually been going on for several months already with no specific deadline so a bit longer won’t matter.

#17

BoldMinded (Brian)

Comment has been marked private.

#18

BoldMinded (Brian)

<root>
    <entry>
        <title>Entry bsr-a-bundgard.jpg</title>
        <grid>
            <image>bsr-a-bundgard.jpg</image>
        </grid>
    </entry>
    <entry>
        <title>Entry bsr-a-berthet.jpg</title>
        <grid>
            <image>bsr-a-berthet.jpg,bsr-anagai.jpg</image>
        </grid>
    </entry>
    <entry>
        <title>Entry 220333.jpg</title>
        <grid>
            <image>220333.jpg</image>
        </grid>
    </entry>
</root>
#19

John Faulds

Yes, that did it! Thanks very much 😊

#20

BoldMinded (Brian)

Good to hear 😊

Login to reply