Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter hypopolol

    (@hypopolol)

    Ok damn me, i forgot to remove ” in datas …

    Thread Starter hypopolol

    (@hypopolol)

    Oh nice, thank you !

    So this time it works but (there’s always a but ^^), i can’t decide for the term_id, so i can’t decide witch one is a cat, a subcat, a subsubcat etc..

    if ($niv == 2) {
    			$id = substr($lib, 0, 2);
    			$parent = substr($lib, 0, 1);
    			$cat_name = substr($lib, 5);
    			$catarr = array(
    						    'term_id' => $id,
    							'name' => $cat_name,
    							'parent' => $parent,
    							'taxonomy' => 'product_cat',
    							'slug' => $cat_name,
    							'description' => $cat_name
    			);
    			$term = wp_insert_term( $cat_name, 'product_cat', $catarr );
    			if ( is_wp_error( $term ) ) {
    				$term_id = $term->error_data['term_exists'] ?? null;
    			} else {
    				$term_id = $id;
    			}
    			echo $id.'&nbsp;|&nbsp;'.$parent.'&nbsp;|&nbsp;'.$cat_name.'<br>';
    		}

    in this exemple: $niv == 2 so it’s a subcat, her parent cat is the first digit of $lib. So for each cat i’ve tried, like above, to replace
    $term_id = $term['term_id'];
    by
    $term_id = $id;

    so this way can refound her to set her as parent of her subsubcat’s (i’m pretty sure it’s possible to use less ‘her’ in that sentence). So what happen her is, $niv == 1 category, witch are main cats, are well created since i don’t define parent cat, but $term_id = $id doesn’t work, (it’s maybe because wordpress don’t like id with only 1 digit ?), it’s replaced by 5 digits ids, so when $niv == 2 arrive they are not created at all because ‘parent’ => $parent fails.

    And finally i have tons of
    Notice: update_woocommerce_term_meta est obsolète depuis la version 3.6 ! Utilisez update_term_meta à la place. in /var/www/wordpress/wp-includes/functions.php on line 4440
    when using wp_insert_term() ^^.

    So i’m gonna lookup for these issues, but if someone got and idea <3

    Thanks again !

    Thread Starter hypopolol

    (@hypopolol)

    Thanks for answere !

    I’ve tried but doing this will make me manually update about 5000 products of my store (exept if there’s a way to auto define EAN as SKU for all existing items), so a bit too long.

    I’ve asked allimport staff if their pluggin can help me, because their demo version can’t.

    So thank you again, i’ll wait for their answer.

    Thread Starter hypopolol

    (@hypopolol)

    Solved:

    with ovh you need at least a VPS , else outgoing connections will be blocked.

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