Documents Archive

3.8.11 – How to Update your wpsc-user-log.php file.

You’ve likely landed on this page because you recently upgraded to WPeC 3.8.11 or greater and you happen to have a theme that has modified the wpsc-user-log.php page.  This was a change made in 3.8.10, and this documentation is our effort to, as easily as possible, assist you in upgrading your theme file to be compatibile with the latest version of WPeC.

Before 3.8.10

Before WPeC 3.8.10 was released, the wpsc-user.log.php was a mish-mash of presentation and logic filled with tons of conditionals and inconsistent hooks and mechanisms for plugin developers to modify the output.  If you have a very basic understanding of HTML and template tags in WordPress, you can check out the source of this file here.

You’ll see a few basic blocks

  • is_user_logged_in()
  • START OF PROFILE PAGE
  • START OF DOWNLOADS PAGE
  • START OF PURCHASE HISTORY PAGE
  • You must be logged in (Preceded by <?php else : ?>)

After 3.8.10

After 3.8.10, the wpsc-user-log.php page has been streamlined into a fairly versatile system where each view of the user account page is inserted via hooks.  This means it is far easier for plugin developers to add (or remove) different view in the My Account page without having to worry the user with making changes to their theme files.  If you look at the source file, you’ll see it drastically simplified. The blocks are as follows:

  • is_user_logged_in()
  • do_action (this is important)
  • You must be logged in (Preceded by <?php else : ?>)

After looking at the code, here are the really important differences to note:

  1. Near the top, by the global keyword –  the new version removes all of the previous globals, and adds one, $current_tab.
  2. The contents inside of the user-profile-links <div> have completely changed. It’s only a few lines, but they are important.
  3. Outside of that <div>, there is a new action, <?php do_action( 'wpsc_user_profile_section_' . $current_tab ); ?>
    Also super important.
  4. Aside from that, everything else is stripped away and you’re left with the “else” condition for the logged out form.

If there are new changes you want to make, or you’re beginning the process of re-applying changes to different areas of this file, you’ll notice three new files which contain the areas previously contained in this file.

  1. wpsc-account-downloads.php
  2. wpsc-account-purchase-history.php
  3. wpsc-account-edit-profile.php

Naturally, you can just apply your previous changes to each of these files.  This should be a fairly easy change, even for novices.  But of course, if you need any help in this process, WPEC Consultants are highly capable and should be able to handle even the more complex theme files within an hour’s time – for most themes, it could be much less than that.

Read Documentation ·

First Data Global Gateway e4

(more…)

Read Documentation ·

Transfirst

TransFirst is one of the nation’s leading providers of payment processing services. With more than 15 years of experience and some of the leading experts in the payment processing industry on our staff, we know what it takes to help our merchants and professional partners grow their businesses and achieve lasting success.

(more…)

Read Documentation ·

USAEpay

Since 1998 the USA ePay team has been making it possible for businesses to accept credit cards easily, safely and securely. Now more than ever we stand behind our products.

(more…)

Read Documentation ·

Authorize.net SIM Manager

What is Authorize.net SIM?

Authorize.net Server Integration Method (SIM) provides a secure hosted payment form to make integration easy for Web merchants that do not have an SSL certificate. The Authorize.Net Payment Gateway can handle all the steps in the secure transaction process:

  • Secure payment data collection
  • Secure transmission of payment information for settlement
  • Secure cardholder information storage (more…)
Read Documentation ·

WP Affiliate Manager – Affiliate Plugin for WP e-Commerce

We’re glad to announce the release of WP Affiliate Manager version 1.5.0.  This version initially centered around a bugfix having to do with a namespace conflict in the latest (3.8.9.x) versions of WP e-Commerce.  However in the process, we were able to add several minor enhancements that will enhance WP Affiliate Manager for the future.

gettext translation wrappers

While not all screens have had the gettext translation wrappers applied (notably the settings and paypal pages in wp-admin), everything else has been added.  Expect a 1.5.x release early in 2013 that will be fully translatable.

As such, we’re putting out a call for translators.  We are willing to offer free lifetime use & upgrades of the WP Affiliate Manager to anyone who contributes a full translation in their own language. We have a couple of people already talking to us about certain languages, so if you’re interested, please fill out the form on our translation page and let us know what language you’d like to help us add to WP Affiliate Manager!

money_format() for Windows

money_format() is a native PHP function, but it does not exist on Windows platforms.  We added a simple one for those hosting in Windows environments which should get the job done.

PayPal enhancements

First, the sandbox PayPal URL has been fixed.  This is mostly used for development/testing purposes, but none-the-less is important.

Also, we removed the requirement for needing the PHP cURL module requirement.  Instead, WP Affiliate Manager uses WordPress’ native HTTP request methods.

jQuery UI Tabs + cookies + mod_security bugfix

An interesting sidenote… we discovered a bug where if you went to the 2nd tab on WP Affiliate Manager’s “My Affiliates” screen on our test server, your next navigation point in WordPress would either result in a 404 error, or an endless loop of 302 redirects.

Turns out the bug was caused by a perfect storm of Apache’s mod_security (which is enabled on our test server) and the use of jQuery UI Tabs with a cookie save option.  What was occurring was the cookie name was being saved as “ui-tabs-1″ and if your last visited tab was the 2nd tab (index 1) the cookie was saved as “ui-tabs-1=1″.  This would be passed with each HTTP request as a cookie header.  Since mod_security doesn’t like anything where “1=1″, it was changing the request, causing WordPress to become all sorts of confused.  You can see a bug report about it here: http://bugs.jqueryui.com/ticket/8027

The solution was to name the cookie, so the automatically generated name wasn’t used:

jQuery("#tabs").tabs({
    cookie: {
        name: 'wpam_detail_tab'
    }
});

Enjoy all of the fixes!

Read Documentation ·

the_product_tag_list

Located in: tagging_functions.php

Functions that call this hook: wpsc_get_the_product_tag_list()
Arguments Accepted: $tags
Version Introduced: 3.8.9

Description: Filter the tag list of the current product in the loop.

Code in context:
[php highlight="159" firstline="148"]
function wpsc_get_the_product_tag_list( $before = ”, $sep = ”, $after = ” ) {
global $post;

if ( ! $post->ID )
return false;

$tags = get_the_term_list( $post->ID, ‘product_tag’, $before, $sep, $after );

if ( empty( $tags ) )
return false;

return apply_filters( ‘the_product_tag_list’, $tags );
}
[/php]

Read Documentation ·

get_the_product_tags

Located in: tagging_functions.php

Functions that call this hook: wpsc_get_the_product_tags()
Arguments Accepted: $tags, $id
Version Introduced: 3.8.9

Description: Filter the tags associated with a certain product ID.

Code in context:
[php highlight="145" firstline="143"]
function wpsc_get_the_product_tags( $id = 0 ) {
$tags = get_the_terms( $id, ‘product_tag’ );
return apply_filters( ‘get_the_product_tags’, $tags, $id );
}
[/php]

Read Documentation ·

wpsc_specials_widget_no_items_message

Located in: special_widgets.php

Functions that call this hook: wpsc_specials()
Arguments Accepted: __( 'We currently have no items on special.', 'wpsc' )
Version Introduced: 3.8.9

Description: Filter the “no items” message on Product Specials Widget.

Code in context:
[php highlight="200" firstline="193"]
add_filter( ‘posts_join’, ‘_wpsc_filter_special_widget_join’ );
add_filter( ‘posts_where’, ‘_wpsc_filter_special_widget_where’ );
$special_products = new WP_Query( $args );
remove_filter( ‘posts_join’, ‘_wpsc_filter_special_widget_join’ );
remove_filter( ‘posts_where’, ‘_wpsc_filter_special_widget_where’ );

if ( ! $special_products->post_count ) {
echo apply_filters( ‘wpsc_specials_widget_no_items_message’, __( ‘We currently have no items on special.’, ‘wpsc’ ) );
return;
}

$product_ids = array();
[/php]

Read Documentation ·

wpsc_shipwire_send_tracking_email

Located in: shipwire_functions.php

Functions that call this hook: sync_products()
Arguments Accepted: true, $order_id, $tracking_number
Version Introduced: 3.8.9

Description: Whether to send the tracking email.

Code in context:
[php highlight="623" firstline="607"]
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’
);

$tracking_updates += $update;

if ( apply_filters( ‘wpsc_shipwire_send_tracking_email’, true, $order_id, $tracking_number ) && $update )
self::_send_tracking_email( $order_id, $tracking_number );
}
[/php]

Read Documentation ·

wpsc_shipwire_rates_cache_expiration

Located in: shipwire_functions.php

Functions that call this hook: fetch_fresh_quotes()
Arguments Accepted: 60 * 60
Version Introduced: 3.8.9

Description: Filter the the expiration for the transient, defaults to one hour.

Code in context:
[php highlight="561" firstline="541"]
public static function fetch_fresh_quotes() {
$quotes = simplexml_load_string( self::send_shipping_request( self::get_shipping_xml() ) );
$methods = array();

$quotes = is_object( $quotes ) ? $quotes->Order->Quotes->Quote : $methods;

if ( ! is_object( $quotes ) )
return $methods;

foreach ( $quotes as $quote ) {

$service = (string) $quote['method'];
$service = convert_code_to_service( $service );
$cost = (string) $quote->Cost;

$methods[$service] = $cost;
}

$methods = apply_filters( ‘wpsc_shipwire_methods’, $methods, $quotes );

set_transient( self::get_cache_key(), $methods, apply_filters( ‘wpsc_shipwire_rates_cache_expiration’, 60 * 60 ) );

return $methods;
}
[/php]

Read Documentation ·

wpsc_shipwire_methods

Located in: shipwire_functions.php

Functions that call this hook: fetch_fresh_quotes() ()
Arguments Accepted: $methods, $quotes
Version Introduced: 3.8.9

Description: Filter the methods returns – the $methods array and $quotes object are both passed to the filter

Code in context:
[php highlight="559" firstline="541"]
public static function fetch_fresh_quotes() {
$quotes = simplexml_load_string( self::send_shipping_request( self::get_shipping_xml() ) );
$methods = array();

$quotes = is_object( $quotes ) ? $quotes->Order->Quotes->Quote : $methods;

if ( ! is_object( $quotes ) )
return $methods;

foreach ( $quotes as $quote ) {

$service = (string) $quote['method'];
$service = convert_code_to_service( $service );
$cost = (string) $quote->Cost;

$methods[$service] = $cost;
}

$methods = apply_filters( ‘wpsc_shipwire_methods’, $methods, $quotes );

set_transient( self::get_cache_key(), $methods, apply_filters( ‘wpsc_shipwire_rates_cache_expiration’, 60 * 60 ) );

return $methods;
}
[/php]

Read Documentation ·

get_tracking_xml

Located in: shipwire_functions.php

Functions that call this hook: get_tracking_xml() ()
Arguments Accepted: $xml
Version Introduced: 3.8.9

Description: Filter XML output of Shipwire tracking.

Code in context:
[php highlight="395" firstline="385"]
public static function get_tracking_xml() {

$xml = ‘<?xml version="1.0" encoding="utf-8"?>’;
$xml .= ‘<TrackingUpdate>’;
$xml .= ‘<EmailAddress>’ . self::$email . ‘</EmailAddress>’;
$xml .= ‘<Password>’ . self::$passwd . ‘</Password>’;
$xml .= ‘<Server>’ . self::$server . ‘</Server>’;
$xml .= ‘<Bookmark>’ . apply_filters( ‘wpsc_shipwire_tracking_bookmark’, ’1′ ) .’</Bookmark>’;
$xml .= ‘</TrackingUpdate>’;

return apply_filters( ‘get_tracking_xml’, $xml );
}

[/php]

Read Documentation ·

wpsc_shipwire_tracking_bookmark

Located in: shipwire_functions.php

Functions that call this hook: get_tracking_xml() ()
Arguments Accepted: 1
Version Introduced: 3.8.9

Description: Filter tracking bookmark value.

Code in context:
[php highlight="392" firstline="385"]
public static function get_tracking_xml() {

$xml = ‘<?xml version="1.0" encoding="utf-8"?>’;
$xml .= ‘<TrackingUpdate>’;
$xml .= ‘<EmailAddress>’ . self::$email . ‘</EmailAddress>’;
$xml .= ‘<Password>’ . self::$passwd . ‘</Password>’;
$xml .= ‘<Server>’ . self::$server . ‘</Server>’;
$xml .= ‘<Bookmark>’ . apply_filters( ‘wpsc_shipwire_tracking_bookmark’, ’1′ ) .’</Bookmark>’;
$xml .= ‘</TrackingUpdate>’;

return apply_filters( ‘get_tracking_xml’, $xml );
}

[/php]

Read Documentation ·

get_inventory_xml

Located in: shipwire_functions.php

Functions that call this hook: get_inventory_xml() ()
Arguments Accepted: false
Version Introduced: 3.8.9

Description: Filter the XML output for Shipwire Inventory.

Code in context:
[php highlight="364" firstline="350"]
public static function get_inventory_xml( $product_code = ” ) {

$xml = ‘<?xml version="1.0" encoding="utf-8"?>’;
$xml .= ‘<InventoryUpdate>’;
$xml .= ‘<EmailAddress>’ . self::$email . ‘</EmailAddress>’;
$xml .= ‘<Password>’ . self::$passwd . ‘</Password>’;
$xml .= ‘<Server>’ . self::$server . ‘</Server>’;

if ( false !== ( $warehouse = apply_filters( ‘wpsc_shipwire_inventory_warehouse’, false ) ) )
$xml .= ‘<Warehouse>’ . $warehouse . ‘</Warehouse>’;

$xml .= ‘<ProductCode>’ . $product_code . ‘</ProductCode>’;
$xml .= ‘</InventoryUpdate>’;

return apply_filters( ‘get_inventory_xml’, $xml );
}
[/php]

Read Documentation ·

wpsc_shipwire_inventory_warehouse

Located in: shipwire_functions.php

Functions that call this hook: get_inventory_xml() ()
Arguments Accepted: false
Version Introduced: 3.8.9

Description: Ability to query inventory from specific warehouse on ‘wpsc_shipwire_inventory_warehouse’.

Code in context:
[php highlight="358" firstline="350"]
public static function get_inventory_xml( $product_code = ” ) {

$xml = ‘<?xml version="1.0" encoding="utf-8"?>’;
$xml .= ‘<InventoryUpdate>’;
$xml .= ‘<EmailAddress>’ . self::$email . ‘</EmailAddress>’;
$xml .= ‘<Password>’ . self::$passwd . ‘</Password>’;
$xml .= ‘<Server>’ . self::$server . ‘</Server>’;

if ( false !== ( $warehouse = apply_filters( ‘wpsc_shipwire_inventory_warehouse’, false ) ) )
$xml .= ‘<Warehouse>’ . $warehouse . ‘</Warehouse>’;

$xml .= ‘<ProductCode>’ . $product_code . ‘</ProductCode>’;
$xml .= ‘</InventoryUpdate>’;

return apply_filters( ‘get_inventory_xml’, $xml );
}
[/php]

Read Documentation ·

get_order_xml

Located in: shipwire_functions.php

Functions that call this hook: get_order_xml()
Arguments Accepted: $xml, $log_id
Version Introduced: 3.8.9

Description: Filter the XML output of the Shipwire request.

Code in context:
[php highlight="210" firstline="201"]
$xml .= ‘</Item>’;

$num++;

}

$xml .=’</Order>’;
$xml .=’</OrderList>’;

return apply_filters( ‘get_order_xml’, $xml, $log_id );
[/php]

Read Documentation ·

wpsc_shipwire_show_dimensions

Located in: shipwire_functions.php

Functions that call this hook: get_order_xml()
Arguments Accepted: false
Version Introduced: 3.8.9

Description: Whether to send dimensions value to Shipwire.

Code in context:
[php highlight="179" firstline="176"]
$num = 0;

$show_declared_value = apply_filters( ‘wpsc_shipwire_show_declared_value’, true );
$show_dimensions = apply_filters( ‘wpsc_shipwire_show_dimensions’, false );

foreach ( $products as $product ) {

if ( $product->no_shipping )
continue;
[/php]

Read Documentation ·

wpsc_shipwire_show_declared_value

Located in: shipwire_functions.php

Functions that call this hook: get_order_xml()
Arguments Accepted: false
Version Introduced: 3.8.9

Description: Whether to send declared value to Shipwire.

Code in context:
[php highlight="178" firstline="176"]
$num = 0;

$show_declared_value = apply_filters( ‘wpsc_shipwire_show_declared_value’, true );
$show_dimensions = apply_filters( ‘wpsc_shipwire_show_dimensions’, false );

foreach ( $products as $product ) {

if ( $product->no_shipping )
continue;
[/php]

Read Documentation ·

wpsc_shipwire_show_affiliate

Located in: shipwire_functions.php

Functions that call this hook: get_order_xml()
Arguments Accepted: false
Version Introduced: 3.8.9

Description: Whether to send referring affiliate to Shipwire.

Code in context:
[php highlight="155" firstline="149"]
$xml = ‘<?xml version="1.0" encoding="utf-8"?>’;
$xml .= ‘<OrderList>’;
$xml .= ‘<EmailAddress>’ . self::$email . ‘</EmailAddress>’;
$xml .= ‘<Password>’ . self::$passwd . ‘</Password>’;
$xml .= ‘<Server>’ . self::$server . ‘</Server>’;

$referrer = apply_filters( ‘wpsc_shipwire_show_affiliate’, false );

if ( $referrer )
$xml .= ‘<Referer>’ . $referrer . ‘</Referer>’;
}
[/php]

Read Documentation ·

wpsc_paypal_pro_accepted_card_types

Located in: paypal-pro.merchant.php

Functions that call this hook: form_paypal_pro()
Arguments Accepted: $card_types
Version Introduced: 3.8.9

Description: Filter the acceptable cart types for PayPal Pro.

Code in context:
[php highlight="551" firstline="545"]
$card_types = array(
‘Visa’ => __( ‘Visa’, ‘wpsc’ ),
‘Mastercard’ => __( ‘MasterCard’, ‘wpsc’ ),
‘Discover’ => __( ‘Discover’, ‘wpsc’ ),
‘Amex’ => __( ‘Amex’, ‘wpsc’ ),
);
$card_types = apply_filters( ‘wpsc_paypal_pro_accepted_card_types’, $card_types );
foreach ( $card_types as $type => $title ) {
$output .= sprintf( ‘<option value="%1$s">%2$s</option>’, $type, esc_html( $title ) );
}
[/php]

Read Documentation ·

wpsc_get_the_post_id_by_shortcode

Located in: theme.functions.php

Functions that call this hook: wpsc_get_the_post_id_by_shortcode()
Arguments Accepted: $id, $shortcode
Version Introduced: 3.8.9

Description: Filter the post ID corresponding to a certain shortcode.

Code in context:
[php highlight="1259" firstline="1234"]
function wpsc_get_the_post_id_by_shortcode( $shortcode ) {

$shortcode_options = array(
‘[productspage]‘ => ‘product_list_url’,
‘[shoppingcart]‘ => ‘shopping_cart_url’,
‘[checkout]‘ => ‘shopping_cart_url’,
‘[transactionresults]‘ => ‘transact_url’,
‘[userlog]‘ => ‘user_account_url’
);

if ( ! isset( $shortcode_options[$shortcode] ) )
return 0;

$page_ids = get_option( ‘wpsc_shortcode_page_ids’, false );

if ( $page_ids === false ) {
wpsc_update_permalink_slugs();
$page_ids = get_option( ‘wpsc_shortcode_page_ids’, false );
}

$post_id = isset( $page_ids[$shortcode] ) ? $page_ids[$shortcode] : null;

// For back compat
$post_id = apply_filters( ‘wpec_get_the_post_id_by_shortcode’, $post_id );

return apply_filters( ‘wpsc_get_the_post_id_by_shortcode’, $post_id, $shortcode );

}
[/php]

Read Documentation ·

wpsc_get_transaction_html_output

Located in: purchase-log.helpers.php

Functions that call this hook: wpsc_get_transaction_html_output()
Arguments Accepted: $output, $notification
Version Introduced: 3.8.9

Description: Filter transaction result output.

Code in context:
[php highlight="248" firstline="238"]
function wpsc_get_transaction_html_output( $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 ”;

$notification = new WPSC_Purchase_Log_Customer_HTML_Notification( $purchase_log );
$output = $notification->get_html_message();

$output = apply_filters( ‘wpsc_get_transaction_html_output’, $output, $notification );
return $output;
}
[/php]

Read Documentation ·

wpsc_get_purchase_log_html_table

Located in: purchase-log.helpers.php

Functions that call this hook: wpsc_get_purchase_log_html_table()
Arguments Accepted: $output, $headings, $rows
Version Introduced: 3.8.9

Description: Filter purchase log HTML (used for notifications) table output.

Code in context:
[php highlight="163" firstline="161"]
<?php
$output = ob_get_clean();
$output = apply_filters( ‘wpsc_get_purchase_log_html_table’, $output, $headings, $rows );
return $output;
[/php]

Read Documentation ·

wpsc_purchase_log_insert_data

Located in: purchase-log.class.php

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

Description: Filter purchase log’s values before they are inserted into the database.

Code in context:
[php highlight="536" firstline="518"]
} else {
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_data

Located in: purchase-log.class.php

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

Description: Filter purchase log’s values before they are updated into the database.

Code in context:
[php highlight="514" firstline="509"]
if ( $where_col ) {
$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 );
} else {
[/php]

Read Documentation ·

wpsc_purchase_log_set_properties

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::set()
Arguments Accepted: $properties, $this
Version Introduced: 3.8.9

Description: Filter values before they are set as purchase log’s properties.

Code in context:
[php highlight="457" firstline="447"]
public function set( $key, $value = null ) {
if ( is_array( $key ) ) {
$properties = $key;
} else {
if ( is_null( $value ) )
return $this;

$properties = array( $key => $value );
}

$properties = apply_filters( ‘wpsc_purchase_log_set_properties’, $properties, $this );

if ( array_key_exists( ‘processed’, $properties ) ) {
$this->previous_status = $this->get( ‘processed’ );

if ( $properties['processed'] != $this->previous_status )
$this->is_status_changed = true;
}

$this->data = array_merge( $this->data, $properties );
return $this;
}
[/php]

Read Documentation ·

wpsc_purchase_log_gateway_data

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::get_gateway_data()
Arguments Accepted: $this->gateway_data, $this->data
Version Introduced: 3.8.9

Description: Filter purchase log data (formatted for payment gateways) before it is returned.

Code in context:
[php highlight="431" firstline="423"]
if ( $from_currency ) {
// adjust total amount in case there’s slight decimal error
$total = $subtotal + $shipping + $this->gateway_data['tax'] – $this->gateway_data['discount'];
if ( $this->gateway_data['amount'] != $total )
$this->gateway_data['amount'] = $total;
}

$this->gateway_data = apply_filters( ‘wpsc_purchase_log_gateway_data’, $this->gateway_data, $this->get_data() );
return $this->gateway_data;
[/php]

Read Documentation ·

wpsc_purchase_log_get_data

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::get_data()
Arguments Accepted: $this->data, $this
Version Introduced: 3.8.9

Description: Filter purchase log data before it is returned.

Code in context:
[php highlight="383" firstline="387"]
public function get_data() {
if ( empty( $this->data ) )
$this->fetch();

return apply_filters( ‘wpsc_purchase_log_get_data’, $this->data, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_get_property

Located in: purchase-log.class.php

Functions that call this hook: WPSC_Purchase_Log::get()
Arguments Accepted: $value, $key, $this
Version Introduced: 3.8.9

Description: Filter purchase log property before it is returned.

Code in context:
[php highlight="346" firstline="358"]
public function get( $key ) {
// lazy load the purchase log row if it’s not fetched from the database yet
if ( empty( $this->data ) || ! array_key_exists( $key, $this->data ) )
$this->fetch();

if ( isset( $this->data[$key] ) )
$value = $this->data[$key];
elseif ( isset( $this->meta_data[$key] ) )
$value = $this->meta_data[$key];
else
$value = null;

return apply_filters( ‘wpsc_purchase_log_get_property’, $value, $key, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_data

Located in: purchase-log.class.php

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

Description: Filter purchase log data returned by the database before it is used to update the cache.

Code in context:
[php highlight="312" firstline="310"]
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 );
}
[/php]

Read Documentation ·

wpsc_purchase_log_customer_html_notification_raw_message

Located in: purchase-log-notification.class.php

Functions that call this hook: WPSC_Purchase_Log_Customer_HTML_Notification::get_raw_message()
Arguments Accepted: $raw_message, $this
Version Introduced: 3.8.9

Description: Filter the customer HTML purchase notification’s raw message (transaction results’ page content) before placeholders are replaced by real values.

Code in context:
[php highlight="426" firstline="416"]
public function get_raw_message() {
$raw_message = apply_filters( ‘wpsc_pre_transaction_results’, ”, $this );
if ( $this->purchase_log->get( ‘processed’ ) == WPSC_Purchase_Log::ORDER_RECEIVED )
$raw_message = __( ‘Thank you, your purchase is pending, you will be sent an email once the order clears.’, ‘wpsc’ ) . "\n\r";

$raw_message .= get_option( ‘wpsc_email_receipt’ );
$raw_message = $this->maybe_add_discount( $raw_message );

// preserve pre-3.8.9 filter hooks
$raw_message = apply_filters( ‘wpsc_transaction_result_message_html’, $raw_message );
return apply_filters( ‘wpsc_purchase_log_customer_html_notification_raw_message’, $raw_message, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_admin_notification_raw_message

Located in: purchase-log-notification.class.php

Functions that call this hook: WPSC_Purchase_Log_Admin_Notification::get_raw_message()
Arguments Accepted: $raw_message, $this
Version Introduced: 3.8.9

Description: Filter the admin purchase notification’s raw message (admin report) before placeholders are replaced by real values.

Code in context:
[php highlight="384" firstline="398"]
// Checkout fields
$message .= "\r\n";
foreach ( $data as $section ) {
if ( empty( $section['fields'] ) )
continue;
$message .= "<strong>{$section['title']}</strong>\r\n";
foreach ( $section['fields'] as $field ) {
$message .= $field->name . ‘ : ‘ . $field->value . "\r\n";
}
$message .= "\r\n";
}

// preserve pre-3.8.9 hooks
$message = apply_filters( ‘wpsc_transaction_result_report’, $message );
return apply_filters( ‘wpsc_purchase_log_admin_notification_raw_message’, $message, $this );
[/php]

Read Documentation ·

wpsc_purchase_log_customer_notification_raw_message

Located in: purchase-log-notification.class.php

Functions that call this hook: WPSC_Purchase_Log_Customer_Notification::get_raw_message()
Arguments Accepted: $raw_message, $this
Version Introduced: 3.8.9

Description: Filter the customer purchase notification’s raw message (purchase receipt) before placeholders are replaced by real values.

Code in context:
[php highlight="297" firstline="287"]
public function get_raw_message() {
$raw_message = ”;

if ( $this->purchase_log->get( ‘processed’ ) == WPSC_Purchase_Log::ORDER_RECEIVED )
$raw_message = __( ‘Thank you, your purchase is pending, you will be sent an email once the order clears.’, ‘wpsc’ ) . "\n\r";

$raw_message .= get_option( ‘wpsc_email_receipt’ );
$raw_message = $this->maybe_add_discount( $raw_message );
// pre-3.8.9 filter hook
$raw_message = apply_filters( ‘wpsc_transaction_result_message’, $raw_message );
return apply_filters( ‘wpsc_purchase_log_customer_notification_raw_message’, $raw_message, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_notification_html_args

Located in: purchase-log-notification.class.php

Functions that call this hook: get_html_args()
Arguments Accepted: $this->html_args, $this
Version Introduced: 3.8.9

Description: Filter the placeholder arguments for html notification.

Code in context:
[php highlight="198" firstline="191"]
private function get_html_args() {
$common_args = $this->get_common_args();
$common_args = array_map( ‘esc_html’, $common_args );
$this->html_product_list = $this->create_html_product_list();
$this->html_args = array(
‘product_list’ => $this->html_product_list,
);
$this->html_args = apply_filters( ‘wpsc_purchase_log_notification_html_args’, $this->html_args, $this );
return array_merge( $common_args, $this->html_args );
}
[/php]

Read Documentation ·

wpsc_purchase_log_notification_plaintext_args

Located in: purchase-log-notification.class.php

Functions that call this hook: get_plaintext_args()
Arguments Accepted: $this->plaintext_args, $this
Version Introduced: 3.8.9

Description: Filter the placeholder arguments for plaintext notification.

Code in context:
[php highlight="187" firstline="182"]
private function get_plaintext_args() {
$this->plaintext_product_list = $this->create_plaintext_product_list();
$this->plaintext_args = array(
‘product_list’ => $this->plaintext_product_list,
);
$this->plaintext_args = apply_filters( ‘wpsc_purchase_log_notification_plaintext_args’, $this->plaintext_args, $this );
return array_merge( $this->get_common_args(), $this->plaintext_args );
}
[/php]

Read Documentation ·

wpsc_email_product_list_html_custom_message

Located in: purchase-log-notification.class.php

Functions that call this hook: create_html_product_list()
Arguments Accepted: __( 'Customization for %s', 'wpsc' )
Version Introduced: 3.8.9

Description: Filter the custom message heading in plain text purchase notification.

Code in context:
[php highlight="159" firstline="155"]
foreach ( $this->purchase_log->get_cart_contents() as $cart_item ) {
if ( empty( $cart_item->custom_message ) )
continue;

$custom_message_string = apply_filters( ‘wpsc_email_product_list_html_custom_message’, __( ‘Customization for %s’, ‘wpsc’ ) );
$output .= ‘<hr />’;
$output .= ‘<p><strong>’ . sprintf( $custom_message_string, esc_html( $cart_item->name ) ) . ‘</strong></p>’;
$output .= wpautop( esc_html( $cart_item->custom_message ) );
}
[/php]

Read Documentation ·

wpsc_email_product_list_plaintext_custom_message

Located in: purchase-log-notification.class.php

Functions that call this hook: create_plaintext_product_list()
Arguments Accepted: __( 'Customization for %s', 'wpsc' )
Version Introduced: 3.8.9

Description: Filter the custom message heading in plain text purchase notification.

Code in context:
[php highlight="127" firstline="123"]
foreach ( $this->purchase_log->get_cart_contents() as $cart_item ) {
if ( empty( $cart_item->custom_message ) )
continue;

$custom_message_string = apply_filters( ‘wpsc_email_product_list_plaintext_custom_message’, __( ‘Customization for %s’, ‘wpsc’ ) );
$output .= "\r\n" . ‘=== ‘ . sprintf( $custom_message_string, $cart_item->name ) . ‘ ===’ . "\r\n";
$output .= $cart_item->custom_message;
$output .= "\r\n";
}
[/php]

Read Documentation ·

wpsc_purchase_log_notification_product_table_args

Located in: purchase-log-notification.class.php

Functions that call this hook: get_table_args()
Arguments Accepted: $args, $this
Version Introduced: 3.8.9

Description: Filter the array containing default arguments to generate the product list table used in purchase notifications.

Code in context:
[php firstline="65" highlight="116"]
private function get_table_args() {
$log_id = $this->purchase_log->get( ‘id’ );
$log_data = $this->purchase_log->get_data();
$rows = array();

$headings = array(
_x( ‘Name’ , ‘purchase log notification table heading’, ‘wpsc’ ) => ‘left’,
_x( ‘Price’ , ‘purchase log notification table heading’, ‘wpsc’ ) => ‘right’,
_x( ‘Quantity’ , ‘purchase log notification table heading’, ‘wpsc’ ) => ‘right’,
_x( ‘Item Total’ , ‘purchase log notification table heading’, ‘wpsc’ ) => ‘right’,
);

$has_additional_details = false;
$additional_details = array();

foreach( $this->purchase_log->get_cart_contents() as $item ) {
$cart_item_array = array(
‘purchase_id’ => $log_id,
‘cart_item’ => (array) $item,
‘purchase_log’ => $log_data,
);

// legacy code, which Gary honestly doesn’t fully understand because it just doesn’t make sense
// prior to 3.8.9, these actions are called on each product item. Don’t really know what they do.
do_action( ‘wpsc_transaction_result_cart_item’, $cart_item_array );
do_action( ‘wpsc_confirm_checkout’, $log_id );

// then there’s also this annoying apply_filters call, which is apparently not the best example
// of how to use it, but we have to preserve them anyways
$additional_content = apply_filters( ‘wpsc_transaction_result_content’, array( "purchase_id" => $log_id, "cart_item" => $item, "purchase_log" => $log_data ) );
if ( ! is_string( $additional_content ) )
$additional_content = ”;
else
$has_additional_details = true;
$additional_details[] = $additional_content;

$item_total = $item->quantity * $item->price;
$item_total = wpsc_currency_display( $item_total , array( ‘display_as_html’ => false ) );
$item_price = wpsc_currency_display( $item->price, array( ‘display_as_html’ => false ) );
$rows[] = array( $item->name, $item_price, $item->quantity, $item_total );
}

// Preserve the ‘wpsc_transaction_result_content’ filter for backward compat
if ( $has_additional_details ) {
$headings[] = __( ‘Additional Details’, ‘wpsc’ );
foreach ( $rows as $index => $row ) {
$rows[] = $additional_details[$index];
}
}

$table_args = array( ‘headings’ => $headings, ‘rows’ => $rows );
return apply_filters( ‘wpsc_purchase_log_notification_product_table_args’, $table_args, $this );
}
[/php]

Read Documentation ·

wpsc_purchase_log_notification_common_args

Located in: purchase-log-notification.class.php

Functions that call this hook: get_common_args()
Arguments Accepted: $args, $this
Version Introduced: 3.8.9

Description: Filter the array containing default placeholders and values for purchase notifications (purchase receipts, admin sales report).

Code in context:
[php firstline="36" highlight="62"]
$args = array(
// Legacy tags
// These tags are dumb because they force the string to go with the amount, giving no
// control to the user. Unfortunately we still have to support those for the next decade.
‘purchase_id’ => sprintf( __( "Purchase # %s" , ‘wpsc’ ), $this->purchase_log->get( ‘id’ ) ) . "\r\n",
‘total_tax’ => sprintf( __( ‘Total Tax: %s’ , ‘wpsc’ ), $tax ) . "\r\n",
‘total_shipping’ => sprintf( __( ‘Total Shipping: %s’, ‘wpsc’ ), $shipping ) . "\r\n",
‘total_price’ => sprintf( __( ‘Total: %s’ , ‘wpsc’ ), $total ) . "\r\n",
‘shop_name’ => get_option( ‘blogname’ ),
‘find_us’ => $this->purchase_log->get( ‘find_us’ ),
‘discount’ => sprintf( __( ‘Discount Amount: %s (%s)’, ‘wpsc’ ), $discount, $this->purchase_log->get( ‘discount_data’ ) ) . "\r\n",

// New tags
‘coupon_code’ => $this->purchase_log->get( ‘discount_data’ ),
‘transaction_id’ => $this->purchase_log->get( ‘transactid’ ),
‘purchase_log_id’ => $this->purchase_log->get( ‘id’ ),
‘payment_method’ => $this->purchase_log->get( ‘gateway_name’ ),
‘shipping_method’ => $this->purchase_log->get( ‘shipping_method_name’ ),
‘shipping_option’ => $this->purchase_log->get( ‘shipping_option_name’ ),
‘discount_amount’ => $discount,
‘tax’ => $tax,
‘shipping’ => $shipping,
‘total’ => $total,
‘subtotal’ => $subtotal,
);

return apply_filters( ‘wpsc_purchase_log_notification_common_args’, $args, $this );
[/php]

Read Documentation ·

wpsc_the_product_price_display_you_save_amount_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $you_save_amount_class, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “You Save” amount span element.

Code in context:
[php firstline="2001" highlight="2002"]
$you_save_class = apply_filters( ‘wpsc_the_product_price_display_you_save_class’, $you_save_class, $id );
$you_save_amount_class = apply_filters( ‘wpsc_the_product_price_display_you_save_amount_class’, $you_save_amount_class, $id );
$attributes = ‘class="’ . esc_attr( $you_save_class ) . ‘"’;
if ( ! $show_you_save )
$attributes .= ‘ style="display:none;"’;
$you_save_before = sprintf( $you_save_before, $attributes );
$you_save_amount_before = sprintf( $you_save_amount_before, esc_attr( $you_save_amount_class ), esc_attr( $you_save_amount_id ) );[/php]

Read Documentation ·

wpsc_the_product_price_display_you_save_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $you_save_class, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “You Save” span element.

Code in context:
[php firstline="2001" highlight="2001"]
$you_save_class = apply_filters( ‘wpsc_the_product_price_display_you_save_class’, $you_save_class, $id );
$you_save_amount_class = apply_filters( ‘wpsc_the_product_price_display_you_save_amount_class’, $you_save_amount_class, $id );
$attributes = ‘class="’ . esc_attr( $you_save_class ) . ‘"’;
if ( ! $show_you_save )
$attributes .= ‘ style="display:none;"’;
$you_save_before = sprintf( $you_save_before, $attributes );
$you_save_amount_before = sprintf( $you_save_amount_before, esc_attr( $you_save_amount_class ), esc_attr( $you_save_amount_id ) );[/php]

Read Documentation ·

wpsc_the_product_price_display_price_amount_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $price_amount_lass, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “Price” amount span element.

Code in context:
[php firstline="1996" highlight="1997"]
$price_class = apply_filters( ‘wpsc_the_product_price_display_price_class’, esc_attr( $price_class ), $id );
$price_amount_class = apply_filters( ‘wpsc_the_product_price_display_price_amount_class’, esc_attr( $price_amount_class ), $id );
$price_before = sprintf( $price_before, esc_attr( $price_class ) );
$price_amount_before = sprintf( $price_amount_before, esc_attr( $price_amount_class ), esc_attr( $price_amount_id ) );
[/php]

Read Documentation ·

wpsc_the_product_price_display_price_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $price_class, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “Price” span element.

Code in context:
[php firstline="1996" highlight="1996"]
$price_class = apply_filters( ‘wpsc_the_product_price_display_price_class’, esc_attr( $price_class ), $id );
$price_amount_class = apply_filters( ‘wpsc_the_product_price_display_price_amount_class’, esc_attr( $price_amount_class ), $id );
$price_before = sprintf( $price_before, esc_attr( $price_class ) );
$price_amount_before = sprintf( $price_amount_before, esc_attr( $price_amount_class ), esc_attr( $price_amount_id ) );
[/php]

Read Documentation ·

wpsc_the_product_price_display_old_price_amount_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $old_price_amount_class, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “Old Price” amount span element.

Code in context:
[php firstline="1988" highlight="1989"]
$old_price_class = apply_filters( ‘wpsc_the_product_price_display_old_price_class’, $old_price_class, $id );
$old_price_amount_class = apply_filters( ‘wpsc_the_product_price_display_old_price_amount_class’, $old_price_amount_class, $id );
$attributes = ‘class="’ . esc_attr( $old_price_class ) . ‘"’;
if ( ! $show_old_price )
$attributes .= ‘ style="display:none;"’;
$old_price_before = sprintf( $old_price_before, $attributes );
$old_price_amount_before = sprintf( $old_price_amount_before, esc_attr( $old_price_amount_class ), esc_attr( $old_price_amount_id ) );
[/php]

Read Documentation ·

wpsc_the_product_price_display_old_price_class

Located in: product-template.php

Functions that call this hook: wpsc_the_product_price_display()
Arguments Accepted: $old_price_class, $product_id
Version Introduced: 3.8.9

Description: Filter the class for the “Old Price” span element.

Code in context:
[php firstline="1988" highlight="1988"]
$old_price_class = apply_filters( ‘wpsc_the_product_price_display_old_price_class’, $old_price_class, $id );
$old_price_amount_class = apply_filters( ‘wpsc_the_product_price_display_old_price_amount_class’, $old_price_amount_class, $id );
$attributes = ‘class="’ . esc_attr( $old_price_class ) . ‘"’;
if ( ! $show_old_price )
$attributes .= ‘ style="display:none;"’;
$old_price_before = sprintf( $old_price_before, $attributes );
$old_price_amount_before = sprintf( $old_price_amount_before, esc_attr( $old_price_amount_class ), esc_attr( $old_price_amount_id ) );
[/php]

Read Documentation ·

wpsc_preview_image_bgcolor

Located in: misc.functions.php

Functions that call this hook: nzshpcrt_display_preview_image()
Arguments Accepted: array( 255, 255, 255 )
Version Introduced: 3.8.9

Description: Specify the background color of the preview image.

Code in context:
[php firstline="408" highlight="409"]
// Create temp resized image
$bgcolor_default = apply_filters( ‘wpsc_preview_image_bgcolor’, array( 255, 255, 255 ) );
$temp_img = ImageCreateTrueColor( $temp_w, $temp_h );
$bgcolor = ImageColorAllocate( $temp_img, $bgcolor_default[0], $bgcolor_default[1], $bgcolor_default[2] ) ;
ImageFilledRectangle( $temp_img, 0, 0, $temp_w, $temp_h, $bgcolor );
ImageAlphaBlending( $temp_img, TRUE );
ImageCopyResampled( $temp_img, $src_img, 0, 0, 0, 0, $temp_w, $temp_h, $source_w, $source_h );

$dst_img = ImageCreateTrueColor( $width, $height );
$bgcolor = ImageColorAllocate( $dst_img, $bgcolor_default[0], $bgcolor_default[1], $bgcolor_default[2] );
ImageFilledRectangle( $dst_img, 0, 0, $width, $height, $bgcolor );
ImageAlphaBlending( $dst_img, TRUE );
[/php]

Read Documentation ·

wpsc_preview_image_cropping_method

Located in: misc.functions.php

Functions that call this hook: nzshpcrt_display_preview_image()
Arguments Accepted: 'cropping'
Version Introduced: 3.8.9

Description: Specify which scaling method to use (cropping or non-cropping).

Code in context:
[php firstline="377" highlight="378"]
// select our scaling method
$scaling_method = apply_filters( ‘wpsc_preview_image_cropping_method’, ‘cropping’ );

// set both offsets to zero
$offset_x = $offset_y = 0;

// Here are the scaling methods, non-cropping causes black lines in tall images, but doesnt crop images.
switch ( $scaling_method ) {
case ‘cropping’:
// if the image is wider than it is high and at least as wide as the target width.
if ( ($source_h <= $source_w ) ) {
if ( $height < $width ) {
$temp_h = ($width / $source_w) * $source_h;
} else {
$temp_w = ($height / $source_h) * $source_w;
}
} else {
$temp_h = ($width / $source_w) * $source_h;
}
break;

case ‘non-cropping’:
default:
if ( $height < $width ) {
$temp_h = ($width / $source_w) * $source_h;
} else {
$temp_w = ($height / $source_h) * $source_w;
}
break;
}
[/php]

Read Documentation ·

wpsc_google_analytics_site_name

Located in: google-analytics.class.php

Functions that call this hook: get_site_name()
Arguments Accepted: $site_name
Version Introduced: 3.8.9

Description: Filter the domain name of the site to use with Google Analytics.

Code in context:
[php firstline="95" highlight="99"]
public function get_site_name() {

$site_name = $this->sanitize( get_bloginfo( ‘name’ ) );

return apply_filters( ‘wpsc_google_analytics_site_name’, $site_name );
}
[/php]

Read Documentation ·

wpsc_google_analytics_domain_name

Located in: google-analytics.class.php

Functions that call this hook: get_domain_name()
Arguments Accepted: $site_url
Version Introduced: 3.8.9

Description: Filter the domain name of the site to use with Google Analytics.

Code in context:
[php firstline="88" highlight="92"]
public function get_domain_name() {

$site_url = $this->sanitize( str_replace( array( ‘https://www.’, ‘http://www.’, ‘https://’, ‘http://’, ), ”, untrailingslashit( network_home_url() ) ) );

return apply_filters( ‘wpsc_google_analytics_domain_name’, $site_url );
}
[/php]

Read Documentation ·