Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter scottjonesk

    (@scottjonesk)

    Thank you. I am sure we’re going to get this. Could you give new code from scratch? Correct code in its entirety?
    Also, specifically where is affiliate_id to be created?

    Thank you!

    Thread Starter scottjonesk

    (@scottjonesk)

    Getting there! Thank you so much for the help!
    So I delete this first row of:
    add_filter( “woe_fetch_order”, function($row, $order ){

    then i get an error of

    The code you are trying to save produced a fatal error on line 11:Unmatched ‘}’

    add_filter( “woe_fetch_order”, function($row, $order ){
    global $wpdb;
    $user_id = $wpdb->get_var( “SELECT aff.user_id
    FROM {$wpdb->prefix}affiliate_wp_referrals AS ref
    LEFT JOIN {$wpdb->prefix}affiliate_wp_affiliates AS aff
    ON aff.affiliate_id = ref.affiliate_id
    WHERE ref.context=’woocommerce’ AND ref.reference=”.$order->get_id() );
    if($user_id) {
    $user_info = get_userdata($user_id);
    $row[“affiliate_id”]= $user_info->user_email;
    }
    return $row;
    },10,2);

    Thread Starter scottjonesk

    (@scottjonesk)

    Submitted as a ticket. Thank you!

    Thread Starter scottjonesk

    (@scottjonesk)

    Maybe I put the affiliate_id into the wrong spot? Which category? or does it matter? I see common, customer, billing address, shipping address, products, product order items, product totals, coupons, other items, cart, shipping, totals, and Others.

    Thread Starter scottjonesk

    (@scottjonesk)

    Ok. Thank you. So onlinephp.io caught the error. Misc Settings has the entire code. Error is still the same. Sorry. What should I do next? I really appreciate the help!

    Thread Starter scottjonesk

    (@scottjonesk)

    Thank you,

    it quoted back

    Fatal error: Uncaught Error: Call to undefined function ​add_filter() in /home/user/scripts/code.php:2
    Stack trace: 0 {main}

    thrown in /home/user/scripts/code.php on line 2

    The code I used, once again was

    add_filter( "woe_fetch_order", function($row, $order ){
    global $wpdb;
    $user_id = $wpdb->get_var( "SELECT aff.user_id
    FROM {$wpdb->prefix}affiliate_wp_referrals AS ref
    LEFT JOIN {$wpdb->prefix}affiliate_wp_affiliates AS aff
    ON aff.affiliate_id = ref.affiliate_id
    WHERE ref.context='woocommerce' AND ref.reference=".$order->get_id() );
    if($user_id) {
    $user_info = get_userdata($user_id);
    $row["affiliate_id"]= $user_info->user_email;
    }
    return $row;
    },10,2);

    Thread Starter scottjonesk

    (@scottjonesk)

    Thank you. This is great. I created a meta key affilitate_id under Products and then tried Common. Both gave me this error. I think we’re almost there. Please help? Thank you!

    Uncaught Error: Call to undefined function ​add_filter() in /home3/mhurefmy/public_html/wp-content/plugins/woo-order-export-lite/classes/core/class-wc-order-export-engine.php(369) : eval()’d code:1 Stack trace: #0 /home3/mhurefmy/public_html/wp-content/plugins/woo-order-export-lite/classes/core/class-wc-order-export-engine.php(369): eval() #1 /home3/mhurefmy/public_html/wp-content/plugins/woo-order-export-lite/classes/core/class-wc-order-export-engine.php(431): WC_Order_Export_Engine::validate_defaults(Array) #2 /home3/mhurefmy/public_html/wp-content/plugins/woo-order-export-lite/classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php(22): WC_Order_Export_Engine::build_file(Array, ‘estimate_previe…’, ‘file’, 0, 0, ‘test’) #3 /home3/mhurefmy/public_html/wp-content/plugins/woo-order-export-lite/classes/class-wc-order-export-admin.php(531): WC_Order_Export_Admin_Tab_Abstract->ajax_preview() #4 /home3/mhurefmy/public_html/wp-includes/class-wp-hook.php(310): WC_Order_Export_Admin->ajax_gate(”) #5 /home3/mhurefmy/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(”, Array) #6 /home3/mhurefmy/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #7 /home3/mhurefmy/public_html/wp-admin/admin-ajax.php(188): do_action(‘wp_ajax_order_e…’) #8 {main} thrown

    Thread Starter scottjonesk

    (@scottjonesk)

    Thank you Mihai, Do you know of another affiliate program that does offer this? I’ll be able to come back to you when yours is done?

    Thanks,

    Scott

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