Send email on Job Dispatched from WP e-commerce

I sell a product using WP e-commerce that is downloadable only after I check some information that the customer sends me. After checking the information I would like to go to the WordPress dashboard, change the order status to “Job Dispatched”, and have that trigger a new email to the customer with instructions on what to do next.

Any ideas or experience with attaching some trigger event or option to the “Job Dispatched” status change?

Related posts

Leave a Reply

1 comment

  1. I’d suggest you start by looking at action ‘wpsc_purchase_log_update’, which is triggered in wpsc-includes/purchase-log.class.php and passes the wpsc_purchase_log object. Test the $previous_status member of that object, and the new status value (might be in data member as $data['statusno']) == WPSC_Purchase_Log::JOB_DISPATCHED.

    Something like this (untested):

    add_action('wpsc_purchase_log_update', 'wpse_73707_wpscPurchaseLogUpdate');
    
    /**
    * trigger event or option to the "Job Dispatched" status change
    * @param WPSC_Purchase_Log $purchaseLog
    */
    function wpse_73707_wpscPurchaseLogUpdate($purchaseLog) {
        if ($purchaseLog->previous_status && $purchaseLog->data['statusno'] == WPSC_Purchase_Log::JOB_DISPATCHED) {
            // send your email ...
        }
    }