• Resolved tomislavgalic19

    (@tomislavgalic19)


    Hello,

    I am trying to bulk import some products along with their attributes.

    I have approximately 2 to 10 attributes depends on the category for my products. But my columns where are the attributes in my xlsx file are not in the same order so I can’t map it to the same attributes with key-value pairs for every product.

    For example:

    for one product is:
    <name>Color</name>
    <value>Green</value>
    <name>Size</name>
    <value>Medium</value>
    and second product is:
    <name>Size</name>
    <value>Medium</value>
    <name>Color</name>
    <value>Green</value>
    

    What would you suggest I do?

    I am not sure my request is clear. Please feel free to ask questions.

    Thank you in advance for your help!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tomislavgalic19

    (@tomislavgalic19)

    Sending you screenshot of how my file is looking in the xlsx if helpful.

    I’m trying to pass the function call in value box in wp all import but its not working, always server terminating the proccess when trying to import.

    Function is set like this:

    function my_get_attribute_value( $attr, $name, $value ) {
    if ( empty( $name ) || empty( $value ) ) return;

    $names = explode( “, “, $name[0] );
    $values = explode( “, “, $value[0] );

    foreach ( $names as $key => $v ) {
    if ( $v == $attr && array_key_exists( $key, $values ) ) {
    return $values[ $key ];

    }
    }
    }

    Function call: [my_get_attribute_value(“CORE_CPU”,array({Extras/Name}),array({Extras/Value}))]

    Plugin Author WP All Import

    (@wpallimport)

    Hey @tomislavgalic19,

    You could drag in every possible name/value pair in the attributes section, that way it doesn’t matter if it’s in a different position in each record: https://d.pr/i/orTyJ7.

    If I misunderstood and you must use the function, you need to:

    • Make sure you change the quotes in the code to valid quotes: https://d.pr/n/LLc0JS.
    • Pass the correct elements from your file (not from the example snippet you found) to the function, e.g.:
    [my_get_attribute_value("CORE_CPU",array({name}),array({value}))]
    Thread Starter tomislavgalic19

    (@tomislavgalic19)

    Hey,

    my file in excel is going like this:

    And I want to import 2 attributes with my products which are CORE_CPU and CPU_MODEL, I want them to be in my language as name “Broj jezgri” i “Model procesora”.

    How should I do that?

    Function I use -> https://d.pr/n/LLc0JS

    And I have set in attributes like this [my_get_attribute_value(“CORE_CPU”,array({name}),array({value}))] in value field in my wocommerce add-on

    It doesn’t work again.

    Am I doing something wrong or it is some plugin conflict?

    Thanks in advance,

    Tomislav Galić

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Importing products attributes’ is closed to new replies.