Import Asset CSV to Matrix Script

Morning,


trying to interpret the documentation within this script and have some questions for anyone who has successfully used it (or for the author (Mark Brydon))



  • what format does the csv file follow? there is no mention in this script although there is a reference to csv_to_xml_actions so you could assume its the same format?
    [*]Metadata CSV - seems simple, just comma separated metadata field id and name of field?
    [*]Asset Attribute Mapping CSV - more confusing (supplied field name, asset attribute name?)

i guess the example is causing my confusion. it would help if you provided more examples for each.

i have 471 course entries to import - we have successfully migrated to a mysql table with each section saved as separate fields (ready for insertion as metadata).

in the above example the various csv files would look like (using two fields for now):

CSV IMPORT FILE

name, course_name
Advertising Skills - Statement of Attainment, Advertising Skills

META MAP FILE (metadata field id)

5672, course_name

ATTR MAP FILE

course_name, name

Then the TYPE_CODE would be page_standard

Any advice/help appreciated (still waiting on management to get support pack purchased!)

i think im getting closer - it creates the page under the proper parentid but fails to attach metadata and bails at line 235 with this error:


Fatal error: Cannot access protected property MySource: $mm in SYSTEM_ROOT/scripts/import/import_asset_csv_to_matrix.php on line 235

[quote]trying to interpret the documentation within this script and have some questions for anyone who has successfully used it (or for the author (Mark Brydon))


  • what format does the csv file follow? there is no mention in this script although there is a reference to csv_to_xml_actions so you could assume its the same format?
    [*]Metadata CSV - seems simple, just comma separated metadata field id and name of field?
    [*]Asset Attribute Mapping CSV - more confusing (supplied field name, asset attribute name?)

i guess the example is causing my confusion. it would help if you provided more examples for each.[/quote]
Please note that this script only supports single assets - your later post mentions "pages" which suggests you are attempting to create Standard Page assets. The script will only modify attributes on the imported asset, whereas for page content the particular Bodycopy DIV needs to be modified. I have tested this with simple assets such as Users and Single Calendar Events without problems.

If you are importing pages, you might want to use the scripts/import/create_pages.php script. This takes a CSV file containing:
    page name, asset type (ie; page_standard), parent asset ID, link type


The files required by the [i]import_asset_csv_to_matrix.php[/i] script are as follows. For example, to import a user named "Fred Smith":

CSV Import File (with header line) - all required attributes to create the asset (even "name", or in this case "username" and "password") must be specified here and in the Attribute Mapping CSV File further down the page
    name, pass, USER_FIRST_NAME, online
    Fred Smith, 123456, Fred, Yes


[b]Metadata Mapping CSV File[/b] (no header line) [ field asset ID, field name ]
    1234, online


[b]Asset Attribute Mapping CSV File[/b] (no header line) [ attribute alias in CSV Import file, asset attribute name ]
    name, username
    USER_FIRST_NAME, first_name
    pass, password


Regarding the fatal error: This script was developed prior to 3.18 so this may be something changed in the core. It seems the script needs to be verified for compatibility with 3.18+ installations. Please submit a bug report and we will take a look.

[b]Edit:[/b] Added script name for clarity, to differentiate CSV formats from those required for the create_pages.php script

This script is fixed now. It will be available in next release. See bug tracker (#3555).