Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter stathisstr

    (@stathisstr)

    Thanks a lot for your response xue, i will contact them.

    Thread Starter stathisstr

    (@stathisstr)

    I’m trying to have some products from woocomerce in my form, for example as shown in the screenshot: https://snipboard.io/aEeJux.jpg but this can only be achieved with superforms.
    Is there any way i can have the same functionality with WP-Forms or with any other form plugin?

    Thread Starter stathisstr

    (@stathisstr)

    Good morning Cara and thanks for your advice.
    I deactivated the plugin code snippets and everyting worked correctly.
    I activated the plugin and disabled 2 snippets and everything worked correctly.
    The main problem now is what could i do to fix the snippets that causing the problem.

    Thread Starter stathisstr

    (@stathisstr)

    Hello Ian, i think it’s this one

    add_filter( ‘manage_edit-shop_order_columns’, ‘shop_order_columns’ );
    function shop_order_columns( $columns ){
    $new_columns = (is_array($columns)) ? $columns : array();

    $new_columns[‘category’] = ‘Κατηγορίες’;

    return $new_columns;
    }

    add_action( ‘manage_shop_order_posts_custom_column’, ‘shop_order_posts_custom_column’ );
    function shop_order_posts_custom_column( $column ){
    global $post, $the_order;

    if ( empty( $the_order ) || $the_order->get_id() != $post->ID ) {
    $the_order = wc_get_order( $post->ID );
    }

    $category_name_array = array();
    $i=0;

    foreach ($the_order->get_items() as $item_id => $item_data) {
    $product = $item_data->get_product();
    $category = $product->get_category_ids();

    $name = get_product_category_by_id($category[0]);
    $category_name_array[$i] = $name;
    $i++;
    }

    if ( $column == ‘category’ ) {
    $arrlength = count($category_name_array);
    $category_to_display = ”;
    for($x = 0; $x < $arrlength; $x++){
    if($x == 0){
    $category_to_display = $category_name_array[$x];
    } else{
    $category_to_display = $category_to_display.”, “.$category_name_array[$x];
    }
    }
    echo($category_to_display);
    }
    }

    function get_product_category_by_id( $category_id ) {
    $term = get_term_by( ‘id’, $category_id, ‘product_cat’, ‘ARRAY_A’ );
    return $term[‘name’];
    }

    Thread Starter stathisstr

    (@stathisstr)

    Thanks Edith, but Redux is not installed. The following error i think is the reason.

    2021-07-08T08:22:32+00:00 CRITICAL Uncaught Error: Call to a member function get_category_ids() on bool in /var/www/vhosts/randp.gr/public_html/traumaedu/wp-content/plugins/code-snippets/php/snippet-ops.php(469) : eval()’d code:23
    Stack trace:
    #0 /var/www/vhosts/randp.gr/public_html/traumaedu/wp-includes/class-wp-hook.php(294): shop_order_posts_custom_column()
    #1 /var/www/vhosts/randp.gr/public_html/traumaedu/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters()
    #2 /var/www/vhosts/randp.gr/public_html/traumaedu/wp-includes/plugin.php(484): WP_Hook->do_action()
    #3 /var/www/vhosts/randp.gr/public_html/traumaedu/wp-admin/includes/class-wp-posts-list-table.php(1282): do_action()
    #4 /var/www/vhosts/randp.gr/public_html/traumaedu/wp-admin/includes/class-wp-list-table.php(1447): WP_Posts_List_Table->column_default()
    #5 /var/www/vhosts/randp.gr/public_html/traumaedu/wp-admin/includes/class-wp-posts-list-table.php(1315): WP_List_Table->single_row_columns()
    #6 /var/www/vhosts/randp.gr/public_html/traumaedu/wp-admin/includes/class-wp-posts-list-ta μέσα στο /var/www/vhosts/randp.gr/public_html/traumaedu/wp-content/plugins/code-snippets/php/snippet-ops.php(469) : eval()’d code στην γραμμή 23

    Thread Starter stathisstr

    (@stathisstr)

    Thanks for your replies, i’m going to give it a try again and let you know with the outcome.

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