I want to make the program work so that the “affiliate” signup IS the referral. Is this possible or could I use the Contact Form 7 to record the referrals and somehow place that on the affiliate sign up page? I’m having trouble locating how to actually use the Contact Form 7 to integrate into my site. (Essentially it’s just a free affiliate program, that signs up the next, the next, the next…)
Affiliate Stats or Contact Form 7
Posted in Affiliates Enterprise
Hi,
you can use Affiliates API and “affiliates_stored_affiliate” hook for that purpose.
For example:
function myFunction ($affiliateId) {
// net order amount
// the commission is calculated based on that
$net_amount = 101;
// appropriate currency cod e for the referral
$currency = 'USD';
// related post ID, order ID, ...
$post_id = $affiliateId;
$data = array(
'order_id' => array(
'title' => 'Affiliate #',
'domain' => AFFILIATES_PLUGIN_DOMAIN,
'value' => esc_sql( $affiliateId )
),
'order_total' => array(
'title' => 'Total',
'domain' => AFFILIATES_PLUGIN_DOMAIN,
'value' => esc_sql( $net_amount )
),
'order_currency' => array(
'title' => 'Currency',
'domain' => AFFILIATES_PLUGIN_DOMAIN,
'value' => esc_sql( $currency )
)
);
$r = new Affiliates_Referral_WordPress();
$description = sprintf( 'Affiliate #%s', $affiliateId );
$r->evaluate( $post_id, $description, $data, $net_amount, null, $currency, null, 'sale' );
}
add_action('affiliates_stored_affiliate', 'myFunction');
cheers