CSV import - update fullpath

Hi,

Is it possible to update fullpath of an existing object, so it is moved in the tree structure?

image

In the screenshot we would like to move the two product-objects in yellow below the product-object “Navigator Eco-logical”. I exported these with the csv export (chrildren grid), and changed the fullpath as if it would be linked under “Navigator Eco-logical”.

When executing the csv import with columns ID and fullpath with resolver ID the fullpath does not get updated.
When executing the csv import with columns Filename and fullpath with resolver Filename and option Overwrite - the fullpath does not get updated.
Resolver Fullpath will not work as it will create new objects, instead of updating (based on the key/filename).

Thanks for the support!

Best regards,
Koen

This isn’t possible by default as far as I know. You could create a data object import event listener for it.
Consider the situation where the parent object doesn’t exist yet though. What should the import do? Create a folder? What if the next line/import tries to import a parent object there? It’s very unpredictable.

The only reliable way I can think of to do this would be to export the key and the parent ID (via the any getter extractor), updating them in Excel for example, and importing them again.

Unfortunately, it seems Pimcore doesn’t provide a way to update the parent ID or key. You’ll need to create custom operators for that and configure it in a PHP code operator.

1 Like

Thanks for the feedback. I was already afraid that would be the answer.

As the basic funcionality of the csv import will not work, we will check for a work-around with you colleagues at YouWe (Jeffrey). :wink:

Hi @KoenCoppens,

There’s the ElementManagerBundle which is capable of doing exactly that. Here’s an example:

Configure a naming scheme for your object

element_manager:
    classes:
        MyAwesomePimcoreObject:
            unique_key: true
            naming_scheme:
                enabled: true
                options:
                    parent_path: '/Products/Example/Path'
                    archive_path: '/Products/Example/Path/_Archive'
                    scheme: '[object.getName()]'

The scheme option evaluates the string with the ExpressionLanguage component of Symfony. Therefore, you are able to even create your own expression interpreters, which will make your path dynamically adjustable, based on some of your object’s attributes.

Let me know if you have any questions.
Cheers!

1 Like

Thanks @aarongerig! We’ll check it out.