Form asking to send commission to acount

Posted in

Actually i am confused that this topic comes under affiliate coupons or not? (move it to other conversation if not suitable here)

What i want is:-

When an affiliate login to his area:-

He will be able to see a form in which he can enter his email id and commission amount (not more than actual amount that are showing already in his affiliate area) that he want to send to his account

Now admin got a mail and able to see that request in admin panel. Now he will reply to the affiliate that please generate an invoice of that much amount and send me mail again, but when he is sending this mail at that time only amount will be deducted from affiliate account. (amount processing and transfer to account is not our concern at all, it will be done manually by admin)

So let me know how i can create a form (because when i am using default form of Affiliate Pro, it gave me only name, email description field only not the amount field).

Also at the time of sending reply mail from admin what function i have to use to get affiliate commission details and deduct it and save the new amount (I know that custom coding required for this,which i can do, but what functions i have to call to get commission details and save the new amount )?

Thanks in advance.

9 Responses to Form asking to send commission to acount

  1. Andreas March 22, 2017 at 4:24 am #

    Hello Antonio

    Please remove the above comment of mine. I have wrongly putted it here.

    Thanks for the improvement on my other comments.

    This topic is closed now.

    • antonio March 22, 2017 at 7:55 am #

      Perfect !!

  2. Andreas March 20, 2017 at 11:45 am #

    Hello Antonio

    Can you please format that comment of mine so that code will become readable. I am unable to do that now.

    Thanks

    • antonio March 20, 2017 at 3:11 pm #

      Done !! It could be better, but something has improved.

  3. Andreas March 20, 2017 at 7:28 am #

    Hi antonio

    I did it with my custom function (adding codes and details) so that my other will get help:-

    1. in affiliate-area page added some div’s some hidden fields and a contact form:-


    [affiliates_id]

    2. Created a contact-form with below structure:-


    [hidden affiliate-id class:affiliate_id]
    [hidden affiliate-pending-commission class:affiliate_pending_commission]
    Your Name (required)
    [text* your-name readonly default:user_display_name]
    Your Email (required)
    [email* your-email readonly default:user_email]
    Subject
    [text your-subject readonly "Request to withdrawal my commission"]
    Your Message
    [textarea your-message readonly "Please send my commission amount to my account."]
    [submit "Send"]

    3. in footer.js file added some jQuery code:-

    if(window.location.href.indexOf('affiliate-area')>-1){
    if($('.commissions_pending_payment').find("ul").length == 0){
    $('.wpcf7-form').hide();
    }else{
    $('.affiliate_id').val($.trim($('.send_affiliate_id').text()));
    $('.affiliate_pending_commission').val($('.commissions_pending_payment ul li:first').text());
    }
    }

    4. in function.php added a new function:-

    add_action('wpcf7_mail_sent','send_amount_to_account');
    /* deduct the commission from afiliate area at the time he asked for refund */
    function send_amount_to_account( $contact_form ) {
    global $wpdb;
    $referrals_table = _affiliates_get_tablename( 'referrals' );
    $where = " WHERE affiliate_id = %d";
    $values = array($_POST['affiliate-id']);
    $query = $wpdb->prepare("UPDATE $referrals_table set status='closed' $where",$values);
    $wpdb->query($query);
    $from = 'vegard.tunes@staging4.reinstyrke.no';
    $to = $_POST['your-email'];
    $name = $_POST["your-name"];
    $subject = "Raise an invoice";
    $message = "Hi $name, Thanks for working with Us Please create and send invoice to post@reinstyrke.no to release funds Thanks";
    $headers = "From:Rein Styrke:\n";
    $headers.= "MIME-Version: 1.0\n";
    $headers.= "Content-type: text/html; charset=iso 8859-1";
    wp_mail($to,$subject,$message,$headers);
    }

    Thanks

    • antonio March 20, 2017 at 7:40 am #

      Thanks for sharing !!

  4. Andreas March 17, 2017 at 4:45 am #

    Hi Antonio

    Thanks for your response.

    Actually as you said i knew that i have to do it custom. what i want to know that can you please tell me the documentation link or some link where i can see all the available functions of affiliates plugins like function to get affiliate details,save amount to corresponding affiliate…..

    I want these function reference link so that i can read them and do manual coding and try to achieve what i want.

    Thanks

  5. antonio March 16, 2017 at 9:45 am #

    Hi Andreas,
    Really this option is not available.
    You could create a form (for example using Contact Form 7), and add this form inside the [affiliates_is_affiliate] shortcode in the affiliate-area page, so only the affiliates can see this form.
    From the Affiliates->Totals section you can ‘close’ the referrals indicating that these referrals are paid.
    Kind Regards,
    Antonio B.

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share