Changeset 840335
- Timestamp:
- 01/17/2014 02:42:44 PM (12 years ago)
- Location:
- wp-e-commerce/trunk
- Files:
-
- 3 added
- 23 edited
-
readme.txt (modified) (2 diffs)
-
wp-shopping-cart.php (modified) (1 diff)
-
wpsc-admin/admin.php (modified) (1 diff)
-
wpsc-admin/css/admin.css (modified) (6 diffs)
-
wpsc-admin/css/xit.gif (added)
-
wpsc-admin/db-upgrades/routines/9.php (added)
-
wpsc-admin/display-sales-logs.php (modified) (2 diffs)
-
wpsc-admin/includes/display-items-functions.php (modified) (1 diff)
-
wpsc-admin/includes/product-functions.php (modified) (2 diffs)
-
wpsc-admin/js/admin.js (modified) (2 diffs)
-
wpsc-components/marketplace-core-v1/library/Sputnik.php (modified) (3 diffs)
-
wpsc-components/merchant-core-v2/helpers/checkout.php (modified) (1 diff)
-
wpsc-components/theme-engine-v1/helpers/checkout.php (modified) (1 diff)
-
wpsc-components/theme-engine-v1/helpers/page.php (modified) (2 diffs)
-
wpsc-components/theme-engine-v1/helpers/query.php (modified) (1 diff)
-
wpsc-components/theme-engine-v1/templates/wpsc-default.css (modified) (1 diff)
-
wpsc-core/js/wp-e-commerce.js (modified) (1 diff)
-
wpsc-core/wpsc-constants.php (modified) (2 diffs)
-
wpsc-core/wpsc-deprecated.php (modified) (1 diff)
-
wpsc-includes/customer.php (modified) (5 diffs)
-
wpsc-includes/wpsc-meta-init.php (modified) (3 diffs)
-
wpsc-includes/wpsc-meta-purchase.php (added)
-
wpsc-shipping/ups_20.php (modified) (7 diffs)
-
wpsc-shipping/usps_20.php (modified) (9 diffs)
-
wpsc-theme/wpsc-default.css (modified) (1 diff)
-
wpsc-updates/database_template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-e-commerce/trunk/readme.txt
r836750 r840335 5 5 Requires at least: 3.7 6 6 Tested up to: 3.8 7 Stable tag: 3.8.13. 27 Stable tag: 3.8.13.3 8 8 9 9 WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online. … … 146 146 147 147 == Changelog == 148 149 = 3.8.13.3 = 150 * Fix: Users disappear in Network Admin -> Users page (for multisite) 151 * Fix: User counts are incorrect when there are thousands separators. 152 * Fix: "Save Product Files" button doesn't like being clicked on. 153 148 154 149 155 = 3.8.13.2 = -
wp-e-commerce/trunk/wp-shopping-cart.php
r836750 r840335 130 130 $wpdb->wpsc_cart_itemmeta = WPSC_TABLE_CART_ITEM_META; // required for _get_meta_table() 131 131 $wpdb->wpsc_cart_item_meta = WPSC_TABLE_CART_ITEM_META; 132 $wpdb->wpsc_purchase_meta = WPSC_TABLE_PURCHASE_META; 132 133 $wpdb->wpsc_product_rating = WPSC_TABLE_PRODUCT_RATING; 133 134 $wpdb->wpsc_download_status = WPSC_TABLE_DOWNLOAD_STATUS; -
wp-e-commerce/trunk/wpsc-admin/admin.php
r836750 r840335 1061 1061 $timeranges[2]["end"] = mktime( 0, 0, 0, $this_month, 1, $this_year ); 1062 1062 $timeranges[3]["start"] = mktime( 0, 0, 0, $this_month, 1, $this_year ); 1063 $timeranges[3]["end"] = mktime();1063 $timeranges[3]["end"] = time(); // using mktime here can generate a php runtime warning 1064 1064 1065 1065 $prod_data = array( ); -
wp-e-commerce/trunk/wpsc-admin/css/admin.css
r836750 r840335 348 348 } 349 349 350 .newCurrency { 351 width: 50%; 352 word-wrap: break-word; 353 height: auto; 354 } 355 356 .newCurrPrice { 350 351 /** 352 * Product Currency and Quantity Discount Layers 353 */ 354 355 .wpsc-currency-layers { 356 clear: both; 357 margin: 0 0 15px 0; 358 padding: 15px 0 0 0; 359 } 360 361 .wpsc-quantity-discounts { 362 clear: both; 363 margin: 0 0 20px 0; 364 } 365 366 .wpsc-currency-layers table, 367 .wpsc-quantity-discounts table { 368 border-collapse: collapse; 369 margin: 10px 0; 370 width: 100%; 371 } 372 373 .wpsc-quantity-discounts table { 374 margin-top: 20px; 375 } 376 377 .wpsc-currency-layers th, 378 .wpsc-quantity-discounts th { 379 font-weight: normal; 380 text-align: left; 381 vertical-align: bottom; 382 } 383 384 .wpsc-currency-layers th.price, 385 .wpsc-quantity-discounts th.price { 357 386 width: 30%; 358 387 } 359 388 360 .wpsc_delete_currency_layer { 361 text-decoration: none; 389 .wpsc-quantity-discounts th.qty { 390 width: 40%; 391 } 392 393 .wpsc-quantity-discounts td { 394 line-height: 28px; 395 } 396 397 .wpsc-quantity-discounts td.curr { 398 text-align: right; 399 } 400 401 .wpsc-currency-layers th.remove, 402 .wpsc-quantity-discounts th.remove { 403 width: 20px; 404 } 405 406 .wpsc-currency-layers td, 407 .wpsc-quantity-discounts td { 408 padding: 3px 2px 3px 0px; 409 } 410 411 .wpsc-currency-layers .newCurrency { 412 margin: 0px; 413 width: 95%; 414 } 415 416 .wpsc-quantity-discounts .qty input { 417 width: 4em; 418 } 419 420 .wpsc-currency-layers .newCurrPrice, 421 .wpsc-quantity-discounts .newCurrPrice { 422 width: 100%; 423 } 424 425 .wpsc_delete_currency_layer, 426 .wpsc-quantity-discounts .remove_line { 427 color: #bbb; 362 428 display: block-inline; 363 color: red; 364 font-weight: bold; 429 font size: 16px; 430 line-height: 20px; 431 margin: 4px 0 0 0; 365 432 text-align: center; 366 } 367 368 .wpsc_delete_currency_layer:hover { 369 text-decoration: underline; 433 width: 20px; 434 height: 20px; 435 } 436 437 .wpsc_delete_currency_layer:hover, 438 .wpsc-quantity-discounts .remove_line:hover { 439 color: #c00; 370 440 } 371 441 … … 376 446 377 447 div.wpsc_floatleft label { 378 line-height: 18px;379 white-space: nowrap;448 line-height: 18px; 449 white-space: nowrap; 380 450 } 381 451 … … 873 943 overflow-y: auto; 874 944 position: relative; 945 width: 100%; 875 946 } 876 947 … … 2139 2210 } 2140 2211 2141 .remove_line {2142 color: red;2143 text-decoration: none;2144 text-align: center;2145 font-weight: bold;2146 }2147 2148 .remove_line:hover {2149 text-decoration: underline;2150 }2151 2152 2212 2153 2213 /** … … 2192 2252 padding-top: 5px !important; 2193 2253 padding-bottom: 5px !important; 2194 }2195 2196 #table_rate td {2197 padding-bottom: 10px;2198 2254 } 2199 2255 … … 2449 2505 } 2450 2506 2507 .branch-3-7 .wpsc-currency-layers td.remove a, 2508 .branch-3-7 .wpsc-quantity-discounts td.remove a, 2509 .branch-3-6 .wpsc-currency-layers td.remove a, 2510 .branch-3-6 .wpsc-quantity-discounts td.remove a { 2511 background: url(xit.gif) no-repeat 0 0; 2512 display: inline-block; 2513 margin-top: 7px; 2514 overflow: hidden; 2515 text-indent: -999px; 2516 width: 10px; 2517 height: 10px; 2518 } 2519 2520 .branch-3-7 .wpsc-currency-layers td.remove a:hover, 2521 .branch-3-7 .wpsc-quantity-discounts td.remove a:hover, 2522 .branch-3-6 .wpsc-currency-layers td.remove a:hover, 2523 .branch-3-6 .wpsc-quantity-discounts td.remove a:hover { 2524 background-position: -10px 0; 2525 } -
wp-e-commerce/trunk/wpsc-admin/display-sales-logs.php
r725142 r840335 241 241 </tr> 242 242 <?php 243 do_action( 'wpsc_additional_sales_item_info', wpsc_purchaselog_details_id() ); 243 244 endwhile; 244 245 } … … 302 303 register_column_headers( 'wpsc_purchase_log_item_details', $columns ); 303 304 304 include( 'includes/purchase-logs-page/packing-slip.php' ); 305 if ( file_exists( get_stylesheet_directory() . '/wpsc-packing-slip.php' ) ) { 306 include( get_stylesheet_directory() . '/wpsc-packing-slip.php' ); 307 } else { 308 include( 'includes/purchase-logs-page/packing-slip.php' ); 309 } 310 305 311 exit; 306 312 } -
wp-e-commerce/trunk/wpsc-admin/includes/display-items-functions.php
r836750 r840335 191 191 </div> 192 192 193 <div style="clear:both; margin-bottom:20px;"></div> 194 195 <div class='new_layer' style="display:none"> 196 <select name='newCurrency[]' class='newCurrency'> 197 198 <?php foreach ( (array)$currency_data as $currency ) {?> 199 <option value='<?php echo $currency['id']; ?>' > 200 <?php echo esc_html( $currency['country'] ); ?> 201 </option> 202 <?php } ?> 203 </select> 204 205 <input type='number' min="0" step="0.1" 206 class='newCurrPrice text' 207 size='8' 208 name='newCurrPrice[]' 209 value='0.00' /> 210 <a href="#" class='wpsc_delete_currency_layer<?php echo $currency_delete_class; ?>'><?php echo $currency_delete_text; ?></a> 211 193 <div class="wpsc-currency-layers"> 194 <table> 195 <thead> 196 <tr> 197 <th class="type" colspan="2"><?php esc_html_e( 'Alternative Currencies:', 'wpsc' ); ?></th> 198 <th class="price"><?php esc_html_e( 'Price:', 'wpsc' ); ?></th> 199 <tr> 200 </thead> 201 <tbody> 202 <?php 203 if ( isset( $product_alt_currency ) && is_array( $product_alt_currency ) ) : 204 $i = 0; 205 foreach ( $product_alt_currency as $iso => $alt_price ) : 206 $i++; 207 ?> 208 <tr class="wpsc_additional_currency"> 209 <td class="remove"><a href="#" class="wpsc_delete_currency_layer<?php echo $currency_delete_class; ?>" rel="<?php echo $iso; ?>"><?php echo $currency_delete_text; ?></a></td> 210 <td> 211 <select name="newCurrency[]" class="newCurrency"> 212 <?php foreach ( $currency_data as $currency ) : ?> 213 <option value="<?php echo $currency['id']; ?>" <?php selected( $iso, $currency['isocode'] ); ?>> 214 <?php echo htmlspecialchars( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>) 215 </option> 216 <?php endforeach; ?> 217 </select> 218 </td> 219 <td><input type="number" min="0" step="0.1" class="newCurrPrice text" size="8" name="newCurrPrice[]" value="<?php echo $alt_price; ?>" /></td> 220 </tr> 221 <?php 222 endforeach; 223 endif; 224 ?> 225 <tr id="wpsc_currency_row_template" class="template hidden"> 226 <td class="remove"><a href="#" class="wpsc_delete_currency_layer<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td> 227 <td> 228 <select name="newCurrency[]" class="newCurrency"> 229 <?php foreach ( (array)$currency_data as $currency ) { ?> 230 <option value="<?php echo $currency['id']; ?>"> 231 <?php echo esc_html( $currency['country'] ); ?> 232 </option> 233 <?php } ?> 234 </select> 235 </td> 236 <td><input type="number" min="0" step="0.1" class="newCurrPrice text" size="8" name="newCurrPrice[]" value="0.00" /></td> 237 </tr> 238 </tbody> 239 </table> 240 <a href="#wpsc_currency_row_template" class="button button-small wpsc_add_new_currency"><?php esc_html_e( 'Add a Currency Option', 'wpsc' ); ?></a> 241 <?php wp_nonce_field( 'update-options', 'wpsc-update-currency-layers', false ); ?> 212 242 </div> 213 243 214 <a href='#' 215 class='button button-small wpsc_add_new_currency' 216 style="margin-top:10px;"> 217 <?php esc_html_e( '+ Currency Option', 'wpsc' ); ?> 218 </a> 219 220 <?php 221 if ( isset( $product_alt_currency ) && is_array( $product_alt_currency ) ) : 222 $i = 0; 223 foreach ( $product_alt_currency as $iso => $alt_price ) : 224 $i++; 225 ?> 226 <div class='wpsc_additional_currency'> 227 <label for='newCurrency[]'><?php esc_html_e( 'Currency type', 'wpsc' ); ?>:</label><br /> 228 <select name='newCurrency[]' class='newCurrency' style='width:42%'> 229 <?php 230 foreach ( $currency_data as $currency ) : 231 if ( $iso == $currency['isocode'] ) 232 $selected = "selected='selected'"; 233 else 234 $selected = ""; 235 ?> 236 <option value='<?php echo $currency['id']; ?>' <?php echo $selected; ?> > 237 <?php echo htmlspecialchars( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>) 238 </option> 239 <?php endforeach; ?> 240 </select> 241 242 <?php esc_html_e( 'Price:', 'wpsc' ); ?> <input type='text' class='text' size='8' name='newCurrPrice[]' value='<?php echo $alt_price; ?>' style=' display:inline' /> 243 <a href='#' class='wpsc_delete_currency_layer<?php echo $currency_delete_class; ?>' rel='<?php echo $iso; ?>'><?php if ( ! $wp_38 ) : ?><img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/cross.png' /><?php endif; ?></a></div> 244 <?php 245 endforeach; 246 endif; 247 ?> 248 249 <div id='table_rate'> 250 251 <br style='clear:both' /> 252 <table style="width:100%"> 253 <tbody> 254 <?php 255 if ( count( $product_meta['table_rate_price']['quantity'] ) > 0 ) { 256 foreach ( (array)$product_meta['table_rate_price']['quantity'] as $key => $quantity ) { 257 if ( $quantity != '' ) { 258 $table_price = number_format( $product_meta['table_rate_price']['table_price'][$key], 2, '.', '' ); 259 ?> 260 <tr> 261 <td> 262 <input type="text" size="5" value="<?php echo $quantity; ?>" name="table_rate_price[quantity][]"/> 263 <span class='description'><?php esc_html_e( 'and above', 'wpsc' ); ?></span> 264 </td> 265 <td> 266 <input type="text" size="10" value="<?php echo $table_price; ?>" name="table_rate_price[table_price][]" /> 267 </td> 268 <td> 269 <a href="#" class="remove_line<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a> 270 </td> 271 </tr> 272 <?php 273 } 274 } 275 } 276 ?> 277 <tr id="sample_qd"> 278 <td> 279 <span> 280 <input type="number" size="5" 281 min="0" step="1" value="0" 282 style="width:60px;" 283 name="table_rate_price[quantity][]"/> 284 <?php esc_html_e( '+', 'wpsc' );?> 285 </span> 286 </td> 287 288 <td style="text-align:right;"> 289 <span> 290 <?php echo $ct_code.' '.$ct_symb; ?> 291 <input type="number" size="10" 292 min = "0" step="0.1" value="0" 293 style="width:80px;" 294 name="table_rate_price[table_price][]" /> 295 </span> 296 </td> 297 <td style="vertical-align:middle; width:20px; text-align:center;"> 298 <a href="#" class="remove_line<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a> 299 </td> 300 </tr> 301 </tbody> 302 </table> 303 304 <a class='add_level button button-small' 305 style="margin-top:10px;"> 306 <?php esc_html_e( '+ Quantity Discount', 'wpsc' ); ?> 307 </a> 308 309 <div style='clear:both; margin-bottom:20px;'></div> 310 311 <input id='add_form_donation' 312 type='checkbox' 313 name='meta[_wpsc_is_donation]' 314 value='yes' 315 <?php checked( $product_data['meta']['_wpsc_is_donation'] , 1 ); ?> /> 316 317 <label for='add_form_donation'><?php echo __( 'Purchase is a donation.', 'wpsc' ) ?></label> 318 319 </div> 244 <div class="wpsc-quantity-discounts"> 245 <table> 246 <thead> 247 <tr> 248 <th class="qty" colspan="2"><?php esc_html_e( 'Quantity:', 'wpsc' ); ?></th> 249 <th class="curr"><span class="hidden"><?php esc_html_e( 'Currency:', 'wpsc' ); ?><span></th> 250 <th class="price"><?php esc_html_e( 'Price:', 'wpsc' ); ?></th> 251 </tr> 252 </thead> 253 <tbody> 254 <?php 255 if ( count( $product_meta['table_rate_price']['quantity'] ) > 0 ) { 256 foreach ( (array)$product_meta['table_rate_price']['quantity'] as $key => $quantity ) { 257 if ( $quantity != '' ) { 258 $table_price = number_format( $product_meta['table_rate_price']['table_price'][ $key ], 2, '.', '' ); 259 ?> 260 <tr> 261 <td class="remove"><a href="#" class="remove_line<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td> 262 <td class="qty"> 263 <input type="text" size="5" value="<?php echo $quantity; ?>" name="table_rate_price[quantity][]" /> 264 <?php esc_html_e( '+', 'wpsc' ); ?> 265 </td> 266 <td class="curr"><?php echo $ct_code . ' ' . $ct_symb; ?></td> 267 <td><input type="number" size="10" min="0" step="0.1" class="newCurrPrice text" value="<?php echo $table_price; ?>" name="table_rate_price[table_price][]" /></td> 268 </tr> 269 <?php 270 } 271 } 272 } 273 ?> 274 <tr id="wpsc_quantity_discount_row_template" class="template hidden"> 275 <td class="remove"><a href="#" class="remove_line<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td> 276 <td class="qty"> 277 <input type="number" size="5" min="0" step="1" value="0" name="table_rate_price[quantity][]" /> 278 <?php esc_html_e( '+', 'wpsc' ); ?> 279 </td> 280 <td class="curr"><?php echo $ct_code . ' ' . $ct_symb; ?></td> 281 <td><input type="number" size="10" min="0" step="0.1" class="newCurrPrice text" value="0" name="table_rate_price[table_price][]" /></td> 282 </tr> 283 </tbody> 284 </table> 285 <a href="#wpsc_quantity_discount_row_template" class="add_level button button-small"><?php esc_html_e( 'Add a Quantity Discount', 'wpsc' ); ?></a> 286 <?php wp_nonce_field( 'update-options', 'wpsc-update-quantity-discounts', false ); ?> 287 </div> 288 289 <input id="add_form_donation" type="checkbox" name="meta[_wpsc_is_donation]" value="yes" <?php checked( $product_data['meta']['_wpsc_is_donation'], 1 ); ?> /> 290 <label for="add_form_donation"><?php _e( 'Purchase is a donation.', 'wpsc' ) ?></label> 291 320 292 <?php endif; ?> 321 293 <?php -
wp-e-commerce/trunk/wpsc-admin/includes/product-functions.php
r836750 r840335 91 91 } 92 92 93 // table rate price 94 $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] = isset( $post_data['table_rate_price'] ) ? $post_data['table_rate_price'] : array(); 95 96 // if table_rate_price is unticked, wipe the table rate prices 97 if ( empty( $post_data['table_rate_price']['state'] ) ) { 98 $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] = array(); 99 $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] = array(); 100 } 101 102 if ( ! empty( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] ) ) { 103 foreach ( (array) $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] as $key => $value ){ 104 if(empty($value)){ 105 unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][$key]); 106 unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][$key]); 93 // Update the table rate prices (quantity discounts) 94 if ( isset( $post_data['wpsc-update-quantity-discounts'] ) && wp_verify_nonce( $post_data['wpsc-update-quantity-discounts'], 'update-options' ) ) { 95 $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] = isset( $post_data['table_rate_price'] ) ? $post_data['table_rate_price'] : array(); 96 97 // If table_rate_price is empty, set empty table rate price arrays 98 if ( empty( $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] ) ) { 99 $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] = array(); 100 $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] = array(); 101 } 102 103 // Remove any rates with no quantity or price 104 if ( ! empty( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] ) ) { 105 foreach ( (array) $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] as $key => $value ) { 106 if ( empty( $value ) ) { 107 unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][ $key ] ); 108 unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][ $key ] ); 109 } 110 } 111 foreach ( (array) $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] as $key => $value ) { 112 if ( empty( $value ) ) { 113 unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][ $key ] ); 114 unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][ $key ] ); 115 } 107 116 } 108 117 } … … 187 196 wpsc_update_custom_meta($product_id, $post_data); 188 197 189 //and the alt currency 190 if ( ! empty( $post_data['newCurrency'] ) ) { 191 foreach( (array) $post_data['newCurrency'] as $key =>$value ){ 192 wpsc_update_alt_product_currency( $product_id, $value, $post_data['newCurrPrice'][$key] ); 198 // Update the alternative currencies 199 if ( isset( $post_data['wpsc-update-currency-layers'] ) && wp_verify_nonce( $post_data['wpsc-update-currency-layers'], 'update-options' ) ) { 200 201 // Clear currencies before re-saving to make sure deleted currencies are removed 202 update_product_meta( $product_id, 'currency', array() ); 203 204 if ( ! empty( $post_data['newCurrency'] ) ) { 205 foreach( (array) $post_data['newCurrency'] as $key =>$value ) { 206 wpsc_update_alt_product_currency( $product_id, $value, $post_data['newCurrPrice'][ $key ] ); 207 } 193 208 } 194 209 } -
wp-e-commerce/trunk/wpsc-admin/js/admin.js
r836750 r840335 186 186 }); 187 187 188 //new currency JS in admin product page 189 190 var firstclick = true; 191 192 jQuery('#wpsc_price_control_forms').on( 'click', 'a.wpsc_add_new_currency', function( event ){ 193 if(firstclick == true){ 194 jQuery('div.new_layer').first().show(); 195 html = jQuery('div.new_layer').html(); 196 firstclick = false; 197 }else{ 198 jQuery('a.wpsc_add_new_currency').before('<div class="new_layer">'+html+'</div>'); 199 } 200 event.preventDefault(); 201 }); 202 203 //delete currency layer in admin product page 204 jQuery('#wpsc_price_control_forms').on( 'click', 'a.wpsc_delete_currency_layer', function(event){ 205 jQuery(this).prev('input').val(''); 206 jQuery(this).prev('select').val(''); 207 jQuery(this).parent('div:first').remove(); 208 event.preventDefault(); 209 }); 210 211 //As far as I can tell, WP provides no good way of unsetting elements in the bulk edit area...tricky jQuery action will do for now....not ideal whatsoever, nor eternally stable. 188 /* 189 Alternative Currencies 190 Trigger and handle UI events for adding and removing currency layers. 191 */ 192 193 var currencyRowTemplate = jQuery( '.wpsc-currency-layers tr.template' ).remove().removeClass( 'template hidden' ).removeAttr( 'id' ); 194 195 // Hide table if empty 196 if ( jQuery( '.wpsc-currency-layers tbody tr' ).length == 0 ) { 197 jQuery( '.wpsc-currency-layers table' ).hide(); 198 } 199 200 // Add new currency layer 201 jQuery( '.wpsc-currency-layers' ).on( 'click', 'a.wpsc_add_new_currency', function( e ) { 202 jQuery( this ).siblings( 'table' ).show(); 203 jQuery( '.wpsc-currency-layers tbody' ).append( currencyRowTemplate.clone() ); 204 e.preventDefault(); 205 }); 206 207 // Delete currency layer in admin product page 208 jQuery( '.wpsc-currency-layers' ).on( 'click', 'a.wpsc_delete_currency_layer', function( e ) { 209 var currencyRow = jQuery( this ).closest( 'tr' ); 210 currencyRow.find( 'input' ).val( '' ); 211 currencyRow.find( 'select' ).val( '' ); 212 if ( currencyRow.siblings().length == 0 ) { 213 currencyRow.closest( 'table' ).hide(); 214 } 215 currencyRow.remove(); 216 e.preventDefault(); 217 }); 218 219 /* 220 Quantity Discounts 221 Trigger and handle UI events for adding and removing quantity dicounts. 222 */ 223 224 var qtyRowTemplate = jQuery( '.wpsc-quantity-discounts tr.template' ).remove().removeClass( 'template hidden' ).removeAttr( 'id' ); 225 226 // Hide table if empty 227 if ( jQuery( '.wpsc-quantity-discounts tbody tr' ).length == 0 ) { 228 jQuery( '.wpsc-quantity-discounts table' ).hide(); 229 } 230 231 // Add new row to rate table 232 jQuery( '.wpsc-quantity-discounts' ).on( 'click', '.add_level', function( e ) { 233 jQuery( this ).siblings( 'table' ).show(); 234 added = jQuery( '.wpsc-quantity-discounts tbody' ).append( qtyRowTemplate.clone() ); 235 e.preventDefault(); 236 }); 237 238 // Remove a row from rate table 239 jQuery( '.wpsc-quantity-discounts' ).on( 'click', '.remove_line', function( e ) { 240 var qtyRow = jQuery( this ).closest( 'tr' ); 241 qtyRow.find( 'input' ).val( '' ); 242 if ( qtyRow.siblings().length == 0 ) { 243 qtyRow.closest( 'table' ).hide(); 244 } 245 qtyRow.remove(); 246 e.preventDefault(); 247 }); 248 249 /* 250 As far as I can tell, WP provides no good way of unsetting elements in the bulk edit area... 251 tricky jQuery action will do for now....not ideal whatsoever, nor eternally stable. 252 */ 212 253 if( pagenow == 'edit-wpsc-product' ) { 213 254 jQuery('.inline-edit-password-input').closest('.inline-edit-group').css('display', 'none'); … … 274 315 }); 275 316 276 // RATE TABLE277 var sample_qd = jQuery('#sample_qd').remove().removeAttr('id');278 279 // Add new row to rate table280 jQuery( 'div#table_rate' ).on( 'click', '.add_level', function(){281 added = jQuery('#table_rate tbody').append(sample_qd.clone());282 });283 284 // Remove a row from rate table285 jQuery( 'div#table_rate' ).on( 'click', '.remove_line', function(){286 jQuery(this).parent().parent('tr').remove();287 event.preventDefault();288 });289 290 317 jQuery( '.wpsc_featured_product_toggle' ).on( 'click', function(){ 291 318 post_values = { -
wp-e-commerce/trunk/wpsc-components/marketplace-core-v1/library/Sputnik.php
r826436 r840335 112 112 foreach ( $cart_contents as $product ) { 113 113 $download_link = get_post_meta( $product->prodid, '_download_url', true ); 114 $download_link = esc_url( add_query_arg( 'marketplace', Sputnik_API::domain(), $download_link ) ); 115 $products .= "\n" . '<a href="' . $download_link . '">Download ' . $product->name . '</a>' . "\n"; 114 if ( !empty ( $download_link) ) { 115 $download_link = esc_url( add_query_arg( 'marketplace', Sputnik_API::domain(), $download_link ) ); 116 $products .= "\n" . '<a href="' . $download_link . '">Download ' . $product->name . '</a>' . "\n"; 117 } 116 118 } 117 119 … … 144 146 } 145 147 146 public function add_download_link_page( $purchase_log_object, $sessionid, $display_to_screen ) {148 public static function add_download_link_page( $purchase_log_object, $sessionid, $display_to_screen ) { 147 149 if ( ! $display_to_screen ) 148 150 return; … … 154 156 foreach ( $cart_contents as $product ) { 155 157 $download_link = get_post_meta( $product->prodid, '_download_url', true ); 156 $download_link = esc_url( add_query_arg( 'marketplace', Sputnik_API::domain(), $download_link ) ); 157 $products .= "\n" . '<a href="' . $download_link . '">Download ' . $product->name . '</a>' . "\n"; 158 if ( !empty ( $download_link) ) { 159 $download_link = esc_url( add_query_arg( 'marketplace', Sputnik_API::domain(), $download_link ) ); 160 $products .= "\n" . '<a href="' . $download_link . '">Download ' . $product->name . '</a>' . "\n"; 161 } 158 162 } 159 163 -
wp-e-commerce/trunk/wpsc-components/merchant-core-v2/helpers/checkout.php
r803568 r840335 3 3 add_filter( 'wpsc_get_gateway_list', '_wpsc_filter_merchant_v2_get_gateway_list' ); 4 4 5 /** 6 * Get Gateway List 7 * 8 * HTML to display radio button list of payment gateways. 9 * 10 * @return string Payment gateways HTML. 11 * 12 * @uses apply_filters() Calls 'wpsc_gateway_image'. 13 * @uses wpsc_have_gateways() Are there any gateways? 14 * @uses wpsc_the_gateway() Setup gateway data. 15 * @uses wpsc_gateway_name() Gateway display name. 16 * @uses wpsc_gateway_internal_name() Gateway internal name. 17 * @uses wpsc_gateway_is_checked() Gateway radio button checked attribute. 18 * @uses wpsc_show_gateway_image() Show gateway image? 19 * @uses wpsc_gateway_image_url() Gateway image URL 20 * @uses wpsc_gateway_form_field_style() Adds class to show/hide fields based on selected gateway. 21 * @uses wpsc_gateway_form_fields() Addition fields for the gateway. 22 */ 5 23 function _wpsc_filter_merchant_v2_get_gateway_list() { 6 24 ob_start(); 7 while ( wpsc_have_gateways() ) : wpsc_the_gateway(); ?> 8 <div class="custom_gateway"> 9 <label><input type="radio" value="<?php echo wpsc_gateway_internal_name();?>" <?php echo wpsc_gateway_is_checked(); ?> name="custom_gateway" class="custom_gateway"/><?php echo wpsc_gateway_name(); ?> 10 <?php if ( wpsc_show_gateway_image() ): 11 $gateway_image = '<img src="' . esc_url( wpsc_gateway_image_url() ) . '" alt="' . esc_attr( wpsc_gateway_name() ) . '" style="position:relative; top:5px;" />'; 25 while ( wpsc_have_gateways() ) : 26 wpsc_the_gateway(); 27 $gateway_name = wpsc_gateway_name(); 28 ?> 29 <div class="custom_gateway <?php echo sanitize_html_class( wpsc_gateway_internal_name() ); ?>"> 30 <label><input type="radio" value="<?php echo wpsc_gateway_internal_name(); ?>" <?php echo wpsc_gateway_is_checked(); ?> name="custom_gateway" class="custom_gateway" /> 31 <?php if ( ! empty( $gateway_name ) ) { ?> 32 <span class="custom_gateway_name"><?php echo $gateway_name; ?></span> 33 <?php } ?> 34 <?php 35 if ( wpsc_show_gateway_image() ) : 36 $gateway_image = '<img src="' . esc_url( wpsc_gateway_image_url() ) . '" alt="' . esc_attr( $gateway_name ) . '" class="custom_gateway_image" />'; 12 37 echo apply_filters( 'wpsc_gateway_image', $gateway_image, wpsc_gateway_internal_name() ); 13 endif; ?> 38 endif; 39 ?> 14 40 </label> 15 16 41 <?php if ( wpsc_gateway_form_fields() ) : ?> 17 <table class= 'wpsc_checkout_table <?php echo wpsc_gateway_form_field_style();?>'>18 <?php echo wpsc_gateway_form_fields(); ?>42 <table class="wpsc_checkout_table <?php echo wpsc_gateway_form_field_style(); ?>"> 43 <?php echo wpsc_gateway_form_fields(); ?> 19 44 </table> 20 45 <?php endif; ?> 21 46 </div> 22 <?php endwhile; 47 <?php 48 endwhile; 23 49 return ob_get_clean(); 24 50 } -
wp-e-commerce/trunk/wpsc-components/theme-engine-v1/helpers/checkout.php
r734596 r840335 137 137 return true; 138 138 endif; 139 140 return false; 139 141 } 140 142 -
wp-e-commerce/trunk/wpsc-components/theme-engine-v1/helpers/page.php
r836750 r840335 14 14 add_action( 'update_option_category_image_height' , 'wpsc_cache_to_upload' ); 15 15 add_action('template_redirect', 'wpsc_all_products_on_page'); 16 add_action('post_thumbnail_html','wpsc_the_featured_image_fix', 10, 2);17 16 add_filter( 'aioseop_description', 'wpsc_set_aioseop_description' ); 18 17 add_filter('request', 'wpsc_remove_page_from_query_string'); … … 1227 1226 $hide_subcatsprods = new WPSC_Hide_subcatsprods_in_cat; 1228 1227 add_action( 'pre_get_posts', array( &$hide_subcatsprods, 'get_posts' ) ); 1229 }1230 1231 function wpsc_the_featured_image_fix( $stuff, $post_ID ){1232 global $wp_query;1233 1234 $is_tax = is_tax( 'wpsc_product_category' );1235 1236 $queried_object = get_queried_object();1237 $is_single = is_single() && $queried_object->ID == $post_ID && get_post_type() == 'wpsc-product';1238 1239 if ( $is_tax || $is_single ) {1240 $header_image = get_header_image();1241 $stuff = '';1242 1243 if ( $header_image )1244 $stuff = '<img src="' . esc_url( $header_image ) . '" width="' . HEADER_IMAGE_WIDTH . '" height="' . HEADER_IMAGE_HEIGHT . '" alt="" />';1245 }1246 1247 remove_action('post_thumbnail_html','wpsc_the_featured_image_fix');1248 1249 return $stuff;1250 1228 } 1251 1229 -
wp-e-commerce/trunk/wpsc-components/theme-engine-v1/helpers/query.php
r836750 r840335 185 185 } 186 186 if ( count( $wpsc_query_vars ) <= 1 ) { 187 $post_type_object = get_post_type_object( 'wpsc-product' );188 187 $wpsc_query_vars = array( 189 188 'post_status' => apply_filters( 'wpsc_product_display_status', array( 'publish' ) ), 190 189 'post_parent' => 0, 191 'order' => apply_filters( 'wpsc_product_order', get_option( 'wpsc_product_order', 'ASC' ) ) 190 'order' => apply_filters( 'wpsc_product_order', get_option( 'wpsc_product_order', 'ASC' ) ), 191 'post_type' => apply_filters( 'wpsc_product_post_type', array( 'wpsc-product' ) ), 192 192 ); 193 193 if($wp_query->query_vars['preview']) -
wp-e-commerce/trunk/wpsc-components/theme-engine-v1/templates/wpsc-default.css
r799653 r840335 1060 1060 } 1061 1061 1062 .wpsc_gateway_container .custom_gateway_image { 1063 position: relative; 1064 top: 5px; 1065 } 1066 1062 1067 .wpsc_no_image{ 1063 1068 display: none; -
wp-e-commerce/trunk/wpsc-core/js/wp-e-commerce.js
r826436 r840335 310 310 jQuery( 'div.wpsc_variation_forms' ).on( 'change', '.wpsc_select_variation', function() { 311 311 jQuery('option[value="0"]', this).attr('disabled', 'disabled'); 312 self = this;312 var self = this; 313 313 var parent_form = jQuery(this).closest("form.product_form"); 314 314 if ( parent_form.length === 0 ) -
wp-e-commerce/trunk/wpsc-core/wpsc-constants.php
r836750 r840335 33 33 define( 'WPSC_MINOR_VERSION' , 'e8a508c011' ); 34 34 define( 'WPSC_PRESENTABLE_VERSION', '3.8.14-dev' ); 35 define( 'WPSC_DB_VERSION' , 8);35 define( 'WPSC_DB_VERSION' , 9 ); 36 36 37 37 // Define Debug Variables for developers … … 164 164 165 165 define( 'WPSC_TABLE_CART_ITEM_META', "{$wp_table_prefix}wpsc_cart_item_meta" ); 166 define( 'WPSC_TABLE_PURCHASE_META', "{$wp_table_prefix}wpsc_purchase_meta" ); 166 167 } 167 168 -
wp-e-commerce/trunk/wpsc-core/wpsc-deprecated.php
r826436 r840335 1743 1743 return _wpsc_get_exchange_rate( $from, $to ); 1744 1744 } 1745 1746 1747 /** 1748 * @access public 1749 * @param unknown $stuff 1750 * @param unknown $post_ID 1751 * @return string 1752 * @deprecated since 3.8.13.3 1753 */ 1754 function wpsc_the_featured_image_fix( $stuff, $post_ID ){ 1755 _wpsc_deprecated_function( __FUNCTION__, '3.8.13.2', 'wpsc_the_featured_image_fix'); 1756 global $wp_query; 1757 1758 $is_tax = is_tax( 'wpsc_product_category' ); 1759 1760 $queried_object = get_queried_object(); 1761 $is_single = is_single() && $queried_object->ID == $post_ID && get_post_type() == 'wpsc-product'; 1762 1763 if ( $is_tax || $is_single ) { 1764 $header_image = get_header_image(); 1765 $stuff = ''; 1766 1767 if ( $header_image ) 1768 $stuff = '<img src="' . esc_url( $header_image ) . '" width="' . HEADER_IMAGE_WIDTH . '" height="' . HEADER_IMAGE_HEIGHT . '" alt="" />'; 1769 } 1770 1771 remove_action('post_thumbnail_html','wpsc_the_featured_image_fix'); 1772 1773 return $stuff; 1774 } -
wp-e-commerce/trunk/wpsc-includes/customer.php
r836750 r840335 505 505 */ 506 506 function _wpsc_is_bot_user() { 507 if ( is_user_logged_in() ) 507 508 $is_bot = false; 509 510 if ( is_user_logged_in() ) { 508 511 return false; 509 510 if ( strpos( $_SERVER['REQUEST_URI'], '?wpsc_action=rss' ) ) 512 } 513 514 if ( strpos( $_SERVER['REQUEST_URI'], '?wpsc_action=rss' ) ) { 511 515 return true; 516 } 512 517 513 518 // Cron jobs are not flesh originated 514 if ( defined('DOING_CRON') && DOING_CRON ) 519 if ( defined('DOING_CRON') && DOING_CRON ) { 515 520 return true; 521 } 516 522 517 523 // XML RPC requests are probably from cybernetic beasts 518 if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) 524 if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) { 519 525 return true; 526 } 520 527 521 528 // coming to login first, after the user logs in we know they are a live being, until then they are something else 522 if ( strpos( $_SERVER['PHP_SELF'], 'wp-login' ) || strpos( $_SERVER['PHP_SELF'], 'wp-register' ) ) 529 if ( strpos( $_SERVER['PHP_SELF'], 'wp-login' ) || strpos( $_SERVER['PHP_SELF'], 'wp-register' ) ) { 523 530 return true; 531 } 524 532 525 533 // even web servers talk to themselves when they think no one is listening 526 if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'wordpress' ) !== false ) 534 if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'wordpress' ) !== false ) { 527 535 return true; 536 } 528 537 529 538 // the user agent could be google bot, bing bot or some other bot, one would hope real user agents do not have the … … 540 549 $pattern = '/(' . implode( '|', $bot_agents_patterns ) . ')/i'; 541 550 542 if ( preg_match( $pattern, $_SERVER['HTTP_USER_AGENT'] ) ) 551 if ( preg_match( $pattern, $_SERVER['HTTP_USER_AGENT'] ) ) { 543 552 return true; 553 } 544 554 545 555 // Are we feeding the masses? 546 if ( is_feed() ) 556 if ( is_feed() ) { 547 557 return true; 558 } 548 559 549 560 // at this point we have eliminated all but the most obvious choice, a human (or cylon?) 550 return false;561 return apply_filters( 'wpsc_is_bot_user', false ); 551 562 } 552 563 … … 564 575 */ 565 576 function _wpsc_extract_user_count( $view ) { 566 if ( preg_match( '/class="count">\((\d+)\)/', $view, $matches ) ) { 567 return absint( $matches[1] ); 577 global $wp_locale; 578 if ( preg_match( '/class="count">\((.+)\)/', $view, $matches ) ) { 579 return absint( str_replace( $wp_locale->number_format['thousands_sep'], '', $matches[1] ) ); 568 580 } 569 581 … … 587 599 $all_count = _wpsc_extract_user_count( $views['all'] ); 588 600 $new_count = $all_count - $anon_count; 589 $views['all'] = str_replace( "(${all_count})", "(${new_count})", $views['all'] );601 $views['all'] = preg_replace( '/class="count">\(.+\)/', 'class="count">(' . number_format_i18n( $new_count ) . ')', $views['all'] ); 590 602 } 591 603 … … 618 630 return; 619 631 620 // if the site is multisite, a JOIN is already done632 // if the site is multisite, we need to do things a bit differently 621 633 if ( is_multisite() ) { 622 $query->query_where .= " AND CAST($wpdb->usermeta.meta_value AS CHAR) NOT LIKE '%" . like_escape( '"wpsc_anonymous"' ) . "%'"; 634 // on Network Admin, a JOIN with usermeta is not possible (some users don't have capabilities set, so we fall back to matching user_login, although this is not ideal) 635 if ( empty( $query->query_vars['blog_id'] ) ) { 636 $query->query_where .= " AND $wpdb->users.user_login NOT LIKE '\_________'"; 637 } else { 638 $query->query_where .= " AND CAST($wpdb->usermeta.meta_value AS CHAR) NOT LIKE '%" . like_escape( '"wpsc_anonymous"' ) . "%'"; 639 } 623 640 return; 624 641 } -
wp-e-commerce/trunk/wpsc-includes/wpsc-meta-init.php
r836750 r840335 2 2 3 3 require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-cart-item.php' ); 4 require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-purchase.php' ); 4 5 5 6 /** … … 36 37 .'PRIMARY KEY (meta_id), ' 37 38 .'KEY wpsc_cart_item_id (wpsc_cart_item_id), ' 39 .'KEY meta_key (meta_key(191)), ' 40 .'KEY meta_value (meta_value(20)), ' 41 .'KEY meta_key_and_value (meta_key(191),meta_value(32)), ' 42 .'KEY meta_timestamp_index (meta_timestamp) ' 43 .') '. $charset_collate; 44 45 dbDelta( $sql ); 46 } 47 48 /** 49 * Create the meta table for Purchases 50 * 51 * @since 3.8.12 52 * @access private 53 * 54 */ 55 function _wpsc_create_purchase_meta_table() { 56 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 57 global $wpdb; 58 global $charset_collate; 59 60 $sql = 'CREATE TABLE IF NOT EXISTS '. $wpdb->wpsc_purchase_meta .' (' 61 .'meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, ' 62 .'wpsc_purchase_id bigint(20) unsigned NOT NULL DEFAULT 0 , ' 63 .'meta_key varchar(255) DEFAULT NULL, ' 64 .'meta_value longtext, ' 65 .'meta_timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ' 66 .'PRIMARY KEY (meta_id), ' 67 .'KEY wpsc_purchase_id (wpsc_purchase_id), ' 38 68 .'KEY meta_key (meta_key(191)), ' 39 69 .'KEY meta_value (meta_value(20)), ' … … 130 160 wpsc_meta_migrate( 'cart_item' ); 131 161 } 162 163 function _wpsc_meta_migrate_wpsc_purchase() { 164 wpsc_meta_migrate( 'purchase' ); 165 } -
wp-e-commerce/trunk/wpsc-shipping/ups_20.php
r836750 r840335 13 13 14 14 function ash_ups () { 15 global $wpec_ash;16 15 $this->internal_name = "ups"; 17 16 $this->name = _x( "UPS", 'Shipping Module', 'wpsc' ); … … 22 21 $this->_setServiceURL(); 23 22 $this->_includeUPSData(); 24 $this->shipment = $wpec_ash->get_shipment();25 23 return true; 26 24 } … … 211 209 <label for="ups_singular_shipping" ><?php _e( 'Singular Shipping', 'wpsc' ); ?> *</label> 212 210 <p class='description'><?php _e( 'Rate each quantity of items in a cart as its own package using dimensions on product', 'wpsc' ); ?></p> 211 <input type="checkbox" id="ups_intl_rate" name="wpsc_ups_settings[intl_rate]" value="1" <?php checked( 1, $wpsc_ups_settings['intl_rate'] ); ?> /> 212 <label for="ups_intl_rate" ><?php _e( 'Disable International Shipping', 'wpsc' ); ?></label> 213 <p class='description'><?php _e( 'No shipping rates will be displayed if the shipment destination country is different than your base country/region.', 'wpsc' ); ?></p> 213 214 </td> 214 215 </tr> … … 346 347 private function _build_shipment( &$Shipment, $args ){ 347 348 348 $cart_shipment = apply_filters( 'wpsc_ cart_shipment', $this->shipment, $this->name); //Filter to allow reprocessing shipment packages.349 $cart_shipment = apply_filters( 'wpsc_the_shipment', $this->shipment, $args ); //Filter to allow reprocessing shipment packages. 349 350 350 351 foreach ( $cart_shipment->packages as $package ) { … … 719 720 720 721 function getQuote() { 721 global $wpdb, $wpec_ash; 722 if ( ! is_object( $wpec_ash ) ) { 723 $wpec_ash = new ASH(); 724 } 725 726 722 global $wpdb, $wpec_ash, $wpsc_cart; 727 723 // Arguments array for various functions to use 728 724 $args = array(); 725 726 $args['dest_ccode'] = wpsc_get_customer_meta( 'shipping_country' ); 727 if ( $args['dest_ccode'] == "UK" ) 728 // So, UPS is a little off the times 729 $args['dest_ccode'] = "GB"; 730 // Get the ups settings from the ups account info page (Shipping tab) 731 $wpsc_ups_settings = get_option( "wpsc_ups_settings", array() ); 732 //Disable International Shipping. Default: Enabled, as it currently is. 733 $args['intl_rate'] = isset( $wpsc_ups_settings['intl_rate'] ) && ! empty( $wpsc_ups_settings['intl_rate'] ) ? FALSE : TRUE; 734 if ( ! $args['intl_rate'] && $args['dest_ccode'] != get_option( 'base_country' ) ) 735 return array(); 736 737 // Destination zip code 738 // If ths zip code is provided via a form post use it! 739 $args['dest_pcode'] = (string) wpsc_get_customer_meta( 'shipping_zip' ); 740 if ( isset( $_POST['zipcode'] ) && ( $_POST['zipcode'] != __( "Your Zipcode", 'wpsc' ) && $_POST['zipcode'] != "YOURZIPCODE" ) ) 741 $args['dest_pcode'] = esc_attr( $_POST['zipcode'] ); 742 if ( in_array( $args['dest_pcode'], array( __( 'Your Zipcode', 'wpsc' ), 'YOURZIPCODE' ) ) ) 743 $args['dest_pcode'] = ''; 744 if( ! empty ( $args['dest_pcode'] ) ) 745 wpsc_update_customer_meta( 'shipping_zip', $args['dest_pcode'] ); 746 if ( empty ( $args['dest_pcode'] ) ) 747 // We cannot get a quote without a zip code so might as well return! 748 return array(); 749 750 // Get the total weight from the shopping cart 751 $args['weight'] = wpsc_cart_weight_total(); 752 if ( empty( $args["weight"] ) ) 753 return array(); 754 755 // If the region code is provided via a form post use it! 756 if ( isset( $_POST['region'] ) && ! empty( $_POST['region'] ) ) { 757 $query = $wpdb->prepare( "SELECT `" . WPSC_TABLE_REGION_TAX . "`.* FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `" . WPSC_TABLE_REGION_TAX . "`.`id` = %d", $_POST['region'] ); 758 $dest_region_data = $wpdb->get_results( $query, ARRAY_A ); 759 $args['dest_state'] = ( is_array( $dest_region_data ) ) ? $dest_region_data[0]['code'] : ""; 760 wpsc_update_customer_meta( 'shipping_state', $args['dest_state'] ); //Unify state meta. 761 } else if ( $dest_state = wpsc_get_customer_meta( 'shipping_state' ) ) { 762 // Well, we have a zip code in the session and no new one provided 763 $args['dest_state'] = $dest_state; 764 } else { 765 $args['dest_state'] = ""; 766 } 767 768 if ( ! is_object( $wpec_ash ) ) 769 $wpec_ash = new ASH(); 770 771 $shipping_cache_check['state'] = $args['dest_state']; //The destination is needed for cached shipment check. 772 $shipping_cache_check['country'] = $args['dest_ccode']; 773 $shipping_cache_check['zipcode'] = $args['dest_pcode']; 774 $this->shipment = $wpec_ash->get_shipment(); 775 $this->shipment->set_destination( $this->internal_name, $shipping_cache_check ); //Set this shipment's destination. 776 $this->shipment->rates_expire = date('Y-m-d'); 777 778 $args["singular_shipping"] = ( array_key_exists( "singular_shipping", $wpsc_ups_settings ) ) ? $wpsc_ups_settings["singular_shipping"] : "0"; 779 if ( $args['weight'] > 150 && ! (boolean) $args["singular_shipping"] ) { // This is where shipping breaks out of UPS if weight is higher than 150 LBS 780 $over_weight_txt = __( 'Your order exceeds the standard shipping weight limit. Please contact us to quote other shipping alternatives.', 'wpsc' ); 781 $shipping_quotes[$over_weight_txt] = 0; // yes, a constant. 782 $wpec_ash->cache_results( $this->internal_name, array( $shipping_quotes ), $this->shipment ); //Update shipment cache. 783 return array( $shipping_quotes ); 784 } 785 786 $cache = $wpec_ash->check_cache( $this->internal_name, $this->shipment ); //And now, we're ready to check cache. 787 788 // We do not want to spam UPS (and slow down our process) if we already 789 // have a shipping quote! 790 if ( count( $cache['rate_table'] ) >= 1 ) //$cache['rate_table'] could be array(0).. 791 return $cache['rate_table']; 792 729 793 // Final rate table 730 794 $rate_table = array(); 731 // Get the ups settings from the ups account info page (Shipping tab)732 $wpsc_ups_settings = get_option( "wpsc_ups_settings", array() );733 // Get the wordpress shopping cart options734 $wpsc_options = get_option( "wpsc_options" );735 795 736 796 // API Auth settings // … … 741 801 $args['negotiated_rates'] = ( array_key_exists( 'ups_negotiated_rates', $wpsc_ups_settings ) ) ? $wpsc_ups_settings['ups_negotiated_rates'] : ""; 742 802 $args['residential'] = $wpsc_ups_settings['49_residential']; 743 $args["singular_shipping"] = ( array_key_exists( "singular_shipping", $wpsc_ups_settings ) ) ? $wpsc_ups_settings["singular_shipping"] : "0";744 803 $args['insured_shipment'] = ( array_key_exists( "insured_shipment", $wpsc_ups_settings ) ) ? $wpsc_ups_settings["insured_shipment"] : "0"; 745 804 // What kind of pickup service do you use ? … … 764 823 $args['shipf_ccode'] = $args['shipr_ccode']; 765 824 $args['shipf_pcode'] = $args['shipr_pcode']; 766 // Get the total weight from the shopping cart767 825 $args['units'] = "LBS"; 768 $args['weight'] = wpsc_cart_weight_total(); 769 // Destination zip code 770 $args['dest_ccode'] = wpsc_get_customer_meta( 'shipping_country' ); 771 if ( $args['dest_ccode'] == "UK" ) { 772 // So, UPS is a little off the times 773 $args['dest_ccode'] = "GB"; 774 } 775 776 // If ths zip code is provided via a form post use it! 777 $args['dest_pcode'] = (string) wpsc_get_customer_meta( 'shipping_zip' ); 778 if ( isset( $_POST['zipcode'] ) && ( $_POST['zipcode'] != __( "Your Zipcode", 'wpsc' ) && $_POST['zipcode'] != "YOURZIPCODE" ) ) 779 $args['dest_pcode'] = esc_attr( $_POST['zipcode'] ); 780 781 if ( in_array( $args['dest_pcode'], array( __( 'Your Zipcode', 'wpsc' ), 'YOURZIPCODE' ) ) ) 782 $args['dest_pcode'] = ''; 783 784 wpsc_update_customer_meta( 'shipping_zip', $args['dest_pcode'] ); 785 786 if ( empty ( $args['dest_pcode'] ) ) { 787 // We cannot get a quote without a zip code so might as well return! 788 return array(); 789 } 790 791 // If the region code is provided via a form post use it! 792 if ( isset( $_POST['region'] ) && ! empty( $_POST['region'] ) ) { 793 $query = $wpdb->prepare( "SELECT `" . WPSC_TABLE_REGION_TAX . "`.* FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `" . WPSC_TABLE_REGION_TAX . "`.`id` = %d", $_POST['region'] ); 794 $dest_region_data = $wpdb->get_results( $query, ARRAY_A ); 795 $args['dest_state'] = ( is_array( $dest_region_data ) ) ? $dest_region_data[0]['code'] : ""; 796 wpsc_update_customer_meta( 'ups_state', $args['dest_state'] ); 797 } else if ( $dest_state = wpsc_get_customer_meta( 'ups_state' ) ) { 798 // Well, we have a zip code in the session and no new one provided 799 $args['dest_state'] = $dest_state; 826 $args['shipper'] = $this->internal_name; 827 $args = apply_filters( 'wpsc_shipment_data', $args, $this->shipment ); 828 829 $args["cart_total"] = $wpsc_cart->calculate_subtotal( true ); 830 // Build the XML request 831 $request = $this->_buildRateRequest( $args ); 832 // Now that we have the message to send ... Send it! 833 $raw_quote = $this->_makeRateRequest( $request ); 834 // Now we have the UPS response .. unfortunately its not ready 835 // to be viewed by normal humans ... 836 $quotes = $this->_parseQuote( $raw_quote ); 837 // If we actually have rates back from UPS we can use em! 838 if ( $quotes != false ) { 839 $rate_table = apply_filters( 'wpsc_rates_table', $this->_formatTable( $quotes, $args['currency'] ), $args, $this->shipment ); 800 840 } else { 801 $args['dest_state'] = ""; 802 } 803 $shipping_cache_check['package_count'] = $this->shipment->package_count; //Package count is needed for cached shipment check. 804 $shipping_cache_check['destination']['state'] = $args['dest_state']; //The destination is needed for cached shipment check. 805 $shipping_cache_check['destination']['country'] = $args['dest_ccode']; 806 $shipping_cache_check['destination']['zipcode'] = $args['dest_pcode']; 807 $shipping_cache_check['total_weight'] = $args['weight']; 808 $shipping_cache_check['rates_expire'] = date('Y-m-d'); 809 $this->shipment->rates_expire = date('Y-m-d'); 810 $this->shipment->set_destination($this->internal_name,$shipping_cache_check['destination']); //Set this shipment's destination. 811 $session_cache_check = $wpec_ash->check_cache( $this->internal_name, $this->shipment ); //Now, we're ready to check cache. 812 if ( ! is_array( $session_cache_check ) ) { 813 $session_cache_check = array(); 814 } 815 $session_cache = $session_cache_check; 816 if ( ! is_array( $session_cache ) ) { 817 $session_cache = array(); 818 } else 819 $session_cache_check = $session_cache_check['shipment']; 820 if ( ! (boolean) $args["singular_shipping"] ) { 821 // This is where shipping breaks out of UPS if weight is higher than 150 LBS 822 if ( $args['weight'] > 150 ) { 823 $this->shipment->set_destination($this->internal_name,$shipping_cache_check['destination']); 824 $this->shipment->rates_expire = date('Y-m-d'); 825 $shipping_quotes[ TXT_WPSC_OVER_UPS_WEIGHT ] = 0; // yes, a constant. 826 $wpec_ash->cache_results($this->internal_name,array($shipping_quotes),$this->shipment); //Update shipment cache. 827 return array( $shipping_quotes ); 828 } 829 } 830 // We do not want to spam UPS (and slow down our process) if we already 831 // have a shipping quote! 832 if ( ( $session_cache_check === $shipping_cache_check ) && ( count( $session_cache['rate_table']) >= 1 ) ) { //'rate_table' could be array(0). 833 $rate_table = $session_cache['rate_table']; 834 return $rate_table; 835 } else { 836 global $wpsc_cart; 837 $args["cart_total"] = $wpsc_cart->calculate_subtotal( true ); 838 // Build the XML request 839 $request = $this->_buildRateRequest( $args ); 840 // Now that we have the message to send ... Send it! 841 $raw_quote = $this->_makeRateRequest( $request ); 842 // Now we have the UPS response .. unfortunately its not ready 843 // to be viewed by normal humans ... 844 $quotes = $this->_parseQuote( $raw_quote ); 845 // If we actually have rates back from UPS we can use em! 846 if ( $quotes != false ) { 847 $rate_table = $this->_formatTable( $quotes, $args['currency'] ); 848 } else { 849 if ( $wpsc_ups_settings['upsenvironment'] == '1' ) { 850 echo "<strong>:: GetQuote ::DEBUG OUTPUT::</strong><br />"; 851 echo "Arguments sent to UPS"; 852 print_r( $args ); 853 echo "<hr />"; 854 print $request; 855 echo "<hr />"; 856 echo "Response from UPS"; 857 echo $raw_quote; 858 echo "</strong>:: GetQuote ::End DEBUG OUTPUT::"; 859 } 860 } 861 } 862 $this->shipment->rates_expire = date('Y-m-d'); //Refresh rates once a day. 863 $this->shipment->set_destination($this->internal_name,$shipping_cache_check['destination']); //Set destination before caching rates. 841 if ( $wpsc_ups_settings['upsenvironment'] == '1' ) { 842 echo "<strong>:: GetQuote ::DEBUG OUTPUT::</strong><br />"; 843 echo "Arguments sent to UPS"; 844 print_r( $args ); 845 echo "<hr />"; 846 print $request; 847 echo "<hr />"; 848 echo "Response from UPS"; 849 echo $raw_quote; 850 echo "</strong>:: GetQuote ::End DEBUG OUTPUT::"; 851 } 852 } 853 //Avoid trying getting rates again and again when the stored zipcode is incorrect. 854 if( count( $rate_table ) == 0 ) 855 wpsc_update_customer_meta( 'shipping_zip', '' ); 864 856 $wpec_ash->cache_results( 865 857 $this->internal_name, -
wp-e-commerce/trunk/wpsc-shipping/usps_20.php
r836750 r840335 216 216 </label> 217 217 <p class='description'><?php _e( 'This setting will provide rates based on the dimensions from each item in your cart', 'wpsc' ); ?></p> 218 <label> 219 <input type='checkbox' <?php checked( $settings['intl_rate'], 1 ); ?> name='wpec_usps[intl_rate]' value='1' /> 220 <?php _e( 'Disable International Shipping', 'wpsc' ); ?> 221 </label> 222 <p class='description'><?php _e( 'No shipping rates will be displayed if the shipment destination country is different than your base country/region.', 'wpsc' ); ?></p> 218 223 </td> 219 224 </tr> … … 729 734 global $wpec_ash_xml; 730 735 731 $rate_tables = array(); 732 $cart_shipment = apply_filters( 'wpsc_cart_shipment', $this->shipment, $this->name ); //Filter to allow reprocesing the shipment before is quoted. 733 736 $rate_tables = array(); 737 $cart_shipment = apply_filters( 'wpsc_the_shipment', $this->shipment, $data ); //Filter to allow reprocesing the shipment before is quoted. 734 738 foreach ( $cart_shipment->packages as $package ) { 735 739 $temp_data = $data; … … 767 771 global $wpec_ash_xml; 768 772 $rate_tables = array(); 769 $cart_shipment = apply_filters( 'wpsc_the_shipment',$this->name,$this->shipment); //Filter to allow reprocesing the shipment before is quoted.773 $cart_shipment = apply_filters( 'wpsc_the_shipment', $this->shipment, $data ); //Filter to allow reprocesing the shipment before is quoted. 770 774 foreach ( $cart_shipment->packages as $package ) { 771 775 $temp_data = $data; … … 889 893 function getQuote() { 890 894 global $wpdb, $wpec_ash, $wpec_ash_tools; 891 if ( ! is_object( $wpec_ash ) ) {892 $wpec_ash = new ASH();893 }894 if ( ! is_object( $wpec_ash_tools ) ) {895 $wpec_ash_tools = new ASHTools();896 }897 895 $data = array(); 898 $this->shipment = $wpec_ash->get_shipment();899 896 //************** These values are common to all entry points ************** 900 //*** Grab Total Weight from the shipment object for simple shipping901 $data["weight"] = wpsc_cart_weight_total();902 if ( empty( $data["weight"] ) ) {903 return array();904 }905 906 897 //*** User/Customer Entered Values ***\\ 898 //*** Set up the destination country ***\ 899 $data["dest_country"] = wpsc_get_customer_meta( 'shipping_country' ); 900 $settings = get_option( 'wpec_usps' ); 901 //Disable International Shipping. Default: Enabled as it currently is. 902 $data['intl_rate'] = isset( $settings['intl_rate'] ) && ! empty( $settings['intl_rate'] ) ? FALSE : TRUE; 903 if( ! $data['intl_rate'] && $data['dest_country'] != get_option( 'base_country' ) ) 904 return array(); 905 907 906 // If ths zip code is provided via a form post use it! 908 907 $data["dest_zipcode"] = (string) wpsc_get_customer_meta( 'shipping_zip' ); … … 911 910 if ( in_array( $data["dest_zipcode"], array( __( 'Your Zipcode', 'wpsc' ), 'YOURZIPCODE' ) ) ) 912 911 $data["dest_zipcode"] = ''; 913 wpsc_update_customer_meta( 'shipping_zip', $data["dest_zipcode"] ); 914 if ( empty ( $data["dest_zipcode"] ) ) { 912 if( ! empty( $data["dest_zipcode"] ) ) 913 wpsc_update_customer_meta( 'shipping_zip', $data["dest_zipcode"] ); 914 if ( empty ( $data["dest_zipcode"] ) ) 915 915 // We cannot get a quote without a zip code so might as well return! 916 916 return array(); 917 } 917 //*** Grab Total Weight from the shipment object for simple shipping 918 $data["weight"] = wpsc_cart_weight_total(); 919 if ( empty( $data["weight"] ) ) 920 return array(); 918 921 919 922 // If the region code is provided via a form post use it! … … 922 925 $dest_region_data = $wpdb->get_results( $query, ARRAY_A ); 923 926 $data['dest_state'] = ( is_array( $dest_region_data ) ) ? $dest_region_data[0]['code'] : ""; 924 wpsc_update_customer_meta( ' usps_state', $data['dest_state'] );925 } else if ( $dest_state = wpsc_get_customer_meta( ' usps_state' ) ) {927 wpsc_update_customer_meta( 'shipping_state', $data['dest_state'] ); //Unify state meta. 928 } else if ( $dest_state = wpsc_get_customer_meta( 'shipping_state' ) ) { 926 929 // Well, we have a zip code in the session and no new one provided 927 930 $data['dest_state'] = $dest_state; … … 929 932 $data['dest_state'] = ""; 930 933 } 931 932 //*** Set up the destination country ***\933 $data["dest_country"] = wpsc_get_customer_meta( 'shipping_country' ); 934 if ( ! is_object( $wpec_ash_tools ) ) 935 $wpec_ash_tools = new ASHTools(); 936 934 937 $data["dest_country"] = $wpec_ash_tools->get_full_country( $data["dest_country"] ); 935 938 $data["dest_country"] = $this->_update_country( $data["dest_country"] ); 936 939 940 if ( ! is_object( $wpec_ash ) ) 941 $wpec_ash = new ASH(); 937 942 $shipping_cache_check['state'] = $data['dest_state']; 938 943 $shipping_cache_check['country'] = $data['dest_country']; 939 944 $shipping_cache_check['zipcode'] = $data["dest_zipcode"]; 945 $this->shipment = $wpec_ash->get_shipment(); 940 946 $this->shipment->set_destination( $this->internal_name, $shipping_cache_check ); 941 942 $settings = get_option( "wpec_usps" ); 947 $this->shipment->rates_expire = date('Y-m-d'); //Date will be checked against the cached date. 948 943 949 $data["adv_rate"] = (!empty($settings["adv_rate"])) ? $settings["adv_rate"] : FALSE; // Use advanced shipping for Domestic Rates ? Not available 944 $this->shipment->rates_expire = date('Y-m-d'); //Date will be checked against the cached date.945 if ( $data["weight"] > 70 && ! $data["adv_rate"] ) { //Yes, USPS has a weight limit too: https://www.usps.com/send/can-you-mail-it.htm?#3.946 $shipping_quotes[ TXT_WPSC_OVER_UPS_WEIGHT]=0; //FIXME Remove UPS and 150lb from this message, and it can be used here too. Temporary fix.950 if ( $data["weight"] > 70 && ! (boolean) $data["adv_rate"] ) { //USPS has a weight limit: https://www.usps.com/send/can-you-mail-it.htm?#3. 951 $over_weight_txt = __('Your order exceeds the standard shipping weight limit. Please contact us to quote other shipping alternatives.','wpsc'); 952 $shipping_quotes[$over_weight_txt] = 0; // yes, a constant. 947 953 $wpec_ash->cache_results( $this->internal_name, array($shipping_quotes), $this->shipment ); 948 954 return array($shipping_quotes); … … 951 957 // Check to see if the cached shipment is still accurate, if not we need new rate 952 958 $cache = $wpec_ash->check_cache( $this->internal_name, $this->shipment ); 953 954 if ( count($cache["rate_table"]) >= 1 ) { //$cache['rate_table'] could be array(0). 959 // We do not want to spam USPS (and slow down our process) if we already 960 // have a shipping quote! 961 if ( count($cache["rate_table"] ) >= 1 ) //$cache['rate_table'] could be array(0). 955 962 return $cache["rate_table"]; 956 }957 963 958 964 //*** WPEC Configuration values ***\\ … … 963 969 $data["services"] = ( ! empty( $settings["services"] ) ) ? $settings["services"] : array( "PRIORITY", "EXPRESS", "FIRST CLASS" ); 964 970 $data["user_id"] = $settings["id"]; 971 $data['shipper'] = $this->internal_name; 972 $data = apply_filters( 'wpsc_shipment_data', $data, $this->shipment ); 965 973 //************ GET THE RATE ************\\ 966 $rate_table = $this->_run_quote( $data ); 974 $rate_table = apply_filters( 'wpsc_rates_table', $this->_run_quote( $data ), $data, $this->shipment ); 975 //Avoid trying getting rates again and again when the stored zipcode is incorrect. 976 if( count( $rate_table ) == 0 ) 977 wpsc_update_customer_meta( 'shipping_zip', '' ); 967 978 //************ CACHE the Results ************\\ 968 979 $wpec_ash->cache_results( $this->internal_name, $rate_table, $this->shipment ); -
wp-e-commerce/trunk/wpsc-theme/wpsc-default.css
r799653 r840335 1070 1070 } 1071 1071 1072 .wpsc_gateway_container .custom_gateway_image { 1073 position: relative; 1074 top: 5px; 1075 } 1076 1072 1077 .wpsc_no_image{ 1073 1078 display: none; -
wp-e-commerce/trunk/wpsc-updates/database_template.php
r799653 r840335 225 225 $wpsc_database_template[$table_name]['indexes']['wpsc_cart_item_id'] = 'KEY wpsc_cart_item_id ( `wpsc_cart_item_id` ) '; 226 226 $wpsc_database_template[$table_name]['actions']['after']['all'] = '_wpsc_meta_migrate_wpsc_cart_item'; 227 228 // code to create or update the {$wpdb->prefix}wpsc_purchase_meta table 229 $table_name = $wpdb->wpsc_purchase_meta; 230 $wpsc_database_template[$table_name]['columns']['meta_id'] = "bigint(20) unsigned NOT NULL AUTO_INCREMENT "; 231 $wpsc_database_template[$table_name]['columns']['wpsc_purchase_id'] = "bigint(20) unsigned NOT NULL DEFAULT '0' "; 232 $wpsc_database_template[$table_name]['columns']['meta_key'] = "varchar(255) default NULL "; 233 $wpsc_database_template[$table_name]['columns']['meta_value'] = "longtext "; 234 $wpsc_database_template[$table_name]['columns']['meta_timestamp'] = "timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP "; 235 $wpsc_database_template[$table_name]['indexes']['PRIMARY'] = "PRIMARY KEY ( `meta_id` ) "; 236 $wpsc_database_template[$table_name]['indexes']['meta_key'] = "KEY `meta_key` ( `meta_key`(191) ) "; 237 $wpsc_database_template[$table_name]['indexes']['meta_value'] = "KEY `meta_value` ( `meta_value`(20) ) "; 238 $wpsc_database_template[$table_name]['indexes']['meta_key_and_value'] = "KEY `meta_key_and_value` ( `meta_key`(191), `meta_value`(32) ) "; 239 $wpsc_database_template[$table_name]['indexes']['meta_timestamp_index'] = "KEY meta_timestamp_index (meta_timestamp) "; 240 $wpsc_database_template[$table_name]['indexes']['wpsc_purchase_id'] = 'KEY wpsc_purchase_id ( `wpsc_purchase_id` ) '; 241 $wpsc_database_template[$table_name]['actions']['after']['all'] = '_wpsc_meta_migrate_wpsc_purchase';
Note: See TracChangeset
for help on using the changeset viewer.