Hierarchy import now working

Closed

Import WP Updated 2 years ago 16 Replies

Jens asked 2 years ago on March 7, 2023 at 11:04 am

I had the Problem, Hierarchy is not working.

I set follow import:

 

Taxonomy = Category

Terms = Categorie>{1}

Enable Hierarchy = yes

Hierarchy Character = >

 

If i start now an Import, new Categories will be created, instead Hierarchy (Test>1, Test>2, Test>3) its create Test,1,2,3 as seperate Categories.
You can see on Screenshot.

J

James replied Support Agent

2 years ago on March 7, 2023 at 12:00 pm

Hi Jens,

Can you confirm if there are any categories below the "Lebensmittel Retten" , as your screenshot cuts off before that?

I have tested the latest version of the importer to import posts with categories, and the hierarchy was working, what are you importing so i can double-check this?

James

JG

Jens replied

2 years ago on March 7, 2023 at 12:20 pm

Hi, yes a bunch of Categorys are under Lebensmittel Retten

JG

Jens replied

2 years ago on March 7, 2023 at 12:20 pm

Hi, yes a bunch of Categorys are under Lebensmittel Retten

J

James replied Support Agent

2 years ago on March 7, 2023 at 12:26 pm

Is there a "Haustier" category that also sits under "Lebensmittel Retten" ?

JG

Jens replied

2 years ago on March 7, 2023 at 12:33 pm

J

James replied Support Agent

2 years ago on March 7, 2023 at 1:31 pm

From your first screenshot showing "Lebensmittel Retten > {3}" in the taxonomies section with hierarchy enabled, the first record imported that produces the "Lebensmittel Retten > Haustier" , using this post as an example is this post object under the "Lebensmittel Retten > Haustie" or the "Haustie" category?

J

James replied Support Agent

2 years ago on March 9, 2023 at 12:06 pm

Under categories, i can see you are using a custom method "iwpex_prefix_terms", however based on the preview of the terms field still showing the function name, this tends to mean the function doesnt exist. for example in my second screenshot i have switch to use strtoupper  as an example, and you can see the preview has been uppercased.

JG

Jens replied

2 years ago on March 9, 2023 at 12:14 pm

Thanks,so What Code i must take to get the strukture:

Base-Category

> Hierarchie

 

So like your screenshot:

Lebensmittel Retten

>Brotaufstriche.....

J

James replied Support Agent

2 years ago on March 9, 2023 at 12:25 pm

Add the following code to your website:

function iwpex_prefix_terms($input = '', $prefix = '', $output_delimiter = ',', $input_delimter = ',')
{

    $terms = explode($input_delimter, $input);

    $terms = array_map(function ($item) use ($prefix) {
        return $prefix . trim($item);
    }, $terms);

    return implode($output_delimiter, $terms);
}

I have attached an example of the code being used, i have tried to match the signature of the function you tried to use in your taxonomy terms field.

[iwpex_prefix_terms("{3}", "Lebensmittel Retten")]

JG

Jens replied privately

2 years ago on March 9, 2023 at 12:58 pm

J

James replied privately Support Agent

2 years ago on March 9, 2023 at 1:15 pm

JG

Jens replied

2 years ago on March 9, 2023 at 2:17 pm

Ahh. Perfect. Now its working correctly.

Thanks in advance for your Hard work.

JG

Jens replied

2 years ago on March 9, 2023 at 4:32 pm

Hi James, sorry for opening the Ticket again, but... why its not working anymore? You cahnged anythin in Plugins Structure or else?
J

James replied privately Support Agent

2 years ago on March 9, 2023 at 4:58 pm

JG

Jens replied privately

2 years ago on March 9, 2023 at 6:13 pm

J

James replied Support Agent

2 years ago on March 9, 2023 at 7:07 pm

Sounds similar to the issue, if the parent category is not listed on the same page as its child categories, the child categories do not show the hierarchy.

You can always confirm if a category has a parent by editing it and seeing the parent that way.