0

I am currently using 2 feeds of module Feeds to load a simple structure of nested taxonomies, with just 2 levels. I use two CSV files, one with the parent taxonomies, and the other with the children (see attached image to see the relationship through a PGUID, parent id). But now the problem is that my client will want no 2 fixed levels, but 3, 4, or more, varying depending on demand. So I do not know how to optimize the load (it is running in a cron in Elyisia cron right now). Must I create a new feed for each level? What happens if the levels differ from day to day? Is there any recursive solution to this - Multilevel Feeds or something ?

Note: the handling of the multilevel taxonomies should be done in just a single CSV file.

enter image description here

  • Until now, no one has approached with a definite solution, for a problem which is enormously simple in any other CMS or PHP-only approach. – Cesar Sep 19 '16 at 6:54
0

You can solve this by double running an import with only one master CSV and using the Skip hash check & Update existing terms settings within your importer.

Feeds tracks each imported item in the feeds_item table. As entries are imported, it adds the imported guid to the table and stores hashed value of the imported row within hash. This hash value is checked upon reprocessing so Feeds can skip any unnecessary updating (if the source data hasn't changed it doesn't need reprocessing).

If Skip hash check is enabled with Update existing terms set to Update existing terms, this forces Feeds to update regardless. For your purposes, the first import run will ensure that each feed item is in the feeds_item table. On the second import run, the hierarchy integrity will be restored as each pguid will have a valid guid reference in the feeds_item table.

  • But if I have, let's say, 5 levels of hierarchy, I must run the running 5 consecutive times? – Cesar Sep 16 '16 at 5:18
  • No, the depth is irrelevant, the important thing is there's a guid/entity id relationship in the feeds_item table. This will exist for items after the first pass. – Shawn Conn Sep 16 '16 at 5:21
  • I will try it with your options. It seems a clever solution, but still don't know how and when to stop making passes. Will try it. – Cesar Sep 16 '16 at 8:38
  • I'm assuming this is file upload that's batch processing the CSV in portions. I just tried it with sample CSV, making sure to run it again after the initial import. As long as it gets a 2nd pass that updates all existing terms, it should set all parent guid to each taxonomy entity that was imported in on the first run. – Shawn Conn Sep 17 '16 at 4:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.