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

Hierarchy not maintained when importing categories with different levels (5.8.0) #1522

Closed
jmauzyk opened this issue Oct 2, 2024 · 4 comments
Assignees

Comments

@jmauzyk
Copy link

jmauzyk commented Oct 2, 2024

Description

After upgrading to 5.8.0, categories imported by title to a category field do not maintain hierarchy and include ancestors if there are more than one category with different levels.

After import with 5.7.0:
Screenshot 2024-10-02 at 9 52 46 AM

After import with 5.8.0:
Screenshot 2024-10-02 at 9 50 15 AM

Steps to reproduce

  1. Set up an element data import and configure a node to import categories by title to a category field.
  2. Import element data with a node that contains more than one category that have different levels in the category structure.

Additional info

  • Craft version: Pro 4.12.5
  • PHP version: 8.2.4
  • Database driver & version: PostgreSQL 14.7
@jmauzyk jmauzyk added the bug label Oct 2, 2024
@i-just
Copy link
Contributor

i-just commented Oct 9, 2024

Hi, thanks for getting in touch! I’m unable to replicate this on a clean install. Are you importing into an Entry? Could you share a snippet of your feed and a screenshot of the mapping screen?

@i-just i-just self-assigned this Oct 9, 2024
@jmauzyk
Copy link
Author

jmauzyk commented Nov 22, 2024

Sorry for the delayed response here. I'm importing into a Product element. Here's a snippet of the category data in the XML feed:

    <Categories>
        <Category><![CDATA[Frame & Fork]]></Category>
        <Category><![CDATA[Parts]]></Category>
    </Categories>

Here is a screenshot of the associated mapping:
Image

I dug into this a bit more to try and figure out the source of the issue, and while examining the relations table I noticed that there was a category saved in the relations table that wasn't displaying. The category was one by the same name (Frame & Fork), but in a different category group. It seems that something changed in 5.8.0 so that when searching for category matches by title, it no longer scopes to the category groups defined by the field. As a result, both categories with matching titles are saved to the relation field, which in turn prevents the parent category from being saved.

@i-just
Copy link
Contributor

i-just commented Nov 22, 2024

Thanks for the additional info! It sounds like you might be running into this one: #1530. PR's already raised, but hasn't been released yet.

@angrybrad
Copy link
Member

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

No branches or pull requests

3 participants