• Resolved juriix

    (@juriix)


    Hellou, Does your plugin support Categories Mapping? I found the link https://www.importwp.com/docs/importer/importer-templates/wordpress-taxonomy-importer-template/, but I’m not smart to it.
    Where do I put the XML feed categories and where do I put the WP categories I created earlier ?
    —-
    I know how to add categories (feed), but I don’t know how to map the category import.

    I’m trying to import Categories into an already created Category.

    I have in my FEED XML a category path that looks like this:

    Kids > Shoes > Walk, Run > Walk

    Kids > Shoes > Walk, Run > Run

    Kids > T-shirt

    Kids > Glasses

    In WP i have >

    Kids > Shoes > Walk

    Kids > Shoes > Run

    E.g.

    I need the Kids content (category) to appear only under the exact Kids > Shoes > Walk and no new categories.

    Kids > Shoes > Walk, Run > Walk (FEED XML) TO Kids > Shoes > Walk (WP created Category)
    —-

    • This topic was modified 2 years, 10 months ago by juriix.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author ImportWP

    (@jcollings)

    Hi Juriix,

    Taxonomy hierarchy can be imported when terms are added to a post / post_type by enabling hierachy and setting the hierarchy character https://www.importwp.com/docs/importer/how-to-guides/how-to-import-wordpress-taxonomies-onto-a-post-type/

    However your feed:

    Kids > Shoes > Walk, Run > Walk
    Kids > Shoes > Walk, Run > Run
    Kids > T-shirt
    Kids > Glasses

    Would match the following hierarchy:

    - Kids
        |- Shoes
        |    |- Walk
        |- T-Shirt
        |- Glasses
    - Run
        |- Walk
        |- Run

    Would match the following hierarchy (if you changed the term seperator delimiter from a “,” ):

    - Kids
        |- Shoes
        |    |- Walk, Run
        |    |    |- Walk
        |    |    |- Run
        |- T-Shirt
        |- Glasses

    Please make sure you are using the latest version 2.4.9 or greater as i have fix some bugs relating to this.

    • This reply was modified 2 years, 10 months ago by ImportWP.
    Thread Starter juriix

    (@juriix)

    Hello,

    I know that categories can be uploaded via Taxomony, but I don’t know where to enter WP Categories and where to Feed Categories so that they merge when they are different -> mapping.

    The categories are different, in the feed the category name is not the same as in WP.

    Screen:

    View post on imgur.com

    E.g. WP Shoes VS Feed Socks

    I would imagine that I would put WP category in one row, field and Feed category in the other and then they will be merged when importing. This way I add xx Taxomony and map all the categories. But that’s not how it works, is it?

    Thank you

    • This reply was modified 2 years, 10 months ago by juriix.
    • This reply was modified 2 years, 10 months ago by juriix.
    • This reply was modified 2 years, 10 months ago by juriix.
    Plugin Author ImportWP

    (@jcollings)

    Mapping like you suggest can currently only be achieved by creating your own custom function, and using that custom function to modify the feed category names to match your wp category names.

    an example of using a custom function to modify dates, can be seen here: https://www.importwp.com/docs/importer/code-snippets/modifying-dates-using-custom-methods/ , this should give you an idea of how to create and use custom methods.

    Thread Starter juriix

    (@juriix)

    I can’t handle this, it’s too complicated. I’m not a programmer.

    Plugin Author ImportWP

    (@jcollings)

    Ok, if you can provide me with a 2 column csv list of Feed Term values, and Wp Term value, i should be able to create you a custom function.

    e.g.

    Feed Term, WP Term
    Feed Socks, WP Shoes
    Thread Starter juriix

    (@juriix)

    Wait a minute. I’ll add it right here.

    Thread Starter juriix

    (@juriix)

    I created a table CSV with two columns. If you prepared them for me, it would be great.

    Table CSV:
    https://easyupload.io/96rs0f

    UTF8

    delimiter is ,

    Plugin Author ImportWP

    (@jcollings)

    Hi Juriix,

    Sorry it has taken so long to get back to you, but i have been away from the keyboard over the weekend.

    Please update import wp to v2.4.10+

    Custom method to map your categories, add this to your theme or via a plugin:

    function iwpex_juriix_map_categories($input = '')
    {
        // Feed => WordPress
        $map = [
            'Boty > Koza?ky (Dámské)' => 'Boty > Dámské > Koza?ky',
            'Boty > Kecky (Dámské)' => 'Boty > Dámské > Kecky',
            'Boty > Kecky (Pánské)' => 'Boty > Pánské > Kecky',
            'Pono?ky > Barevné' => 'Pono?ky',
            'Pono?ky > Bílé' => 'Pono?ky',
            'Pono?ky > ?erné' => 'Pono?ky',
        ];
    
        $base_delimiter = apply_filters('iwp/value_delimiter', ',');
        $base_delimiter = apply_filters('iwp/taxonomy/value_delimiter', $base_delimiter);
    
        $parts = explode($base_delimiter, $input);
    
        $parts = array_map(function ($item) use ($map) {
            return isset($map[$item]) ? $map[$item] : $item;
        }, $parts);
    
        return implode($base_delimiter, $parts);
    }

    Once the code is added, you should be able to update the value in the taxonomy terms field, previously from your screenshot it was {23} , change this to [iwpex_juriix_map_categories("{23}")].

    If done correctly, the preview text should update and show the mapped values.

    Thread Starter juriix

    (@juriix)

    It’s working, thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Mapping (map) Categories – WP / XML feed’ is closed to new replies.