• Resolved juriix

    (@juriix)


    Hello,
    I’m trying to import Categories into an already created Category, but every time I start the import, new categories and subcategories are created.

    I have in my XML a category path that looks like this:
    Kids > Shoes > Sport, Run
    Kids > T-shirt
    Kids > Glasses

    Now I would like to have the structure like this (WP manual created Category)
    Kids & Baby

    I need the Kids content (category) to appear only under the Kids & Baby category, no subcategories and no new categories.

    Can you advise me what I am doing wrong or how to set up the Rubrics?

    Thank you very much for your help

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

    (@wpallimport)

    Hi @juriix,

    I can see that we’ve already been working on this issue with you via our support system, so let’s continue the discussion there to avoid confusion.

    Thread Starter juriix

    (@juriix)

    Ok, thank you.

    Hi,
    I am interested in this Solution, too.
    regards
    Wolfgang

    Thread Starter juriix

    (@juriix)

    Hello,

    add this in All Import -> Settings

    //Map categories
    function my_translate_category($category) {
        if($category === 'Kids > Shoes') {
            return 'Kids & Baby';
        } else {
            return 'Neza?azené';
        }
    }

    But I don’t know how to import into subcategories that are already in the system.

    Regards

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

    Hi,
    thank you, I will try this…
    regards

    Thread Starter juriix

    (@juriix)

    Hello,

    I don’t know why some content doesn’t want to import under mapped categories.

    E.g. the product “Adidas L” should be imported into “kids-baby”, but imported into “Uncategorized”.

    Path from feed – Kids > Shoes > Sport, Run

     } elseif($category === 'Kids') {
            return 'kids-baby';

    Kids (main category) has subcategories Shoes > Sport, Run

    Since I tested the feed I thought that if the Product has only the main category it will be imported OK, but if the product has subcategories the content will be imported into “uncategorized”. Could it be that the import is set as “Each Post has just one Rubric” (Each P?íspěvek has just one Rubrika)? If so, how to set the import to import the content with Subcategories into the correct Rubrics (categories) as well?

    Thank you.

    Plugin Author WP All Import

    (@wpallimport)

    Hi @juriix,

    That’s happening because “Kids > Shoes > Sport, Run” does not === “Kids”. You’d have to update your code to use strpos() or something similar to see if “Kids” exists in the string, rather than looking for an exact match.

    Thread Starter juriix

    (@juriix)

    Hello,

    I have created this for POST

    add_filter('wp_all_import_is_post_to_create', 'my_is_post_to_create', 10, 3);
    
    //Map categories
    function my_translate_category($category) {
        if(strpos($category, 'Shoes') !== false) {
            return 'kids-baby';

    but for Woocommerce Products it doesn’t work, Can you help me?

    Thank you

    Thread Starter juriix

    (@juriix)

    Solved

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Map categories’ is closed to new replies.