wpsc_edit_order_status

Located in: ajax-and-init.php

Functions that call this hook: wpsc_purchlog_edit_status()
Arguments Accepted: array(‘purchlog_id’=>$purchlog_id, ‘purchlog_data’=>$log_data, ‘new_status’=>$purchlog_status));

Version Introduced: 3.8

Description: This hook is triggered right before the purchase logs sale’s status are updated, you would use this hook if you wanted to update a sales status.

Code in context:
[php firstline=”643″ highlight=”651″]
$log_data = $wpdb->get_row( "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = ‘{$purchlog_id}’ LIMIT 1", ARRAY_A );
$is_transaction = wpsc_check_purchase_processed($log_data[‘processed’]);
if ( $is_transaction && function_exists(‘wpsc_member_activate_subscriptions’)) {
wpsc_member_activate_subscriptions( $_POST[‘id’] );
}

//in the future when everyone is using the 2.0 merchant api, we should use the merchant class to update the staus,
// then you can get rid of this hook and have each person overwrite the method that updates the status.
do_action(‘wpsc_edit_order_status’, array(‘purchlog_id’=>$purchlog_id, ‘purchlog_data’=>$log_data, ‘new_status’=>$purchlog_status));

$wpdb->query( "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET processed='{$purchlog_status}’ WHERE id='{$purchlog_id}’" );

wpsc_clear_stock_claims();
wpsc_decrement_claimed_stock($purchlog_id);
[/php]