Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep Existing Values on Update #64

Open
doctorallen opened this issue Mar 22, 2016 · 4 comments
Open

Keep Existing Values on Update #64

doctorallen opened this issue Mar 22, 2016 · 4 comments

Comments

@doctorallen
Copy link

doctorallen commented Mar 22, 2016

I'm using the latest version of importX, and when updating resources, it seems to remove all values that I don't pass in the CSV. I want to update field values, and keep any existing resource and template variables that I have not been passed the same.

I'm digging through the code trying to figure out where I can get this to work, but if someone has experience with doing this, or has done it before, that might save me some time.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@CouponCodeSwap
Copy link

I'm experiencing the same issue. Because TV values are not in the same table, it makes it difficult to do an update import because all TV values not included in CSV file get deleted.

@doctorallen
Copy link
Author

I've dug into it a bit, and I think that it's part of the MODX resource/update processor. I'm trying to figure out it's possible to prevent the replacement of all of these values using some option but so far I haven't found anything.

@doctorallen
Copy link
Author

Yeah, it definitely is the MODX resource/update processor. It queries all of the modx templateVariables, and either sets their new value to the value passed to the processor, or the default value, when in reality it should be looping over the passed TVs.

What I did was added a new processor that extends the existing processor and overrides the saveTemplateVariables function. Here is the code for the new processor. I put this in /core/model/mox/processors/resource/. I then set the importx.processor setting to updatenooverride. You still have to pass the alias, parent, and published settings in the CSV, because apparently those get overridden anyway and I didn't care to try and fix that as well.

Here is the example CSV I used:

id;alias;parent;published;tv1
2;test-alias;18;1;value1

@Mark-H Mark-H reopened this Mar 25, 2016
@Mark-H
Copy link
Member

Mark-H commented Mar 25, 2016

I'm reopening this as it is something I'd like to keep in mind for importx v2. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants