Version Description
- Fix: Some users had theme compatibilities and other configurations that caused "Add to Cart" to no longer function as expected.
- Fix: Customer uploads for products broke with JS overhaul
- Fix: Product image links broke.
Download this release
Release Info
Developer | JustinSainton |
Plugin | WP eCommerce |
Version | 3.8.11.1 |
Comparing to | |
See all releases |
Code changes from version 3.8.11 to 3.8.11.1
- readme.txt +7 -1
- wp-shopping-cart.php +1 -1
- wpsc-core/wpsc-constants.php +3 -5
- wpsc-includes/ajax.functions.php +151 -92
- wpsc-includes/product-template.php +8 -7
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://getshopped.org
|
|
4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 3.6
|
7 |
-
Stable tag: 3.8.11
|
8 |
|
9 |
WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
|
10 |
|
@@ -145,6 +145,12 @@ Before updating please make a backup of your existing files and database. Just i
|
|
145 |
After upgrading from earlier versions look for link "Update Store". This will update your database structure to work with new version.
|
146 |
|
147 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
= 3.8.11 =
|
149 |
* New: Payment Gateway UI is revamped.
|
150 |
* New: Sales Log UI is revamped.
|
4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 3.6
|
7 |
+
Stable tag: 3.8.11.1
|
8 |
|
9 |
WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
|
10 |
|
145 |
After upgrading from earlier versions look for link "Update Store". This will update your database structure to work with new version.
|
146 |
|
147 |
== Changelog ==
|
148 |
+
|
149 |
+
= 3.8.11.1 =
|
150 |
+
* Fix: Some users had theme compatibilities and other configurations that caused "Add to Cart" to no longer function as expected.
|
151 |
+
* Fix: Customer uploads for products broke with JS overhaul
|
152 |
+
* Fix: Product image links broke.
|
153 |
+
|
154 |
= 3.8.11 =
|
155 |
* New: Payment Gateway UI is revamped.
|
156 |
* New: Sales Log UI is revamped.
|
wp-shopping-cart.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WP e-Commerce
|
4 |
* Plugin URI: http://getshopped.org/
|
5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
6 |
-
* Version: 3.8.11
|
7 |
* Author: Instinct Entertainment
|
8 |
* Author URI: http://getshopped.org/
|
9 |
**/
|
3 |
* Plugin Name: WP e-Commerce
|
4 |
* Plugin URI: http://getshopped.org/
|
5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
6 |
+
* Version: 3.8.11.1
|
7 |
* Author: Instinct Entertainment
|
8 |
* Author URI: http://getshopped.org/
|
9 |
**/
|
wpsc-core/wpsc-constants.php
CHANGED
@@ -7,8 +7,6 @@ $wpsc_title_data = array();
|
|
7 |
* wpsc_core_load_session()
|
8 |
*
|
9 |
* Load up the WPEC session
|
10 |
-
*
|
11 |
-
* Pending Gary's feedback, I think we can actually get rid of this.
|
12 |
*/
|
13 |
function wpsc_core_load_session() {
|
14 |
|
@@ -30,9 +28,9 @@ function wpsc_core_constants() {
|
|
30 |
if(!defined('WPSC_URL'))
|
31 |
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
32 |
// Define Plugin version
|
33 |
-
define( 'WPSC_VERSION', '3.8.11' );
|
34 |
-
define( 'WPSC_MINOR_VERSION', '
|
35 |
-
define( 'WPSC_PRESENTABLE_VERSION', '3.8.11' );
|
36 |
define( 'WPSC_DB_VERSION', 4 );
|
37 |
|
38 |
// Define Debug Variables for developers
|
7 |
* wpsc_core_load_session()
|
8 |
*
|
9 |
* Load up the WPEC session
|
|
|
|
|
10 |
*/
|
11 |
function wpsc_core_load_session() {
|
12 |
|
28 |
if(!defined('WPSC_URL'))
|
29 |
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
30 |
// Define Plugin version
|
31 |
+
define( 'WPSC_VERSION', '3.8.11.1' );
|
32 |
+
define( 'WPSC_MINOR_VERSION', '74e9456712' );
|
33 |
+
define( 'WPSC_PRESENTABLE_VERSION', '3.8.11.1' );
|
34 |
define( 'WPSC_DB_VERSION', 4 );
|
35 |
|
36 |
// Define Debug Variables for developers
|
wpsc-includes/ajax.functions.php
CHANGED
@@ -16,10 +16,6 @@ if ( isset( $_REQUEST['wpsc_ajax_action'] ) && ($_REQUEST['wpsc_ajax_action'] ==
|
|
16 |
add_action( 'init', 'wpsc_special_widget' );
|
17 |
}
|
18 |
|
19 |
-
/**
|
20 |
-
* add_to_cart function, used through ajax and in normal page loading.
|
21 |
-
* No parameters, returns nothing
|
22 |
-
*/
|
23 |
function wpsc_add_to_cart() {
|
24 |
global $wpsc_cart;
|
25 |
|
@@ -92,6 +88,7 @@ function wpsc_add_to_cart() {
|
|
92 |
|
93 |
$cart_item = $wpsc_cart->set_item( $product_id, $parameters );
|
94 |
|
|
|
95 |
if ( is_object( $cart_item ) ) {
|
96 |
do_action( 'wpsc_add_to_cart', $product, $cart_item );
|
97 |
$cart_messages[] = str_replace( "[product_name]", $cart_item->get_title(), __( 'You just added "[product_name]" to your cart.', 'wpsc' ) );
|
@@ -106,21 +103,29 @@ function wpsc_add_to_cart() {
|
|
106 |
}
|
107 |
}
|
108 |
|
109 |
-
|
110 |
-
$output = _wpsc_ajax_get_cart( false, $cart_messages );
|
111 |
|
112 |
-
|
113 |
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
116 |
|
117 |
-
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
118 |
die( json_encode( $json_response ) );
|
|
|
119 |
}
|
120 |
|
121 |
add_action( 'wp_ajax_add_to_cart' , 'wpsc_add_to_cart' );
|
122 |
add_action( 'wp_ajax_nopriv_add_to_cart', 'wpsc_add_to_cart' );
|
123 |
|
|
|
|
|
|
|
|
|
|
|
124 |
function wpsc_get_cart() {
|
125 |
_wpsc_ajax_get_cart();
|
126 |
}
|
@@ -136,13 +141,20 @@ function wpsc_empty_cart() {
|
|
136 |
global $wpsc_cart;
|
137 |
$wpsc_cart->empty_cart( false );
|
138 |
|
139 |
-
|
140 |
-
|
|
|
|
|
141 |
}
|
142 |
|
143 |
add_action( 'wp_ajax_empty_cart' , 'wpsc_empty_cart' );
|
144 |
add_action( 'wp_ajax_nopriv_empty_cart', 'wpsc_empty_cart' );
|
145 |
|
|
|
|
|
|
|
|
|
|
|
146 |
/**
|
147 |
* coupons price, used through ajax and in normal page loading.
|
148 |
* No parameters, returns nothing
|
@@ -207,10 +219,45 @@ function wpsc_update_item_quantity() {
|
|
207 |
wpsc_coupon_price( $coupon );
|
208 |
}
|
209 |
}
|
|
|
210 |
|
211 |
-
_wpsc_ajax_get_cart();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
}
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
/**
|
215 |
* Returns the Cart Widget
|
216 |
*
|
@@ -221,9 +268,9 @@ function wpsc_update_item_quantity() {
|
|
221 |
* @return mixed Returns an array of output data, alternatively
|
222 |
*/
|
223 |
function _wpsc_ajax_get_cart( $die = true, $cart_messages = array() ) {
|
224 |
-
|
225 |
|
226 |
-
|
227 |
|
228 |
ob_start();
|
229 |
include_once( wpsc_get_template_file_path( 'wpsc-cart_widget.php' ) );
|
@@ -245,24 +292,27 @@ function _wpsc_ajax_get_cart( $die = true, $cart_messages = array() ) {
|
|
245 |
}
|
246 |
}
|
247 |
|
248 |
-
|
249 |
-
|
|
|
|
|
250 |
|
251 |
-
|
252 |
-
|
253 |
|
254 |
-
|
|
|
255 |
|
256 |
if ( ! empty( $action_output ) ) {
|
257 |
_wpsc_doing_it_wrong( 'wpsc_alternate_cart_html', __( 'As of WPeC 3.8.11, it is improper to hook into "wpsc_alternate_cart_html" to output javascript. We now have a custom javascript event called "wpsc_fancy_notification" you can hook into.', 'wpsc' ), '3.8.11' );
|
258 |
-
$return['
|
259 |
}
|
260 |
-
|
261 |
-
if ( $die )
|
262 |
-
die( $output . $action_output );
|
263 |
-
else
|
264 |
-
return $return;
|
265 |
}
|
|
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
|
268 |
// execute on POST and GET
|
@@ -306,6 +356,7 @@ if ( isset( $_REQUEST['wpsc_ajax_action'] ) && ($_REQUEST['wpsc_ajax_action'] ==
|
|
306 |
add_action( 'init', 'wpsc_update_product_rating' );
|
307 |
}
|
308 |
|
|
|
309 |
/**
|
310 |
* update_shipping_price function, used through ajax and in normal page loading.
|
311 |
* No parameters, returns nothing
|
@@ -412,6 +463,11 @@ function wpsc_update_product_price() {
|
|
412 |
add_action( 'wp_ajax_update_product_price' , 'wpsc_update_product_price' );
|
413 |
add_action( 'wp_ajax_nopriv_update_product_price', 'wpsc_update_product_price' );
|
414 |
|
|
|
|
|
|
|
|
|
|
|
415 |
/**
|
416 |
* update location function, used through ajax and in normal page loading.
|
417 |
* No parameters, returns nothing
|
@@ -474,13 +530,14 @@ function wpsc_update_location() {
|
|
474 |
exit;
|
475 |
}
|
476 |
|
|
|
|
|
|
|
477 |
// execute on POST and GET
|
478 |
-
if ( isset( $_REQUEST['wpsc_ajax_actions'] ) && $_REQUEST['wpsc_ajax_actions']
|
479 |
add_action( 'init', 'wpsc_update_location' );
|
480 |
}
|
481 |
|
482 |
-
add_action( 'wp_ajax_update_location' , 'wpsc_update_location' );
|
483 |
-
add_action( 'wp_ajax_nopriv_update_location', 'wpsc_update_location' );
|
484 |
|
485 |
function wpsc_cart_html_page() {
|
486 |
require_once(WPSC_FILE_PATH . "/wpsc-includes/shopping_cart_container.php");
|
@@ -823,6 +880,11 @@ function wpsc_change_tax() {
|
|
823 |
add_action( 'wp_ajax_change_tax' , 'wpsc_change_tax' );
|
824 |
add_action( 'wp_ajax_nopriv_change_tax', 'wpsc_change_tax' );
|
825 |
|
|
|
|
|
|
|
|
|
|
|
826 |
function _wpsc_change_profile_country() {
|
827 |
global $wpdb;
|
828 |
|
@@ -943,7 +1005,7 @@ function wpsc_download_file() {
|
|
943 |
$download_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `uniqueid` = '%s' AND `downloads` > '0' AND `active`='1' LIMIT 1", $downloadid ), ARRAY_A );
|
944 |
|
945 |
if ( is_null( $download_data ) && is_numeric( $downloadid ) )
|
946 |
-
|
947 |
|
948 |
|
949 |
if ( (get_option( 'wpsc_ip_lock_downloads' ) == 1) && ($_SERVER['REMOTE_ADDR'] != null) ) {
|
@@ -1029,7 +1091,7 @@ function _wpsc_force_download_file( $file_id ) {
|
|
1029 |
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
|
1030 |
}
|
1031 |
header( "Pragma: public" );
|
1032 |
-
|
1033 |
|
1034 |
// destroy the session to allow the file to be downloaded on some buggy browsers and webservers
|
1035 |
session_destroy();
|
@@ -1062,69 +1124,66 @@ function wpsc_update_shipping_quotes_on_shipping_same_as_billing() {
|
|
1062 |
}
|
1063 |
else {
|
1064 |
?>
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
|
1123 |
<?php
|
1124 |
|
1125 |
}
|
1126 |
exit;
|
1127 |
-
|
1128 |
-
}
|
1129 |
-
|
1130 |
-
?>
|
16 |
add_action( 'init', 'wpsc_special_widget' );
|
17 |
}
|
18 |
|
|
|
|
|
|
|
|
|
19 |
function wpsc_add_to_cart() {
|
20 |
global $wpsc_cart;
|
21 |
|
88 |
|
89 |
$cart_item = $wpsc_cart->set_item( $product_id, $parameters );
|
90 |
|
91 |
+
|
92 |
if ( is_object( $cart_item ) ) {
|
93 |
do_action( 'wpsc_add_to_cart', $product, $cart_item );
|
94 |
$cart_messages[] = str_replace( "[product_name]", $cart_item->get_title(), __( 'You just added "[product_name]" to your cart.', 'wpsc' ) );
|
103 |
}
|
104 |
}
|
105 |
|
106 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
|
|
107 |
|
108 |
+
$json_response = array( 'cart_messages' => $cart_messages, 'product_id' => $product_id, 'cart_total' => wpsc_cart_total() );
|
109 |
|
110 |
+
$output = _wpsc_ajax_get_cart( false, $cart_messages );
|
111 |
+
|
112 |
+
$json_response = $json_response + $output;
|
113 |
+
|
114 |
+
if ( is_numeric( $product_id ) && 1 == get_option( 'fancy_notifications' ) )
|
115 |
+
$json_response['fancy_notification'] = str_replace( array( "\n", "\r" ), array( '\n', '\r' ), fancy_notification_content( $cart_messages ) );
|
116 |
|
|
|
117 |
die( json_encode( $json_response ) );
|
118 |
+
}
|
119 |
}
|
120 |
|
121 |
add_action( 'wp_ajax_add_to_cart' , 'wpsc_add_to_cart' );
|
122 |
add_action( 'wp_ajax_nopriv_add_to_cart', 'wpsc_add_to_cart' );
|
123 |
|
124 |
+
// execute on POST and GET
|
125 |
+
if ( isset( $_REQUEST['wpsc_ajax_action'] ) && 'add_to_cart' == $_REQUEST['wpsc_ajax_action'] ) {
|
126 |
+
add_action( 'init', 'wpsc_add_to_cart' );
|
127 |
+
}
|
128 |
+
|
129 |
function wpsc_get_cart() {
|
130 |
_wpsc_ajax_get_cart();
|
131 |
}
|
141 |
global $wpsc_cart;
|
142 |
$wpsc_cart->empty_cart( false );
|
143 |
|
144 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
145 |
+
$output = _wpsc_ajax_get_cart( false );
|
146 |
+
die( json_encode( $output ) );
|
147 |
+
}
|
148 |
}
|
149 |
|
150 |
add_action( 'wp_ajax_empty_cart' , 'wpsc_empty_cart' );
|
151 |
add_action( 'wp_ajax_nopriv_empty_cart', 'wpsc_empty_cart' );
|
152 |
|
153 |
+
// execute on POST and GET
|
154 |
+
if ( isset( $_REQUEST['wpsc_ajax_action'] ) && ( 'empty_cart' == $_REQUEST['wpsc_ajax_action'] || isset( $_GET['sessionid'] ) && $_GET['sessionid'] > 0 ) ) {
|
155 |
+
add_action( 'init', 'wpsc_empty_cart' );
|
156 |
+
}
|
157 |
+
|
158 |
/**
|
159 |
* coupons price, used through ajax and in normal page loading.
|
160 |
* No parameters, returns nothing
|
219 |
wpsc_coupon_price( $coupon );
|
220 |
}
|
221 |
}
|
222 |
+
$die = ! ( ( isset( $_REQUEST['wpsc_ajax_action'] ) && 'true' == $_REQUEST['wpsc_ajax_action'] ) || ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) );
|
223 |
|
224 |
+
_wpsc_ajax_get_cart( $die );
|
225 |
+
}
|
226 |
+
|
227 |
+
function _wpsc_get_alternate_html() {
|
228 |
+
// These shenanigans are necessary for two reasons.
|
229 |
+
// 1) Some hook into POST, some GET, some REQUEST. They check for the conditional params below.
|
230 |
+
// 2) Most functions properly die() - that means that our output buffer stops there and won't continue on for our purposes.
|
231 |
+
// If there is a better way to get that output without dying, I'm all ears. A nice slow HTTP request for now.
|
232 |
+
$javascript = wp_remote_retrieve_body(
|
233 |
+
wp_remote_post(
|
234 |
+
add_query_arg(
|
235 |
+
array( 'ajax' => 'true', 'wpsc_action' => 'wpsc_get_alternate_html', 'ajax' => 'true', 'wpsc_ajax_action' => 'add_to_cart' ), home_url() ),
|
236 |
+
array( 'body' =>
|
237 |
+
array( 'cart_messages' => $cart_messages, 'ajax' => 'true', 'wpsc_ajax_action' => 'add_to_cart', 'product_id' => $_REQUEST['product_id']
|
238 |
+
)
|
239 |
+
)
|
240 |
+
)
|
241 |
+
);
|
242 |
+
return $javascript;
|
243 |
}
|
244 |
|
245 |
+
/**
|
246 |
+
* Returns the jQuery that is likely included in calls to this action. For back compat only, will be deprecated soon.
|
247 |
+
* Couldn't think up a better way to return this output, which most often will end in die(), without die()ing early ourselves.
|
248 |
+
*
|
249 |
+
* @param array $cart_messages [description]
|
250 |
+
*/
|
251 |
+
function _wpsc_ajax_return_alternate_html() {
|
252 |
+
$cart_messages = is_array( $_POST['cart_messages'] ) ? $_POST['cart_messages'] : array();
|
253 |
+
|
254 |
+
do_action( 'wpsc_alternate_cart_html', $cart_messages );
|
255 |
+
die;
|
256 |
+
}
|
257 |
+
|
258 |
+
if ( isset( $_REQUEST['wpsc_action'] ) && 'wpsc_get_alternate_html' == $_REQUEST['wpsc_action'] )
|
259 |
+
add_action( 'init', '_wpsc_ajax_return_alternate_html' );
|
260 |
+
|
261 |
/**
|
262 |
* Returns the Cart Widget
|
263 |
*
|
268 |
* @return mixed Returns an array of output data, alternatively
|
269 |
*/
|
270 |
function _wpsc_ajax_get_cart( $die = true, $cart_messages = array() ) {
|
271 |
+
$return = array();
|
272 |
|
273 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
274 |
|
275 |
ob_start();
|
276 |
include_once( wpsc_get_template_file_path( 'wpsc-cart_widget.php' ) );
|
292 |
}
|
293 |
}
|
294 |
|
295 |
+
$action_output = '';
|
296 |
+
if ( has_action( 'wpsc_alternate_cart_html' ) ) {
|
297 |
+
//Deprecated action. Do not use. We now have a custom JS event called 'wpsc_fancy_notification'. There is access to the complete $json_response object.
|
298 |
+
ob_start();
|
299 |
|
300 |
+
echo _wpsc_get_alternate_html();
|
301 |
+
$action_output = ob_get_contents();
|
302 |
|
303 |
+
ob_end_clean();
|
304 |
+
}
|
305 |
|
306 |
if ( ! empty( $action_output ) ) {
|
307 |
_wpsc_doing_it_wrong( 'wpsc_alternate_cart_html', __( 'As of WPeC 3.8.11, it is improper to hook into "wpsc_alternate_cart_html" to output javascript. We now have a custom javascript event called "wpsc_fancy_notification" you can hook into.', 'wpsc' ), '3.8.11' );
|
308 |
+
$return['wpsc_alternate_cart_html'] = $action_output;
|
309 |
}
|
|
|
|
|
|
|
|
|
|
|
310 |
}
|
311 |
+
|
312 |
+
if ( $die )
|
313 |
+
die( $output . $action_output );
|
314 |
+
else
|
315 |
+
return $return;
|
316 |
}
|
317 |
|
318 |
// execute on POST and GET
|
356 |
add_action( 'init', 'wpsc_update_product_rating' );
|
357 |
}
|
358 |
|
359 |
+
|
360 |
/**
|
361 |
* update_shipping_price function, used through ajax and in normal page loading.
|
362 |
* No parameters, returns nothing
|
463 |
add_action( 'wp_ajax_update_product_price' , 'wpsc_update_product_price' );
|
464 |
add_action( 'wp_ajax_nopriv_update_product_price', 'wpsc_update_product_price' );
|
465 |
|
466 |
+
// execute on POST and GET
|
467 |
+
if ( isset( $_REQUEST['update_product_price'] ) && 'true' == $_REQUEST['update_product_price'] && ! empty( $_POST['product_id'] ) && is_numeric( $_POST['product_id'] ) ) {
|
468 |
+
add_action( 'init', 'wpsc_update_product_price' );
|
469 |
+
}
|
470 |
+
|
471 |
/**
|
472 |
* update location function, used through ajax and in normal page loading.
|
473 |
* No parameters, returns nothing
|
530 |
exit;
|
531 |
}
|
532 |
|
533 |
+
add_action( 'wp_ajax_update_location' , 'wpsc_update_location' );
|
534 |
+
add_action( 'wp_ajax_nopriv_update_location', 'wpsc_update_location' );
|
535 |
+
|
536 |
// execute on POST and GET
|
537 |
+
if ( isset( $_REQUEST['wpsc_ajax_actions'] ) && 'update_location' == $_REQUEST['wpsc_ajax_actions'] ) {
|
538 |
add_action( 'init', 'wpsc_update_location' );
|
539 |
}
|
540 |
|
|
|
|
|
541 |
|
542 |
function wpsc_cart_html_page() {
|
543 |
require_once(WPSC_FILE_PATH . "/wpsc-includes/shopping_cart_container.php");
|
880 |
add_action( 'wp_ajax_change_tax' , 'wpsc_change_tax' );
|
881 |
add_action( 'wp_ajax_nopriv_change_tax', 'wpsc_change_tax' );
|
882 |
|
883 |
+
// execute on POST and GET
|
884 |
+
if ( isset( $_REQUEST['wpsc_ajax_action'] ) && 'change_tax' == $_REQUEST['wpsc_ajax_action'] ) {
|
885 |
+
add_action( 'init', 'wpsc_change_tax' );
|
886 |
+
}
|
887 |
+
|
888 |
function _wpsc_change_profile_country() {
|
889 |
global $wpdb;
|
890 |
|
1005 |
$download_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `uniqueid` = '%s' AND `downloads` > '0' AND `active`='1' LIMIT 1", $downloadid ), ARRAY_A );
|
1006 |
|
1007 |
if ( is_null( $download_data ) && is_numeric( $downloadid ) )
|
1008 |
+
$download_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `id` = %d AND `downloads` > '0' AND `active`='1' AND `uniqueid` IS NULL LIMIT 1", $downloadid ), ARRAY_A );
|
1009 |
|
1010 |
|
1011 |
if ( (get_option( 'wpsc_ip_lock_downloads' ) == 1) && ($_SERVER['REMOTE_ADDR'] != null) ) {
|
1091 |
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
|
1092 |
}
|
1093 |
header( "Pragma: public" );
|
1094 |
+
header( "Expires: 0" );
|
1095 |
|
1096 |
// destroy the session to allow the file to be downloaded on some buggy browsers and webservers
|
1097 |
session_destroy();
|
1124 |
}
|
1125 |
else {
|
1126 |
?>
|
1127 |
+
<tr class="wpsc_shipping_info">
|
1128 |
+
<td colspan="5">
|
1129 |
+
<?php _e( 'Please choose a country below to calculate your shipping costs', 'wpsc' ); ?>
|
1130 |
+
</td>
|
1131 |
+
</tr>
|
1132 |
+
|
1133 |
+
<?php if ( ! wpsc_have_shipping_quote() ) : // No valid shipping quotes ?>
|
1134 |
+
<?php if ( wpsc_have_valid_shipping_zipcode() ) : ?>
|
1135 |
+
<tr class='wpsc_update_location'>
|
1136 |
+
<td colspan='5' class='shipping_error' >
|
1137 |
+
<?php _e('Please provide a Zipcode and click Calculate in order to continue.', 'wpsc'); ?>
|
1138 |
+
</td>
|
1139 |
+
</tr>
|
1140 |
+
<?php else : ?>
|
1141 |
+
<tr class='wpsc_update_location_error'>
|
1142 |
+
<td colspan='5' class='shipping_error' >
|
1143 |
+
<?php _e('Sorry, online ordering is unavailable to this destination and/or weight. Please double check your destination details.', 'wpsc'); ?>
|
1144 |
+
</td>
|
1145 |
+
</tr>
|
1146 |
+
<?php endif; ?>
|
1147 |
+
<?php endif; ?>
|
1148 |
+
<tr class='wpsc_change_country'>
|
1149 |
+
<td colspan='5'>
|
1150 |
+
<form name='change_country' id='change_country' action='' method='post'>
|
1151 |
+
<?php echo wpsc_shipping_country_list();?>
|
1152 |
+
<input type='hidden' name='wpsc_update_location' value='true' />
|
1153 |
+
<input type='submit' name='wpsc_submit_zipcode' value='<?php esc_attr_e( 'Calculate', 'wpsc' ); ?>' />
|
1154 |
+
</form>
|
1155 |
+
</td>
|
1156 |
+
</tr>
|
1157 |
+
|
1158 |
+
<?php if (wpsc_have_morethanone_shipping_quote()) :?>
|
1159 |
+
<?php while (wpsc_have_shipping_methods()) : wpsc_the_shipping_method(); ?>
|
1160 |
+
<?php if ( ! wpsc_have_shipping_quotes() ) { continue; } // Don't display shipping method if it doesn't have at least one quote ?>
|
1161 |
+
<tr class='wpsc_shipping_header'><td class='shipping_header' colspan='5'><?php echo wpsc_shipping_method_name().__(' - Choose a Shipping Rate', 'wpsc'); ?> </td></tr>
|
1162 |
+
<?php while (wpsc_have_shipping_quotes()) : wpsc_the_shipping_quote(); ?>
|
1163 |
+
<tr class='<?php echo wpsc_shipping_quote_html_id(); ?>'>
|
1164 |
+
<td class='wpsc_shipping_quote_name wpsc_shipping_quote_name_<?php echo wpsc_shipping_quote_html_id(); ?>' colspan='3'>
|
1165 |
+
<label for='<?php echo wpsc_shipping_quote_html_id(); ?>'><?php echo wpsc_shipping_quote_name(); ?></label>
|
1166 |
+
</td>
|
1167 |
+
<td class='wpsc_shipping_quote_price wpsc_shipping_quote_price_<?php echo wpsc_shipping_quote_html_id(); ?>' style='text-align:center;'>
|
1168 |
+
<label for='<?php echo wpsc_shipping_quote_html_id(); ?>'><?php echo wpsc_shipping_quote_value(); ?></label>
|
1169 |
+
</td>
|
1170 |
+
<td class='wpsc_shipping_quote_radio wpsc_shipping_quote_radio_<?php echo wpsc_shipping_quote_html_id(); ?>' style='text-align:center;'>
|
1171 |
+
<?php if(wpsc_have_morethanone_shipping_methods_and_quotes()): ?>
|
1172 |
+
<input type='radio' id='<?php echo wpsc_shipping_quote_html_id(); ?>' <?php echo wpsc_shipping_quote_selected_state(); ?> onclick='switchmethod("<?php echo wpsc_shipping_quote_name(); ?>", "<?php echo wpsc_shipping_method_internal_name(); ?>")' value='<?php echo wpsc_shipping_quote_value(true); ?>' name='shipping_method' />
|
1173 |
+
<?php else: ?>
|
1174 |
+
<input <?php echo wpsc_shipping_quote_selected_state(); ?> disabled='disabled' type='radio' id='<?php echo wpsc_shipping_quote_html_id(); ?>' value='<?php echo wpsc_shipping_quote_value(true); ?>' name='shipping_method' />
|
1175 |
+
<?php wpsc_update_shipping_single_method(); ?>
|
1176 |
+
<?php endif; ?>
|
1177 |
+
</td>
|
1178 |
+
</tr>
|
1179 |
+
<?php endwhile; ?>
|
1180 |
+
<?php endwhile; ?>
|
1181 |
+
<?php endif; ?>
|
1182 |
+
|
1183 |
+
<?php wpsc_update_shipping_multiple_methods(); ?>
|
1184 |
|
1185 |
<?php
|
1186 |
|
1187 |
}
|
1188 |
exit;
|
1189 |
+
}
|
|
|
|
|
|
wpsc-includes/product-template.php
CHANGED
@@ -1101,9 +1101,10 @@ function wpsc_the_product_image( $width = '', $height = '', $product_id = '' ) {
|
|
1101 |
|
1102 |
$product_thumbnail_id = wpsc_the_product_thumbnail_id( $product_id );
|
1103 |
$src = wp_get_attachment_image_src( $product_thumbnail_id, 'large' );
|
|
|
1104 |
|
1105 |
if ( is_ssl() && ! empty( $src ) )
|
1106 |
-
$src = str_replace( 'http://', 'https://', $src );
|
1107 |
|
1108 |
return apply_filters( 'wpsc_product_image', $src );
|
1109 |
}
|
@@ -1665,13 +1666,13 @@ function wpsc_the_variation_price( $return_as_numeric = false ) {
|
|
1665 |
if ( $wpsc_variations->variation_count > 0 ) {
|
1666 |
|
1667 |
$product_id = get_the_ID();
|
1668 |
-
$wpq = array(
|
1669 |
'variations' => $wpsc_variations->variation->slug,
|
1670 |
'post_status' => array( 'inherit', 'publish' ),
|
1671 |
'post_type' => 'wpsc-product',
|
1672 |
-
'post_parent' => $product_id
|
1673 |
);
|
1674 |
-
|
1675 |
$query = new WP_Query( $wpq );
|
1676 |
// Should never happen
|
1677 |
if ( $query->post_count != 1 )
|
@@ -1681,16 +1682,16 @@ function wpsc_the_variation_price( $return_as_numeric = false ) {
|
|
1681 |
|
1682 |
$price = get_product_meta( $variation_product_id, 'price',true );
|
1683 |
$special_price = get_product_meta( $variation_product_id, 'special_price', true );
|
1684 |
-
|
1685 |
if ( $special_price < $price && $special_price > 0 )
|
1686 |
$price = $special_price;
|
1687 |
-
|
1688 |
$price = apply_filters( 'wpsc_do_convert_price', $price, $product_id, $variation_product_id );
|
1689 |
$output = $return_as_numeric ? $price : wpsc_currency_display( $price, array( 'display_as_html' => false ) );
|
1690 |
} else {
|
1691 |
$output = false;
|
1692 |
}
|
1693 |
-
|
1694 |
return $output;
|
1695 |
}
|
1696 |
|
1101 |
|
1102 |
$product_thumbnail_id = wpsc_the_product_thumbnail_id( $product_id );
|
1103 |
$src = wp_get_attachment_image_src( $product_thumbnail_id, 'large' );
|
1104 |
+
$src = is_array( $src ) ? $src[0] : $src;
|
1105 |
|
1106 |
if ( is_ssl() && ! empty( $src ) )
|
1107 |
+
$src = str_replace( 'http://', 'https://', $src[0] );
|
1108 |
|
1109 |
return apply_filters( 'wpsc_product_image', $src );
|
1110 |
}
|
1666 |
if ( $wpsc_variations->variation_count > 0 ) {
|
1667 |
|
1668 |
$product_id = get_the_ID();
|
1669 |
+
$wpq = array(
|
1670 |
'variations' => $wpsc_variations->variation->slug,
|
1671 |
'post_status' => array( 'inherit', 'publish' ),
|
1672 |
'post_type' => 'wpsc-product',
|
1673 |
+
'post_parent' => $product_id
|
1674 |
);
|
1675 |
+
|
1676 |
$query = new WP_Query( $wpq );
|
1677 |
// Should never happen
|
1678 |
if ( $query->post_count != 1 )
|
1682 |
|
1683 |
$price = get_product_meta( $variation_product_id, 'price',true );
|
1684 |
$special_price = get_product_meta( $variation_product_id, 'special_price', true );
|
1685 |
+
|
1686 |
if ( $special_price < $price && $special_price > 0 )
|
1687 |
$price = $special_price;
|
1688 |
+
|
1689 |
$price = apply_filters( 'wpsc_do_convert_price', $price, $product_id, $variation_product_id );
|
1690 |
$output = $return_as_numeric ? $price : wpsc_currency_display( $price, array( 'display_as_html' => false ) );
|
1691 |
} else {
|
1692 |
$output = false;
|
1693 |
}
|
1694 |
+
|
1695 |
return $output;
|
1696 |
}
|
1697 |
|