Skip to content

Commit

Permalink
Fix compatibility issues with the references to the wpsc-theme folder
Browse files Browse the repository at this point in the history
- WPSC_THEME_ENGINE_V1_PATH and WPSC_THEME_ENGINE_V1_URL should be used to refer to the templates' paths.
- Restore the wpsc-theme folder, just in case old themes are still relying on these files being there.
  • Loading branch information
Gary Cao committed Jun 11, 2013
1 parent bf9962c commit 2423b5c
Show file tree
Hide file tree
Showing 35 changed files with 3,731 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ function wpsc_user_purchases() {
*
*/
function _wpsc_action_purchase_history_section() {
include( WPSC_FILE_PATH . '/wpsc-theme/wpsc-account-purchase-history.php' );
include( WPSC_CORE_THEME_PATH. '/wpsc-account-purchase-history.php' );
}
add_action( 'wpsc_user_profile_section_purchase_history', '_wpsc_action_purchase_history_section' );

Expand All @@ -746,7 +746,7 @@ function _wpsc_action_purchase_history_section() {
*
*/
function _wpsc_action_edit_profile_section() {
include( WPSC_FILE_PATH . '/wpsc-theme/wpsc-account-edit-profile.php' );
include( WPSC_CORE_THEME_PATH . '/wpsc-account-edit-profile.php' );
}
add_action( 'wpsc_user_profile_section_edit_profile', '_wpsc_action_edit_profile_section' );

Expand Down Expand Up @@ -785,7 +785,7 @@ function _wpsc_action_downloads_section() {
}
}

include( WPSC_FILE_PATH . '/wpsc-theme/wpsc-account-downloads.php' );
include( WPSC_CORE_THEME_PATH . '/wpsc-account-downloads.php' );
}
add_action( 'wpsc_user_profile_section_downloads', '_wpsc_action_downloads_section' );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function wpsc_latest_product( $args = null, $instance ) {
if ( $thumbnail )
$output .= '<img src="' . esc_url( $thumbnail ) . '" title="' . apply_filters( 'the_title', $latest_product->post_title ) . '" alt="' . apply_filters( 'the_title', $latest_product->post_title ) . '" />';
else
$output .='<img class="no-image" id="product_image_'.wpsc_the_product_id().'" alt="' . esc_attr__( 'No Image', 'wpsc' ) . '" title="'.wpsc_the_product_title().'" src="'.WPSC_URL.'/wpsc-theme/wpsc-images/noimage.png" width="' . $width . '" height="' . $height . '" />';
$output .='<img class="no-image" id="product_image_'.wpsc_the_product_id().'" alt="' . esc_attr__( 'No Image', 'wpsc' ) . '" title="'.wpsc_the_product_title().'" src="' . WPSC_CORE_THEME_PATH . '/wpsc-images/noimage.png" width="' . $width . '" height="' . $height . '" />';

$output .= '</a>';
$output .= '</div>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function wpsc_specials( $args = null, $instance ) {
if ( wpsc_the_product_thumbnail() ) : ?>
<a rel="<?php echo str_replace(array(" ", '"',"'", '&quot;','&#039;'), array("_", "", "", "",''), wpsc_the_product_title()); ?>" href="<?php echo esc_url( wpsc_the_product_permalink() ); ?>"><img class="product_image" id="product_image_<?php echo esc_attr( wpsc_the_product_id() ); ?>" alt="<?php echo esc_attr( wpsc_the_product_title() ); ?>" title="<?php echo esc_attr( wpsc_the_product_title() ); ?>" src="<?php echo esc_url( wpsc_the_product_thumbnail( $width, $height ) ); ?>"/></a>
<?php else : ?>
<a href="<?php esc_url( wpsc_the_product_permalink() ); ?>"><img class="no-image" id="product_image_<?php echo esc_attr( wpsc_the_product_id() ); ?>" alt="<?php echo esc_attr( wpsc_the_product_title() ); ?>" title="<?php echo esc_attr( wpsc_the_product_title() ); ?>" src="<?php echo esc_url( WPSC_URL . '/wpsc-theme/wpsc-images/noimage.png' ); ?>" width="<?php echo esc_attr( $width ); ?>" height="<?php echo esc_attr( $height ); ?>" /></a>
<a href="<?php esc_url( wpsc_the_product_permalink() ); ?>"><img class="no-image" id="product_image_<?php echo esc_attr( wpsc_the_product_id() ); ?>" alt="<?php echo esc_attr( wpsc_the_product_title() ); ?>" title="<?php echo esc_attr( wpsc_the_product_title() ); ?>" src="<?php echo esc_url( WPSC_CORE_THEME_PATH . '/wpsc-images/noimage.png' ); ?>" width="<?php echo esc_attr( $width ); ?>" height="<?php echo esc_attr( $height ); ?>" /></a>
<?php endif; ?>
<br />
<?php endif; // close show thumbnails ?>
Expand Down
50 changes: 50 additions & 0 deletions wpsc-theme/compatibility.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
Generalised theme compatibility fixes, the shopping cart does not need bullets
*/

li.widget_wp_shopping_cart ul {
list-style-image: none !important;
list-style-type: none !important;
}

li.widget_wp_shopping_cart ul li {
list-style-image: none !important;
list-style-type: none !important;
background: none !important;
}

li.widget_wp_shopping_cart ul li:before{
/* Countermand any content properties like the one in the default wordpress theme. */
content: "" !important;
}


div.categorydisplay ul li:before{
/* Countermand any content properties like the one in the default wordpress theme. */
content: "" !important;
}

a.additional_description_link img {
margin:0px 3px 0px 0px;
}

div.textcol form {
min-width: 300px;
}

div.wpsc_loading_animation {
visibility: hidden;
}

#idc-container-parent{
clear:both;

}
table.wpsc_checkout_table label{
display:inline;
padding-right:10px;
}
aside.widget_wpsc_product_specials span.oldprice {
text-decoration: line-through;
color: #666;
}
130 changes: 130 additions & 0 deletions wpsc-theme/functions/wpsc-transaction_results_functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?php

/**
* transaction_results function main function for creating the purchase reports, transaction results page, and email receipts
* @access public
*
* @since 3.7
* @param $sessionid (string) unique session id
* @param echo_to_screen (boolean) whether to output the results or return them (potentially redundant)
* @param $transaction_id (int) the transaction id
*/
function transaction_results( $sessionid, $display_to_screen = true, $transaction_id = null ) {
global $message_html, $echo_to_screen, $wpsc_cart, $purchase_log;

// pre-3.8.9 variable
$echo_to_screen = $display_to_screen;

$purchase_log_object = new WPSC_Purchase_Log( $sessionid, 'sessionid' );

// compatibility with pre-3.8.9 templates where they use a global
// $purchase_log object which is simply just a database row
$purchase_log = $purchase_log_object->get_data();

// pre-3.8.9 templates also use this global variable
$message_html = wpsc_get_transaction_html_output( $purchase_log_object );

$wpsc_cart->empty_cart();

do_action( 'wpsc_transaction_results_shutdown', $purchase_log_object, $sessionid, $display_to_screen );

return $message_html;
}

function wpsc_transaction_html_output() {
global $message_html;
echo $message_html;
}

function wpsc_transaction_theme() {
global $wpdb, $user_ID, $nzshpcrt_gateways, $sessionid, $cart_log_id, $errorcode;
$errorcode = '';
$transactid = '';
$dont_show_transaction_results = false;
if ( isset( $_GET['sessionid'] ) )
$sessionid = $_GET['sessionid'];

if ( !isset( $_GET['sessionid'] ) && isset( $_GET['ms'] ) )
$sessionid = $_GET['ms'];

if ( isset( $_GET['gateway'] ) && 'google' == $_GET['gateway'] ) {
wpsc_google_checkout_submit();
wpsc_delete_customer_meta( 'checkout_session_id' );
}

$selected_gateway = wpsc_get_customer_meta( 'selected_gateway' );
if ( $selected_gateway && in_array( $selected_gateway, array( 'paypal_certified', 'wpsc_merchant_paypal_express' ) ) )
$sessionid = wpsc_get_customer_meta( 'paypal_express_sessionid' );

if ( isset( $_REQUEST['eway'] ) && '1' == $_REQUEST['eway'] )
$sessionid = $_GET['result'];
elseif ( isset( $_REQUEST['eway'] ) && '0' == $_REQUEST['eway'] )
echo wpsc_get_customer_meta( 'eway_message' );
elseif ( isset( $_REQUEST['payflow'] ) && '1' == $_REQUEST['payflow'] ){
echo wpsc_get_customer_meta( 'payflow_message' );
wpsc_delete_customer_meta( 'payflow_message' );
}

$dont_show_transaction_results = false;

if ( $selected_gateway ) {
// Replaces the ugly if else for gateways
switch( $selected_gateway ){
case 'paypal_certified':
case 'wpsc_merchant_paypal_express':
echo wpsc_get_customer_meta( 'paypal_express_message' );

$reshash = wpsc_get_customer_meta( 'paypal_express_reshash' );
if( isset( $reshash['PAYMENTINFO_0_TRANSACTIONTYPE'] ) && in_array( $reshash['PAYMENTINFO_0_TRANSACTIONTYPE'], array( 'expresscheckout', 'cart' ) ) )
$dont_show_transaction_results = false;
else
$dont_show_transaction_results = true;
break;
case 'dps':
$sessionid = decrypt_dps_response();
break;
//paystation was not updating the purchase logs for successful payment - this is ugly as need to have the databse update done in one place by all gatways on a sucsessful transaction hook not some within the gateway and some within here and some not at all??? This is getting a major overhaul but for here and now it just needs to work for the gold cart people!
case 'paystation':
$ec = $_GET['ec'];
$result= $_GET['em'];

if($result == 'Transaction successful' && $ec == 0)
$processed_id = '3';

if($result == 'Insufficient Funds' && $ec == 5){
$processed_id = '6';

$payment_instructions = printf( __( 'Sorry your transaction was not accepted due to insufficient funds <br /><a href="%1$s">Click here to go back to checkout page</a>.', 'wpsc' ), get_option( "shopping_cart_url" ) );
}
if ( $processed_id )
wpsc_update_purchase_log_status( $sessionid, $processed_id, 'sessionid' );

break;
case 'wpsc_merchant_paymentexpress' :
// Payment Express sends back there own session id, which is temporarily stored in the Auth field
// so just swapping that over here
$result = $wpdb->get_var( $wpdb->prepare( "SELECT `sessionid` FROM `" .WPSC_TABLE_PURCHASE_LOGS. "` WHERE `authcode` = %s", $sessionid ) );
if($result != null){
// just in case they are using an older version old gold cart (pre 2.9.5)
$sessionid = $result;
$dont_show_transaction_results = true;
}
break;
case 'eway_hosted':
$sessionid = decrypt_eway_uk_response();
break;
//default filter for other payment gateways to use
default:
$sessionid = apply_filters('wpsc_previous_selected_gateway_' . $selected_gateway, $sessionid);
break;
}
}

if( ! $dont_show_transaction_results ) {
if ( !empty($sessionid) ){
$cart_log_id = $wpdb->get_var( $wpdb->prepare( "SELECT `id` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= %s LIMIT 1", $sessionid ) );
return transaction_results( $sessionid, true );
}else
printf( __( 'Sorry your transaction was not accepted.<br /><a href="%1$s">Click here to go back to checkout page</a>.', 'wpsc' ), get_option( "shopping_cart_url" ) );
}
}
Loading

0 comments on commit 2423b5c

Please sign in to comment.