Bookly with Paypal has the error when referal

Posted in

According to your Email before, and http://docs.itthinx.com/document/affiliates-pro/api/referrals/

We modify the Functions.php in my theme as follows:

function my_affiliates_referral( $referral_id, $data ) {
$referral = new Affiliates_Referral();

// appropriate currency code for the referral
$currency = ‘AUD’;

// related post ID, order ID, …
$post_id = $order_id;

$data = array(
‘order_id’ => array(
‘title’ => ‘Order #’,
‘domain’ => ‘affiliates’,
‘value’ => esc_sql( $order_id )
),
‘order_total’ => array(
‘title’ => ‘Total’,
‘domain’ => ‘affiliates’,
‘value’ => esc_sql( $net_amount )
),
‘order_currency’ => array(
‘title’ => ‘Currency’,
‘domain’ => ‘affiliates’,
‘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_referral’, ‘my_affiliates_referral’ );

and we also modify the file at wp-content\plugins\bookly-responsive-appointment-booking-tool\frontend\modules\booking\ajax.php

public static function renderComplete()
{
$userData = new Lib\UserBookingData( self::parameter( ‘form_id’ ) );
if ( $userData->load() ) {
$progress_tracker = self::_prepareProgressTracker( Steps::DONE, $userData );
$error = self::parameter( ‘error’ );
if ( $error == ‘appointments_limit_reached’ ) {
$response = array(
‘success’ => true,
‘html’ => self::renderTemplate( ‘8_complete’, array(
‘progress_tracker’ => $progress_tracker,
‘info_text’ => InfoText::prepare( Steps::DONE, Lib\Utils\Common::getTranslatedOption( ‘bookly_l10n_info_complete_step_limit_error’ ), $userData ),
), false ),
);
} else {
$payment = $userData->extractPaymentStatus();
do {
if ( $payment ) {
switch ( $payment[’status’] ) {
case ‘processing’:
$info_text = InfoText::prepare( Steps::DONE, Lib\Utils\Common::getTranslatedOption( ‘bookly_l10n_info_complete_step_processing’ ), $userData );
break ( 2 );
}
}
$info_text = InfoText::prepare( Steps::DONE, Lib\Utils\Common::getTranslatedOption( ‘bookly_l10n_info_complete_step’ ), $userData );
} while ( 0 );

do_action(‘affiliates_referral’);

$response = array(
‘success’ => true,
‘html’ => self::renderTemplate( ‘8_complete’, array(
‘progress_tracker’ => $progress_tracker,
‘info_text’ => $info_text,
), false ),
‘final_step_url’ => Lib\Proxy\Pro::getFinalStepUrl(),
);
}
} else {
$response = array( ‘success’ => false, ‘error’ => Errors::SESSION_ERROR );
}
$userData->sessionSave();

// Output JSON response.
wp_send_json( $response );
}

Then Yesterday, the error from email:
Error Details
=============
An error of type E_ERROR was caused in line 347 of the file /www/wwwroot/sydney.qingscleaning.com/wp-content/themes/sydney/functions.php. Error message: Uncaught ArgumentCountError: Too few arguments to function my_affiliates_referral(), 1 passed in /www/wwwroot/sydney.qingscleaning.com/wp-includes/class-wp-hook.php on line 288 and exactly 2 expected in /www/wwwroot/sydney.qingscleaning.com/wp-content/themes/sydney/functions.php:347
Stack trace:
#0 /www/wwwroot/sydney.qingscleaning.com/wp-includes/class-wp-hook.php(288): my_affiliates_referral(‘2’)
#1 /www/wwwroot/sydney.qingscleaning.com/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array)
#2 /www/wwwroot/sydney.qingscleaning.com/wp-includes/plugin.php(465): WP_Hook->do_action(Array)
#3 /www/wwwroot/sydney.qingscleaning.com/wp-content/plugins/affiliates-pro/lib/ext/wordpress/class-affiliates-referral-wordpress.php(82): do_action(‘affiliates_refe…’, ‘2’, Array)
#4 /www/wwwroot/sydney.qingscleaning.com/wp-content/plugins/affiliates-pro/lib/ext/wordpress/class-affiliates-referral-wordpress.php(53): Affiliates_Referral_WordPress->add_referrals(Array, NULL, ‘User Registrati…’, Array, ’10’, NU

Can you help us to settle down it ?

One Response to Bookly with Paypal has the error when referal

  1. Denitsa July 18, 2019 at 2:01 pm #

    Hello,
    The immediate reason for the error you’re getting is that the do_action(‘affiliates_referral’) requires additional arguments – a referral id and an array with referral data.
    However, from the looks of it, since we’re not maintaining he Bookly plugin and I’m not familiar with its code, you’d need to contact the Bookly developers and ask them for some details regarding the implementation and API, so we could help you tailor a solution. The main questions we need answered are how exactly is a booking added (the hook that’s used for this) and the API info regarding a successful booking (like booking id, amount, pre taxes, etc.).
    Let me know once you’ve obtained that information, so we can help you out further.
    Cheers,
    Denitsa

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