API Action Reference RSS feed for this section

wpsc_shipwire_post_sync

Located in: shipwire_functions.php

Functions that call this hook: sync_products()
Arguments Accepted: $tracking, $inventory
Version Introduced: 3.8.9

Description: This action is triggered after shipwire tracking information is synced.

Code in context:
[php firstline="631" highlight="641"]
foreach ( $inventory as $sku => $qty ) {
$sql = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = ‘_wpsc_sku’ AND meta_value = %s", $sku );
$queries[] = $sql;
$product_id = $wpdb->get_var( $sql );
$product_ids[] = $product_id;
$stock_updates = (int) update_post_meta( $product_id, ‘_wpsc_stock’, $qty );

$inventory_updates += $stock_updates;
}

do_action( ‘wpsc_shipwire_post_sync’, $tracking, $inventory );

$sync_response = array(
‘tracking’ => sprintf( _n( ‘Shipwire updated %d tracking number.’, ‘Shipwire updated %d tracking numbers.’, $tracking_updates, ‘wpsc’ ), $tracking_updates ),
‘inventory’ => sprintf( _n( ‘Shipwire updated inventory on %d product.’, ‘Shipwire updated inventory on %d products.’, $inventory_updates, ‘wpsc’ ), $inventory_updates ),
);
[/php]

Read Documentation ·

wpsc_shipwire_pre_sync

Located in: shipwire_functions.php

Functions that call this hook: sync_products()
Arguments Accepted: $tracking, $inventory
Version Introduced: 3.8.9

Description: This action is triggered before shipwire tracking information is synced.

Code in context:
[php firstline="599" highlight="603"]
$product_code = isset( $_POST['product_code'] ) ? $_POST['product_code'] : $product_code;
$tracking = self::get_tracking_info();
$inventory = self::get_inventory_info( $product_code );

do_action( ‘wpsc_shipwire_pre_sync’, $tracking, $inventory );

$tracking_updates = 0;

foreach ( $tracking as $order_id => $tracking_number ) {
$tracking_numbers = array_keys( $tracking_number );
$update = (int) $wpdb->update(
WPSC_TABLE_PURCHASE_LOGS,
array(
‘track_id’ => $tracking_numbers[0]
),
array(
‘id’ => $order_id
),
‘%s’,
‘%d’
);
[/php]

Read Documentation ·

wpsc_paypal_standard_deactivate_subscription

Located in: paypal-standard.merchant.php

Functions that call this hook: process_gateway_notification()
Arguments Accepted: $subscr_id, $merchant_object
Version Introduced: 3.8.9

Description: This action is triggered when subscription via PayPal Standard is canceled.

Code in context:
[php firstline="518" highlight="519"]
case ‘subscr_cancel’:
do_action( ‘wpsc_paypal_standard_deactivate_subscription’, $this->paypal_ipn_values['subscr_id'], $this );
case ‘subscr_eot’:
case ‘subscr_failed’:
foreach($this->cart_items as $cart_row) {
$altered_count = 0;
if((bool)$cart_row['is_recurring'] == true) {
$altered_count++;
wpsc_update_cartmeta($cart_row['cart_item_id'], ‘is_subscribed’, 0);
}
}
break;
[/php]

Read Documentation ·

wpsc_activated_subscription

Located in: paypal-pro.merchant.php, paypal-express.merchant.php

Functions that call this hook: process_gateway_notification()
Arguments Accepted: $cart_item_id, $merchant_object
Version Introduced: 3.8.9

Description: This action is triggered when IPN information of a recurring product is returned from PayPal.

Code in context:
[php firstline="306" highlight="315"]
case ‘subscr_signup’:
case ‘subscr_payment’:
if ( in_array( $status, array( 2, 3 ) ) ) {
$this->set_transaction_details( $this->paypal_ipn_values['subscr_id'], $status );
transaction_results($this->cart_data['session_id'],false);
}
foreach ( $this->cart_items as $cart_row ) {
if ( $cart_row['is_recurring'] == true ) {
do_action( ‘wpsc_activate_subscription’, $cart_row['cart_item_id'], $this->paypal_ipn_values['subscr_id'] );
do_action(‘wpsc_activated_subscription’, $cart_row['cart_item_id'], $this );
}
}
break;
[/php]

Read Documentation ·

wpsc_dynamic_css

Located in: theme.functions.php

Functions that call this hook: wpsc_get_user_dynamic_css()
Arguments Accepted: none
Version Introduced: 3.8.9

Description: This action is triggered when dynamic css is being output.

Code in context:
[php firstline="810" highlight="815"]
div.default_product_display .imagecol img.no-image, #content div.default_product_display .imagecol img.no-image {
width: <?php echo $thumbnail_width; ?>px;
height: <?php echo $thumbnail_height; ?>px;
}

<?php do_action( ‘wpsc_dynamic_css’ ); ?>

/*
* Single View Styling
*/

div.single_product_display div.item_no_image {
width: <?php echo $single_thumbnail_width – 2; ?>px;
height: <?php echo $single_thumbnail_height – 2; ?>px;
}
div.single_product_display div.item_no_image a {
width: <?php echo $single_thumbnail_width – 2; ?>px;
}
[/php]

Read Documentation ·

wpsc_transaction_send_email_to_admin

Located in: purchase-log.helpers.php

Functions that call this hook: wpsc_send_admin_email()
Arguments Accepted: $purchase_notification_object, $is_email_sent
Version Introduced: 3.8.9

Description: This action is triggered after a purchase report has been emailed to the admin.

Code in context:
[php firstline="219" highlight="234"]
function wpsc_send_admin_email( $purchase_log, $force = false ) {
if ( ! is_object( $purchase_log ) )
$purchase_log = new WPSC_Purchase_Log( $purchase_log );

if ( $purchase_log->get( ‘email_sent’ ) && ! $force )
return;

$email = new WPSC_Purchase_Log_Admin_Notification( $purchase_log );
$email_sent = $email->send();

if ( $email_sent ) {
$purchase_log->set( ‘email_sent’, 1 );
$purchase_log->save();
}

do_action( ‘wpsc_transaction_send_email_to_admin’, $email, $email_sent );
return $email_sent;
}
[/php]

Read Documentation ·

wpsc_transaction_send_email_to_customer

Located in: purchase-log.helpers.php

Functions that call this hook: wpsc_send_customer_email()
Arguments Accepted: $purchase_notification_object, $is_email_sent
Version Introduced: 3.8.9

Description: This action is triggered after a purchase receipt has been emailed to the customer.

Code in context:
[php firstline="205" highlight="215"]
function wpsc_send_customer_email( $purchase_log ) {
if ( ! is_object( $purchase_log ) )
$purchase_log = new WPSC_Purchase_Log( $purchase_log );

if ( ! $purchase_log->is_transaction_completed() && ! $purchase_log->is_order_received() )
return;

$email = new WPSC_Purchase_Log_Customer_Notification( $purchase_log );
$email_sent = $email->send();

do_action( ‘wpsc_transaction_send_email_to_customer’, $email, $email_sent );
return $email_sent;
}
[/php]

Read Documentation ·

wpsc_purchase_log_save

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::save()
Arguments Accepted: $purchase_log_object
Version Introduced: 3.8.9

Description: This action is triggered after a purchase log is saved to the database (either updated or inserted).

Code in context:
[php firstline="538" highlight="548"]
if ( $this->is_status_changed ) {
if ( $this->is_transaction_completed() )
$this->update_downloadable_status();
$current_status = $this->get( ‘processed’ );
$previous_status = $this->previous_status;
$this->previous_status = $current_status;
$this->is_status_changed = false;
do_action( ‘wpsc_update_purchase_log_status’, $this->get( ‘id’ ), $current_status, $previous_status, $this );
}

do_action( ‘wpsc_purchase_log_save’, $this );

return $result;
[/php]

Read Documentation ·

wpsc_update_purchase_log_status

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::save()
Arguments Accepted: $log_id, $current_status, $previous_status, $purchase_log_object
Version Introduced: 3.8.9

Description: This action is triggered after a purchase log’s status is updated.

Code in context:
[php firstline="538" highlight="545"]
if ( $this->is_status_changed ) {
if ( $this->is_transaction_completed() )
$this->update_downloadable_status();
$current_status = $this->get( ‘processed’ );
$previous_status = $this->previous_status;
$this->previous_status = $current_status;
$this->is_status_changed = false;
do_action( ‘wpsc_update_purchase_log_status’, $this->get( ‘id’ ), $current_status, $previous_status, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_insert

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::save()
Arguments Accepted: $purchase_log_object
Version Introduced: 3.8.9

Description: This action is triggered after a purchase log’s data is inserted into the database.

Code in context:
[php firstline="519" highlight="535"]
do_action( ‘wpsc_purchase_log_pre_insert’ );
$data = apply_filters( ‘wpsc_purchase_log_insert_data’, $this->data );
$format = $this->get_data_format( $data );
$result = $wpdb->insert( WPSC_TABLE_PURCHASE_LOGS, $data, $format );

if ( $result ) {
$this->set( ‘id’, $wpdb->insert_id );

// set $this->args so that properties can be lazy loaded right after
// the row is inserted into the db
$this->args = array(
‘col’ => ‘id’,
‘value’ => $this->get( ‘id’ ),
);
}

do_action( ‘wpsc_purchase_log_insert’, $this );
[/php]

Read Documentation ·

wpsc_purchase_log_pre_insert

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::save()
Arguments Accepted: none
Version Introduced: 3.8.9

Description: This action is triggered before a purchase log’s data is inserted into the database.

Code in context:
[php firstline="519" highlight="519"]
do_action( ‘wpsc_purchase_log_pre_insert’ );
$data = apply_filters( ‘wpsc_purchase_log_insert_data’, $this->data );
$format = $this->get_data_format( $data );
$result = $wpdb->insert( WPSC_TABLE_PURCHASE_LOGS, $data, $format );

if ( $result ) {
$this->set( ‘id’, $wpdb->insert_id );

// set $this->args so that properties can be lazy loaded right after
// the row is inserted into the db
$this->args = array(
‘col’ => ‘id’,
‘value’ => $this->get( ‘id’ ),
);
}

do_action( ‘wpsc_purchase_log_insert’, $this );
[/php]

Read Documentation ·

wpsc_purchase_log_update

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::save()
Arguments Accepted: $purchase_log_object
Version Introduced: 3.8.9

Description: This action is triggered after a purchase log’s data is updated.

Code in context:
[php firstline="510" highlight="517"]
$where_val = $this->args['value'];
$where_format = self::get_column_format( $where_col );
do_action( ‘wpsc_purchase_log_pre_update’, $this );
self::delete_cache( $where_val, $where_col );
$data = apply_filters( ‘wpsc_purchase_log_update_data’, $this->data );
$format = $this->get_data_format( $data );
$result = $wpdb->update( WPSC_TABLE_PURCHASE_LOGS, $data, array( $where_col => $where_val ), $format, array( $where_format ) );
do_action( ‘wpsc_purchase_log_update’, $this );
[/php]

Read Documentation ·

wpsc_purchase_log_pre_update

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::save()
Arguments Accepted: $purchase_log_object
Version Introduced: 3.8.9

Description: This action is triggered before a purchase log’s data is updated.

Code in context:
[php firstline="510" highlight="512"]
$where_val = $this->args['value'];
$where_format = self::get_column_format( $where_col );
do_action( ‘wpsc_purchase_log_pre_update’, $this );
self::delete_cache( $where_val, $where_col );
$data = apply_filters( ‘wpsc_purchase_log_update_data’, $this->data );
$format = $this->get_data_format( $data );
$result = $wpdb->update( WPSC_TABLE_PURCHASE_LOGS, $data, array( $where_col => $where_val ), $format, array( $where_format ) );
[/php]

Read Documentation ·

wpsc_purchase_log_pre_save

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::save()
Arguments Accepted: $purchase_log_object
Version Introduced: 3.8.9

Description: This action is triggered before a purchase log’s data is saved to the database.

Code in context:
[php firstline="498" highlight="501"]
public function save() {
global $wpdb;

do_action( ‘wpsc_purchase_log_pre_save’, $this );

// $this->args['col'] is empty when the record is new and needs to
// be inserted. Otherwise, it means we’re performing an update
$where_col = $this->args['col'];

$result = false;
[/php]

Read Documentation ·

wpsc_purchase_log_fetched

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::fetch()
Arguments Accepted: $purchase_log_object
Version Introduced: 3.8.9

Description: This action is triggered after a purchase log’s data is fetched from the database.

Code in context:
[php firstline="292" highlight="321"]
private function fetch() {
global $wpdb;

if ( $this->fetched )
return;

// If $this->args is not set yet, it means the object contains a new unsaved
// row so we don’t need to fetch from DB
if ( ! $this->args['col'] || ! $this->args['value'] )
return;

extract( $this->args );

$format = self::get_column_format( $col );
$sql = $wpdb->prepare( "SELECT * FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE {$col} = {$format}", $value );

$this->exists = false;

if ( $data = $wpdb->get_row( $sql, ARRAY_A ) ) {
$this->exists = true;
$this->data = apply_filters( ‘wpsc_purchase_log_data’, $data );
$this->cart_contents = $this->get_cart_contents();

$this->set_meta_props();
self::update_cache( $this );
}

do_action( ‘wpsc_purchase_log_fetched’, $this );

$this->fetched = true;
}
[/php]

Read Documentation ·

wpsc_purchase_log_delete

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::delete()
Arguments Accepted: $log_id
Version Introduced: 3.8.9

Description: This action is triggered after a purchase log is deleted.

Code in context:
[php firstline="170" highlight="177"]
public static function delete( $log_id ) {
global $wpdb;
do_action( ‘wpsc_purchase_log_before_delete’, $log_id );
self::delete_cache( $log_id );
$sql = $wpdb->prepare( "DELETE FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE id = %d", $log_id );
$wpdb->query( $sql );
do_action( ‘wpsc_purchase_log_delete’, $log_id );
}
[/php]

Read Documentation ·

wpsc_purchase_log_before_delete

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::delete()
Arguments Accepted: $log_id
Version Introduced: 3.8.9

Description: This action is triggered just before a purchase log is deleted.

Code in context:
[php firstline="170" highlight="177"]
public static function delete( $log_id ) {
global $wpdb;
do_action( ‘wpsc_purchase_log_before_delete’, $log_id );
self::delete_cache( $log_id );
$sql = $wpdb->prepare( "DELETE FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE id = %d", $log_id );
$wpdb->query( $sql );
do_action( ‘wpsc_purchase_log_delete’, $log_id );
}
[/php]

Read Documentation ·

wpsc_purchase_log_delete_cache

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::delete_cache()
Arguments Accepted: $log, $value, $col
Version Introduced: 3.8.9

Description: This action is triggered when a purchase log’s object cache is deleted.

Code in context:
[php firstline="151" highlight="158"]
public static function delete_cache( $value, $col = ‘id’ ) {
// this will pull from the old cache, so no worries there
$log = new WPSC_Purchase_Log( $value, $col );
wp_cache_delete( $log->get( ‘id’ ), ‘wpsc_purchase_logs’ );
wp_cache_delete( $log->get( ‘sessionid’ ), ‘wpsc_purchase_logs_sessionid’ );
wp_cache_delete( $log->get( ‘id’ ), ‘wpsc_purchase_log_cart_contents’ );
do_action( ‘wpsc_purchase_log_delete_cache’, $log, $value, $col );
}
[/php]

Read Documentation ·

wpsc_purchase_log_update_cache

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::update_cache()
Arguments Accepted: $log
Version Introduced: 3.8.9

Description: This action is triggered when a purchase log’s object cache is updated.

Code in context:
[php firstline="127" highlight="137"]
public static function update_cache( &$log ) {
// wpsc_purchase_logs stores the data array, while wpsc_purchase_logs_sessionid stores the
// log id that’s associated with the sessionid

$id = $log->get( ‘id’ );
wp_cache_set( $id, $log->data, ‘wpsc_purchase_logs’ );
if ( $sessionid = $log->get( ‘sessionid’ ) )
wp_cache_set( $sessionid, $id, ‘wpsc_purchase_logs_sessionid’ );
wp_cache_set( $id, $log->cart_contents, ‘wpsc_purchase_log_cart_contents’ );
do_action( ‘wpsc_purchase_log_update_cache’, $log );
}
[/php]

Read Documentation ·

wpsc_clear_cart

Located in: cart.class.php

Functions that call this hook: wpsc_cart::empty_cart()
Arguments Accepted: $wpsc_cart
Version Introduced: 3.8.9

Description: This action is triggered when the cart is emptied.

Code in context:
[php firstline="1023" highlight="1036"]
function empty_cart($fromwidget = true) {
global $wpdb;
$wpdb->query($wpdb->prepare("DELETE FROM `".WPSC_TABLE_CLAIMED_STOCK."` WHERE `cart_id` IN (‘%s’);", $this->unique_id));

$this->cart_items = array();
$this->cart_item = null;
$this->cart_item_count = 0;
$this->current_cart_item = -1;
$this->coupons_amount = 0;
$this->coupons_name = ”;
$this->clear_cache();
$this->cleanup();
do_action( ‘wpsc_clear_cart’, $this );
}
[/php]

Read Documentation ·

wpsc_remove_item

Located in: cart.class.php

Functions that call this hook: wpsc_cart::remove_item()
Arguments Accepted: $key, $wpsc_cart
Version Introduced: 3.8.9

Description: This action is triggered when an item is removed from the cart.

Code in context:
[php firstline="999" highlight="1013"]
if(isset($this->cart_items[$key])) {
$cart_item =& $this->cart_items[$key];
$cart_item->update_item(0);
unset($this->cart_items[$key]);
$this->cart_items = array_values($this->cart_items);
$this->cart_item_count = count($this->cart_items);
$this->current_cart_item = -1;
do_action( ‘wpsc_remove_item’, $key, $this );

$this->clear_cache();
return true;
} else {
$this->clear_cache();
return false;
}
[/php]

Read Documentation ·

wpsc_add_item

Located in: cart.class.php

Functions that call this hook: wpsc_cart::set_item()
Arguments Accepted: $product_id, $parameters, $wpsc_cart
Version Introduced: 3.8.9

Description: This action is triggered when an item is added to cart.

Code in context:
[php firstline="879" highlight="883"]
// if we are still adding the item, add it
if($add_item === true) {
$this->cart_items[] = $new_cart_item;
do_action( ‘wpsc_add_item’, $product_id, $parameters, $this );
}
[/php]

Read Documentation ·

wpsc_edit_item

Located in: cart.class.php

Functions that call this hook: wpsc_cart::set_item()
Arguments Accepted: $product_id, $parameters, $wpsc_cart
Version Introduced: 3.8.9

Description: This action is triggered when a cart item is edited (e.g. quantity).

Code in context:
[php firstline="856" highlight="875"]
foreach($this->cart_items as $key => $cart_item) {
// compare product ids and variations.
if(($cart_item->product_id == $new_cart_item->product_id) &&
($cart_item->product_variations == $new_cart_item->product_variations) &&
($cart_item->custom_message == $new_cart_item->custom_message) &&
($cart_item->custom_file == $new_cart_item->custom_file)) {
// if they are the same, increment the count, and break out;
if(!$updater){
$this->cart_items[$key]->quantity += $new_cart_item->quantity;
} else {
$this->cart_items[$key]->quantity = $new_cart_item->quantity;

}
$this->cart_items[$key]->refresh_item();
$add_item = false;
$edit_item = true;
do_action(‘wpsc_edit_item’ , $product_id , $parameters , $this);

}
}
[/php]

Read Documentation ·

wpsc_add_to_cart

Located in: ajax.functions.php

Functions that call this hook: wpsc_add_to_cart()
Arguments Accepted: $product, $cart_item
Version Introduced: 3.8.9

Description: This action is triggered when a cart item is successfully added to cart.

Code in context:
[php firstline="87" highlight="101"]
$cart_item = $wpsc_cart->set_item( $product_id, $parameters );

if ( is_object( $cart_item ) ) {
do_action( ‘wpsc_add_to_cart’, $product, $cart_item );
$cart_messages[] = str_replace( "[product_name]", $cart_item->get_title(), __( ‘You just added "[product_name]" to your cart.’, ‘wpsc’ ) );
} else {
if ( $parameters['quantity'] <= 0 ) {
$cart_messages[] = __( ‘Sorry, but you cannot add zero items to your cart’, ‘wpsc’ );
} else if ( $wpsc_cart->get_remaining_quantity( $product_id, $parameters['variation_values'], $parameters['quantity'] ) > 0 ) {
$quantity = $wpsc_cart->get_remaining_quantity( $product_id, $parameters['variation_values'], $parameters['quantity'] );
$cart_messages[] = sprintf( _n( ‘Sorry, but there is only %s of this item in stock.’, ‘Sorry, but there are only %s of this item in stock.’, $quantity, ‘wpsc’ ), $quantity );
} else {
$cart_messages[] = sprintf( __( ‘Sorry, but the item "%s" is out of stock.’, ‘wpsc’ ), $product->post_title );
}
}
[/php]

Read Documentation ·

wpsc_register_taxonomies_after

Located in: wpsc-functions.php

Functions that call this hook: wpsc_register_post_types()
Arguments Accepted: none
Version Introduced: 3.8.9

Description: This action is triggered after custom WPEC taxonomies have been registered.

Code in context:
[php firstline="327" highlight="453"]
function wpsc_register_post_types() {
global $wpsc_page_titles;

// Products
$labels = array(
‘name’ => _x( ‘Products’ , ‘post type name’ , ‘wpsc’ ),
‘singular_name’ => _x( ‘Product’ , ‘post type singular name’ , ‘wpsc’ ),
‘add_new’ => _x( ‘Add New’ , ‘admin menu: add new product’, ‘wpsc’ ),
‘add_new_item’ => __( ‘Add New Product’ , ‘wpsc’ ),
‘edit_item’ => __( ‘Edit Product’ , ‘wpsc’ ),
‘new_item’ => __( ‘New Product’ , ‘wpsc’ ),
‘view_item’ => __( ‘View Product’ , ‘wpsc’ ),
‘search_items’ => __( ‘Search Products’ , ‘wpsc’ ),
‘not_found’ => __( ‘No products found’ , ‘wpsc’ ),
‘not_found_in_trash’ => __( ‘No products found in Trash’, ‘wpsc’ ),
‘menu_name’ => __( ‘Products’ , ‘wpsc’ ),
‘parent_item_colon’ => ”,
);
$args = array(
‘capability_type’ => ‘post’,
‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’ ),
‘hierarchical’ => true,
‘exclude_from_search’ => false,
‘public’ => true,
‘show_ui’ => true,
‘show_in_nav_menus’ => true,
‘menu_icon’ => WPSC_CORE_IMAGES_URL . "/credit_cards.png",
‘labels’ => $labels,
‘query_var’ => true,
‘register_meta_box_cb’ => ‘wpsc_meta_boxes’,
‘rewrite’ => array(
‘slug’ => $wpsc_page_titles['products'] . ‘/%wpsc_product_category%’,
‘with_front’ => false
)
);
$args = apply_filters( ‘wpsc_register_post_types_products_args’, $args );
register_post_type( ‘wpsc-product’, $args );

// Purchasable product files
$args = array(
‘capability_type’ => ‘post’,
‘map_meta_cap’ => true,
‘hierarchical’ => false,
‘exclude_from_search’ => true,
‘rewrite’ => false,
‘labels’ => array(
‘name’ => __( ‘Product Files’, ‘wpsc’ ),
‘singular_name’ => __( ‘Product File’ , ‘wpsc’ ),
),
);
$args = apply_filters( ‘wpsc_register_post_types_product_files_args’, $args );
register_post_type( ‘wpsc-product-file’, $args );

// Product tags
$labels = array(
‘name’ => _x( ‘Product Tags’ , ‘taxonomy general name’ , ‘wpsc’ ),
‘singular_name’ => _x( ‘Product Tag’ , ‘taxonomy singular name’, ‘wpsc’ ),
‘search_items’ => __( ‘Product Search Tags’ , ‘wpsc’ ),
‘all_items’ => __( ‘All Product Tags’ , ‘wpsc’ ),
‘edit_item’ => __( ‘Edit Tag’ , ‘wpsc’ ),
‘update_item’ => __( ‘Update Tag’ , ‘wpsc’ ),
‘add_new_item’ => __( ‘Add new Product Tag’ , ‘wpsc’ ),
‘new_item_name’ => __( ‘New Product Tag Name’, ‘wpsc’ ),
);

$args = array(
‘hierarchical’ => false,
‘labels’ => $labels,
‘rewrite’ => array(
‘slug’ => ‘/’ . sanitize_title_with_dashes( _x( ‘tagged’, ‘slug, part of url’, ‘wpsc’ ) ),
‘with_front’ => false )
);
$args = apply_filters( ‘wpsc_register_taxonomies_product_tag_args’, $args );
register_taxonomy( ‘product_tag’, ‘wpsc-product’, $args );

// Product categories, is heirarchical and can use permalinks
$labels = array(
‘name’ => _x( ‘Product Categories’ , ‘taxonomy general name’ , ‘wpsc’ ),
‘singular_name’ => _x( ‘Product Category’ , ‘taxonomy singular name’, ‘wpsc’ ),
‘search_items’ => __( ‘Search Product Categories’, ‘wpsc’ ),
‘all_items’ => __( ‘All Product Categories’ , ‘wpsc’ ),
‘parent_item’ => __( ‘Parent Product Category’ , ‘wpsc’ ),
‘parent_item_colon’ => __( ‘Parent Product Category:’ , ‘wpsc’ ),
‘edit_item’ => __( ‘Edit Product Category’ , ‘wpsc’ ),
‘update_item’ => __( ‘Update Product Category’ , ‘wpsc’ ),
‘add_new_item’ => __( ‘Add New Product Category’ , ‘wpsc’ ),
‘new_item_name’ => __( ‘New Product Category Name’, ‘wpsc’ ),
‘menu_name’ => _x( ‘Categories’ , ‘taxonomy general name’, ‘wpsc’ ),
);
$args = array(
‘labels’ => $labels,
‘hierarchical’ => true,
‘rewrite’ => array(
‘slug’ => $wpsc_page_titles['products'],
‘with_front’ => false,
‘hierarchical’ => (bool) get_option( ‘product_category_hierarchical_url’, 0 ),
),
);
$args = apply_filters( ‘wpsc_register_taxonomies_product_category_args’, $args );

register_taxonomy( ‘wpsc_product_category’, ‘wpsc-product’, $args );
$labels = array(
‘name’ => _x( ‘Variations’ , ‘taxonomy general name’ , ‘wpsc’ ),
‘singular_name’ => _x( ‘Variation’ , ‘taxonomy singular name’, ‘wpsc’ ),
‘search_items’ => __( ‘Search Variations’ , ‘wpsc’ ),
‘all_items’ => __( ‘All Variations’ , ‘wpsc’ ),
‘parent_item’ => __( ‘Parent Variation’ , ‘wpsc’ ),
‘parent_item_colon’ => __( ‘Parent Variations:’, ‘wpsc’ ),
‘edit_item’ => __( ‘Edit Variation’ , ‘wpsc’ ),
‘update_item’ => __( ‘Update Variation’ , ‘wpsc’ ),
‘add_new_item’ => __( ‘Add New Variation’ , ‘wpsc’ ),
‘new_item_name’ => __( ‘New Variation Name’, ‘wpsc’ ),
);
$args = array(
‘hierarchical’ => true,
‘query_var’ => ‘variations’,
‘rewrite’ => false,
‘public’ => true,
‘labels’ => $labels
);
$args = apply_filters( ‘wpsc_register_taxonomies_product_variation_args’, $args );
// Product Variations, is internally heirarchical, externally, two separate types of items, one containing the other
register_taxonomy( ‘wpsc-variation’, ‘wpsc-product’, $args );

do_action( ‘wpsc_register_post_types_after’ );
do_action( ‘wpsc_register_taxonomies_after’ );
}
[/php]

Read Documentation ·

wpsc_register_post_types_after

Located in: wpsc-functions.php

Functions that call this hook: wpsc_register_post_types()
Arguments Accepted: none
Version Introduced: 3.8.9

Description: This action hook is called after WPEC custom post types are registered.

Code in context:
[php firstline="327" highlight="453"]
function wpsc_register_post_types() {
global $wpsc_page_titles;

// Products
$labels = array(
‘name’ => _x( ‘Products’ , ‘post type name’ , ‘wpsc’ ),
‘singular_name’ => _x( ‘Product’ , ‘post type singular name’ , ‘wpsc’ ),
‘add_new’ => _x( ‘Add New’ , ‘admin menu: add new product’, ‘wpsc’ ),
‘add_new_item’ => __( ‘Add New Product’ , ‘wpsc’ ),
‘edit_item’ => __( ‘Edit Product’ , ‘wpsc’ ),
‘new_item’ => __( ‘New Product’ , ‘wpsc’ ),
‘view_item’ => __( ‘View Product’ , ‘wpsc’ ),
‘search_items’ => __( ‘Search Products’ , ‘wpsc’ ),
‘not_found’ => __( ‘No products found’ , ‘wpsc’ ),
‘not_found_in_trash’ => __( ‘No products found in Trash’, ‘wpsc’ ),
‘menu_name’ => __( ‘Products’ , ‘wpsc’ ),
‘parent_item_colon’ => ”,
);
$args = array(
‘capability_type’ => ‘post’,
‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’ ),
‘hierarchical’ => true,
‘exclude_from_search’ => false,
‘public’ => true,
‘show_ui’ => true,
‘show_in_nav_menus’ => true,
‘menu_icon’ => WPSC_CORE_IMAGES_URL . "/credit_cards.png",
‘labels’ => $labels,
‘query_var’ => true,
‘register_meta_box_cb’ => ‘wpsc_meta_boxes’,
‘rewrite’ => array(
‘slug’ => $wpsc_page_titles['products'] . ‘/%wpsc_product_category%’,
‘with_front’ => false
)
);
$args = apply_filters( ‘wpsc_register_post_types_products_args’, $args );
register_post_type( ‘wpsc-product’, $args );

// Purchasable product files
$args = array(
‘capability_type’ => ‘post’,
‘map_meta_cap’ => true,
‘hierarchical’ => false,
‘exclude_from_search’ => true,
‘rewrite’ => false,
‘labels’ => array(
‘name’ => __( ‘Product Files’, ‘wpsc’ ),
‘singular_name’ => __( ‘Product File’ , ‘wpsc’ ),
),
);
$args = apply_filters( ‘wpsc_register_post_types_product_files_args’, $args );
register_post_type( ‘wpsc-product-file’, $args );

// Product tags
$labels = array(
‘name’ => _x( ‘Product Tags’ , ‘taxonomy general name’ , ‘wpsc’ ),
‘singular_name’ => _x( ‘Product Tag’ , ‘taxonomy singular name’, ‘wpsc’ ),
‘search_items’ => __( ‘Product Search Tags’ , ‘wpsc’ ),
‘all_items’ => __( ‘All Product Tags’ , ‘wpsc’ ),
‘edit_item’ => __( ‘Edit Tag’ , ‘wpsc’ ),
‘update_item’ => __( ‘Update Tag’ , ‘wpsc’ ),
‘add_new_item’ => __( ‘Add new Product Tag’ , ‘wpsc’ ),
‘new_item_name’ => __( ‘New Product Tag Name’, ‘wpsc’ ),
);

$args = array(
‘hierarchical’ => false,
‘labels’ => $labels,
‘rewrite’ => array(
‘slug’ => ‘/’ . sanitize_title_with_dashes( _x( ‘tagged’, ‘slug, part of url’, ‘wpsc’ ) ),
‘with_front’ => false )
);
$args = apply_filters( ‘wpsc_register_taxonomies_product_tag_args’, $args );
register_taxonomy( ‘product_tag’, ‘wpsc-product’, $args );

// Product categories, is heirarchical and can use permalinks
$labels = array(
‘name’ => _x( ‘Product Categories’ , ‘taxonomy general name’ , ‘wpsc’ ),
‘singular_name’ => _x( ‘Product Category’ , ‘taxonomy singular name’, ‘wpsc’ ),
‘search_items’ => __( ‘Search Product Categories’, ‘wpsc’ ),
‘all_items’ => __( ‘All Product Categories’ , ‘wpsc’ ),
‘parent_item’ => __( ‘Parent Product Category’ , ‘wpsc’ ),
‘parent_item_colon’ => __( ‘Parent Product Category:’ , ‘wpsc’ ),
‘edit_item’ => __( ‘Edit Product Category’ , ‘wpsc’ ),
‘update_item’ => __( ‘Update Product Category’ , ‘wpsc’ ),
‘add_new_item’ => __( ‘Add New Product Category’ , ‘wpsc’ ),
‘new_item_name’ => __( ‘New Product Category Name’, ‘wpsc’ ),
‘menu_name’ => _x( ‘Categories’ , ‘taxonomy general name’, ‘wpsc’ ),
);
$args = array(
‘labels’ => $labels,
‘hierarchical’ => true,
‘rewrite’ => array(
‘slug’ => $wpsc_page_titles['products'],
‘with_front’ => false,
‘hierarchical’ => (bool) get_option( ‘product_category_hierarchical_url’, 0 ),
),
);
$args = apply_filters( ‘wpsc_register_taxonomies_product_category_args’, $args );

register_taxonomy( ‘wpsc_product_category’, ‘wpsc-product’, $args );
$labels = array(
‘name’ => _x( ‘Variations’ , ‘taxonomy general name’ , ‘wpsc’ ),
‘singular_name’ => _x( ‘Variation’ , ‘taxonomy singular name’, ‘wpsc’ ),
‘search_items’ => __( ‘Search Variations’ , ‘wpsc’ ),
‘all_items’ => __( ‘All Variations’ , ‘wpsc’ ),
‘parent_item’ => __( ‘Parent Variation’ , ‘wpsc’ ),
‘parent_item_colon’ => __( ‘Parent Variations:’, ‘wpsc’ ),
‘edit_item’ => __( ‘Edit Variation’ , ‘wpsc’ ),
‘update_item’ => __( ‘Update Variation’ , ‘wpsc’ ),
‘add_new_item’ => __( ‘Add New Variation’ , ‘wpsc’ ),
‘new_item_name’ => __( ‘New Variation Name’, ‘wpsc’ ),
);
$args = array(
‘hierarchical’ => true,
‘query_var’ => ‘variations’,
‘rewrite’ => false,
‘public’ => true,
‘labels’ => $labels
);
$args = apply_filters( ‘wpsc_register_taxonomies_product_variation_args’, $args );
// Product Variations, is internally heirarchical, externally, two separate types of items, one containing the other
register_taxonomy( ‘wpsc-variation’, ‘wpsc-product’, $args );

do_action( ‘wpsc_register_post_types_after’ );
do_action( ‘wpsc_register_taxonomies_after’ );
}
[/php]

Read Documentation ·

wpsc_update_payment_gateway_settings

Located in: ajax-and-init.php

Functions that call this hook: wpsc_gateway_settings()
Arguments Accepted: none
Version Introduced: 3.8

Description: This hook is triggered after WP-e-Commerce updates the gateway settings.

Code in context:
[php firstline="1179" highlight="1214"]
//change the gateway settings
function wpsc_gateway_settings() {
//To update options
if ( isset( $_POST['wpsc_options'] ) ) {
foreach ( $_POST['wpsc_options'] as $key => $value ) {
if ( $value != get_option( $key ) ) {
update_option( $key, $value );
}
}
unset( $_POST['wpsc_options'] );
}

if ( isset( $_POST['user_defined_name'] ) && is_array( $_POST['user_defined_name'] ) ) {
$payment_gateway_names = get_option( ‘payment_gateway_names’ );

if ( !is_array( $payment_gateway_names ) ) {
$payment_gateway_names = array( );
}
$payment_gateway_names = array_merge( $payment_gateway_names, (array)$_POST['user_defined_name'] );
update_option( ‘payment_gateway_names’, $payment_gateway_names );
}
$custom_gateways = get_option( ‘custom_gateway_options’ );

$nzshpcrt_gateways = nzshpcrt_get_gateways();
foreach ( $nzshpcrt_gateways as $gateway ) {
if ( in_array( $gateway['internalname'], $custom_gateways ) ) {
if ( isset( $gateway['submit_function'] ) ) {
call_user_func_array( $gateway['submit_function'], array( ) );
$changes_made = true;
}
}
}
if ( (isset( $_POST['payment_gw'] ) && $_POST['payment_gw'] != null ) ) {
update_option( ‘payment_gateway’, $_POST['payment_gw'] );
}

do_action( ‘wpsc_update_payment_gateway_settings’ );
}

}
[/php]

Read Documentation ·

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]

Read Documentation ·

wpsc_constants

Located in: wp-shopping-cart-php

Functions that call this hook: constants()

Version Introduced: 3.8

Description: This hook is called after the default core constants have been added. You could use this hook to add any additional constants for your plugin.

Code in context:
[php firstline="69" highlight="98"]
/**
* Setup the WPEC core constants
*/
function constants() {
// Define globals and constants used by wp-e-commerce
require_once( WPSC_FILE_PATH . ‘/wpsc-core/wpsc-constants.php’ );

// Load the WPEC core constants
wpsc_core_constants();

// Is WordPress Multisite
wpsc_core_is_multisite();

// Start the wpsc session
wpsc_core_load_session();

// Which version of WPEC
wpsc_core_constants_version_processing();

// WPEC Table names and related constants
wpsc_core_constants_table_names();

// Uploads directory info
wpsc_core_constants_uploads();

// Purchase log statuses
wpsc_core_constants_purchase_logs();

// Any additional constants can hook in here
do_action( ‘wpsc_constants’ );
}

[/php]

Example Use:
[php]
add_action(‘wpsc_constants’,'add_my_constant’);
function add_my_constant(){
define( ‘MY_WPSC_CONSTANT’, ‘some_value’ );
}
[/php]

Read Documentation ·

wpsc_bottom_of_shopping_cart

Located in: wpsc-shopping_cart_page.php

Functions that call this hook: none this is the checkout page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: The wpsc_bottom_of_shopping_cart action is triggered at the bottom of the Checkout page within the WP e-Commerce Checkout (shopping_cart.php) theme template.

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

Use Case:
[php firstline="1"]
add_action(‘wpsc_bottom_of_shopping_cart’, ‘add_thankyou_message’);
function add_thankyou_message(){
echo "Thanks for purchasing with our store – we look forward to doing business with you again!";
}
[/php]

Code in context:
[php firstline="205" highlight="216"] <table class="productcart">
<tr class="total_price total_tax">
<td colspan="3">
<?php echo wpsc_display_tax_label(true); ?>
</td>
<td colspan="2">
<span id="checkout_tax" class="pricedisplay checkout-tax"><?php echo wpsc_cart_tax(); ?></span>
</td>
</tr>
</table>
<?php endif; ?>
<?php do_action(‘wpsc_before_form_of_shopping_cart’); ?>

<?php if(!empty($_SESSION['wpsc_checkout_user_error_messages'])): ?>
<p class="validation-error">
<?php
foreach($_SESSION['wpsc_checkout_user_error_messages'] as $user_error )
echo $user_error."<br />n";

$_SESSION['wpsc_checkout_user_error_messages'] = array();
?>
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_inside_shopping_cart

Located in: wpsc-shopping_cart_page.php

Functions that call this hook: none this is the checkout page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered inside the checkout form right before the gateways are listed and below the how did you find us section.

Code in context:
[php firstline="400" highlight="412"] <tr>
<td><label for=’how_find_us’><?php _e(‘How did you find us’ , ‘wpsc’); ?></label></td>
<td>
<select name=’how_find_us’>
<option value=’Word of Mouth’><?php _e(‘Word of mouth’ , ‘wpsc’); ?></option>
<option value=’Advertisement’><?php _e(‘Advertising’ , ‘wpsc’); ?></option>
<option value=’Internet’><?php _e(‘Internet’ , ‘wpsc’); ?></option>
<option value=’Customer’><?php _e(‘Existing Customer’ , ‘wpsc’); ?></option>
</select>
</td>
</tr>
<?php endif; ?>
<?php do_action(‘wpsc_inside_shopping_cart’); ?>

<?php //this HTML displays activated payment gateways ?>
<?php if(wpsc_gateway_count() > 1): // if we have more than one gateway enabled, offer the user a choice ?>
<tr>
<td colspan=’2′ class=’wpsc_gateway_container’>

[/php]

Read Documentation ·

wpsc_before_form_of_shopping_cart

Located in: wpsc-shopping_cart_page.php

Functions that call this hook: none this is the checkout page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered just before the user detail form on the checkout page.

Code in context:
[php firstline="205" highlight="216"] <table class="productcart">
<tr class="total_price total_tax">
<td colspan="3">
<?php echo wpsc_display_tax_label(true); ?>
</td>
<td colspan="2">
<span id="checkout_tax" class="pricedisplay checkout-tax"><?php echo wpsc_cart_tax(); ?></span>
</td>
</tr>
</table>
<?php endif; ?>
<?php do_action(‘wpsc_before_form_of_shopping_cart’); ?>

<?php if(!empty($_SESSION['wpsc_checkout_user_error_messages'])): ?>
<p class="validation-error">
<?php
foreach($_SESSION['wpsc_checkout_user_error_messages'] as $user_error )
echo $user_error."<br />n";

$_SESSION['wpsc_checkout_user_error_messages'] = array();
?>
<?php endif; ?>
[/php]

Read Documentation ·

wpsc_before_shipping_of_shopping_cart

Located in: wpsc-shopping_cart_page.php

Functions that call this hook: none this is the checkout page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: Used to add content/ functionality to checkout page between the product list and the shipping calculator.

Code in context:
[php firstline="121" highlight="127"] if(isset($_SESSION['WpscGatewayErrorMessage']) && $_SESSION['WpscGatewayErrorMessage'] != ”) :? >
<p class="validation-error"><?php echo $_SESSION['WpscGatewayErrorMessage']; ?></p>
<?php
endif;
?>

<?php do_action(‘wpsc_before_shipping_of_shopping_cart’); ?>

<div id="wpsc_shopping_cart_container">
<?php if(wpsc_uses_shipping()) : ?>
<h2><?php _e(‘Calculate Shipping Price’, ‘wpsc’); ?></h2>
<table class="productcart">
<tr class="wpsc_shipping_info">
<td colspan="5">

[/php]

Read Documentation ·

wpsc_after_checkout_cart_row

Located in: wpsc-shopping_cart_page.php

Functions that call this hook: none this is the checkout page template files
Arguments Accepted: $product_id
Version Introduced: 3.8

Description: This action is triggered just after the table row for each item in the “confirm your order” table.

Similar Actions: wpsc_before_checkout_cart_row – Called before the product row.

Code in context:
[php firstline="75" highlight="84"] <td class="wpsc_product_remove wpsc_product_remove_<?php echo wpsc_the_cart_item_key(); ?>">
<form action="<?php echo get_option(‘shopping_cart_url’); ?>" method="post" class="adjustform remove">
<input type="hidden" name="quantity" value="0" />
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
<input type="hidden" name="wpsc_update_quantity" value="true" />
<input type="submit" value="<?php _e(‘Remove’, ‘wpsc’); ?>" name="submit" />
</form>
</td>
</tr>
<?php do_action ( "wpsc_after_checkout_cart_row" ); ?>
<?php endwhile; ?>
<?php //this HTML displays coupons if there are any active coupons to use ?>

<?php

if(wpsc_uses_coupons()): ?>[/php]

Read Documentation ·

wpsc_after_checkout_cart_item_name

Located in: wpsc-shopping_cart_page.php

Functions that call this hook: none this is the checkout page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered just after the product name is output into the “confirm your order” table (it is called within the tag)

Similar Actions: wpsc_before_checkout_cart_item_name – Printed in the table division but before the product name.

Code in context:
[php firstline="56" highlight="59"] <td class="wpsc_product_name wpsc_product_name_<?php echo wpsc_the_cart_item_key(); ?>">
<?php do_action ( "wpsc_before_checkout_cart_item_name" ); ?>
<a href="<?php echo wpsc_cart_item_url();?>"><?php echo wpsc_cart_item_name(); ?></a>
<?php do_action ( "wpsc_after_checkout_cart_item_name" ); ?>
</td>
[/php]

Read Documentation ·

wpsc_before_checkout_cart_item_name

Located in: wpsc-shopping_cart_page.php

Functions that call this hook: none this is the checkout page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered just before the product name is output into the “confirm your order” table (it is called within the tag)

Similar Actions: wpsc_after_checkout_cart_item_name – Printed in the table division but after the product name.

Code in context:
[php firstline="56" highlight="57"] <td class="wpsc_product_name wpsc_product_name_<?php echo wpsc_the_cart_item_key(); ?>">
<?php do_action ( "wpsc_before_checkout_cart_item_name" ); ?>
<a href="<?php echo wpsc_cart_item_url();?>"><?php echo wpsc_cart_item_name(); ?></a>
<?php do_action ( "wpsc_after_checkout_cart_item_name" ); ?>
</td>
[/php]

Read Documentation ·

wpsc_after_checkout_cart_item_image

Located in: wpsc-shopping_cart_page.php

Functions that call this hook: none this is the checkout page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered after the product image is printed into the table (it is called within the tag), this will also be called – if the product has no image.

Similar Actions: wpsc_before_checkout_cart_item_image – Printed in the table division but before the image.

Code in context:
[php firstline="37" highlight="41,51"] <td class="firstcol wpsc_product_image wpsc_product_image_<?php echo wpsc_the_cart_item_key(); ?>">
<?php if(” != wpsc_cart_item_image()): ?>
<?php do_action ( "wpsc_before_checkout_cart_item_image" ); ?>
<img src="<?php echo wpsc_cart_item_image(); ?>" alt="<?php echo wpsc_cart_item_name(); ?>" title="<?php echo wpsc_cart_item_name(); ?>" class="product_image" />
<?php do_action ( "wpsc_after_checkout_cart_item_image" ); ?>
<?php else:
/* I dont think this gets used anymore,, but left in for backwards compatibility */
?>
<div class="item_no_image">
<?php do_action ( "wpsc_before_checkout_cart_item_image" ); ?>
<a href="<?php echo wpsc_the_product_permalink(); ?>">
<span><?php _e(‘No Image’,'wpsc’); ?></span>

</a>
<?php do_action ( "wpsc_after_checkout_cart_item_image" ); ?>
</div>
<?php endif; ?>
</td>

[/php]

Read Documentation ·

wpsc_before_checkout_cart_item_image

Located in: wpsc-shopping_cart_page.php

Functions that call this hook: none this is the checkout page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered just before the product image is printed into the table (it is called within the tag), this will also be called – if the product has no image.

Similar Actions: wpsc_after_checkout_cart_item_image – Printed in the table division but after the image.

Code in context:
[php firstline="37" highlight="39,46"] <td class="firstcol wpsc_product_image wpsc_product_image_<?php echo wpsc_the_cart_item_key(); ?>">
<?php if(” != wpsc_cart_item_image()): ?>
<?php do_action ( "wpsc_before_checkout_cart_item_image" ); ?>
<img src="<?php echo wpsc_cart_item_image(); ?>" alt="<?php echo wpsc_cart_item_name(); ?>" title="<?php echo wpsc_cart_item_name(); ?>" class="product_image" />
<?php do_action ( "wpsc_after_checkout_cart_item_image" ); ?>
<?php else:
/* I dont think this gets used anymore,, but left in for backwards compatibility */
?>
<div class="item_no_image">
<?php do_action ( "wpsc_before_checkout_cart_item_image" ); ?>
<a href="<?php echo wpsc_the_product_permalink(); ?>">
<span><?php _e(‘No Image’,'wpsc’); ?></span>

</a>
<?php do_action ( "wpsc_after_checkout_cart_item_image" ); ?>
</div>
<?php endif; ?>
</td>

[/php]

Read Documentation ·

wpsc_before_checkout_cart_row

Located in: wpsc-shopping_cart_page.php

Functions that call this hook: none this is the checkout page template files
Arguments Accepted: $product_id
Version Introduced: 3.8

Description: This action is triggered just before the table row for each item in the “confirm your order” table

Similar Actions: wpsc_after_checkout_cart_row – Called after the product row has been closed.

Code in context:
[php firstline="23" highlight="34"] </tr>
<?php while (wpsc_have_cart_items()) : wpsc_the_cart_item(); ?>
<?php
$alt++;
if ($alt %2 == 1)
$alt_class = ‘alt’;
else
$alt_class = ”;
?>
<?php //this displays the confirm your order html ?>

<?php do_action ( "wpsc_before_checkout_cart_row" ); ?>
<tr class="product_row product_row_<?php echo wpsc_the_cart_item_key(); ?> <?php echo $alt_class;?>">

<td class="firstcol wpsc_product_image wpsc_product_image_<?php echo wpsc_the_cart_item_key(); ?>">
<?php if(” != wpsc_cart_item_image()): ?>
<?php do_action ( "wpsc_before_checkout_cart_item_image" ); ?>
<img src="<?php echo wpsc_cart_item_image(); ?>" alt="<?php echo wpsc_cart_item_name(); ?>" title="<?php echo wpsc_cart_item_name(); ?>" class="product_image" />
<?php do_action ( "wpsc_after_checkout_cart_item_image" ); ?>[/php]

Read Documentation ·

wpsc_additional_user_profile_links

Located in: wpsc-user-log.php

Functions that call this hook: None – this is the user-log template file
Arguments Accepted: ‘|’ – this is the separator between the links
Version Introduced: 3.8

Description: This action is triggered on the user profile page you would use it to add additional menus to that page for displaying extra account information. For example you could use it to display membership details if your creating a plugin that allows for recurring billing.

Use Case:
[php]
<?php
add_action( ‘wpsc_additional_user_profile_links’, ‘add_user_subscription_link’ );

function add_user_subscription_link(){
?>
<a href="<?php echo get_option( ‘user_account_url’ ) . $separator . "subscriptions=true"; ?>">Your Subscriptions</a>"
<?php
}
[/php]

Code in context:
[php firstline="14" highlight="20"]
<div class="wrap">
<?php if ( is_user_logged_in() ) : ?>
<div class="user-profile-links">
<a href="<?php echo get_option( ‘user_account_url’ ); ?>"><?php _e(‘Purchase History’,'wpsc’); ?></a> |
<a href="<?php echo get_option( ‘user_account_url’ ) . $separator . "edit_profile=true"; ?>"><?php _e(‘Your Details’,'wpsc’); ?></a> |
<a href="<?php echo get_option( ‘user_account_url’ ) . $separator . "downloads=true"; ?>"><?php _e(‘Your Downloads’,'wpsc’); ?></a>
<?php do_action(‘wpsc_additional_user_profile_links’, ‘|’); ?>
</div>
<?php endif; ?>

<br />
<!– START OF PROFILE PAGE –>
<?php if ( is_wpsc_profile_page() ) : ?>
[/php]

Read Documentation ·

wpsc_product_addons

Located in: wpsc-products_page.php, wpsc-Single_product.php

Functions that call this hook: none this is the product page template files
Arguments Accepted: $product_id
Version Introduced: 3.8

Description: This action is triggered after the product description it can be used to add additional information to your product.

note: This hook is only called on the single product pages and the default product page (not list or grid view)

Similar Hooks: wpsc_product_addon_before_descr – this is output before the product description.
wpsc_product_addon_after_descr – this is output after the product description.

Code in context:

wpsc-products_page.php
[php firstline="96" highlight="102"]
<div class="productcol" style="margin-left:<?php echo $image_width + 20; ?>px;" >

<?php
do_action(‘wpsc_product_before_description’, wpsc_the_product_id(), $wp_query->post);
do_action(‘wpsc_product_addons’, wpsc_the_product_id());
?>

<div class="wpsc_description">
<?php echo wpsc_the_product_description(); ?>
</div><!–close wpsc_description–>

<?php if(wpsc_the_product_additional_description()) : ?>
<div class="additional_description_container">
[/php]

wpsc-single_products_page.php
[php firstline="46" highlight="51"]
<div class="productcol">
<?php do_action(‘wpsc_product_before_description’, wpsc_the_product_id(), $wp_query->post); ?>
<div class="product_description">
<?php echo wpsc_the_product_description(); ?>
</div><!–close product_description –>
<?php do_action( ‘wpsc_product_addons’, wpsc_the_product_id() ); ?>
<?php if ( wpsc_the_product_additional_description() ) : ?>
<div class="single_additional_description">
<p><?php echo wpsc_the_product_additional_description(); ?></p>
</div><!–close single_additional_description–>
<?php endif; ?>
<?php do_action( ‘wpsc_product_addon_after_descr’, wpsc_the_product_id() ); ?>
<?php

[/php]

Read Documentation ·

wpsc_theme_footer

Located in: wpsc-grid_view.php, wpsc-list_view.php, wpsc-products_page.php, wpsc-Single_product.php

Functions that call this hook: none this is the product page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered right at the very bottom of the products page container. You could use to to output an additional footer for your store pages.

Code in context:
[php firstline="165" highlight="172"]
<?php if(wpsc_has_pages_bottom()) : ?>
<div class="wpsc_page_numbers_bottom group">
<?php wpsc_pagination(); ?>
</div><!–close wpsc_page_numbers_bottom–>
<?php endif; ?>
<?php endif; ?>

<?php do_action( ‘wpsc_theme_footer’ ); ?>

</div><!–close grid_view_products_page_container–>

[/php]

Read Documentation ·

wpsc_product_form_fields_end

Located in: wpsc-grid_view.php, wpsc-list_view.php, wpsc-products_page.php, wpsc-Single_product.php

Functions that call this hook: none this is the product page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered just before the product form closes.

Similar Hooks: wpsc_product_form_fields_begin – this is triggered just after the product form is created.

Code in context:
[php firstline="207" highlight="215"]
<input type="submit" value="<?php _e(‘Add To Cart’, ‘wpsc’); ?>" name="Buy" class="wpsc_buy_button" id="product_<?php echo wpsc_the_product_id(); ?>_submit_button"/>
<?php endif; ?>
</div><!–close wpsc_buy_button_container–>
<?php endif ; ?>
<?php endif ; ?>
<div class="entry-utility wpsc_product_utility">
<?php edit_post_link( __( ‘Edit’, ‘wpsc’ ), ‘<span class="edit-link">’, ‘</span>’ ); ?>
</div>
<?php do_action ( ‘wpsc_product_form_fields_end’ ); ?>
</form><!–close product_form–>

<?php if((get_option(‘hide_addtocart_button’) == 0) && (get_option(‘addtocart_or_buynow’)==’1′)) : ?>
[/php]

Read Documentation ·

wpsc_product_form_fields_begin

Located in: wpsc-grid_view.php, wpsc-list_view.php, wpsc-products_page.php, wpsc-Single_product.php

Functions that call this hook: none this is the product page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered right after the product form has been created.

Similar Hooks: wpsc_product_form_fields_end – this is triggered just before the form closes.

Code in context:
[php firstline="121" highlight="127"]
<?php if(wpsc_product_external_link(wpsc_the_product_id()) != ”) : ?>
<?php $action = wpsc_product_external_link(wpsc_the_product_id()); ?>
<?php else: ?>
<?php $action = htmlentities(wpsc_this_page_url(), ENT_QUOTES, ‘UTF-8′ ); ?>
<?php endif; ?>
<form class="product_form" enctype="multipart/form-data" action="<?php echo $action; ?>" method="post" name="product_<?php echo wpsc_the_product_id(); ?>" id="product_<?php echo wpsc_the_product_id(); ?>" >
<?php do_action ( ‘wpsc_product_form_fields_begin’ ); ?>
<?php /** the variation group HTML and loop */?>
<?php if (wpsc_have_variation_groups()) { ?>
<fieldset><legend><?php _e(‘Product Options’, ‘wpsc’); ?></legend>
<div class="wpsc_variation_forms">
<table>

[/php]

Read Documentation ·

wpsc_product_before_description

Located in: wpsc-list_view.php, wpsc-products_page.php, wpsc-Single_product.php

Functions that call this hook: none this is the product page template files
Arguments Accepted: $product_id, $wp_query->post (current product in the loop)
Version Introduced: 3.8

Description: This action is triggered right before the product description. The MP3 music player uses this to display the J player preview.

You could use it to display any additional custom post meta about your products.

Note: This action is called on all product theme files apart from the grid view.

Use Case:
[php]
add_action(‘wpsc_product_before_description’,'my_function’);

function my_function($product_id, $wp_query-&gt;post){
//whatever you want to go before the products description
$extra_meta = get_product_meta(‘$product_id’, ‘my_extra_info’);
echo "Product Specs";
echo $extra_meta;
}
[/php]

Code in context:
[php firstline="46" highlight="47"]
<div class="productcol">
<?php do_action(‘wpsc_product_before_description’, wpsc_the_product_id(), $wp_query->post); ?>
<div class="product_description">
<?php echo wpsc_the_product_description(); ?>
</div><!–close product_description –>
<?php do_action( ‘wpsc_product_addons’, wpsc_the_product_id() ); ?>
<?php if ( wpsc_the_product_additional_description() ) : ?>
<div class="single_additional_description">
<p><?php echo wpsc_the_product_additional_description(); ?></p>
</div><!–close single_additional_description–>
<?php endif; ?>
<?php do_action( ‘wpsc_product_addon_after_descr’, wpsc_the_product_id() ); ?>
[/php]

Read Documentation ·

wpsc_top_of_products_page

Located in: wpsc-grid_view.php, wpsc-list_view.php, wpsc-products_page.php, wpsc-Single_product.php

Functions that call this hook: none this is the product page template files
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered at the top of the products page, it is used to add things to the top of the products pages for exapmle: Gold Cart uses this hook to output its live search.

Use Case:
[php]
add_action(‘wpsc_top_of_products_page’,'my_function’);

function my_function(){
//whatever you want to go on the products page goes here
echo "Big Sale 50% off everything!!";
}
[/php]

Code in context:
[php firstline="1" highlight="12"]
<?php
global $wp_query;
$image_width = get_option(‘product_image_width’);
/*
* Most functions called in this page can be found in the wpsc_query.php file
*/
?>
<div id="default_products_page_container" class="wrap wpsc_container">

<?php wpsc_output_breadcrumbs(); ?>

<?php do_action(‘wpsc_top_of_products_page’); // Plugin hook for adding things to the top of the products page, like the live search ?>
<?php if(wpsc_display_categories()): ?>
<?php if(wpsc_category_grid_view()) :? >
<div class="wpsc_categories wpsc_category_grid group">
<?php wpsc_start_category_query(array(‘category_group’=> get_option(‘wpsc_default_category’),
[/php]

Read Documentation ·

wpsc_after_cart_widget_item_name

Located in: wpsc-cart_widget.php

Functions that call this hook: none this is the cart_widget template file
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered right after the cart item name gets printed into the table row in the cart widget.

Similar actions: wpsc_before_cart_widget_item_name – called before the name is printed

Code in context:
[php firstline="9" highlight="21"]
<table>
<thead>
<tr>
<th id="product" colspan=’2′><?php _e(‘Product’, ‘wpsc’); ?></th>
<th id="quantity"><?php _e(‘Qty’, ‘wpsc’); ?></th>
<th id="price"><?php _e(‘Price’, ‘wpsc’); ?></th>
<th id="remove">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php while(wpsc_have_cart_items()): wpsc_the_cart_item(); ?>
<tr>
<td colspan=’2′ class=’product-name’><?php do_action ( "wpsc_before_cart_widget_item_name" ); ?><a href="<?php echo wpsc_cart_item_url(); ?>"><?php echo wpsc_cart_item_name(); ?></a><?php do_action ( "wpsc_after_cart_widget_item_name" ); ?></td>
<td><?php echo wpsc_cart_item_quantity(); ?></td>
<td><?php echo wpsc_cart_item_price(); ?></td>
<td class="cart-widget-remove"><form action="" method="post" class="adjustform">
<input type="hidden" name="quantity" value="0" />
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
<input type="hidden" name="wpsc_update_quantity" value="true" />
<input class="remove_button" type="submit" />
</form></td>
[/php]

Read Documentation ·

wpsc_before_cart_widget_item_name

Located in: wpsc-cart_widget.php

Functions that call this hook: none this is the cart_widget template file
Arguments Accepted: none
Version Introduced: 3.8

Description: This action is triggered right before the cart item name gets printed into the widget.

note: The table body and division for the product name have already been opened when this action is triggered.

Similar actions: wpsc_after_cart_widget_item_name – called after the name is printed

Code in context:
[php firstline="9" highlight="21"]
<table>
<thead>
<tr>
<th id="product" colspan=’2′><?php _e(‘Product’, ‘wpsc’); ?></th>
<th id="quantity"><?php _e(‘Qty’, ‘wpsc’); ?></th>
<th id="price"><?php _e(‘Price’, ‘wpsc’); ?></th>
<th id="remove">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php while(wpsc_have_cart_items()): wpsc_the_cart_item(); ?>
<tr>
<td colspan=’2′ class=’product-name’><?php do_action ( "wpsc_before_cart_widget_item_name" ); ?><a href="<?php echo wpsc_cart_item_url(); ?>"><?php echo wpsc_cart_item_name(); ?></a><?php do_action ( "wpsc_after_cart_widget_item_name" ); ?></td>
<td><?php echo wpsc_cart_item_quantity(); ?></td>
<td><?php echo wpsc_cart_item_price(); ?></td>
<td class="cart-widget-remove"><form action="" method="post" class="adjustform">
<input type="hidden" name="quantity" value="0" />
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
<input type="hidden" name="wpsc_update_quantity" value="true" />
<input class="remove_button" type="submit" />
</form></td>
[/php]

Read Documentation ·

wpsc_user_log_after_order_status

Located in: wpsc-user_log_functions.php

Functions that call this hook: wpsc_user_details()
Arguments Accepted: $purchase
Version Introduced: 3.8

Description: This hook is triggered right after the order status text on the my account page (but before the order details) You could use this hook to output any other information you have collected about the purchase that is currently not displayed.

Code in context:
[php firstline="448" highlight="460"]
echo "</tr>nr";
echo "<tr>nr";
echo " <td colspan=’$col_count’ class=’details’>nr";
echo " <div id=’status_box_" . $purchase['id'] . "’ class=’order_status’ style="$status_style">nr";
echo " <div>nr";

//order status code lies here
//check what $purchase['processed'] reflects in the $wpsc_purchlog_statuses array
$status_name = wpsc_find_purchlog_status_name( $purchase['processed'] );
echo " <strong class=’form_group’>" . __( ‘Order Status’, ‘wpsc’ ) . ":</strong>nr";
echo $status_name . "<br /><br />";

do_action( ‘wpsc_user_log_after_order_status’, $purchase );

//written by allen
$usps_id = get_option( ‘usps_user_id’ );
if ( $usps_id != null ) {
$XML1 = "<TrackFieldRequest USERID="$usps_id"><TrackID ID="" . $purchase['track_id'] . ""></TrackID></TrackFieldRequest>";
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "http://secure.shippingapis.com/ShippingAPITest.dll?" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_HEADER, 0 );
$postdata = "API=TrackV2&XML=" . $XML1;
curl_setopt( $ch, CURLOPT_POSTFIELDS, $postdata );
[/php]

Read Documentation ·

wpsc_pre_purchase_logs

Located in: wpsc-user_log_functions.php

Functions that call this hook: wpsc_user_details()
Arguments Accepted: none
Version Introduced: 3.8

Description: This hook is triggered from the “My Account page” it will run just before the users purchase history is output.

note: The users purchase table has already been output at this stage, this hook is triggered before any column details are output to the browser.

Code in context:
[php firstline="379" highlight="386"]
function wpsc_user_details() {
global $wpdb, $user_ID, $wpsc_purchlog_statuses, $gateway_checkout_form_fields, $purchase_log, $col_count;

$nzshpcrt_gateways = nzshpcrt_get_gateways();
$i = 0;
$subtotal = 0;

do_action( ‘wpsc_pre_purchase_logs’ );

foreach ( (array)$purchase_log as $purchase ) {
$status_state = "expand";
$status_style = "display:none;";
$alternate = "";
$i++;

if ( ($i % 2) != 0 )
$alternate = "class=’alt’";

echo "<tr $alternate>nr";
echo " <td class=’processed’>";
echo "<a href=’#’ onclick=’return show_details_box("status_box_" . $purchase['id'] . "","log_expander_icon_" . $purchase['id'] . "");’>";

if ( !empty($_GET['id']) && $_GET['id'] == $purchase['id'] ) {
$status_state = "collapse";
$status_style = "style=’display: block;’";
}

echo "<img class=’log_expander_icon’ id=’log_expander_icon_" . $purchase['id'] . "’ src=’" . WPSC_CORE_IMAGES_URL . "/icon_window_$status_state.gif’ alt=” title=” />";

echo "<span id=’form_group_" . $purchase['id'] . "_text’>" . __( ‘Details’, ‘wpsc’ ) . "</span>";
echo "</a>";
echo " </td>nr";

echo " <td>";
echo date( "jS M Y", $purchase['date'] );
echo " </td>nr";

echo " <td>";
[/php]

Read Documentation ·