Jump to content



Member Since 03 Mar 2020
Offline Last Active Apr 25 2020 12:18 PM

Posts I've Made

In Topic: Your Add-On Needs A New Hook In Cs-Cart. Post It Here.

03 March 2020 - 09:12 PM



I need a hook in reward_points/func.php in fn_change_user_points

UPD: the method code needs to be slightly adjusted (to not "return" inside the if statement).

Providing the full resulting method:

function fn_change_user_points($value, $user_id, $reason = '', $action = CHANGE_DUE_ADDITION)

    $value = (int) $value;
    $result = '';

    if (!empty($value)) {
        $current_value = (int) fn_get_user_additional_data(POINTS, $user_id);
        fn_save_user_additional_data(POINTS, $current_value + $value, $user_id);

        $change_points = array(
            'user_id' => $user_id,
            'amount' => $value,
            'timestamp' => TIME,
            'action' => $action,
            'reason' => $reason
        $result = db_query("REPLACE INTO ?:reward_point_changes ?e", $change_points);

    fn_set_hook('change_user_points_post', $value, $user_id, $reason, $action);

    return $result;


The reason:
   we want to integrate existing web service with the marketplace, 

   and this hook will help to syncrhonize the bonus points data.


Thank you in advance,