I use both parent mappings: Parent Guid and Parent Name.
The case of using such approach is when the source provides some kind of fallback if the parent is not specified directly, i.e.:

      if (!empty($parent_id)) {
        $item['parent_guid'] = $guid;
      } else {
        $item['parent_name'] = $fallback_name;
      }

But in some reason in FeedsTermProcessor hardcoded that if parent's (guid, name) value is empty it is necessary to put zero (top level) to the term object.
So, even though zero level is default for terms and in next iteration other mapping might set the real parent, it always goes to the top level.

Comments

Sergii’s picture

Status: Active » Needs review
StatusFileSize
new1.55 KB

Please review.

Sergii’s picture

Version: 7.x-2.x-dev » 7.x-2.0-alpha7
StatusFileSize
new1.22 KB

Update patch to alpha7.

sdrycroft’s picture

Version: 7.x-2.0-alpha7 » 7.x-2.x-dev
Issue summary: View changes
StatusFileSize
new1.44 KB

I have just run into this exact same issue. The enclosed patch is for the latest dev release. This really is a no-brainer, and should be applied ASAP.

Status: Needs review » Needs work

The last submitted patch, 3: feeds_guid_and_parent_name.patch, failed testing.

sdrycroft’s picture

Status: Needs work » Needs review
StatusFileSize
new2.06 KB

The previous patch is failing due to a completely unrelated error/exception. The attached patch fixes that too.

Andrew Gorokhovets’s picture

megachriz’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

This needs tests that ensure the following:

  • When mapping first to "Parent: GUID" and secondly to "Parent: Term name", and for at least one of these targets there is a value, the imported term should get a parent.
  • When mapping first to "Parent: Term name" and secondly to "Parent: GUID", and for at least one of these targets there is a value, the imported term should get a parent.
  • When updating existing terms and mapping to "Parent: GUID", importing an empty value for that target should result in the term becoming parentless.
  • When updating existing terms and mapping to "Parent: Term name", importing an empty value for that target should result in the term becoming parentless.
  • When updating existing terms and mapping to both "Parent: GUID" and "Parent: Term name" and values for both targets are empty, the term should become parentless.
Andrew Gorokhovets’s picture

Thank you MegaChriz!
You are right. Autotests really needed for this. I try to do it ASAP.
Also I updated a patch, it was required after testing.

megachriz’s picture

@Andrew Gorokhovets
Great that you want to develop the automated tests. If you hit any roadblocks or have any questions during the development of the tests, don't hesitate to ask for help! Maybe with a simple answer or hint you can continue.

bluegeek9’s picture

Status: Needs work » Closed (outdated)
Issue tags: -Needs tests

Drupal 7 reached end of life and the D7 version of Feeds is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues.

If you still have questions about using Feeds on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. You can do so by opening (or reopening) a D7 issue, or by reaching out in the #feeds channel on Drupal Slack.

If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.