wpsc_edit_product

Located in: product-functions.php

Functions that call this hook: wpsc_admin_submit_product(), wpsc_insert_product()
Arguments Accepted: $product_id
Version Introduced: 3.8

Description: This hook is called right at the end of the submit product function and insert product function. All new product data has been inserted at this point – you could use this hook to save your own custom product meta.

Code in context:

wpsc_admin_submit_product()
[php firstline=”183″ highlight=”193″]
if($post_data[‘files’][‘file’][‘tmp_name’] != ”) {
wpsc_item_process_file($product_id, $post_data[‘files’][‘file’]);
} else {
if (!isset($post_data[‘select_product_file’])) $post_data[‘select_product_file’] = null;
wpsc_item_reassign_file($product_id, $post_data[‘select_product_file’]);
}

if(isset($post_data[‘files’][‘preview_file’][‘tmp_name’]) && ($post_data[‘files’][‘preview_file’][‘tmp_name’] != ”)) {
wpsc_item_add_preview_file($product_id, $post_data[‘files’][‘preview_file’]);
}
do_action(‘wpsc_edit_product’, $product_id);
wpsc_ping();
}
return $product_id;
}

[/php]

wpsc_insert_product()
[php firstline=”482″ highlight=”503″]
// and the meta
wpsc_update_product_meta($product_id, $post_data[‘meta’]);

// and the custom meta
wpsc_update_custom_meta($product_id, $post_data);

//and the alt currency
foreach((array)$post_data[‘newCurrency’] as $key =>$value){
wpsc_update_alt_product_currency($product_id, $value, $post_data[‘newCurrPrice’][$key]);
}

if($post_data[‘files’][‘file’][‘tmp_name’] != ”) {
wpsc_item_process_file($product_id, $post_data[‘files’][‘file’]);
} else {
if (!isset($post_data[‘select_product_file’])) $post_data[‘select_product_file’] = null;
wpsc_item_reassign_file($product_id, $post_data[‘select_product_file’]);
}

if(isset($post_data[‘files’][‘preview_file’][‘tmp_name’]) && ($post_data[‘files’][‘preview_file’][‘tmp_name’] != ”)) {
wpsc_item_add_preview_file($product_id, $post_data[‘files’][‘preview_file’]);
}
do_action(‘wpsc_edit_product’, $product_id);
wpsc_ping();
return $product_id;

[/php]