cobwebch / external_import

Other
20 stars 16 forks source link

How to import tx_news tags (comma seperated id list) #290

Closed WebArtAllgaeu closed 1 year ago

WebArtAllgaeu commented 1 year ago

I have a question regarding mm relations. i am not quite sure how to configure the news tags (tx_news). i have already prepared all the data and it is available to the importer as csv files. first the tags are imported, then the news. my current external configuration for the field "tags" in tx_news_domail_model_news.php looks like this :


'tags' => [
   // ....
   // default stuff from tx_news
    'external' => [
        'english' => [
            'field' => 'tags',
            'transformations' => [
                10 => [
                    'mapping' => [
                        'table' => 'tx_news_domain_model_tag',
                        'referenceField' => 'import_id',
                        'multipleValuesSeperator' => ',',
                    ]
                ]
            ],
        ],
    ]
],

the tag id's are available to the importer in the field "tags" of the external csv file and have a comma separated format: "id1,id2,id3 ...". if i import the news the field "tags" will be thrown out in the step transform data. if i use a single id the relation will be created correctly. as far as i understood the option "multipleValuesSeperator" the importer should loop over every splitted value and create the corresponding mm relation, right? what am i missing here?

btw: i use version 7.0

fsuter commented 1 year ago

Hi, this looks correct. All I can spot is a typo in multipleValuesSeperator. It's "multipleValuesSeparator".

WebArtAllgaeu commented 1 year ago

@fsuter hey, thanks for your reply. i spotted the typo 10 minutes ago while i was debugging the extension code xD

one question still remains... is it possible to create relations to the tt_content table inside the news import? i would like to match the field "content" from the external data source to a CType "text" element inside the content_elements field of the news record.

i guess a separate import for the content elements would be much easier, isnt it?

fsuter commented 1 year ago

In theory yes, you could use the "children" property to import content elements in the same run, but - especially given the number of fields in the tt_content table - the configuration would be easier to read and maintain with a separate import.

WebArtAllgaeu commented 1 year ago

okay i will just do it with a separate import then. thanks for your fast reply!

i will close this issue now