WP eCommerce - Version 3.7.6RC3

Version Description

Download this release

Release Info

Developer jghazally
Plugin Icon 128x128 WP eCommerce
Version 3.7.6RC3
Comparing to
See all releases

Code changes from version 3.7.6beta3 to 3.7.6RC3

Files changed (71) hide show
  1. admin-form-functions.php +6 -2
  2. admin.js +7 -0
  3. currency_list.php +1 -1
  4. display-coupons.php +2 -0
  5. extra_image_processing.php +5 -2
  6. image_processing.php +30 -1
  7. image_resize.php +4 -3
  8. js/tinymce3/editor_plugin.js +1 -1
  9. js/user.js +1 -1
  10. js/wp-e-commerce.js +51 -21
  11. merchants/GoogleCheckout-XML.php +7 -7
  12. merchants/paypal-standard.merchant.php +2 -0
  13. merchants/paypal_certified.php +5 -4
  14. merchants/paypal_multiple.php +2 -2
  15. merchants/paypal_pro.php +9 -5
  16. shipping/australiapost.php +2 -1
  17. shipping/flatrate.php +5 -4
  18. shipping/tablerate.php +9 -2
  19. shipping/ups.php +61 -56
  20. shipping/usps.php +1 -1
  21. shipping/weightrate.php +42 -3
  22. themes/default/default.css +4 -7
  23. themes/default/grid_view.php +9 -14
  24. themes/default/list_view.php +23 -24
  25. themes/default/products_page.php +22 -13
  26. themes/default/shopping_cart_page.php +3 -3
  27. themes/default/single_product.php +4 -2
  28. themes/iShop/category_widget.php +2 -2
  29. themes/iShop/grid_view.php +26 -26
  30. themes/iShop/iShop.css +2 -1
  31. themes/iShop/list_view.php +24 -24
  32. themes/iShop/products_page.php +24 -17
  33. themes/iShop/shopping_cart_page.php +3 -1
  34. themes/iShop/single_product.php +4 -2
  35. themes/marketplace/category_widget.php +2 -2
  36. themes/marketplace/grid_view.php +28 -28
  37. themes/marketplace/list_view.php +25 -24
  38. themes/marketplace/marketplace.css +2 -1
  39. themes/marketplace/products_page.php +26 -19
  40. themes/marketplace/shopping_cart_page.php +2 -1
  41. themes/marketplace/single_product.php +7 -5
  42. transaction_result_functions.php +7 -5
  43. transaction_results.php +1 -1
  44. user-downloads.php +1 -1
  45. user-log.php +11 -10
  46. widgets/price_range_widget.php +3 -3
  47. wp-shopping-cart.php +42 -16
  48. wpsc-admin/admin.php +3 -2
  49. wpsc-admin/ajax-and-init.php +2 -2
  50. wpsc-admin/display-items.page.php +12 -2
  51. wpsc-admin/display-options-settings.page.php +1 -1
  52. wpsc-admin/display-sales-logs.php +5 -6
  53. wpsc-admin/includes/display-items-functions.php +21 -12
  54. wpsc-admin/includes/product-functions.php +2 -2
  55. wpsc-admin/includes/settings-pages/general.php +24 -0
  56. wpsc-admin/includes/settings-pages/presentation.php +27 -2
  57. wpsc-admin/includes/settings-pages/shipping.php +1 -0
  58. wpsc-admin/js/admin.js +3 -1
  59. wpsc-includes/ajax.functions.php +59 -8
  60. wpsc-includes/cart.class.php +43 -23
  61. wpsc-includes/checkout.class.php +38 -14
  62. wpsc-includes/coupons.class.php +23 -16
  63. wpsc-includes/deprecated.functions.php +31 -0
  64. wpsc-includes/display.functions.php +11 -4
  65. wpsc-includes/merchant.class.php +3 -3
  66. wpsc-includes/misc.functions.php +5 -4
  67. wpsc-includes/pagination.class.php +261 -0
  68. wpsc-includes/processing.functions.php +1 -2
  69. wpsc-includes/purchaselogs.class.php +16 -12
  70. wpsc-includes/theme.functions.php +12 -2
  71. wpsc-includes/wpsc_query.php +104 -31
admin-form-functions.php CHANGED
@@ -530,6 +530,7 @@ $output ='
530
  <option value="item_quantity" rel="order">Item quantity</option>
531
  <option value="total_quantity" rel="order">Total quantity</option>
532
  <option value="subtotal_amount" rel="order">Subtotal amount</option>
 
533
  </select>
534
  <select name="rules[logic][]">
535
  <option value="equal">Is equal to</option>
@@ -719,7 +720,7 @@ function wpsc_packing_slip($purchase_id) {
719
  global $wpdb;
720
  $purch_sql = "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `id`='".$purchase_id."'";
721
  $purch_data = $wpdb->get_row($purch_sql,ARRAY_A) ;
722
-
723
 
724
  //echo "<p style='padding-left: 5px;'><strong>".__('Date', 'wpsc')."</strong>:".date("jS M Y", $purch_data['date'])."</p>";
725
 
@@ -769,7 +770,7 @@ function wpsc_packing_slip($purchase_id) {
769
  if($form_field['unique_name'] == 'shippingstate'){
770
  echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".wpsc_get_region($purch_data['shipping_region'])."</td></tr>\n\r";
771
  }else{
772
- echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES)."</td></tr>\n\r";
773
  }
774
  break;
775
  }
@@ -911,7 +912,10 @@ function wpsc_packing_slip($purchase_id) {
911
  echo '<td>';
912
  echo '</tr>';
913
  }
 
 
914
  echo "</table>";
 
915
  echo "</div>\n\r";
916
  } else {
917
  echo "<br />".__('This users cart was empty', 'wpsc');
530
  <option value="item_quantity" rel="order">Item quantity</option>
531
  <option value="total_quantity" rel="order">Total quantity</option>
532
  <option value="subtotal_amount" rel="order">Subtotal amount</option>
533
+ ' . apply_filters( 'wpsc_coupon_rule_property_options', '' ) . '
534
  </select>
535
  <select name="rules[logic][]">
536
  <option value="equal">Is equal to</option>
720
  global $wpdb;
721
  $purch_sql = "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `id`='".$purchase_id."'";
722
  $purch_data = $wpdb->get_row($purch_sql,ARRAY_A) ;
723
+ //exit('<pre>'.print_r($purch_data, true).'</pre>');
724
 
725
  //echo "<p style='padding-left: 5px;'><strong>".__('Date', 'wpsc')."</strong>:".date("jS M Y", $purch_data['date'])."</p>";
726
 
770
  if($form_field['unique_name'] == 'shippingstate'){
771
  echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".wpsc_get_region($purch_data['shipping_region'])."</td></tr>\n\r";
772
  }else{
773
+ echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES,'UTF-8')."</td></tr>\n\r";
774
  }
775
  break;
776
  }
912
  echo '<td>';
913
  echo '</tr>';
914
  }
915
+ echo '<tr><td>Total Shipping</td><td>'.$purch_data['base_shipping'].'</td></tr>';
916
+ echo '<tr><td>Total Price</td><td>'.$purch_data['totalprice'].'</td></tr>';
917
  echo "</table>";
918
+
919
  echo "</div>\n\r";
920
  } else {
921
  echo "<br />".__('This users cart was empty', 'wpsc');
admin.js CHANGED
@@ -601,6 +601,13 @@ jQuery(window).load( function () {
601
  }
602
 
603
  });
 
 
 
 
 
 
 
604
  jQuery('a.closeEl').bind('click', toggleContent);
605
  /*
606
  jQuery('div.groupWrapper').sortable( {
601
  }
602
 
603
  });
604
+ jQuery("form[name='add_coupon'] input[name='submit_coupon']").click(function() {
605
+ var title = jQuery("form[name='add_coupon'] input[name='add_coupon_code']").val();
606
+ if ( title == '') {
607
+ alert('Please enter a coupon code.');
608
+ return false;
609
+ }
610
+ });
611
  jQuery('a.closeEl').bind('click', toggleContent);
612
  /*
613
  jQuery('div.groupWrapper').sortable( {
currency_list.php CHANGED
@@ -230,7 +230,7 @@ INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (228, 'USA Minor Outlying Isla
230
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (229, 'Uzbekistan', 'UZ', 'Uzbekistan Sum', '', '', 'UZS', '0', '0','asiapacific','1');
231
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (230, 'Vanuatu', 'VU', 'Vanuatu Vatu', '', '', 'VUV', '0', '0','asiapacific','1');
232
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (231, 'Vatican', 'VA', 'Euro', '€', '&#8364;', 'EUR', '0', '0','europe','1');
233
- INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (232, 'Venezuela', 'VE', 'Venezuelan Bolivar', '', '', 'VUB', '0', '0','asiapacific','1');
234
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (233, 'Vietnam', 'VN', 'Vietnamese Dong', '', '', 'VND', '0', '0','asiapacific','1');
235
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (234, 'Virgin Islands (British)', 'VG', 'US Dollar', '$', '&#036;', 'USD', '0', '0','northamerica','1');
236
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (235, 'Virgin Islands (USA)', 'VI', 'US Dollar', '$', '&#036;', 'USD', '0', '0','northamerica','1');
230
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (229, 'Uzbekistan', 'UZ', 'Uzbekistan Sum', '', '', 'UZS', '0', '0','asiapacific','1');
231
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (230, 'Vanuatu', 'VU', 'Vanuatu Vatu', '', '', 'VUV', '0', '0','asiapacific','1');
232
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (231, 'Vatican', 'VA', 'Euro', '€', '&#8364;', 'EUR', '0', '0','europe','1');
233
+ INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (232, 'Venezuela', 'VE', 'Venezuelan Bolivar', '', '', 'BsF', '0', '0','asiapacific','1');
234
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (233, 'Vietnam', 'VN', 'Vietnamese Dong', '', '', 'VND', '0', '0','asiapacific','1');
235
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (234, 'Virgin Islands (British)', 'VG', 'US Dollar', '$', '&#036;', 'USD', '0', '0','northamerica','1');
236
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (235, 'Virgin Islands (USA)', 'VI', 'US Dollar', '$', '&#036;', 'USD', '0', '0','northamerica','1');
display-coupons.php CHANGED
@@ -304,6 +304,7 @@ if(isset($_GET['token'])) {
304
  <option value="item_quantity" rel="order">Item quantity</option>
305
  <option value="total_quantity" rel="order">Total quantity</option>
306
  <option value="subtotal_amount" rel="order">Subtotal amount</option>
 
307
  </select>
308
  <select name="rules[logic][]">
309
  <option value="equal">Is equal to</option>
@@ -328,6 +329,7 @@ if(isset($_GET['token'])) {
328
  '<option value="item_quantity" rel="order">Item quantity</option>\n'+
329
  '<option value="total_quantity" rel="order">Total quantity</option>\n'+
330
  '<option value="subtotal_amount" rel="order">Subtotal amount</option>\n'+
 
331
  '</select> \n'+
332
  '<select name="rules[logic][]"> \n'+
333
  '<option value="equal">Is equal to</option> \n'+
304
  <option value="item_quantity" rel="order">Item quantity</option>
305
  <option value="total_quantity" rel="order">Total quantity</option>
306
  <option value="subtotal_amount" rel="order">Subtotal amount</option>
307
+ <?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>
308
  </select>
309
  <select name="rules[logic][]">
310
  <option value="equal">Is equal to</option>
329
  '<option value="item_quantity" rel="order">Item quantity</option>\n'+
330
  '<option value="total_quantity" rel="order">Total quantity</option>\n'+
331
  '<option value="subtotal_amount" rel="order">Subtotal amount</option>\n'+
332
+ '<?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>'+
333
  '</select> \n'+
334
  '<select name="rules[logic][]"> \n'+
335
  '<option value="equal">Is equal to</option> \n'+
extra_image_processing.php CHANGED
@@ -44,14 +44,17 @@ if(is_numeric($height) && is_numeric($width) && function_exists('imagecreatefrom
44
  }
45
  ImageCopyResampled($dst_img,$src_img,0,0,0,0,$width,$height,$source_w,$source_h);
46
  //exit($destdir);
 
 
 
47
  switch($imagetype[2])
48
  {
49
  case IMAGETYPE_JPEG:
50
- imagejpeg($dst_img, $destdir, 75);
51
  break;
52
 
53
  case IMAGETYPE_GIF:
54
- imagejpeg($dst_img, $destdir, 75); //our server doesnt support saving gif, make it save gif images if you need gif images, otherwise, jpeg will do.
55
  break;
56
 
57
  case IMAGETYPE_PNG:
44
  }
45
  ImageCopyResampled($dst_img,$src_img,0,0,0,0,$width,$height,$source_w,$source_h);
46
  //exit($destdir);
47
+
48
+ $image_quality = wpsc_image_quality();
49
+
50
  switch($imagetype[2])
51
  {
52
  case IMAGETYPE_JPEG:
53
+ imagejpeg($dst_img, $destdir, $image_quality);
54
  break;
55
 
56
  case IMAGETYPE_GIF:
57
+ imagejpeg($dst_img, $destdir, $image_quality); //our server doesnt support saving gif, make it save gif images if you need gif images, otherwise, jpeg will do.
58
  break;
59
 
60
  case IMAGETYPE_PNG:
image_processing.php CHANGED
@@ -102,9 +102,11 @@ global $wpdb;
102
  ImageCopy( $dst_img, $temp_img, $w1, $h1, 0, 0, $temp_w, $temp_h );
103
  //mail('thomas.howard@gmail.com','lolwut',"ImageCopy( $dst_img, $temp_img, $w1, $h1, 0, 0, $temp_w, $temp_h );");
104
 
 
 
105
  switch($imagetype[2]) {
106
  case IMAGETYPE_JPEG:
107
- if(@ ImageJPEG($dst_img, $image_output, 75) == false) { return false; }
108
  break;
109
 
110
  case IMAGETYPE_GIF:
@@ -138,4 +140,31 @@ global $wpdb;
138
  }
139
  return false;
140
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  ?>
102
  ImageCopy( $dst_img, $temp_img, $w1, $h1, 0, 0, $temp_w, $temp_h );
103
  //mail('thomas.howard@gmail.com','lolwut',"ImageCopy( $dst_img, $temp_img, $w1, $h1, 0, 0, $temp_w, $temp_h );");
104
 
105
+ $image_quality = wpsc_image_quality();
106
+
107
  switch($imagetype[2]) {
108
  case IMAGETYPE_JPEG:
109
+ if(@ ImageJPEG($dst_img, $image_output, $image_quality) == false) { return false; }
110
  break;
111
 
112
  case IMAGETYPE_GIF:
140
  }
141
  return false;
142
  }
143
+
144
+
145
+
146
+ /**
147
+ * WPSC Image Quality
148
+ *
149
+ * Returns the value to use for image quality when creating jpeg images.
150
+ * By default the quality is set to 75%. It is then run through the main jpeg_quality WordPress filter
151
+ * to add compatibility with other plugins that customise image quality.
152
+ *
153
+ * It is then run through the wpsc_jpeg_quality filter so that it is possible to override
154
+ * the quality setting just for WPSC images.
155
+ *
156
+ * @since 3.7.6
157
+ *
158
+ * @param (int) $quality Optional. Image quality when creating jpeg images.
159
+ * @return (int) The image quality.
160
+ */
161
+ function wpsc_image_quality( $quality = 75 ) {
162
+
163
+ $quality = apply_filters( 'jpeg_quality', $quality );
164
+ return apply_filters( 'wpsc_jpeg_quality', $quality );
165
+
166
+ }
167
+
168
+
169
+
170
  ?>
image_resize.php CHANGED
@@ -69,12 +69,13 @@ if(file_exists($imagepath) && is_numeric($height) && is_numeric($width)) {
69
  imagesavealpha($dst_img,true);
70
  ImageAlphaBlending($dst_img, false);
71
  }
72
-
73
-
 
74
  //ImageCopyResampled($dst_img,$src_img,0,0,0,0,$width,$height,$source_w,$source_h);
75
  switch($imagetype[2]) {
76
  case IMAGETYPE_JPEG:
77
- ImageJPEG($dst_img, $image_output, 75);
78
  break;
79
 
80
  case IMAGETYPE_GIF:
69
  imagesavealpha($dst_img,true);
70
  ImageAlphaBlending($dst_img, false);
71
  }
72
+
73
+ $image_quality = wpsc_image_quality();
74
+
75
  //ImageCopyResampled($dst_img,$src_img,0,0,0,0,$width,$height,$source_w,$source_h);
76
  switch($imagetype[2]) {
77
  case IMAGETYPE_JPEG:
78
+ ImageJPEG($dst_img, $image_output, $image_quality);
79
  break;
80
 
81
  case IMAGETYPE_GIF:
js/tinymce3/editor_plugin.js CHANGED
@@ -266,7 +266,7 @@
266
 
267
  tinymce.create('tinymce.plugins.userlogpage_image', {
268
  init : function(ed, url) {
269
- var pb = '<img src="' + url + '/productspage.gif" class="transactionresultpage_image mceItemNoResize" />', cls = 'userlogpage_image', sep = ed.getParam('userlogpage_image', '[userlog]'), pbRE;
270
 
271
  pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g');
272
 
266
 
267
  tinymce.create('tinymce.plugins.userlogpage_image', {
268
  init : function(ed, url) {
269
+ var pb = '<img src="' + url + '/productspage.gif" class="userlogpage_image mceItemNoResize" />', cls = 'userlogpage_image', sep = ed.getParam('userlogpage_image', '[userlog]'), pbRE;
270
 
271
  pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g');
272
 
js/user.js CHANGED
@@ -466,7 +466,7 @@ var usps_method_switch=function (results){
466
  }
467
 
468
  function add_meta_box(results){
469
- jQuery(".wpsc_buy_button").before(results);
470
  jQuery('.time_requested').datepicker({ dateFormat: 'yy-mm-dd' });
471
  }
472
 
466
  }
467
 
468
  function add_meta_box(results){
469
+ // jQuery(".wpsc_buy_button").before(results);
470
  jQuery('.time_requested').datepicker({ dateFormat: 'yy-mm-dd' });
471
  }
472
 
js/wp-e-commerce.js CHANGED
@@ -32,10 +32,11 @@ jQuery(document).ready(function () {
32
  var phone = jQuery("input[title='billingphone']").val();
33
  var email = jQuery("input[title='billingfirstname']").val();
34
  var state = jQuery("select[title='billingregion'] :selected").text();
35
- //var stateID = jQuery("select[title='billingregion'] :selected").val();
36
  var country = jQuery("select[title='billingcountry'] :selected").text();
37
  var countryID = jQuery("select[title='billingcountry'] :selected").val();
38
-
 
39
  jQuery("input[title='shippingfirstname']").val(fname);
40
  jQuery("input[title='shippinglastname']").val(lname);
41
  jQuery("textarea[title='shippingaddress']").val(addr);
@@ -43,19 +44,38 @@ jQuery(document).ready(function () {
43
  jQuery("input[title='shippingpostcode']").val(pcode);
44
  jQuery("input[title='shippingphone']").val(phone);
45
  jQuery("input[title='shippingemail']").val(email);
46
- jQuery("input[title='shippingstate']").val(state);
47
  jQuery("input.shipping_country").val(countryID);
48
  jQuery("span.shipping_country_name").html(country);
49
  jQuery("input.shipping_region").val(countryID);
50
  jQuery("span.shipping_region_name").html(state);
51
  jQuery("select#current_country").val(countryID);
52
  if(state == ''){
53
- jQuery("select#region").hide();
54
- }else{
55
- if(jQuery("select#region").css('display') == 'none'){
 
 
 
 
 
 
56
  jQuery("select#region").show();
 
 
 
 
 
 
 
57
  }
58
- jQuery("select#region").val(state);
 
 
 
 
 
 
59
  }
60
  jQuery("select[title='shipping_country']").val(countryID);
61
  var html_form_id = jQuery("select[title='shipping_country']").attr('id');
@@ -73,13 +93,8 @@ jQuery(document).ready(function () {
73
  }
74
  }
75
  }
76
- submit_change_country();
77
-
78
-
79
-
80
- }else{
81
-
82
-
83
  }
84
 
85
  //otherwise, hide it
@@ -236,8 +251,23 @@ function switchmethod(key,key1){
236
  }
237
 
238
  // submit the country forms.
239
- function submit_change_country(){
240
- document.forms.change_country.submit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  }
242
 
243
  // submit the fancy notifications forms.
@@ -257,7 +287,7 @@ function wpsc_fancy_notification(parent_form){
257
  //console.log(form_button_id);
258
  //return;
259
  var container_offset = {};
260
- new_container_offset = jQuery('#products_page_container').offset(options, container_offset);
261
 
262
  if(container_offset['left'] == null) {
263
  container_offset['left'] = new_container_offset.left;
@@ -265,13 +295,13 @@ function wpsc_fancy_notification(parent_form){
265
  }
266
 
267
  var button_offset = {};
268
- new_button_offset = jQuery('#'+form_button_id).offset(options, button_offset)
269
 
270
  if(button_offset['left'] == null) {
271
  button_offset['left'] = new_button_offset.left;
272
  button_offset['top'] = new_button_offset.top;
273
  }
274
-
275
  jQuery('#fancy_notification').css("left", (button_offset['left'] - container_offset['left'] + 10) + 'px');
276
  jQuery('#fancy_notification').css("top", ((button_offset['top'] - container_offset['top']) -60) + 'px');
277
 
@@ -303,8 +333,8 @@ function shopping_cart_collapser() {
303
 
304
  function set_billing_country(html_form_id, form_id){
305
  var billing_region = '';
306
- country = jQuery(("div#"+html_form_id+" select[class=current_country]")).val();
307
- region = jQuery(("div#"+html_form_id+" select[class=current_region]")).val();
308
  if(/[\d]{1,}/.test(region)) {
309
  billing_region = "&billing_region="+region;
310
  }
32
  var phone = jQuery("input[title='billingphone']").val();
33
  var email = jQuery("input[title='billingfirstname']").val();
34
  var state = jQuery("select[title='billingregion'] :selected").text();
35
+ var stateID = jQuery("select[title='billingregion'] :selected").val();
36
  var country = jQuery("select[title='billingcountry'] :selected").text();
37
  var countryID = jQuery("select[title='billingcountry'] :selected").val();
38
+ var shipID;
39
+ var shipName;
40
  jQuery("input[title='shippingfirstname']").val(fname);
41
  jQuery("input[title='shippinglastname']").val(lname);
42
  jQuery("textarea[title='shippingaddress']").val(addr);
44
  jQuery("input[title='shippingpostcode']").val(pcode);
45
  jQuery("input[title='shippingphone']").val(phone);
46
  jQuery("input[title='shippingemail']").val(email);
47
+ jQuery("input[title='shippingstate']").val(stateID);
48
  jQuery("input.shipping_country").val(countryID);
49
  jQuery("span.shipping_country_name").html(country);
50
  jQuery("input.shipping_region").val(countryID);
51
  jQuery("span.shipping_region_name").html(state);
52
  jQuery("select#current_country").val(countryID);
53
  if(state == ''){
54
+ state = jQuery("select.current_region :selected").text();
55
+ stateID = jQuery("select.current_region :selected").val();
56
+ if(state == ''){
57
+ jQuery("select#region").hide();
58
+ shipName = jQuery('input.shipping_region').attr('name');
59
+ shipID = jQuery('input.shipping_region').attr('id');
60
+ jQuery('input.shipping_region').replaceWith('<input class="shipping_region" type="text" value="'+state+'" name="'+shipName+'" id="'+shipName+'" />');
61
+ jQuery('span.shipping_region_name').replaceWith('<span class="shipping_region_name"></span>');
62
+ }else{
63
  jQuery("select#region").show();
64
+
65
+ jQuery("select#region :selected").html(state).attr('selected','selected');
66
+ shipName = jQuery('input.shipping_region').attr('name');
67
+ shipID = jQuery('input.shipping_region').attr('id');
68
+ jQuery('input.shipping_region').replaceWith('<input type="hidden" value="'+stateID+'" name="'+shipName+'" id="'+shipName+'" class="shipping_region" />');
69
+ jQuery('input.shipping_region').append('<span class="shipping_region_name"></span>');
70
+ jQuery('span.shipping_region_name').html(state);
71
  }
72
+ }else{
73
+ jQuery("select#region").show();
74
+ shipName = jQuery('input.shipping_region').attr('name');
75
+ shipID = jQuery('input.shipping_region').attr('id');
76
+ jQuery('input.shipping_region').replaceWith('<input type="hidden" class="shipping_region" value="'+stateID+'" name="'+shipName+'" id="'+shipName+'" />');
77
+ jQuery("select#region :selected").html(state).attr('selected','selected');
78
+ jQuery('span.shipping_region_name').html(state);
79
  }
80
  jQuery("select[title='shipping_country']").val(countryID);
81
  var html_form_id = jQuery("select[title='shipping_country']").attr('id');
93
  }
94
  }
95
  }
96
+ submit_change_country(true);
97
+
 
 
 
 
 
98
  }
99
 
100
  //otherwise, hide it
251
  }
252
 
253
  // submit the country forms.
254
+ function submit_change_country(ajax){
255
+ if(!ajax){
256
+ document.forms.change_country.submit();
257
+ }else{
258
+ var country_code = jQuery('#current_country :selected').val();
259
+ var params = 'ajax=true&wpsc_ajax_actions=update_location&country='+country_code;
260
+ var region_code = jQuery('#region :selected').val();
261
+ if(typeof(region_code) != 'undefined'){
262
+ params += '&region='+region_code;
263
+ }
264
+
265
+ jQuery.post( 'index.php', params, function(returned_data) { });
266
+ jQuery.post( 'index.php', 'wpsc_ajax_action=update_shipping_price', function(returned_data) {
267
+ eval(returned_data);
268
+ });
269
+
270
+ }
271
  }
272
 
273
  // submit the fancy notifications forms.
287
  //console.log(form_button_id);
288
  //return;
289
  var container_offset = {};
290
+ new_container_offset = jQuery('#products_page_container').offset();
291
 
292
  if(container_offset['left'] == null) {
293
  container_offset['left'] = new_container_offset.left;
295
  }
296
 
297
  var button_offset = {};
298
+ new_button_offset = jQuery('#'+form_button_id).offset()
299
 
300
  if(button_offset['left'] == null) {
301
  button_offset['left'] = new_button_offset.left;
302
  button_offset['top'] = new_button_offset.top;
303
  }
304
+ // console.log((button_offset['left'] - container_offset['left'] + 10));
305
  jQuery('#fancy_notification').css("left", (button_offset['left'] - container_offset['left'] + 10) + 'px');
306
  jQuery('#fancy_notification').css("top", ((button_offset['top'] - container_offset['top']) -60) + 'px');
307
 
333
 
334
  function set_billing_country(html_form_id, form_id){
335
  var billing_region = '';
336
+ country = jQuery(("select[class=current_country]")).val();
337
+ region = jQuery(("select[class=current_region]")).val();
338
  if(/[\d]{1,}/.test(region)) {
339
  billing_region = "&billing_region="+region;
340
  }
merchants/GoogleCheckout-XML.php CHANGED
@@ -90,7 +90,7 @@ function gateway_google($fromcheckout = false){
90
  $cart->SetContinueShoppingUrl($returnURL);
91
  $cart->SetEditCartUrl(get_option('shopping_cart_url'));
92
  $no=1;
93
- //exit("<pre>".print_r($wp_cart,true)."</pre>");
94
 
95
  //new item code
96
  $no = 0;
@@ -100,19 +100,19 @@ function gateway_google($fromcheckout = false){
100
  $curr=new CURRENCYCONVERTER();
101
  $currency_code = $wpdb->get_results("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
102
  $local_currency_code = $currency_code[0]['code'];
103
-
104
  $google_curr = get_option('google_cur');
105
  while (wpsc_have_cart_items()) {
106
  wpsc_the_cart_item();
107
  if($google_curr != $local_currency_code) {
108
  $google_currency_productprice = $curr->convert( wpsc_cart_item_price(false)/wpsc_cart_item_quantity(),$google_curr,$local_currency_code);
109
- $google_currency_shipping = $curr->convert( $wpsc_cart->calculate_total_shipping()/wpsc_cart_item_quantity(),$google_curr,$local_currency_code);
110
 
111
 
112
- } else {
113
- $google_currency_productprice = wpsc_cart_item_price(false)/wpsc_cart_item_quantity();
114
-
115
- }
116
 
117
  // exit('<pre>'.print_r(wpsc_cart_item_name(),true).'</pre>');
118
  $cartitem["$no"] = new GoogleItem(wpsc_cart_item_name(), // Item name
90
  $cart->SetContinueShoppingUrl($returnURL);
91
  $cart->SetEditCartUrl(get_option('shopping_cart_url'));
92
  $no=1;
93
+ //exit("<pre>".print_r($wpsc_cart,true)."</pre>");
94
 
95
  //new item code
96
  $no = 0;
100
  $curr=new CURRENCYCONVERTER();
101
  $currency_code = $wpdb->get_results("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
102
  $local_currency_code = $currency_code[0]['code'];
103
+ // exit('<pre>'.print_r($_REQUEST,true).'</pre>');
104
  $google_curr = get_option('google_cur');
105
  while (wpsc_have_cart_items()) {
106
  wpsc_the_cart_item();
107
  if($google_curr != $local_currency_code) {
108
  $google_currency_productprice = $curr->convert( wpsc_cart_item_price(false)/wpsc_cart_item_quantity(),$google_curr,$local_currency_code);
109
+ $google_currency_shipping = $curr->convert( $wpsc_cart->selected_shipping_amount,$google_curr,$local_currency_code);
110
 
111
 
112
+ } else {
113
+ $google_currency_productprice = wpsc_cart_item_price(false)/wpsc_cart_item_quantity();
114
+ $google_currency_shipping = $wpsc_cart->selected_shipping_amount;
115
+ }
116
 
117
  // exit('<pre>'.print_r(wpsc_cart_item_name(),true).'</pre>');
118
  $cartitem["$no"] = new GoogleItem(wpsc_cart_item_name(), // Item name
merchants/paypal-standard.merchant.php CHANGED
@@ -219,7 +219,9 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
219
  echo "<pre>".print_r($this->collected_gateway_data,true)."</pre>";
220
  exit();
221
  }
 
222
  header("Location: ".get_option('paypal_multiple_url')."?".$gateway_values);
 
223
  }
224
 
225
 
219
  echo "<pre>".print_r($this->collected_gateway_data,true)."</pre>";
220
  exit();
221
  }
222
+ //exit('<pre>'.print_r($gateway_values, true).'</pre>');
223
  header("Location: ".get_option('paypal_multiple_url')."?".$gateway_values);
224
+ exit();
225
  }
226
 
227
 
merchants/paypal_certified.php CHANGED
@@ -780,7 +780,7 @@ $output .= "
780
  }
781
 
782
  $USE_PROXY = false;
783
- $version="56.0";
784
 
785
  if (session_id() == "")
786
  session_start();
@@ -838,7 +838,8 @@ $output .= "
838
  $data['SHIPTOCITY'] = $value['value'];
839
  }
840
  if(($value['unique_name']=='billingcountry') && $value['value'] != ''){
841
- $data['SHIPTOCOUNTRYCODE'] = $value['value'];
 
842
  $state = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_REGION_TAX."` WHERE `id` ='{$purchase_log['billing_region']}' LIMIT 1");
843
  if($purchase_log['billing_region'] > 0) {
844
  $data['SHIPTOSTATE'] = $state;
@@ -1040,7 +1041,7 @@ $output .= "
1040
  global $USE_PROXY, $PROXY_HOST, $PROXY_PORT;
1041
  global $gv_ApiErrorURL;
1042
  global $sBNCode;
1043
-
1044
  //setting the curl parameters.
1045
  $ch = curl_init();
1046
 
@@ -1061,7 +1062,7 @@ $output .= "
1061
 
1062
  //NVPRequest for submitting to server
1063
  $nvpreq="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);
1064
-
1065
  //setting the nvpreq as POST FIELD to curl
1066
  curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
1067
  //exit($nvpreq);
780
  }
781
 
782
  $USE_PROXY = false;
783
+ $version="57.0";
784
 
785
  if (session_id() == "")
786
  session_start();
838
  $data['SHIPTOCITY'] = $value['value'];
839
  }
840
  if(($value['unique_name']=='billingcountry') && $value['value'] != ''){
841
+ $values = maybe_unserialize($value['value']);
842
+ $data['SHIPTOCOUNTRYCODE'] = $values[0];
843
  $state = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_REGION_TAX."` WHERE `id` ='{$purchase_log['billing_region']}' LIMIT 1");
844
  if($purchase_log['billing_region'] > 0) {
845
  $data['SHIPTOSTATE'] = $state;
1041
  global $USE_PROXY, $PROXY_HOST, $PROXY_PORT;
1042
  global $gv_ApiErrorURL;
1043
  global $sBNCode;
1044
+ $version = 57;
1045
  //setting the curl parameters.
1046
  $ch = curl_init();
1047
 
1062
 
1063
  //NVPRequest for submitting to server
1064
  $nvpreq="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);
1065
+ //exit('<pre>'.print_r($nvpreq,true).'</true>');
1066
  //setting the nvpreq as POST FIELD to curl
1067
  curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
1068
  //exit($nvpreq);
merchants/paypal_multiple.php CHANGED
@@ -119,13 +119,13 @@ function gateway_paypal_multiple($seperator, $sessionid) {
119
  $paypal_currency_productprice = $curr->convert($local_currency_productprice,$paypal_currency_code,$local_currency_code);
120
  $paypal_currency_shipping = $curr->convert($local_currency_shipping,$paypal_currency_code,$local_currency_code);
121
  // exit($paypal_currency_productprice . " " . $paypal_currency_shipping.' '.$local_currency_productprice . " " . $local_currency_code);
122
- $base_shipping = $curr->convert($purchase_log['base_shipping'],$paypal_currency_code, $local_currency_code);
123
  //exit($paypal_currency_productprice.' Local>'.$local_currency_productprice.' Base shp'.$base_shipping);
124
  $tax_price = $curr->convert($item['tax_charged'],$paypal_currency_code, $local_currency_code);
125
  } else {
126
  $paypal_currency_productprice = $local_currency_productprice;
127
  $paypal_currency_shipping = $local_currency_shipping;
128
- $base_shipping = $purchase_log['base_shipping'];
129
  $tax_price = $item['tax_charged'];
130
  }
131
  //exit("<pre>".print_r(, true).'</pre>');
119
  $paypal_currency_productprice = $curr->convert($local_currency_productprice,$paypal_currency_code,$local_currency_code);
120
  $paypal_currency_shipping = $curr->convert($local_currency_shipping,$paypal_currency_code,$local_currency_code);
121
  // exit($paypal_currency_productprice . " " . $paypal_currency_shipping.' '.$local_currency_productprice . " " . $local_currency_code);
122
+ $base_shipping = $curr->convert($wpsc_cart->calculate_total_shipping(),$paypal_currency_code, $local_currency_code);
123
  //exit($paypal_currency_productprice.' Local>'.$local_currency_productprice.' Base shp'.$base_shipping);
124
  $tax_price = $curr->convert($item['tax_charged'],$paypal_currency_code, $local_currency_code);
125
  } else {
126
  $paypal_currency_productprice = $local_currency_productprice;
127
  $paypal_currency_shipping = $local_currency_shipping;
128
+ $base_shipping = $wpsc_cart->calculate_total_shipping();
129
  $tax_price = $item['tax_charged'];
130
  }
131
  //exit("<pre>".print_r(, true).'</pre>');
merchants/paypal_pro.php CHANGED
@@ -92,7 +92,10 @@ function gateway_paypal_pro($seperator, $sessionid){
92
  $data['PAYMENTACTION'] = "Sale";
93
  $data['IPADDRESS'] = $_SERVER["REMOTE_ADDR"];
94
  $data['RETURNFMFDETAILS'] = "1"; // optional - return fraud management filter data
95
-
 
 
 
96
  foreach((array)$userinfo as $key => $value){
97
  if(($value['unique_name']=='billingfirstname') && $value['value'] != ''){
98
  $data['FIRSTNAME'] = $value['value'];
@@ -179,7 +182,7 @@ function gateway_paypal_pro($seperator, $sessionid){
179
  //exit($key.' > '.print_r($value,true));
180
  }
181
  $data['SHIPTONAME'] = $data1['SHIPTONAME1'].' '.$data1['SHIPTONAME2'];
182
- exit('<pre>'.print_r($data, true).'</pre>');
183
  if( ($data['SHIPTONAME'] == null) || ($data['SHIPTOSTREET'] == null) || ($data['SHIPTOCITY'] == null) ||
184
  ($data['SHIPTOSTATE'] == null) || ($data['SHIPTOCOUNTRY'] == null) || ($data['SHIPTOZIP'] == null)) {
185
  // if any shipping details are empty, the order will simply fail, this deletes them all if one is empty
@@ -226,7 +229,7 @@ function gateway_paypal_pro($seperator, $sessionid){
226
  $data['L_AMT'.$i] = number_format($Item->unit_price,2);
227
  $data['L_NUMBER'.$i] = $i;
228
  $data['L_QTY'.$i] = $Item->quantity;
229
- $data['L_TAXAMT'.$i] = number_format($Item->tax,2);
230
  }
231
  }
232
  $transaction = "";
@@ -243,7 +246,7 @@ function gateway_paypal_pro($seperator, $sessionid){
243
  }
244
  //exit($transaction);
245
  $response = send($transaction);
246
- exit('<pre>'.print_r($response, true).'</pre><pre>'.print_r($data, true).'</pre>');
247
  if($response->ack == 'Success' || $response->ack == 'SuccessWithWarning'){
248
  //redirect to transaction page and store in DB as a order with accepted payment
249
  $sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `processed`= '2' WHERE `sessionid`=".$sessionid;
@@ -285,6 +288,7 @@ function send ($transaction) {
285
  $connection = curl_init();
286
  if (get_option('paypal_pro_testmode') == "on"){
287
  curl_setopt($connection,CURLOPT_URL,"https://api-3t.sandbox.paypal.com/nvp"); // Sandbox testing
 
288
  }else{
289
  curl_setopt($connection,CURLOPT_URL,"https://api-3t.paypal.com/nvp"); // Live
290
  }
@@ -394,4 +398,4 @@ $output = '
394
  </tr>';
395
  return $output;
396
  }
397
- ?>
92
  $data['PAYMENTACTION'] = "Sale";
93
  $data['IPADDRESS'] = $_SERVER["REMOTE_ADDR"];
94
  $data['RETURNFMFDETAILS'] = "1"; // optional - return fraud management filter data
95
+
96
+ $sql = 'SELECT `code` FROM `'.WPSC_TABLE_CURRENCY_LIST.'` WHERE `id`='.get_option('currency_type');
97
+ $data['CURRENCYCODE'] = $wpdb->get_var($sql);
98
+
99
  foreach((array)$userinfo as $key => $value){
100
  if(($value['unique_name']=='billingfirstname') && $value['value'] != ''){
101
  $data['FIRSTNAME'] = $value['value'];
182
  //exit($key.' > '.print_r($value,true));
183
  }
184
  $data['SHIPTONAME'] = $data1['SHIPTONAME1'].' '.$data1['SHIPTONAME2'];
185
+ // exit('<pre>'.print_r($data, true).'</pre>');
186
  if( ($data['SHIPTONAME'] == null) || ($data['SHIPTOSTREET'] == null) || ($data['SHIPTOCITY'] == null) ||
187
  ($data['SHIPTOSTATE'] == null) || ($data['SHIPTOCOUNTRY'] == null) || ($data['SHIPTOZIP'] == null)) {
188
  // if any shipping details are empty, the order will simply fail, this deletes them all if one is empty
229
  $data['L_AMT'.$i] = number_format($Item->unit_price,2);
230
  $data['L_NUMBER'.$i] = $i;
231
  $data['L_QTY'.$i] = $Item->quantity;
232
+ //$data['L_TAXAMT'.$i] = number_format($Item->tax,2);
233
  }
234
  }
235
  $transaction = "";
246
  }
247
  //exit($transaction);
248
  $response = send($transaction);
249
+ //exit('<pre>'.print_r($response, true).'</pre><pre>'.print_r($data, true).'</pre>');
250
  if($response->ack == 'Success' || $response->ack == 'SuccessWithWarning'){
251
  //redirect to transaction page and store in DB as a order with accepted payment
252
  $sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `processed`= '2' WHERE `sessionid`=".$sessionid;
288
  $connection = curl_init();
289
  if (get_option('paypal_pro_testmode') == "on"){
290
  curl_setopt($connection,CURLOPT_URL,"https://api-3t.sandbox.paypal.com/nvp"); // Sandbox testing
291
+ // exit('sandbox is true');
292
  }else{
293
  curl_setopt($connection,CURLOPT_URL,"https://api-3t.paypal.com/nvp"); // Live
294
  }
398
  </tr>';
399
  return $output;
400
  }
401
+ ?>
shipping/australiapost.php CHANGED
@@ -209,7 +209,8 @@ class australiapost {
209
  }
210
 
211
 
212
- if ($response['response']['code'] != '200' || empty($response['body'])) continue;
 
213
 
214
  $lines = explode("\n", $response['body']);
215
 
209
  }
210
 
211
 
212
+ // Silently ignore any API server errors
213
+ if ( is_wp_error($response) || $response['response']['code'] != '200' || empty($response['body']) ) continue;
214
 
215
  $lines = explode("\n", $response['body']);
216
 
shipping/flatrate.php CHANGED
@@ -73,12 +73,13 @@ class flatrate {
73
  } else {
74
  $country = $_SESSION['wpsc_delivery_country'];
75
  }
76
-
77
-
78
  if (get_option('base_country') != $country) {
79
  $results = $wpdb->get_var("SELECT `continent` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `isocode` IN('{$country}') LIMIT 1");
80
  $flatrates = get_option('flat_rates');
81
-
 
82
  if ($flatrates != '') {
83
 
84
  if($_SESSION['quote_shipping_method'] == $this->internal_name) {
@@ -113,7 +114,7 @@ class flatrate {
113
  $_SESSION['quote_shipping_option'] = null;
114
  }
115
  }
116
-
117
  return $shipping_quotes;
118
  }
119
  }
73
  } else {
74
  $country = $_SESSION['wpsc_delivery_country'];
75
  }
76
+ $_SESSION['quote_shipping_option'] = null;
77
+
78
  if (get_option('base_country') != $country) {
79
  $results = $wpdb->get_var("SELECT `continent` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `isocode` IN('{$country}') LIMIT 1");
80
  $flatrates = get_option('flat_rates');
81
+ $_SESSION['quote_shipping_option'] = null;
82
+
83
  if ($flatrates != '') {
84
 
85
  if($_SESSION['quote_shipping_method'] == $this->internal_name) {
114
  $_SESSION['quote_shipping_option'] = null;
115
  }
116
  }
117
+
118
  return $shipping_quotes;
119
  }
120
  }
shipping/tablerate.php CHANGED
@@ -102,13 +102,20 @@ class tablerate {
102
  }
103
 
104
 
105
- function get_item_shipping($unit_price, $quantity, $weight, $product_id) {
106
- global $wpdb;
 
 
 
 
 
 
107
  if(is_numeric($product_id) && (get_option('do_not_use_shipping') != 1) && ($_SESSION['quote_shipping_method'] == 'flatrate')) {
108
  $sql = "SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='$product_id' LIMIT 1";
109
  $product_list = $wpdb->get_row($sql,ARRAY_A) ;
110
  if($product_list['no_shipping'] == 0) {
111
  //if the item has shipping
 
112
  if($country_code == get_option('base_country')) {
113
  $additional_shipping = $product_list['pnp'];
114
  } else {
102
  }
103
 
104
 
105
+ function get_item_shipping( &$cart_item ) {
106
+
107
+ global $wpdb, $wpsc_cart;
108
+
109
+ $unit_price = $cart_item->unit_price;
110
+ $quantity = $cart_item->quantity;
111
+ $weight = $cart_item->weight;
112
+ $product_id = $cart_item->product_id;
113
  if(is_numeric($product_id) && (get_option('do_not_use_shipping') != 1) && ($_SESSION['quote_shipping_method'] == 'flatrate')) {
114
  $sql = "SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='$product_id' LIMIT 1";
115
  $product_list = $wpdb->get_row($sql,ARRAY_A) ;
116
  if($product_list['no_shipping'] == 0) {
117
  //if the item has shipping
118
+ // exit('<pre>'.print_r($product_list, true).'</pre>');
119
  if($country_code == get_option('base_country')) {
120
  $additional_shipping = $product_list['pnp'];
121
  } else {
shipping/ups.php CHANGED
@@ -280,62 +280,64 @@ class ups {
280
  $wpsc_ups_services = get_option("wpsc_ups_services");
281
  // Initialize a DOM using the XML passed in!
282
  $objDOM = new DOMDocument();
283
- $objDOM->loadXML($raw);
284
-
285
- // Get the <ResponseStatusCode> from the UPS XML
286
- $getStatusNode = $objDOM->getElementsByTagName("ResponseStatusCode");
287
- // Get the value of the error code, 1 == No Error, 0 == Error !!!
288
- $statusCode = $getStatusNode->item(0)->nodeValue;
289
-
290
- if ($statusCode == "0"){
291
- // Usually I dont leave debug stuff in but this is handy stuff!!
292
- // it will print out the error message returned by UPS!
293
- /*$getErrorDescNode = $objDOM->getElementsByTagName("ErrorDescription");
294
- $ErrorDesc = $getErrorDescNode->item(0)->nodeValue;
295
- echo "<br />Error : ".$ErrorDesc."<br />";*/
296
- return false;
297
- }else{
298
- $RateBlocks = $objDOM->getElementsByTagName("RatedShipment");
299
- foreach($RateBlocks as $rate_block){
300
- // Get the <Service> Node from the XML chunk
301
- $getServiceNode = $rate_block->getElementsByTagName("Service");
302
- $serviceNode = $getServiceNode->item(0);
303
-
304
- // Get the <Code> Node from the <Service> chunk
305
- $getServiceCodeNode = $serviceNode->getElementsByTagName("Code");
306
- // Get the value from <Code>
307
- $serviceCode = $getServiceCodeNode->item(0)->nodeValue;
308
-
309
- // Get the <TotalCharges> Node from the XML chunk
310
- $getChargeNodes = $rate_block->getElementsByTagName("TotalCharges");
311
- $chargeNode = $getChargeNodes->item(0);
312
-
313
- // Get the <CurrencyCode> from the <TotalCharge> chunk
314
- $getCurrNode= $chargeNode->getElementsByTagName("CurrencyCode");
315
- // Get the value of <CurrencyCode>
316
- $currCode = $getCurrNode->item(0)->nodeValue;
317
-
318
- // Get the <MonetaryValue> from the <TotalCharge> chunk
319
- $getMonetaryNode= $chargeNode->getElementsByTagName("MonetaryValue");
320
- // Get the value of <MonetaryValue>
321
- $price = $getMonetaryNode->item(0)->nodeValue;
322
- // If there are any services specified in the admin area
323
- // this will check that list and pass on adding any services that
324
- // are not explicitly defined.
325
- if (!empty($wpsc_ups_services)){
326
- if (is_array($wpsc_ups_services)){
327
- if (array_search($serviceCode, $wpsc_ups_services) === false){
328
- continue;
329
- }
330
- }else if ($wpsc_ups_services != $serviceCode){
331
- continue;
332
- }
333
- }
334
- if(array_key_exists($serviceCode,$this->Services)){
335
- $rate_table[$this->Services[$serviceCode]] = array($currCode,$price);
336
- }
337
-
338
- } // End foreach rated shipment block
 
 
339
  }
340
  // Revers sort the rate selection so it is cheapest First!
341
  asort($rate_table);
@@ -454,6 +456,9 @@ class ups {
454
  }
455
  }
456
  // return the final formatted array !
 
 
 
457
  return $rate_table;
458
  }
459
 
280
  $wpsc_ups_services = get_option("wpsc_ups_services");
281
  // Initialize a DOM using the XML passed in!
282
  $objDOM = new DOMDocument();
283
+ if($raw != '') {
284
+ $objDOM->loadXML($raw);
285
+
286
+ // Get the <ResponseStatusCode> from the UPS XML
287
+ $getStatusNode = $objDOM->getElementsByTagName("ResponseStatusCode");
288
+ // Get the value of the error code, 1 == No Error, 0 == Error !!!
289
+ $statusCode = $getStatusNode->item(0)->nodeValue;
290
+
291
+ if ($statusCode == "0"){
292
+ // Usually I dont leave debug stuff in but this is handy stuff!!
293
+ // it will print out the error message returned by UPS!
294
+ /*$getErrorDescNode = $objDOM->getElementsByTagName("ErrorDescription");
295
+ $ErrorDesc = $getErrorDescNode->item(0)->nodeValue;
296
+ echo "<br />Error : ".$ErrorDesc."<br />";*/
297
+ return false;
298
+ }else{
299
+ $RateBlocks = $objDOM->getElementsByTagName("RatedShipment");
300
+ foreach($RateBlocks as $rate_block){
301
+ // Get the <Service> Node from the XML chunk
302
+ $getServiceNode = $rate_block->getElementsByTagName("Service");
303
+ $serviceNode = $getServiceNode->item(0);
304
+
305
+ // Get the <Code> Node from the <Service> chunk
306
+ $getServiceCodeNode = $serviceNode->getElementsByTagName("Code");
307
+ // Get the value from <Code>
308
+ $serviceCode = $getServiceCodeNode->item(0)->nodeValue;
309
+
310
+ // Get the <TotalCharges> Node from the XML chunk
311
+ $getChargeNodes = $rate_block->getElementsByTagName("TotalCharges");
312
+ $chargeNode = $getChargeNodes->item(0);
313
+
314
+ // Get the <CurrencyCode> from the <TotalCharge> chunk
315
+ $getCurrNode= $chargeNode->getElementsByTagName("CurrencyCode");
316
+ // Get the value of <CurrencyCode>
317
+ $currCode = $getCurrNode->item(0)->nodeValue;
318
+
319
+ // Get the <MonetaryValue> from the <TotalCharge> chunk
320
+ $getMonetaryNode= $chargeNode->getElementsByTagName("MonetaryValue");
321
+ // Get the value of <MonetaryValue>
322
+ $price = $getMonetaryNode->item(0)->nodeValue;
323
+ // If there are any services specified in the admin area
324
+ // this will check that list and pass on adding any services that
325
+ // are not explicitly defined.
326
+ if (!empty($wpsc_ups_services)){
327
+ if (is_array($wpsc_ups_services)){
328
+ if (array_search($serviceCode, $wpsc_ups_services) === false){
329
+ continue;
330
+ }
331
+ }else if ($wpsc_ups_services != $serviceCode){
332
+ continue;
333
+ }
334
+ }
335
+ if(array_key_exists($serviceCode,$this->Services)){
336
+ $rate_table[$this->Services[$serviceCode]] = array($currCode,$price);
337
+ }
338
+
339
+ } // End foreach rated shipment block
340
+ }
341
  }
342
  // Revers sort the rate selection so it is cheapest First!
343
  asort($rate_table);
456
  }
457
  }
458
  // return the final formatted array !
459
+ $_SESSION['wpsc_shipping_cache_check']['zipcode'] = $args['dest_pcode'];
460
+ $_SESSION['wpsc_shipping_cache_check']['weight'] = $args['weight'];
461
+ $_SESSION['wpsc_shipping_cache'][$this->internal_name] = $rate_table;
462
  return $rate_table;
463
  }
464
 
shipping/usps.php CHANGED
@@ -184,7 +184,7 @@ class usps {
184
  $request = 'API=IntlRate&XML=' . urlencode($request);
185
  }
186
  $usps_server = 'production.shippingapis.com';
187
- $api_dll = 'shippingapi.dll';
188
  if(get_option('usps_test_server') == '1'){
189
  $url ='http://testing.shippingapis.com/ShippingAPITest.dll?'.$request;
190
  }else{
184
  $request = 'API=IntlRate&XML=' . urlencode($request);
185
  }
186
  $usps_server = 'production.shippingapis.com';
187
+ $api_dll = 'shippingAPI.dll';
188
  if(get_option('usps_test_server') == '1'){
189
  $url ='http://testing.shippingapis.com/ShippingAPITest.dll?'.$request;
190
  }else{
shipping/weightrate.php CHANGED
@@ -76,10 +76,49 @@ class weightrate {
76
  }
77
  }
78
 
79
- function get_item_shipping($unit_price, $quantity, $weight, $product_id) {
80
- return 0;
81
- }
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  function get_cart_shipping($total_price, $weight) {
84
  $layers = get_option('weight_rate_layers');
85
  if ($layers != '') {
76
  }
77
  }
78
 
 
 
 
79
 
80
+ function get_item_shipping(&$cart_item) {
81
+ global $wpdb, $wpsc_cart;
82
+ $unit_price = $cart_item->unit_price;
83
+ $quantity = $cart_item->quantity;
84
+ $weight = $cart_item->weight;
85
+ $product_id = $cart_item->product_id;
86
+
87
+
88
+ $uses_billing_address = false;
89
+ foreach((array)$cart_item->category_id_list as $category_id) {
90
+ $uses_billing_address = (bool)wpsc_get_categorymeta($category_id, 'uses_billing_address');
91
+ if($uses_billing_address === true) {
92
+ break; /// just one true value is sufficient
93
+ }
94
+ }
95
+
96
+ if(is_numeric($product_id) && (get_option('do_not_use_shipping') != 1)) {
97
+ if($uses_billing_address == true) {
98
+ $country_code = $wpsc_cart->selected_country;
99
+ } else {
100
+ $country_code = $wpsc_cart->delivery_country;
101
+ }
102
+
103
+ $product_list = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='{$product_id}' LIMIT 1",ARRAY_A);
104
+ if($product_list['no_shipping'] == 0) {
105
+ //if the item has shipping
106
+ if($country_code == get_option('base_country')) {
107
+ $additional_shipping = $product_list['pnp'];
108
+ } else {
109
+ $additional_shipping = $product_list['international_pnp'];
110
+ }
111
+ $shipping = $quantity * $additional_shipping;
112
+ } else {
113
+ //if the item does not have shipping
114
+ $shipping = 0;
115
+ }
116
+ } else {
117
+ //if the item is invalid or all items do not have shipping
118
+ $shipping = 0;
119
+ }
120
+ return $shipping;
121
+ }
122
  function get_cart_shipping($total_price, $weight) {
123
  $layers = get_option('weight_rate_layers');
124
  if ($layers != '') {
themes/default/default.css CHANGED
@@ -2,7 +2,7 @@
2
  Theme Name: Default Theme
3
  Theme URI: http://instinct.co.nz
4
  Description: Default Theme
5
- Version: 3.5
6
  Author: Thomas Howard
7
  Author URI: http://instinct.co.nz
8
  */
@@ -23,10 +23,7 @@ div.productdisplay img {
23
  border: none;
24
  }
25
 
26
- a.wpsc-current-cat{
27
- font-weight: bold;
28
- color:#000000 !important;
29
- }
30
  #change_country{
31
  float:left;
32
  }
@@ -98,7 +95,7 @@ div.wpsc_listen_button{
98
  }
99
 
100
  div.wpsc_description{
101
- clear: both;
102
  }
103
 
104
  table.shoppingcart{
@@ -1478,7 +1475,7 @@ margin-bottom:10px;
1478
  position:relative;
1479
  }
1480
  .clear_category_group {
1481
- clear: both;
1482
  }
1483
  .widget_wpsc_categorisation h4.wpsc_category_title {
1484
  margin-top: 4px;
2
  Theme Name: Default Theme
3
  Theme URI: http://instinct.co.nz
4
  Description: Default Theme
5
+ Version: 3.6
6
  Author: Thomas Howard
7
  Author URI: http://instinct.co.nz
8
  */
23
  border: none;
24
  }
25
 
26
+
 
 
 
27
  #change_country{
28
  float:left;
29
  }
95
  }
96
 
97
  div.wpsc_description{
98
+ /* clear: both; */
99
  }
100
 
101
  table.shoppingcart{
1475
  position:relative;
1476
  }
1477
  .clear_category_group {
1478
+ /* clear: both; */
1479
  }
1480
  .widget_wpsc_categorisation h4.wpsc_category_title {
1481
  margin-top: 4px;
themes/default/grid_view.php CHANGED
@@ -84,11 +84,11 @@ $image_height = get_option('product_image_height');
84
  <div class="product_grid_display">
85
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
86
  <div class="product_grid_item product_view_<?php echo wpsc_the_product_id(); ?>">
87
-
 
88
  <?php if(wpsc_the_product_thumbnail()) :?>
89
  <div class="item_image">
90
- <a href="<?php echo wpsc_the_product_permalink(); ?>">
91
- <img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>" />
92
  </a>
93
  </div>
94
  <?php else: ?>
@@ -103,19 +103,14 @@ $image_height = get_option('product_image_height');
103
  <?php if(get_option('show_images_only') != 1): ?>
104
  <div class="grid_product_info">
105
  <div class="product_text">
 
 
106
  <strong><?php echo wpsc_the_product_title(); ?></strong>
107
 
108
- <?php if((wpsc_the_product_description() != '') && (get_option('display_description') == 1)): ?>
109
- <p class='griddescription'><?php echo wpsc_the_product_description(); ?></p>
110
- <?php endif; ?>
111
-
112
- <br/>
113
- <span id="product_price_<?php echo wpsc_the_product_id(); ?>" class="pricedisplay"><?php echo wpsc_the_product_price(); ?></span>Price:
114
-
115
- <?php if(get_option('display_moredetails') == 1) : ?>
116
- <br />
117
- <a href='<?php echo wpsc_the_product_permalink(); ?>'>More Details</a>
118
- <?php endif; ?>
119
  </div>
120
  </div>
121
  <div class="grid_more_info">
84
  <div class="product_grid_display">
85
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
86
  <div class="product_grid_item product_view_<?php echo wpsc_the_product_id(); ?>">
87
+
88
+
89
  <?php if(wpsc_the_product_thumbnail()) :?>
90
  <div class="item_image">
91
+ <a href="<?php echo wpsc_the_product_permalink(); ?>" style='background-image: url(<?php echo wpsc_the_product_thumbnail(); ?>);'>
 
92
  </a>
93
  </div>
94
  <?php else: ?>
103
  <?php if(get_option('show_images_only') != 1): ?>
104
  <div class="grid_product_info">
105
  <div class="product_text">
106
+
107
+ <div id="product_price_<?php echo wpsc_the_product_id(); ?>" class="pricedisplay"><?php echo wpsc_the_product_price(true); ?></div>
108
  <strong><?php echo wpsc_the_product_title(); ?></strong>
109
 
110
+ <?php if(get_option('display_moredetails') == 1) : ?>
111
+ <br />
112
+ <a href='<?php echo wpsc_the_product_permalink(); ?>'>More Details</a>
113
+ <?php endif; ?>
 
 
 
 
 
 
 
114
  </div>
115
  </div>
116
  <div class="grid_more_info">
themes/default/list_view.php CHANGED
@@ -63,19 +63,18 @@ global $wpsc_query, $wpdb;
63
  </div>
64
  <?php endif; ?>
65
 
66
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 1 ) || (get_option('wpsc_page_number_position') == 3))) : ?>
67
- <div class='wpsc_page_numbers'>
68
- Pages:
69
- <?php while (wpsc_have_pages()) : wpsc_the_page(); ?>
70
- <?php if(wpsc_page_is_selected()) :?>
71
- <a href='<?php echo wpsc_page_url(); ?>' class='selected'><?php echo wpsc_page_number(); ?></a>
72
- <?php else: ?>
73
- <a href='<?php echo wpsc_page_url(); ?>'><?php echo wpsc_page_number(); ?></a>
74
- <?php endif; ?>
75
- <?php endwhile; ?>
76
  </div>
77
  <?php endif; ?>
78
-
 
 
79
  <table class="list_productdisplay <?php echo wpsc_category_class(); ?>">
80
  <?php /** start the product loop here */?>
81
  <?php $alt = 0; ?>
@@ -135,8 +134,8 @@ global $wpsc_query, $wpdb;
135
 
136
 
137
  <?php if(wpsc_has_multi_adding()): ?>
138
- <label class='wpsc_quantity_update' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
139
- <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update" size="2" value="1"/>
140
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
141
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
142
  <?php endif ;?>
@@ -191,18 +190,18 @@ global $wpsc_query, $wpdb;
191
  echo fancy_notifications();
192
  }
193
  ?>
194
-
195
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
196
- <div class='wpsc_page_numbers'>
197
- Pages:
198
- <?php while ($wpsc_query->have_pages()) : $wpsc_query->the_page(); ?>
199
- <?php if(wpsc_page_is_selected()) :?>
200
- <a href='<?php echo wpsc_page_url(); ?>' class='selected'><?php echo wpsc_page_number(); ?></a>
201
- <?php else: ?>
202
- <a href='<?php echo wpsc_page_url(); ?>'><?php echo wpsc_page_number(); ?></a>
203
- <?php endif; ?>
204
- <?php endwhile; ?>
205
  </div>
206
  <?php endif; ?>
 
 
 
207
  <?php endif; ?>
208
  </div>
63
  </div>
64
  <?php endif; ?>
65
 
66
+
67
+ <!-- Start Pagination -->
68
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 1 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
69
+ <div class="wpsc_page_numbers">
70
+ <?php if ( wpsc_has_pages() ) : ?>
71
+ Pages: <?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?>
72
+ <?php endif; ?>
 
 
 
73
  </div>
74
  <?php endif; ?>
75
+ <!-- End Pagination -->
76
+
77
+
78
  <table class="list_productdisplay <?php echo wpsc_category_class(); ?>">
79
  <?php /** start the product loop here */?>
80
  <?php $alt = 0; ?>
134
 
135
 
136
  <?php if(wpsc_has_multi_adding()): ?>
137
+ <label class='wpsc_quantity_update' for='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]'><?php echo __('Quantity', 'wpsc'); ?>:</label>
138
+ <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]" size="2" value="1"/>
139
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
140
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
141
  <?php endif ;?>
190
  echo fancy_notifications();
191
  }
192
  ?>
193
+
194
+
195
+ <!-- Start Pagination -->
196
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 2 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
197
+ <div class="wpsc_page_numbers">
198
+ <?php if ( wpsc_has_pages() ) : ?>
199
+ Pages: <?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?>
200
+ <?php endif; ?>
 
 
 
201
  </div>
202
  <?php endif; ?>
203
+ <!-- End Pagination -->
204
+
205
+
206
  <?php endif; ?>
207
  </div>
themes/default/products_page.php CHANGED
@@ -65,13 +65,17 @@ global $wpsc_query, $wpdb;
65
  </div>
66
  <?php endif; ?>
67
 
68
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
69
- <div class='wpsc_page_numbers'>
70
- <?php
71
- echo $wpsc_query->pagination($wpsc_query->page_count, $wpsc_query->prodcuts_per_page(), $wpsc_query->query_vars['page'],$wpsc_query->a_page_url());
72
- ?>
 
 
73
  </div>
74
  <?php endif; ?>
 
 
75
 
76
  <?php /** start the product loop here */?>
77
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
@@ -190,9 +194,9 @@ global $wpsc_query, $wpdb;
190
 
191
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
192
  <?php if(wpsc_has_multi_adding()): ?>
193
- <label class='wpsc_quantity_update' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
194
 
195
- <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update" size="2" value="1"/>
196
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
197
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
198
  <?php endif ;?>
@@ -268,13 +272,18 @@ global $wpsc_query, $wpdb;
268
  echo fancy_notifications();
269
  }
270
  ?>
271
- <?php //exit('<pre>'.print_r($wpsc_query->a_page_url(),true).'</pre>'); ?>
272
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
273
- <div class='wpsc_page_numbers'>
274
- <?php
275
- echo $wpsc_query->pagination($wpsc_query->page_count, $wpsc_query->prodcuts_per_page(), $wpsc_query->query_vars['page'],$wpsc_query->a_page_url());
276
- ?>
 
 
277
  </div>
278
  <?php endif; ?>
 
 
 
279
  <?php endif; ?>
280
  </div>
65
  </div>
66
  <?php endif; ?>
67
 
68
+
69
+ <!-- Start Pagination -->
70
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 1 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
71
+ <div class="wpsc_page_numbers">
72
+ <?php if ( wpsc_has_pages() ) : ?>
73
+ Pages: <?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?>
74
+ <?php endif; ?>
75
  </div>
76
  <?php endif; ?>
77
+ <!-- End Pagination -->
78
+
79
 
80
  <?php /** start the product loop here */?>
81
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
194
 
195
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
196
  <?php if(wpsc_has_multi_adding()): ?>
197
+ <label class='wpsc_quantity_update' for='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]'><?php echo __('Quantity', 'wpsc'); ?>:</label>
198
 
199
+ <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]" size="2" value="1"/>
200
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
201
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
202
  <?php endif ;?>
272
  echo fancy_notifications();
273
  }
274
  ?>
275
+
276
+
277
+ <!-- Start Pagination -->
278
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 2 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
279
+ <div class="wpsc_page_numbers">
280
+ <?php if ( wpsc_has_pages() ) : ?>
281
+ Pages: <?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?>
282
+ <?php endif; ?>
283
  </div>
284
  <?php endif; ?>
285
+ <!-- End Pagination -->
286
+
287
+
288
  <?php endif; ?>
289
  </div>
themes/default/shopping_cart_page.php CHANGED
@@ -128,7 +128,7 @@ if(wpsc_cart_item_count() > 0) :
128
  <?php if (!wpsc_have_shipping_quotes()) { continue; } // Don't display shipping method if it doesn't have at least one quote ?>
129
  <tr><td class='shipping_header' colspan='5'><?php echo wpsc_shipping_method_name().__('- Choose a Shipping Rate', 'wpsc'); ?> </td></tr>
130
  <?php while (wpsc_have_shipping_quotes()) : wpsc_the_shipping_quote(); ?>
131
- <tr>
132
  <td colspan='3'>
133
  <label for='<?php echo wpsc_shipping_quote_html_id(); ?>'><?php echo wpsc_shipping_quote_name(); ?></label>
134
  </td>
@@ -210,7 +210,7 @@ if(wpsc_cart_item_count() > 0) :
210
 
211
  <?php do_action('wpsc_before_form_of_shopping_cart'); ?>
212
 
213
- <form class='wpsc_checkout_forms' action='' method='post' enctype="multipart/form-data">
214
 
215
  <?php
216
  /**
@@ -314,7 +314,7 @@ if(wpsc_cart_item_count() > 0) :
314
  </tr>
315
  <?php endif; ?>
316
  <tr>
317
- <td colspan='2'>
318
 
319
  <?php //this HTML displays activated payment gateways?>
320
 
128
  <?php if (!wpsc_have_shipping_quotes()) { continue; } // Don't display shipping method if it doesn't have at least one quote ?>
129
  <tr><td class='shipping_header' colspan='5'><?php echo wpsc_shipping_method_name().__('- Choose a Shipping Rate', 'wpsc'); ?> </td></tr>
130
  <?php while (wpsc_have_shipping_quotes()) : wpsc_the_shipping_quote(); ?>
131
+ <tr class='shipping_quotes'>
132
  <td colspan='3'>
133
  <label for='<?php echo wpsc_shipping_quote_html_id(); ?>'><?php echo wpsc_shipping_quote_name(); ?></label>
134
  </td>
210
 
211
  <?php do_action('wpsc_before_form_of_shopping_cart'); ?>
212
 
213
+ <form name='wpsc_checkout_forms' class='wpsc_checkout_forms' action='' method='post' enctype="multipart/form-data">
214
 
215
  <?php
216
  /**
314
  </tr>
315
  <?php endif; ?>
316
  <tr>
317
+ <td colspan='2' class='wpsc_gateway_container'>
318
 
319
  <?php //this HTML displays activated payment gateways?>
320
 
themes/default/single_product.php CHANGED
@@ -127,11 +127,13 @@ $image_height = get_option('single_view_image_height');
127
 
128
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
129
  <?php if(wpsc_has_multi_adding()): ?>
130
- <label class='wpsc_quantity_update' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
 
131
 
132
- <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update" size="2" value="1"/>
133
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
134
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
 
135
  <?php endif ;?>
136
 
137
  <div class="wpsc_product_price">
127
 
128
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
129
  <?php if(wpsc_has_multi_adding()): ?>
130
+ <fieldset>
131
+ <label class='wpsc_quantity_update' for='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]'><?php echo __('Quantity', 'wpsc'); ?>:</label>
132
 
133
+ <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]" size="2" value="1"/>
134
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
135
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
136
+ </fieldset>
137
  <?php endif ;?>
138
 
139
  <div class="wpsc_product_price">
themes/iShop/category_widget.php CHANGED
@@ -36,5 +36,5 @@
36
  </div>
37
 
38
  <?php endif;?>
39
- <div class='clear_category_group'></div>
40
- </div>
36
  </div>
37
 
38
  <?php endif;?>
39
+ </div>
40
+ <div class='clear_category_group'></div>
themes/iShop/grid_view.php CHANGED
@@ -64,20 +64,20 @@ $image_height = get_option('product_image_height');
64
  <?php endif; ?>
65
  </div>
66
  <?php endif; ?>
67
-
68
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 1 ) || (get_option('wpsc_page_number_position') == 3))) : ?>
69
- <div class='wpsc_page_numbers'>
70
- Pages:
71
- <?php while (wpsc_have_pages()) : wpsc_the_page(); ?>
72
- <?php if(wpsc_page_is_selected()) :?>
73
- <a href='<?php echo wpsc_page_url(); ?>' class='selected'><?php echo wpsc_page_number(); ?></a>
74
- <?php else: ?>
75
- <a href='<?php echo wpsc_page_url(); ?>'><?php echo wpsc_page_number(); ?></a>
76
  <?php endif; ?>
77
- <?php endwhile; ?>
78
- </div>
79
- <?php endif; ?>
80
-
 
81
  <div class="product_grid_display">
82
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
83
  <div class="product_grid_item product_view_<?php echo wpsc_the_product_id(); ?>">
@@ -172,19 +172,19 @@ $image_height = get_option('product_image_height');
172
 
173
 
174
  </div>
175
-
176
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
177
- <div class='wpsc_page_numbers'>
178
- Pages:
179
- <?php while ($wpsc_query->have_pages()) : $wpsc_query->the_page(); ?>
180
- <?php if(wpsc_page_is_selected()) :?>
181
- <a href='<?php echo wpsc_page_url(); ?>' class='selected'><?php echo wpsc_page_number(); ?></a>
182
- <?php else: ?>
183
- <a href='<?php echo wpsc_page_url(); ?>'><?php echo wpsc_page_number(); ?></a>
184
- <?php endif; ?>
185
- <?php endwhile; ?>
186
- </div>
187
- <?php endif; ?>
188
  <?php endif; ?>
189
 
190
 
64
  <?php endif; ?>
65
  </div>
66
  <?php endif; ?>
67
+
68
+
69
+ <!-- Start Pagination -->
70
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 1 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
71
+ <div class="wpsc_page_numbers">
72
+ <?php if ( wpsc_has_pages() ) : ?>
73
+ <div class="pagination-products-showing">Showing <?php echo wpsc_showing_products(); ?> of <?php echo wpsc_total_product_count(); ?> products</div>
74
+ <div class="pagination-pages"><?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?></div>
 
75
  <?php endif; ?>
76
+ </div>
77
+ <?php endif; ?>
78
+ <!-- End Pagination -->
79
+
80
+
81
  <div class="product_grid_display">
82
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
83
  <div class="product_grid_item product_view_<?php echo wpsc_the_product_id(); ?>">
172
 
173
 
174
  </div>
175
+
176
+
177
+ <!-- Start Pagination -->
178
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 2 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
179
+ <div class="wpsc_page_numbers">
180
+ <?php if ( wpsc_has_pages() ) : ?>
181
+ <div class="pagination-pages"><?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?></div>
182
+ <?php endif; ?>
183
+ </div>
184
+ <?php endif; ?>
185
+ <!-- End Pagination -->
186
+
187
+
188
  <?php endif; ?>
189
 
190
 
themes/iShop/iShop.css CHANGED
@@ -2,7 +2,7 @@
2
  Theme Name: iShop Theme
3
  Theme URI: http://instinct.co.nz
4
  Description: Mac Style Theme
5
- Version: 3.5
6
  Author: Thomas Howard
7
  Author URI: http://instinct.co.nz
8
  */
@@ -14,6 +14,7 @@ Author URI: http://instinct.co.nz
14
 
15
  .wpsc_container{
16
  position: relative;
 
17
  }
18
 
19
  div.productdisplay img {
2
  Theme Name: iShop Theme
3
  Theme URI: http://instinct.co.nz
4
  Description: Mac Style Theme
5
+ Version: 3.6
6
  Author: Thomas Howard
7
  Author URI: http://instinct.co.nz
8
  */
14
 
15
  .wpsc_container{
16
  position: relative;
17
+ clear: both;
18
  }
19
 
20
  div.productdisplay img {
themes/iShop/list_view.php CHANGED
@@ -63,19 +63,19 @@ global $wpsc_query, $wpdb;
63
  </div>
64
  <?php endif; ?>
65
 
66
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 1 ) || (get_option('wpsc_page_number_position') == 3))) : ?>
67
- <div class='wpsc_page_numbers'>
68
- Pages:
69
- <?php while (wpsc_have_pages()) : wpsc_the_page(); ?>
70
- <?php if(wpsc_page_is_selected()) :?>
71
- <a href='<?php echo wpsc_page_url(); ?>' class='selected'><?php echo wpsc_page_number(); ?></a>
72
- <?php else: ?>
73
- <a href='<?php echo wpsc_page_url(); ?>'><?php echo wpsc_page_number(); ?></a>
74
- <?php endif; ?>
75
- <?php endwhile; ?>
76
  </div>
77
  <?php endif; ?>
78
-
 
 
79
  <table class="list_productdisplay <?php echo wpsc_category_class(); ?>">
80
  <?php /** start the product loop here */?>
81
  <?php $alt = 0; ?>
@@ -135,8 +135,8 @@ global $wpsc_query, $wpdb;
135
 
136
 
137
  <?php if(wpsc_has_multi_adding()): ?>
138
- <label class='wpsc_quantity_update' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
139
- <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update" size="2" value="1"/>
140
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
141
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
142
  <?php endif ;?>
@@ -195,18 +195,18 @@ global $wpsc_query, $wpdb;
195
  echo fancy_notifications();
196
  }
197
  ?>
198
-
199
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
200
- <div class='wpsc_page_numbers'>
201
- Pages:
202
- <?php while ($wpsc_query->have_pages()) : $wpsc_query->the_page(); ?>
203
- <?php if(wpsc_page_is_selected()) :?>
204
- <a href='<?php echo wpsc_page_url(); ?>' class='selected'><?php echo wpsc_page_number(); ?></a>
205
- <?php else: ?>
206
- <a href='<?php echo wpsc_page_url(); ?>'><?php echo wpsc_page_number(); ?></a>
207
- <?php endif; ?>
208
- <?php endwhile; ?>
209
  </div>
210
  <?php endif; ?>
 
 
 
211
  <?php endif; ?>
212
  </div>
63
  </div>
64
  <?php endif; ?>
65
 
66
+
67
+ <!-- Start Pagination -->
68
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 1 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
69
+ <div class="wpsc_page_numbers">
70
+ <?php if ( wpsc_has_pages() ) : ?>
71
+ <div class="pagination-products-showing">Showing <?php echo wpsc_showing_products(); ?> of <?php echo wpsc_total_product_count(); ?> products</div>
72
+ <div class="pagination-pages"><?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?></div>
73
+ <?php endif; ?>
 
 
74
  </div>
75
  <?php endif; ?>
76
+ <!-- End Pagination -->
77
+
78
+
79
  <table class="list_productdisplay <?php echo wpsc_category_class(); ?>">
80
  <?php /** start the product loop here */?>
81
  <?php $alt = 0; ?>
135
 
136
 
137
  <?php if(wpsc_has_multi_adding()): ?>
138
+ <label class='wpsc_quantity_update' for='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]'><?php echo __('Quantity', 'wpsc'); ?>:</label>
139
+ + <input type="text" id='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]' name="wpsc_quantity_update" size="2" value="1"/>
140
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
141
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
142
  <?php endif ;?>
195
  echo fancy_notifications();
196
  }
197
  ?>
198
+
199
+
200
+ <!-- Start Pagination -->
201
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 2 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
202
+ <div class="wpsc_page_numbers">
203
+ <?php if ( wpsc_has_pages() ) : ?>
204
+ <div class="pagination-pages"><?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?></div>
205
+ <?php endif; ?>
 
 
 
206
  </div>
207
  <?php endif; ?>
208
+ <!-- End Pagination -->
209
+
210
+
211
  <?php endif; ?>
212
  </div>
themes/iShop/products_page.php CHANGED
@@ -66,14 +66,19 @@ global $wpsc_query, $wpdb;
66
  <?php endif; ?>
67
  </div>
68
  <?php endif; ?>
69
-
70
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
71
- <div class='wpsc_page_numbers'>
72
- <?php
73
- echo $wpsc_query->pagination($wpsc_query->page_count, $wpsc_query->prodcuts_per_page(), $wpsc_query->query_vars['page'],$wpsc_query->a_page_url());
74
- ?>
 
 
 
75
  </div>
76
  <?php endif; ?>
 
 
77
 
78
  <?php /** start the product loop here */?>
79
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
@@ -188,9 +193,8 @@ global $wpsc_query, $wpdb;
188
 
189
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
190
  <?php if(wpsc_has_multi_adding()): ?>
191
- <label class='wpsc_quantity_update' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
192
-
193
- <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update" size="2" value="1"/>
194
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
195
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
196
  <?php endif ;?>
@@ -267,15 +271,18 @@ if(function_exists('fancy_notifications')) {
267
  echo fancy_notifications();
268
  }
269
  ?>
270
-
271
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
272
- <div class='wpsc_page_numbers'>
273
- <?php
274
-
275
- // exit('<pre>'.print_r($wpsc_query, true).'</pre>');
276
- echo $wpsc_query->pagination($wpsc_query->page_count, $wpsc_query->prodcuts_per_page(), $wpsc_query->query_vars['page'],$wpsc_query->a_page_url());
277
- ?>
278
  </div>
279
  <?php endif; ?>
 
 
 
280
  <?php endif; ?>
281
  </div>
66
  <?php endif; ?>
67
  </div>
68
  <?php endif; ?>
69
+
70
+
71
+ <!-- Start Pagination -->
72
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 1 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
73
+ <div class="wpsc_page_numbers">
74
+ <?php if ( wpsc_has_pages() ) : ?>
75
+ <div class="pagination-products-showing">Showing <?php echo wpsc_showing_products(); ?> of <?php echo wpsc_total_product_count(); ?> products</div>
76
+ <div class="pagination-pages"><?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?></div>
77
+ <?php endif; ?>
78
  </div>
79
  <?php endif; ?>
80
+ <!-- End Pagination -->
81
+
82
 
83
  <?php /** start the product loop here */?>
84
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
193
 
194
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
195
  <?php if(wpsc_has_multi_adding()): ?>
196
+ <label class='wpsc_quantity_update' for='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]'><?php echo __('Quantity', 'wpsc'); ?>:</label>
197
+ <input type="text" id='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]' name="wpsc_quantity_update" size="2" value="1"/>
 
198
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
199
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
200
  <?php endif ;?>
271
  echo fancy_notifications();
272
  }
273
  ?>
274
+
275
+
276
+ <!-- Start Pagination -->
277
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 2 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
278
+ <div class="wpsc_page_numbers">
279
+ <?php if ( wpsc_has_pages() ) : ?>
280
+ <div class="pagination-pages"><?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?></div>
281
+ <?php endif; ?>
282
  </div>
283
  <?php endif; ?>
284
+ <!-- End Pagination -->
285
+
286
+
287
  <?php endif; ?>
288
  </div>
themes/iShop/shopping_cart_page.php CHANGED
@@ -37,9 +37,11 @@ if(wpsc_cart_item_count() > 0) :
37
  </td>
38
  <?php if(wpsc_uses_shipping()): ?>
39
  <td><span class="pricedisplay" id='shipping_<?php echo wpsc_the_cart_item_key(); ?>'><?php echo wpsc_cart_item_shipping(); ?></span></td>
 
40
  <td><span class="pricedisplay"><?php echo wpsc_cart_item_price(); ?></span></td>
41
  <td>
42
 
 
43
  <form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform">
44
  <input type="hidden" name="quantity" value="0"/>
45
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
@@ -351,7 +353,7 @@ if(wpsc_cart_item_count() > 0) :
351
  </div>
352
  <?php
353
  else:
354
- echo __('Oops, there is nothing in your cart.', 'wpsc') . "<a href=".get_option("product_list_url").">" . __('Please visit our shop', 'wpsc') . "</a>";
355
  endif;
356
  do_action('wpsc_bottom_of_shopping_cart');
357
  ?>
37
  </td>
38
  <?php if(wpsc_uses_shipping()): ?>
39
  <td><span class="pricedisplay" id='shipping_<?php echo wpsc_the_cart_item_key(); ?>'><?php echo wpsc_cart_item_shipping(); ?></span></td>
40
+ <?php endif; ?>
41
  <td><span class="pricedisplay"><?php echo wpsc_cart_item_price(); ?></span></td>
42
  <td>
43
 
44
+
45
  <form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform">
46
  <input type="hidden" name="quantity" value="0"/>
47
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
353
  </div>
354
  <?php
355
  else:
356
+ echo __('Oops, there is nothing in your cart.', 'wpsc') . "<a href='".get_option("product_list_url")."'>" . __('Please visit our shop', 'wpsc') . "</a>";
357
  endif;
358
  do_action('wpsc_bottom_of_shopping_cart');
359
  ?>
themes/iShop/single_product.php CHANGED
@@ -130,11 +130,13 @@ $image_height = get_option('single_view_image_height');
130
 
131
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
132
  <?php if(wpsc_has_multi_adding()): ?>
133
- <label class='wpsc_quantity_update' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
 
134
 
135
- <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update" size="2" value="1"/>
136
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
137
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
 
138
  <?php endif ;?>
139
 
140
  <div class="wpsc_product_price">
130
 
131
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
132
  <?php if(wpsc_has_multi_adding()): ?>
133
+ <fieldset>
134
+ <label class='wpsc_quantity_update' for='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]'><?php echo __('Quantity', 'wpsc'); ?>:</label>
135
 
136
+ <input type="text" id='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]' name="wpsc_quantity_update" size="2" value="1"/>
137
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
138
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
139
+ </fieldset>
140
  <?php endif ;?>
141
 
142
  <div class="wpsc_product_price">
themes/marketplace/category_widget.php CHANGED
@@ -36,5 +36,5 @@
36
  </div>
37
 
38
  <?php endif;?>
39
- <div class='clear_category_group'></div>
40
- </div>
36
  </div>
37
 
38
  <?php endif;?>
39
+ </div>
40
+ <div class='clear_category_group'></div>
themes/marketplace/grid_view.php CHANGED
@@ -64,20 +64,21 @@ $image_height = get_option('product_image_height');
64
  <?php endif; ?>
65
  </div>
66
  <?php endif; ?>
67
-
68
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 1 ) || (get_option('wpsc_page_number_position') == 3))) : ?>
69
- <div class='wpsc_page_numbers'>
70
- Pages:
71
- <?php while (wpsc_have_pages()) : wpsc_the_page(); ?>
72
- <?php if(wpsc_page_is_selected()) :?>
73
- <a href='<?php echo wpsc_page_url(); ?>' class='selected'><?php echo wpsc_page_number(); ?></a>
74
- <?php else: ?>
75
- <a href='<?php echo wpsc_page_url(); ?>'><?php echo wpsc_page_number(); ?></a>
76
- <?php endif; ?>
77
- <?php endwhile; ?>
78
- </div>
79
- <?php endif; ?>
80
-
 
81
  <div class="product_grid_display">
82
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
83
  <div class="product_grid_item product_view_<?php echo wpsc_the_product_id(); ?>">
@@ -172,20 +173,19 @@ $image_height = get_option('product_image_height');
172
 
173
 
174
  </div>
175
-
176
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
177
- <div class='wpsc_page_numbers'>
178
- Pages:
179
- <?php while ($wpsc_query->have_pages()) : $wpsc_query->the_page(); ?>
180
- <?php if(wpsc_page_is_selected()) :?>
181
- <a href='<?php echo wpsc_page_url(); ?>' class='selected'><?php echo wpsc_page_number(); ?></a>
182
- <?php else: ?>
183
- <a href='<?php echo wpsc_page_url(); ?>'><?php echo wpsc_page_number(); ?></a>
184
- <?php endif; ?>
185
- <?php endwhile; ?>
186
- </div>
187
- <?php endif; ?>
188
-
189
  <?php endif; ?>
190
 
191
  <?php
64
  <?php endif; ?>
65
  </div>
66
  <?php endif; ?>
67
+
68
+
69
+ <!-- Start Pagination -->
70
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 1 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
71
+ <div class="wpsc_page_numbers">
72
+ <?php if ( wpsc_has_pages() ) : ?>
73
+ Page <?php echo wpsc_showing_products_page(); ?>: <?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?>
74
+ <?php else : ?>
75
+ Showing all <?php echo wpsc_total_product_count(); ?> products
76
+ <?php endif; ?>
77
+ </div>
78
+ <?php endif; ?>
79
+ <!-- End Pagination -->
80
+
81
+
82
  <div class="product_grid_display">
83
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
84
  <div class="product_grid_item product_view_<?php echo wpsc_the_product_id(); ?>">
173
 
174
 
175
  </div>
176
+
177
+
178
+ <!-- Start Pagination -->
179
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 2 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
180
+ <div class="wpsc_page_numbers">
181
+ <?php if ( wpsc_has_pages() ) : ?>
182
+ Page <?php echo wpsc_showing_products_page(); ?>: <?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?>
183
+ <?php endif; ?>
184
+ </div>
185
+ <?php endif; ?>
186
+ <!-- End Pagination -->
187
+
188
+
 
189
  <?php endif; ?>
190
 
191
  <?php
themes/marketplace/list_view.php CHANGED
@@ -63,19 +63,20 @@ global $wpsc_query, $wpdb;
63
  </div>
64
  <?php endif; ?>
65
 
66
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 1 ) || (get_option('wpsc_page_number_position') == 3))) : ?>
67
- <div class='wpsc_page_numbers'>
68
- Pages:
69
- <?php while (wpsc_have_pages()) : wpsc_the_page(); ?>
70
- <?php if(wpsc_page_is_selected()) :?>
71
- <a href='<?php echo wpsc_page_url(); ?>' class='selected'><?php echo wpsc_page_number(); ?></a>
72
- <?php else: ?>
73
- <a href='<?php echo wpsc_page_url(); ?>'><?php echo wpsc_page_number(); ?></a>
74
- <?php endif; ?>
75
- <?php endwhile; ?>
76
  </div>
77
  <?php endif; ?>
78
-
 
 
79
  <table class="list_productdisplay <?php echo wpsc_category_class(); ?>">
80
  <?php /** start the product loop here */?>
81
  <?php $alt = 0; ?>
@@ -135,8 +136,8 @@ global $wpsc_query, $wpdb;
135
 
136
 
137
  <?php if(wpsc_has_multi_adding()): ?>
138
- <label class='wpsc_quantity_update' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
139
- <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update" size="2" value="1"/>
140
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
141
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
142
  <?php endif ;?>
@@ -190,18 +191,18 @@ global $wpsc_query, $wpdb;
190
  echo fancy_notifications();
191
  }
192
  ?>
193
-
194
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
195
- <div class='wpsc_page_numbers'>
196
- Pages:
197
- <?php while ($wpsc_query->have_pages()) : $wpsc_query->the_page(); ?>
198
- <?php if(wpsc_page_is_selected()) :?>
199
- <a href='<?php echo wpsc_page_url(); ?>' class='selected'><?php echo wpsc_page_number(); ?></a>
200
- <?php else: ?>
201
- <a href='<?php echo wpsc_page_url(); ?>'><?php echo wpsc_page_number(); ?></a>
202
- <?php endif; ?>
203
- <?php endwhile; ?>
204
  </div>
205
  <?php endif; ?>
 
 
 
206
  <?php endif; ?>
207
  </div>
63
  </div>
64
  <?php endif; ?>
65
 
66
+
67
+ <!-- Start Pagination -->
68
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 1 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
69
+ <div class="wpsc_page_numbers">
70
+ <?php if ( wpsc_has_pages() ) : ?>
71
+ Page <?php echo wpsc_showing_products_page(); ?>: <?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?>
72
+ <?php else : ?>
73
+ Showing all <?php echo wpsc_total_product_count(); ?> products
74
+ <?php endif; ?>
 
75
  </div>
76
  <?php endif; ?>
77
+ <!-- End Pagination -->
78
+
79
+
80
  <table class="list_productdisplay <?php echo wpsc_category_class(); ?>">
81
  <?php /** start the product loop here */?>
82
  <?php $alt = 0; ?>
136
 
137
 
138
  <?php if(wpsc_has_multi_adding()): ?>
139
+ <label class='wpsc_quantity_update' for='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>']><?php echo __('Quantity', 'wpsc'); ?>:</label>
140
+ <input type="text" id='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]' name="wpsc_quantity_update" size="2" value="1"/>
141
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
142
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
143
  <?php endif ;?>
191
  echo fancy_notifications();
192
  }
193
  ?>
194
+
195
+
196
+ <!-- Start Pagination -->
197
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 2 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
198
+ <div class="wpsc_page_numbers">
199
+ <?php if ( wpsc_has_pages() ) : ?>
200
+ Page <?php echo wpsc_showing_products_page(); ?>: <?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?>
201
+ <?php endif; ?>
 
 
 
202
  </div>
203
  <?php endif; ?>
204
+ <!-- End Pagination -->
205
+
206
+
207
  <?php endif; ?>
208
  </div>
themes/marketplace/marketplace.css CHANGED
@@ -2,7 +2,7 @@
2
  Theme Name: Marketplace Theme
3
  Theme URI: http://instinct.co.nz
4
  Description: Marketplace Style Theme
5
- Version: 3.5
6
  Author: Allen Han
7
  Author URI: http://instinct.co.nz
8
  */
@@ -14,6 +14,7 @@ Author URI: http://instinct.co.nz
14
 
15
  .wpsc_container{
16
  position: relative;
 
17
  }
18
 
19
  div.productdisplay img {
2
  Theme Name: Marketplace Theme
3
  Theme URI: http://instinct.co.nz
4
  Description: Marketplace Style Theme
5
+ Version: 3.6
6
  Author: Allen Han
7
  Author URI: http://instinct.co.nz
8
  */
14
 
15
  .wpsc_container{
16
  position: relative;
17
+ clear: both;
18
  }
19
 
20
  div.productdisplay img {
themes/marketplace/products_page.php CHANGED
@@ -67,17 +67,21 @@ global $wpsc_query, $wpdb;
67
  <?php endif; ?>
68
  </div>
69
  <?php endif; ?>
70
-
71
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
72
- <div class='wpsc_page_numbers'>
73
- <?php
74
- $display = new display;
75
- // exit('<pre>'.print_r($wpsc_query, true).'</pre>');
76
- echo $display->pagination($wpsc_query->page_count, $wpsc_query->prodcuts_per_page(), $wpsc_query->query_vars['page'],$wpsc_query->a_page_url());
77
- ?>
 
 
78
  </div>
79
  <?php endif; ?>
80
-
 
 
81
  <?php /** start the product loop here */?>
82
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
83
  <div class="productdisplay default_product_display product_view_<?php echo wpsc_the_product_id(); ?> <?php echo wpsc_category_class(); ?>">
@@ -192,9 +196,9 @@ global $wpsc_query, $wpdb;
192
 
193
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
194
  <?php if(wpsc_has_multi_adding()): ?>
195
- <label class='wpsc_quantity_update' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
196
 
197
- <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update" size="2" value="1"/>
198
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
199
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
200
  <?php endif ;?>
@@ -272,16 +276,19 @@ if(function_exists('fancy_notifications')) {
272
  echo fancy_notifications();
273
  }
274
  ?>
275
-
276
- <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
277
- <div class='wpsc_page_numbers'>
278
- <?php
279
- $display = new display;
280
- // exit('<pre>'.print_r($wpsc_query, true).'</pre>');
281
- echo $display->pagination($wpsc_query->page_count, $wpsc_query->prodcuts_per_page(), $wpsc_query->query_vars['page'],$wpsc_query->a_page_url());
282
- ?>
283
  </div>
284
  <?php endif; ?>
 
 
 
285
  <?php endif; ?>
286
 
287
  </div>
67
  <?php endif; ?>
68
  </div>
69
  <?php endif; ?>
70
+
71
+
72
+ <!-- Start Pagination -->
73
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 1 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
74
+ <div class="wpsc_page_numbers">
75
+ <?php if ( wpsc_has_pages() ) : ?>
76
+ Page <?php echo wpsc_showing_products_page(); ?>: <?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?>
77
+ <?php else : ?>
78
+ Showing all <?php echo wpsc_total_product_count(); ?> products
79
+ <?php endif; ?>
80
  </div>
81
  <?php endif; ?>
82
+ <!-- End Pagination -->
83
+
84
+
85
  <?php /** start the product loop here */?>
86
  <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
87
  <div class="productdisplay default_product_display product_view_<?php echo wpsc_the_product_id(); ?> <?php echo wpsc_category_class(); ?>">
196
 
197
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
198
  <?php if(wpsc_has_multi_adding()): ?>
199
+ <label class='wpsc_quantity_update' for='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]'><?php echo __('Quantity', 'wpsc'); ?>:</label>
200
 
201
+ <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]" size="2" value="1"/>
202
  <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
203
  <input type="hidden" name="wpsc_update_quantity" value="true"/>
204
  <?php endif ;?>
276
  echo fancy_notifications();
277
  }
278
  ?>
279
+
280
+
281
+ <!-- Start Pagination -->
282
+ <?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 2 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
283
+ <div class="wpsc_page_numbers">
284
+ <?php if ( wpsc_has_pages() ) : ?>
285
+ Page <?php echo wpsc_showing_products_page(); ?>: <?php echo wpsc_first_products_link( '&laquo; First', true ); ?> <?php echo wpsc_previous_products_link( '&laquo; Previous', true ); ?> <?php echo wpsc_pagination( 10 ); ?> <?php echo wpsc_next_products_link( 'Next &raquo;', true ); ?> <?php echo wpsc_last_products_link( 'Last &raquo;', true ); ?>
286
+ <?php endif; ?>
287
  </div>
288
  <?php endif; ?>
289
+ <!-- End Pagination -->
290
+
291
+
292
  <?php endif; ?>
293
 
294
  </div>
themes/marketplace/shopping_cart_page.php CHANGED
@@ -37,6 +37,7 @@ if(wpsc_cart_item_count() > 0) :
37
  </td>
38
  <?php if(wpsc_uses_shipping()): ?>
39
  <td><span class="pricedisplay" id='shipping_<?php echo wpsc_the_cart_item_key(); ?>'><?php echo wpsc_cart_item_shipping(); ?></span></td>
 
40
  <td><span class="pricedisplay"><?php echo wpsc_cart_item_price(); ?></span></td>
41
  <td>
42
 
@@ -350,7 +351,7 @@ if(wpsc_cart_item_count() > 0) :
350
  </div>
351
  <?php
352
  else:
353
- echo __('Oops, there is nothing in your cart.', 'wpsc') . "<a href=".get_option("product_list_url").">" . __('Please visit our shop', 'wpsc') . "</a>";
354
  endif;
355
  do_action('wpsc_bottom_of_shopping_cart');
356
  ?>
37
  </td>
38
  <?php if(wpsc_uses_shipping()): ?>
39
  <td><span class="pricedisplay" id='shipping_<?php echo wpsc_the_cart_item_key(); ?>'><?php echo wpsc_cart_item_shipping(); ?></span></td>
40
+ <?php endif; ?>
41
  <td><span class="pricedisplay"><?php echo wpsc_cart_item_price(); ?></span></td>
42
  <td>
43
 
351
  </div>
352
  <?php
353
  else:
354
+ echo __('Oops, there is nothing in your cart.', 'wpsc') . "<a href='".get_option("product_list_url")."'>" . __('Please visit our shop', 'wpsc') . "</a>";
355
  endif;
356
  do_action('wpsc_bottom_of_shopping_cart');
357
  ?>
themes/marketplace/single_product.php CHANGED
@@ -132,11 +132,13 @@ $image_height = get_option('single_view_image_height');
132
 
133
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
134
  <?php if(wpsc_has_multi_adding()): ?>
135
- <label class='wpsc_quantity_update' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
136
-
137
- <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update" size="2" value="1"/>
138
- <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
139
- <input type="hidden" name="wpsc_update_quantity" value="true"/>
 
 
140
  <?php endif ;?>
141
 
142
  <div class="wpsc_product_price">
132
 
133
  <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
134
  <?php if(wpsc_has_multi_adding()): ?>
135
+ <fieldset>
136
+ <label class='wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
137
+
138
+ <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]" size="2" value="1"/>
139
+ <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
140
+ <input type="hidden" name="wpsc_update_quantity" value="true"/>
141
+ <fieldset>
142
  <?php endif ;?>
143
 
144
  <div class="wpsc_product_price">
transaction_result_functions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  function transaction_results($sessionid, $echo_to_screen = true, $transaction_id = null) {
3
- global $wpdb,$wpsc_cart;
4
  //$curgateway = get_option('payment_gateway');
5
  $curgateway = $wpdb->get_var("SELECT gateway FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE sessionid='$sessionid'");
6
  $errorcode = 0;
@@ -109,8 +109,7 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
109
  do_action('wpsc_confirm_checkout', $purchase_log['id']);
110
  }
111
  // do_action('wpsc_confirm_checkout', $purchase_log['id']);
112
-
113
- $shipping = $row['pnp']*$row['quantity'];
114
  $total_shipping += $shipping;
115
 
116
  if($product_data['special']==1) {
@@ -162,6 +161,8 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
162
  foreach($link as $single_link){
163
  $product_list .= "\n\r ".$single_link["name"].": ".$single_link["url"]."\n\r";
164
  $product_list_html .= "<a href='".$single_link["url"]."'>".$single_link["name"]."</a>\n";
 
 
165
  }
166
  $product_list .= $additional_content;
167
  $product_list_html .= $additional_content;
@@ -175,9 +176,10 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
175
  $product_list_html.= $row['quantity']." - ". $product_data['name'].stripslashes($variation_list )." ". $message_price ."\n\r";
176
  if ($shipping > 0) $product_list_html .= " &nbsp; ". __('Shipping', 'wpsc').":".$shipping_price ."\n\r";
177
 
 
178
  }
179
  $report = get_option('wpsc_email_admin');
180
- $report_product_list.= $row['quantity']." - ". $product_data['name'] .stripslashes($variation_list)." ".$message_price ."\n\r";
181
  }
182
 
183
  // Decrement the stock here
@@ -316,7 +318,7 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
316
  } else {
317
  if(true === $echo_to_screen) {
318
  echo '<div class="wrap">';
319
- echo __('Oops, there is nothing in your cart.', 'wpsc') . "<a href=".get_option("product_list_url").">" . __('Please visit our shop', 'wpsc') . "</a>";
320
  echo '</div>';
321
  }
322
  }
1
  <?php
2
  function transaction_results($sessionid, $echo_to_screen = true, $transaction_id = null) {
3
+ global $wpdb,$wpsc_cart, $wpsc_shipping_modules;
4
  //$curgateway = get_option('payment_gateway');
5
  $curgateway = $wpdb->get_var("SELECT gateway FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE sessionid='$sessionid'");
6
  $errorcode = 0;
109
  do_action('wpsc_confirm_checkout', $purchase_log['id']);
110
  }
111
  // do_action('wpsc_confirm_checkout', $purchase_log['id']);
112
+ $shipping = $row['pnp'];
 
113
  $total_shipping += $shipping;
114
 
115
  if($product_data['special']==1) {
161
  foreach($link as $single_link){
162
  $product_list .= "\n\r ".$single_link["name"].": ".$single_link["url"]."\n\r";
163
  $product_list_html .= "<a href='".$single_link["url"]."'>".$single_link["name"]."</a>\n";
164
+ $report_product_list .="\n\r ".$single_link["name"].": ".$single_link["url"]."\n\r";
165
+ // $report_product_list .="<a href='".$single_link["url"]."'>".$single_link["name"]."</a>\n";
166
  }
167
  $product_list .= $additional_content;
168
  $product_list_html .= $additional_content;
176
  $product_list_html.= $row['quantity']." - ". $product_data['name'].stripslashes($variation_list )." ". $message_price ."\n\r";
177
  if ($shipping > 0) $product_list_html .= " &nbsp; ". __('Shipping', 'wpsc').":".$shipping_price ."\n\r";
178
 
179
+ $report_product_list.= $row['quantity']." - ". $product_data['name'] .stripslashes($variation_list)." ".$message_price ."\n\r";
180
  }
181
  $report = get_option('wpsc_email_admin');
182
+
183
  }
184
 
185
  // Decrement the stock here
318
  } else {
319
  if(true === $echo_to_screen) {
320
  echo '<div class="wrap">';
321
+ echo __('Oops, there is nothing in your cart.', 'wpsc') . "<a href='".get_option("product_list_url")."'>" . __('Please visit our shop', 'wpsc') . "</a>";
322
  echo '</div>';
323
  }
324
  }
transaction_results.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  global $wpdb, $user_ID, $nzshpcrt_gateways;
3
- //$curgateway = get_option('payment_gateway');
4
 
5
  $sessionid = $_GET['sessionid'];
6
  if(!isset($_GET['sessionid']) && isset($_GET['ms']) ){
1
  <?php
2
  global $wpdb, $user_ID, $nzshpcrt_gateways;
3
+ do_action('wpsc_transaction_results');
4
 
5
  $sessionid = $_GET['sessionid'];
6
  if(!isset($_GET['sessionid']) && isset($_GET['ms']) ){
user-downloads.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  global $wpdb, $user_ID;
3
- $purchases= $wpdb->get_col("SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE user_ID = ".(int)$user_ID."") ;
4
  $rowcount = count($purchases);
5
  //echo "<pre>".print_r($purchases,true)."</pre>";
6
 
1
  <?php
2
  global $wpdb, $user_ID;
3
+ $purchases= $wpdb->get_col("SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE user_ID = ".(int)$user_ID." AND user_ID !='0'") ;
4
  $rowcount = count($purchases);
5
  //echo "<pre>".print_r($purchases,true)."</pre>";
6
 
user-log.php CHANGED
@@ -416,10 +416,12 @@ $date_list[0]['end'] = $end_timestamp;
416
  echo " </table>";
417
  }
418
  }
419
-
420
-
421
- $sql = "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `date`!=''";
422
- $purchase_log = $wpdb->get_results($sql,ARRAY_A) ;
 
 
423
  }
424
  else
425
  {
@@ -437,9 +439,8 @@ $date_list[0]['end'] = $end_timestamp;
437
  <input type="hidden" name="redirect_to" value="<?php echo get_option('user_account_url'); ?>" />
438
  </p>
439
  </form>
440
- <?php
441
- }
442
- }
443
- ?>
444
-
445
- </div>
416
  echo " </table>";
417
  }
418
  }
419
+
420
+ // Commented out as this seemed to be breaking the Your Account layout.
421
+ // Doesn't seem to do anything, does it?
422
+ //$sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date` != ''";
423
+ //$purchase_log = $wpdb->get_results( $sql, ARRAY_A );
424
+
425
  }
426
  else
427
  {
439
  <input type="hidden" name="redirect_to" value="<?php echo get_option('user_account_url'); ?>" />
440
  </p>
441
  </form>
442
+ <?php
443
+ }
444
+ ?>
445
+ </div>
446
+ <?php } ?>
 
widgets/price_range_widget.php CHANGED
@@ -39,11 +39,11 @@ function nzshpcrt_price_range($input = null) {
39
  $j=$i;
40
 
41
  if ($i==$final_count-1) {
42
- echo "<a href='".htmlentities($product_page.$seperater."range=".$j)."'>Over ".$ranges[$i]."</a><br/>";
43
  } else if($ranges[$i]==0){
44
- echo "<a href='".htmlentities($product_page.$seperater."range=".$j)."'>Under ".$ranges[$i+1]."</a><br/>";
45
  }else {
46
- echo "<a href='".htmlentities($product_page.$seperater."range=".$j)."'>".$ranges[$i]." - ".$ranges[$i+1]."</a><br/>";
47
  }
48
  }
49
  if(get_option('permalink_structure') != '') {
39
  $j=$i;
40
 
41
  if ($i==$final_count-1) {
42
+ echo "<a href='".htmlentities($product_page.$seperater."range=".$j)."'>Over ".nzshpcrt_currency_display($ranges[$i],1,true)."</a><br/>";
43
  } else if($ranges[$i]==0){
44
+ echo "<a href='".htmlentities($product_page.$seperater."range=".$j)."'>Under ".nzshpcrt_currency_display($ranges[$i+1],1,true)."</a><br/>";
45
  }else {
46
+ echo "<a href='".htmlentities($product_page.$seperater."range=".$j)."'>".nzshpcrt_currency_display($ranges[$i],1,true)." - ".nzshpcrt_currency_display($ranges[$i+1],1,true)."</a><br/>";
47
  }
48
  }
49
  if(get_option('permalink_structure') != '') {
wp-shopping-cart.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name:WP Shopping Cart
4
  Plugin URI: http://www.getshopped.org
5
  Description: A plugin that provides a WordPress Shopping Cart. Visit the <a href='http://getshopped.org/forums'>getshopped forums</a> for support.
6
- Version: 3.7.6 Beta 3
7
  Author: Instinct
8
  Author URI: http://www.getshopped.org
9
  */
@@ -14,7 +14,7 @@ Author URI: http://www.getshopped.org
14
  // this is to make sure it sets up the table name constants correctly on activation
15
  global $wpdb;
16
  define('WPSC_VERSION', '3.7');
17
- define('WPSC_MINOR_VERSION', '45');
18
 
19
  define('WPSC_PRESENTABLE_VERSION', '3.7.6 Beta 3');
20
 
@@ -116,6 +116,7 @@ require_once(WPSC_FILE_PATH.'/wpsc-includes/mimetype.php');
116
  require_once(WPSC_FILE_PATH.'/wpsc-includes/cart.class.php');
117
  require_once(WPSC_FILE_PATH.'/wpsc-includes/checkout.class.php');
118
  require_once(WPSC_FILE_PATH.'/wpsc-includes/display.functions.php');
 
119
  require_once(WPSC_FILE_PATH.'/wpsc-includes/theme.functions.php');
120
  require_once(WPSC_FILE_PATH.'/wpsc-includes/shortcode.functions.php');
121
  require_once(WPSC_FILE_PATH.'/wpsc-includes/coupons.class.php');
@@ -126,6 +127,9 @@ require_once(WPSC_FILE_PATH."/wpsc-includes/form-display.functions.php");
126
  require_once(WPSC_FILE_PATH."/wpsc-includes/merchant.class.php");
127
  require_once(WPSC_FILE_PATH."/wpsc-includes/meta.functions.php");
128
  require_once(WPSC_FILE_PATH."/wpsc-includes/productfeed.php");
 
 
 
129
  //exit(print_r($v1,true));
130
  if($v1[0] >= 2.8){
131
  require_once(WPSC_FILE_PATH."/wpsc-includes/upgrades.php");
@@ -375,15 +379,21 @@ if(!function_exists('wpsc_initialisation')){
375
  function wpsc_initialisation() {
376
  global $wpsc_cart, $wpsc_theme_path, $wpsc_theme_url, $wpsc_category_url_cache;
377
  // set the theme directory constant
378
-
379
- $uploads_dir = @opendir(WPSC_THEMES_PATH);
380
- $file_names = array();
381
- while(($file = @readdir($uploads_dir)) !== false) {
382
- //echo "<br />test".WPSC_THEMES_PATH.$file;
383
- if(is_dir(WPSC_THEMES_PATH.$file) && ($file != "..") && ($file != ".") && ($file != ".svn")){
384
- $file_names[] = $file;
385
- }
386
- }
 
 
 
 
 
 
387
  if(count($file_names) > 0) {
388
  $wpsc_theme_path = WPSC_THEMES_PATH;
389
  $wpsc_theme_url = WPSC_THEMES_URL;
@@ -414,16 +424,18 @@ if(!function_exists('wpsc_initialisation')){
414
  $GLOBALS['wpsc_cart'] = new wpsc_cart;
415
  }
416
  }
417
- $GLOBALS['wpsc_category_url_cache'] = get_option('wpsc_category_url_cache');
418
-
419
-
420
- register_taxonomy('product_tag', 'product');
421
  }
422
  // first plugin hook in wordpress
423
  add_action('plugins_loaded','wpsc_initialisation', 0);
424
 
425
 
426
 
 
 
 
 
427
 
428
 
429
  switch(get_option('cart_location')) {
@@ -479,4 +491,18 @@ if(!function_exists('wpsc_serialize_shopping_cart')){
479
  }
480
  }
481
  add_action('shutdown','wpsc_serialize_shopping_cart');
482
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Plugin Name:WP Shopping Cart
4
  Plugin URI: http://www.getshopped.org
5
  Description: A plugin that provides a WordPress Shopping Cart. Visit the <a href='http://getshopped.org/forums'>getshopped forums</a> for support.
6
+ Version: 3.7.6 RC 3
7
  Author: Instinct
8
  Author URI: http://www.getshopped.org
9
  */
14
  // this is to make sure it sets up the table name constants correctly on activation
15
  global $wpdb;
16
  define('WPSC_VERSION', '3.7');
17
+ define('WPSC_MINOR_VERSION', '49');
18
 
19
  define('WPSC_PRESENTABLE_VERSION', '3.7.6 Beta 3');
20
 
116
  require_once(WPSC_FILE_PATH.'/wpsc-includes/cart.class.php');
117
  require_once(WPSC_FILE_PATH.'/wpsc-includes/checkout.class.php');
118
  require_once(WPSC_FILE_PATH.'/wpsc-includes/display.functions.php');
119
+ require_once(WPSC_FILE_PATH.'/wpsc-includes/pagination.class.php');
120
  require_once(WPSC_FILE_PATH.'/wpsc-includes/theme.functions.php');
121
  require_once(WPSC_FILE_PATH.'/wpsc-includes/shortcode.functions.php');
122
  require_once(WPSC_FILE_PATH.'/wpsc-includes/coupons.class.php');
127
  require_once(WPSC_FILE_PATH."/wpsc-includes/merchant.class.php");
128
  require_once(WPSC_FILE_PATH."/wpsc-includes/meta.functions.php");
129
  require_once(WPSC_FILE_PATH."/wpsc-includes/productfeed.php");
130
+
131
+ //Add deprecated functions in this file please
132
+ require_once(WPSC_FILE_PATH."/wpsc-includes/deprecated.functions.php");
133
  //exit(print_r($v1,true));
134
  if($v1[0] >= 2.8){
135
  require_once(WPSC_FILE_PATH."/wpsc-includes/upgrades.php");
379
  function wpsc_initialisation() {
380
  global $wpsc_cart, $wpsc_theme_path, $wpsc_theme_url, $wpsc_category_url_cache;
381
  // set the theme directory constant
382
+
383
+ $file_names = array();
384
+
385
+ // Check that theme folder exists to prevent fatal timeout error
386
+ // which crashes WordPress.
387
+ if ( is_dir( WPSC_THEMES_PATH ) ) {
388
+ $uploads_dir = @opendir( WPSC_THEMES_PATH );
389
+ while ( ( $file = @readdir( $uploads_dir ) ) !== false ) {
390
+ //echo "<br />test" . WPSC_THEMES_PATH . $file;
391
+ if ( is_dir( WPSC_THEMES_PATH . $file ) && ( $file != "..") && ( $file != "." ) && ( $file != ".svn" ) ) {
392
+ $file_names[] = $file;
393
+ }
394
+ }
395
+ }
396
+
397
  if(count($file_names) > 0) {
398
  $wpsc_theme_path = WPSC_THEMES_PATH;
399
  $wpsc_theme_url = WPSC_THEMES_URL;
424
  $GLOBALS['wpsc_cart'] = new wpsc_cart;
425
  }
426
  }
427
+ $GLOBALS['wpsc_category_url_cache'] = get_option('wpsc_category_url_cache');
428
+ //register_taxonomy('product_tag', 'product');
 
 
429
  }
430
  // first plugin hook in wordpress
431
  add_action('plugins_loaded','wpsc_initialisation', 0);
432
 
433
 
434
 
435
+ function wpsc_register_post_types() {
436
+ register_taxonomy('product_tag', 'wpsc-product');
437
+ }
438
+ add_action( 'init', 'wpsc_register_post_types', 8 ); // highest priority
439
 
440
 
441
  switch(get_option('cart_location')) {
491
  }
492
  }
493
  add_action('shutdown','wpsc_serialize_shopping_cart');
494
+
495
+
496
+ function wpsc_break_canonical_redirects($redirect_url, $requested_url) {
497
+ global $wp_query;
498
+
499
+ if(is_numeric($wp_query->query_vars['category_id'] )) {
500
+ return false;
501
+ }
502
+ return $redirect_url;
503
+
504
+ }
505
+
506
+ add_filter('redirect_canonical', 'wpsc_break_canonical_redirects', 10, 2);
507
+
508
+ ?>
wpsc-admin/admin.php CHANGED
@@ -126,8 +126,9 @@ function wpsc_admin_pages(){
126
  add_contextual_help(WPSC_DIR_NAME.'/display-items',"<a target='_blank' href='http://www.instinct.co.nz/e-commerce/products/'>About this page</a>");
127
  }
128
  //exit('base page:'.$base_page);
129
- if(IS_WPMU){
130
- $page_hooks[] = add_submenu_page($base_page,__('Marketing', 'wpsc'), __('Marketing', 'wpsc'), 11,'wpsc_display_coupons_page','wpsc_display_coupons_page');
 
131
  }else{
132
  $page_hooks[] = add_submenu_page($base_page,__('Marketing', 'wpsc'), __('Marketing', 'wpsc'), 7,'wpsc_display_coupons_page','wpsc_display_coupons_page');
133
  }
126
  add_contextual_help(WPSC_DIR_NAME.'/display-items',"<a target='_blank' href='http://www.instinct.co.nz/e-commerce/products/'>About this page</a>");
127
  }
128
  //exit('base page:'.$base_page);
129
+ // exit($GLOBALS['wp_version']);
130
+ if(IS_WPMU || $GLOBALS['wp_version'] == '3.0-alpha'){
131
+ $page_hooks[] = add_submenu_page($base_page,__('Marketing', 'wpsc'), __('Marketing', 'wpsc'), 10,'wpsc_display_coupons_page','wpsc_display_coupons_page');
132
  }else{
133
  $page_hooks[] = add_submenu_page($base_page,__('Marketing', 'wpsc'), __('Marketing', 'wpsc'), 7,'wpsc_display_coupons_page','wpsc_display_coupons_page');
134
  }
wpsc-admin/ajax-and-init.php CHANGED
@@ -1314,7 +1314,7 @@ function wpsc_purchlog_edit_status($purchlog_id='', $purchlog_status='') {
1314
  }
1315
 
1316
  $log_data = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `id` = '{$purchlog_id}' LIMIT 1",ARRAY_A);
1317
- if (($purchlog_id==2) && function_exists('wpsc_member_activate_subscriptions')){
1318
  wpsc_member_activate_subscriptions($_POST['id']);
1319
  }
1320
 
@@ -1326,7 +1326,7 @@ function wpsc_purchlog_edit_status($purchlog_id='', $purchlog_status='') {
1326
 
1327
  $wpdb->query("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET processed='{$purchlog_status}' WHERE id='{$purchlog_id}'");
1328
 
1329
- if(($purchlog_id > $log_data['processed']) && ($log_data['processed'] <= 2)) {
1330
  transaction_results($log_data['sessionid'],false);
1331
  }
1332
  exit("1");
1314
  }
1315
 
1316
  $log_data = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `id` = '{$purchlog_id}' LIMIT 1",ARRAY_A);
1317
+ if (($purchlog_status==2) && function_exists('wpsc_member_activate_subscriptions')){
1318
  wpsc_member_activate_subscriptions($_POST['id']);
1319
  }
1320
 
1326
 
1327
  $wpdb->query("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET processed='{$purchlog_status}' WHERE id='{$purchlog_id}'");
1328
 
1329
+ if(($purchlog_status > $log_data['processed']) && ($log_data['processed'] <= 2)) {
1330
  transaction_results($log_data['sessionid'],false);
1331
  }
1332
  exit("1");
wpsc-admin/display-items.page.php CHANGED
@@ -327,7 +327,10 @@ function wpsc_admin_products_list($category_id = 0) {
327
 
328
  ?>
329
  <tr class="product-edit <?php echo ( wpsc_publish_status($product['id']) ) ? ' wpsc_published' : ' wpsc_not_published'; ?>" id="product-<?php echo $product['id']?>" >
330
- <th class="check-column" scope="row"><input type='checkbox' name='product[]' class='deletecheckbox' value='<?php echo $product['id'];?>' /></th>
 
 
 
331
 
332
 
333
  <td class="product-image ">
@@ -337,7 +340,7 @@ function wpsc_admin_products_list($category_id = 0) {
337
  <?php
338
  $edit_product_url = wp_nonce_url(htmlentities(add_query_arg('product_id', $product['id'])), 'edit_product_' . $product['id']);
339
  ?>
340
- <a class='edit-product' href='<?php echo $edit_product_url; ?>'><?php echo $product_name; ?></a>
341
  <?php
342
  if($product['publish'] != 1 ) {
343
  ?> - <strong> <?php _e('Draft', 'wpsc'); ?> </strong> <?php
@@ -353,6 +356,13 @@ function wpsc_admin_products_list($category_id = 0) {
353
  <img alt='<?php echo $product_alert['messages'];?>' title='<?php echo $product_alert['messages'];?>' class='product-alert-image' src='<?php echo WPSC_URL;?>/images/product-alert.jpg' alt='' />
354
  <?php
355
  }
 
 
 
 
 
 
 
356
  ?>
357
  <img class='loadingImg' style='display:none;' src='<?php echo get_option('siteurl'); ?>/wp-admin/images/wpspin_light.gif' alt='loading' />
358
 
327
 
328
  ?>
329
  <tr class="product-edit <?php echo ( wpsc_publish_status($product['id']) ) ? ' wpsc_published' : ' wpsc_not_published'; ?>" id="product-<?php echo $product['id']?>" >
330
+ <th class="check-column" scope="row">
331
+ <input type='checkbox' name='product[]' class='deletecheckbox' value='<?php echo $product['id'];?>' title="ID #<?php echo $product['id']; ?>" />
332
+ <?php echo do_action('wpsc_admin_product_checkbox', $product['id']); ?>
333
+ </th>
334
 
335
 
336
  <td class="product-image ">
340
  <?php
341
  $edit_product_url = wp_nonce_url(htmlentities(add_query_arg('product_id', $product['id'])), 'edit_product_' . $product['id']);
342
  ?>
343
+ <a class='edit-product' href='<?php echo $edit_product_url; ?>' title="ID #<?php echo $product['id']; ?>: <?php echo $product_name; ?>"><?php echo $product_name; ?></a>
344
  <?php
345
  if($product['publish'] != 1 ) {
346
  ?> - <strong> <?php _e('Draft', 'wpsc'); ?> </strong> <?php
356
  <img alt='<?php echo $product_alert['messages'];?>' title='<?php echo $product_alert['messages'];?>' class='product-alert-image' src='<?php echo WPSC_URL;?>/images/product-alert.jpg' alt='' />
357
  <?php
358
  }
359
+
360
+ // If a product alert has stuff to display, show it.
361
+ // Can be used to add extra icons etc
362
+ if ( !empty( $product_alert['display'] ) ) {
363
+ echo $product_alert['display'];
364
+ }
365
+
366
  ?>
367
  <img class='loadingImg' style='display:none;' src='<?php echo get_option('siteurl'); ?>/wp-admin/images/wpspin_light.gif' alt='loading' />
368
 
wpsc-admin/display-options-settings.page.php CHANGED
@@ -15,7 +15,7 @@ function wpsc_display_settings_page(){
15
  <div id="wpsc_options" class="wrap">
16
  <?php if(wpsc_check_theme_versions()){ ?>
17
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
18
- <p><?php _e("It looks like your wp-e-commerce theme files are out of date, this can cause potential problems with some gateways that require the new themes. <br /><strong>We recommend you download the latest version of wp-e-commerce unzip it, and copy the new themes folder into your 'uploads/wpsc/themes' folder on your site.</strong>", "wpsc"); ?></p>
19
  </div>
20
  <?php
21
  }
15
  <div id="wpsc_options" class="wrap">
16
  <?php if(wpsc_check_theme_versions()){ ?>
17
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
18
+ <p><?php _e("It looks like your wp-e-commerce theme files are out of date, this can cause potential problems with some gateways and the appearances of the front end of your shop. <br /><strong>We recommend you download the latest version of wp-e-commerce unzip it, and copy the new themes folder into your 'uploads/wpsc/themes' folder on your site. Or port your changes across.</strong>", "wpsc"); ?></p>
19
  </div>
20
  <?php
21
  }
wpsc-admin/display-sales-logs.php CHANGED
@@ -254,7 +254,7 @@ if(!isset($purchlogs)){
254
 
255
  <div id='wpsc_purchlogitems_links'>
256
  <h3><?php _e('Actions'); ?></h3>
257
- <?php do_action('wpsc-purchlogitem-links-start'); ?>
258
  <?php if(wpsc_purchlogs_have_downloads_locked() != false): ?>
259
  <img src='<?php echo WPSC_URL; ?>/images/lock_open.png' alt='clear lock icon' />&ensp;<a href='<?php echo $_SERVER['REQUEST_URI'].'&amp;wpsc_admin_action=clear_locks'; ?>'><?php echo wpsc_purchlogs_have_downloads_locked(); ?></a><br /><br class='small' />
260
  <?php endif; ?>
@@ -396,7 +396,6 @@ if(!isset($purchlogs)){
396
  <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
397
  <?php /* View functions for purchlogs */?>
398
  <label for='view_purchlogs_by'><?php _e('View:'); ?></label>
399
-
400
  <select id='view_purchlogs_by' name='view_purchlogs_by'>
401
  <?php
402
  $date_is_selected['3mnths'] = '';
@@ -406,8 +405,8 @@ if(!isset($purchlogs)){
406
  $date_is_selected['3mnths'] = 'selected="selected"';
407
  break;
408
 
409
- case '':
410
  case 'all':
 
411
  $date_is_selected['all'] = 'selected="selected"';
412
  break;
413
  }
@@ -494,16 +493,16 @@ if(!isset($purchlogs)){
494
  function get_purchaselogs_content(){
495
  global $purchlogs;
496
  while(wpsc_have_purch_items()) : wpsc_the_purch_item();
497
- // exit('<pre>'.print_r($_SESSION, true).'</pre>');
498
  ?>
499
  <tr>
500
  <th class="check-column" scope="row"><input type='checkbox' name='purchlogids[]' class='editcheckbox' value='<?php echo wpsc_the_purch_item_id(); ?>' /></th>
501
  <td><?php echo wpsc_the_purch_item_date(); ?></td> <!--Date -->
502
  <td><?php echo wpsc_the_purch_item_name(); ?></td> <!--Name/email -->
503
  <td><?php echo nzshpcrt_currency_display(wpsc_the_purch_item_price(), true);
504
- do_action('wpsc_additional_sales_amount_info');
505
  ?>
506
- </td><!-- Amount -->
507
  <td><a href='<?php echo htmlentities(add_query_arg('purchaselog_id', wpsc_the_purch_item_id())) ; ?>'><?php echo wpsc_the_purch_item_details();?> Items</a></td><!-- Details -->
508
  <td>
509
  <?php if(wpsc_purchlogs_is_google_checkout() == false){ ?>
254
 
255
  <div id='wpsc_purchlogitems_links'>
256
  <h3><?php _e('Actions'); ?></h3>
257
+ <?php do_action( 'wpsc_purchlogitem_links_start' ); ?>
258
  <?php if(wpsc_purchlogs_have_downloads_locked() != false): ?>
259
  <img src='<?php echo WPSC_URL; ?>/images/lock_open.png' alt='clear lock icon' />&ensp;<a href='<?php echo $_SERVER['REQUEST_URI'].'&amp;wpsc_admin_action=clear_locks'; ?>'><?php echo wpsc_purchlogs_have_downloads_locked(); ?></a><br /><br class='small' />
260
  <?php endif; ?>
396
  <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
397
  <?php /* View functions for purchlogs */?>
398
  <label for='view_purchlogs_by'><?php _e('View:'); ?></label>
 
399
  <select id='view_purchlogs_by' name='view_purchlogs_by'>
400
  <?php
401
  $date_is_selected['3mnths'] = '';
405
  $date_is_selected['3mnths'] = 'selected="selected"';
406
  break;
407
 
 
408
  case 'all':
409
+
410
  $date_is_selected['all'] = 'selected="selected"';
411
  break;
412
  }
493
  function get_purchaselogs_content(){
494
  global $purchlogs;
495
  while(wpsc_have_purch_items()) : wpsc_the_purch_item();
496
+ //exit('<pre>'.print_r($_SESSION, true).'</pre>');
497
  ?>
498
  <tr>
499
  <th class="check-column" scope="row"><input type='checkbox' name='purchlogids[]' class='editcheckbox' value='<?php echo wpsc_the_purch_item_id(); ?>' /></th>
500
  <td><?php echo wpsc_the_purch_item_date(); ?></td> <!--Date -->
501
  <td><?php echo wpsc_the_purch_item_name(); ?></td> <!--Name/email -->
502
  <td><?php echo nzshpcrt_currency_display(wpsc_the_purch_item_price(), true);
503
+ do_action('wpsc_additional_sales_amount_info',wpsc_the_purch_item_id());
504
  ?>
505
+ </td><!-- Amount -->
506
  <td><a href='<?php echo htmlentities(add_query_arg('purchaselog_id', wpsc_the_purch_item_id())) ; ?>'><?php echo wpsc_the_purch_item_details();?> Items</a></td><!-- Details -->
507
  <td>
508
  <?php if(wpsc_purchlogs_is_google_checkout() == false){ ?>
wpsc-admin/includes/display-items-functions.php CHANGED
@@ -113,6 +113,9 @@ function wpsc_display_product_form ($product_id = 0) {
113
  $product_data = $wpsc_product_defaults;
114
  }
115
  }
 
 
 
116
  $current_user = wp_get_current_user();
117
 
118
  // we put the closed postboxes array into the product data to propagate it to each form without having it global.
@@ -164,10 +167,11 @@ function wpsc_product_basic_details_form(&$product_data) {
164
  <dt><?php echo __('Add to Cart PHP', 'wpsc'); ?>: </dt><dd>&lt;?php echo wpsc_add_to_cart_button(<?php echo $product_data['id'];?>); ?&gt;</dd>
165
  <dt><?php echo __('Display Product SKU', 'wpsc'); ?>: </dt><dd>&lt;?php echo wpsc_product_sku(<?php echo $product_data['id'];?>); ?&gt;</dd>
166
  </dl>
167
-
168
- <p>
169
-
170
- </p>
 
171
  </div>
172
  </div>
173
  <div style='clear:both; height: 0px; margin-bottom: 15px;'></div>
@@ -192,6 +196,12 @@ function wpsc_product_basic_details_form(&$product_data) {
192
  if(is_numeric($product_data['special_price'])) {
193
  $special_price = number_format(($product_data['price'] - $product_data['special_price']), 2);
194
  }
 
 
 
 
 
 
195
  ?>
196
  <input type='text' size='17' value='<?php echo $special_price; ?>' name='special_price'/>
197
  </div>
@@ -309,8 +319,7 @@ function wpsc_product_basic_details_form(&$product_data) {
309
  "wpsc_product_download_forms"
310
  );
311
 
312
- $order = get_option('wpsc_product_page_order');
313
- $order = apply_filters( 'wpsc_products_page_forms', $order);
314
 
315
  //echo "<pre>".print_r($order,true)."</pre>";
316
  if (($order == '') || (count($order ) < 6)){
@@ -325,7 +334,7 @@ function wpsc_product_basic_details_form(&$product_data) {
325
  update_option('wpsc_product_page_order', $order);
326
  foreach((array)$order as $key => $box_function_name) {
327
  if(function_exists($box_function_name)) {
328
- echo call_user_func($box_function_name,$product_data);
329
  }
330
  }
331
  ?>
@@ -405,9 +414,9 @@ function wpsc_product_category_and_tag_forms($product_data=''){
405
  $output .= "".$category_group_name.":<br />";
406
  $output .= "</p>";
407
  if ($product_data == '')
408
- $output .= wpsc_category_list($categorisation_group['id'], false, 'add_');
409
  else
410
- $output .= wpsc_category_list($categorisation_group['id'], $product_data['id'], 'edit_');
411
 
412
  }
413
  }
@@ -1240,12 +1249,12 @@ function wpsc_main_product_image_menu($product_id) {
1240
  * Displays the category forms for adding and editing products
1241
  * Recurses to generate the branched view for subcategories
1242
  */
1243
- function wpsc_category_list($group_id, $product_id = '', $unique_id = '', $category_id = null, $iteration = 0) {
1244
  global $wpdb;
1245
  if(is_numeric($category_id)) {
1246
- $values = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `group_id` IN ('$group_id') AND `active`='1' AND `category_parent` = '$category_id' ORDER BY `id` ASC",ARRAY_A);
1247
  } else {
1248
- $values = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `group_id` IN ('$group_id') AND `active`='1' AND `category_parent` = '0' ORDER BY `id` ASC",ARRAY_A);
1249
  }
1250
 
1251
  if($category_id < 1) {
113
  $product_data = $wpsc_product_defaults;
114
  }
115
  }
116
+
117
+ $product_data = apply_filters('wpsc_display_product_form_get', $product_data);
118
+
119
  $current_user = wp_get_current_user();
120
 
121
  // we put the closed postboxes array into the product data to propagate it to each form without having it global.
167
  <dt><?php echo __('Add to Cart PHP', 'wpsc'); ?>: </dt><dd>&lt;?php echo wpsc_add_to_cart_button(<?php echo $product_data['id'];?>); ?&gt;</dd>
168
  <dt><?php echo __('Display Product SKU', 'wpsc'); ?>: </dt><dd>&lt;?php echo wpsc_product_sku(<?php echo $product_data['id'];?>); ?&gt;</dd>
169
  </dl>
170
+
171
+ <?php if ( $product_data['id'] > 0 ) { ?>
172
+ <p><a href="<?php echo wpsc_product_url( $product_data['id'] ); ?>" target="_blank" class="button">View product</a></p>
173
+ <?php } ?>
174
+
175
  </div>
176
  </div>
177
  <div style='clear:both; height: 0px; margin-bottom: 15px;'></div>
196
  if(is_numeric($product_data['special_price'])) {
197
  $special_price = number_format(($product_data['price'] - $product_data['special_price']), 2);
198
  }
199
+ /*
200
+ if(0 == $product_data['special_price']){
201
+ $special_price = number_format(( $product_data['special_price']), 2);
202
+
203
+ }
204
+ */
205
  ?>
206
  <input type='text' size='17' value='<?php echo $special_price; ?>' name='special_price'/>
207
  </div>
319
  "wpsc_product_download_forms"
320
  );
321
 
322
+ $order = apply_filters( 'wpsc_products_page_forms', get_option('wpsc_product_page_order'));
 
323
 
324
  //echo "<pre>".print_r($order,true)."</pre>";
325
  if (($order == '') || (count($order ) < 6)){
334
  update_option('wpsc_product_page_order', $order);
335
  foreach((array)$order as $key => $box_function_name) {
336
  if(function_exists($box_function_name)) {
337
+ echo call_user_func(apply_filters('wpsc_product_page_order_form_name', $box_function_name),$product_data);
338
  }
339
  }
340
  ?>
414
  $output .= "".$category_group_name.":<br />";
415
  $output .= "</p>";
416
  if ($product_data == '')
417
+ $output .= wpsc_category_list($categorisation_group['id'], false, 'add_', null, 0, 'name' );
418
  else
419
+ $output .= wpsc_category_list($categorisation_group['id'], $product_data['id'], 'edit_', null, 0, 'name' );
420
 
421
  }
422
  }
1249
  * Displays the category forms for adding and editing products
1250
  * Recurses to generate the branched view for subcategories
1251
  */
1252
+ function wpsc_category_list($group_id, $product_id = '', $unique_id = '', $category_id = null, $iteration = 0, $orderby = 'id' ) {
1253
  global $wpdb;
1254
  if(is_numeric($category_id)) {
1255
+ $values = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `group_id` IN ('$group_id') AND `active`='1' AND `category_parent` = '$category_id' ORDER BY `$orderby` ASC",ARRAY_A);
1256
  } else {
1257
+ $values = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `group_id` IN ('$group_id') AND `active`='1' AND `category_parent` = '0' ORDER BY `$orderby` ASC",ARRAY_A);
1258
  }
1259
 
1260
  if($category_id < 1) {
wpsc-admin/includes/product-functions.php CHANGED
@@ -131,7 +131,7 @@ function wpsc_sanitise_product_forms($post_data = null) {
131
  }
132
 
133
  $post_data['files'] = $_FILES;
134
-
135
  //exit('<pre>'.print_r($post_data, true).'</pre>');
136
  return $post_data;
137
  }
@@ -605,7 +605,7 @@ function wpsc_resize_image_thumbnail($product_id, $image_action= 0, $width = 0,
605
  $uploaded_image = $_FILES['thumbnailImage']['tmp_name'];
606
  }
607
  if($uploaded_image !== null) {
608
-
609
  move_uploaded_file($uploaded_image, WPSC_THUMBNAIL_DIR.$image);
610
  //exit($uploaded_image);
611
 
131
  }
132
 
133
  $post_data['files'] = $_FILES;
134
+ //exit('<pre>'.print_r($post_data, true).'</pre><pre>'.print_r($_POST, true).'</pre>');
135
  //exit('<pre>'.print_r($post_data, true).'</pre>');
136
  return $post_data;
137
  }
605
  $uploaded_image = $_FILES['thumbnailImage']['tmp_name'];
606
  }
607
  if($uploaded_image !== null) {
608
+ $image = uniqid().$image;
609
  move_uploaded_file($uploaded_image, WPSC_THUMBNAIL_DIR.$image);
610
  //exit($uploaded_image);
611
 
wpsc-admin/includes/settings-pages/general.php CHANGED
@@ -176,6 +176,30 @@ function wpsc_options_general(){
176
  <label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> 100</label>
177
  </td>
178
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  </table>
180
  <div class="submit">
181
  <input type='hidden' name='wpsc_admin_action' value='submit_options' />
176
  <label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> 100</label>
177
  </td>
178
  </tr>
179
+ <tr>
180
+ <?php
181
+ $decimals = get_option('wpsc_hide_decimals');
182
+ switch($decimals){
183
+ case '1':
184
+ $decimal1 = 'checked="checked"';
185
+ break;
186
+
187
+ case '0':
188
+ default:
189
+ $decimal2 = 'checked="checked"';
190
+ break;
191
+ }
192
+
193
+ ?>
194
+ <th scope="row"><?php _e('Hide Decimals on Products Pages'); ?></th>
195
+ <td>
196
+ <input type='radio' value='1' name='wpsc_options[wpsc_hide_decimals]' id='hide_decimals1' <?php echo $decimal1; ?> />
197
+ <label for='hide_decimals1'><?php _e('Yes'); ?></label>
198
+
199
+ <input type='radio' value='0' name='wpsc_options[wpsc_hide_decimals]' id='hide_decimals2' <?php echo $decimal2; ?> />
200
+ <label for='hide_decimals2'><?php _e('No'); ?></label>
201
+ </td>
202
+ </tr>
203
  </table>
204
  <div class="submit">
205
  <input type='hidden' name='wpsc_admin_action' value='submit_options' />
wpsc-admin/includes/settings-pages/presentation.php CHANGED
@@ -369,7 +369,7 @@ global $wpdb;
369
  </select>
370
  <?php
371
  if(!function_exists('product_display_grid')) {
372
- ?><a href='http://www.instinct.co.nz/e-commerce/shop/'><?php echo __('Purchase unavailable options', 'wpsc'); ?></a> <?php
373
  }
374
  ?>
375
  <div id='list_view_options' <?php if(is_null($product_view2)) { echo "style='display:none;'";} ?> >
@@ -506,7 +506,32 @@ global $wpdb;
506
  <input type='radio' value='1' name='wpsc_options[catsprods_display_type]' id='catsprods_display_type2' <?php echo $catsprods_display_type2; ?> /> <label for='catsprods_display_type2'><?php echo __('Sliding Product Groups (1 product per page)', 'wpsc');?></label>
507
  </td>
508
  </tr>
509
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
510
  <?php
511
  if(function_exists('gold_shpcrt_search_form')) {
512
  ?>
369
  </select>
370
  <?php
371
  if(!function_exists('product_display_grid')) {
372
+ ?><a href='http://getshopped.org/extend/premium-upgrades/'><?php echo __('Purchase unavailable options', 'wpsc'); ?></a> <?php
373
  }
374
  ?>
375
  <div id='list_view_options' <?php if(is_null($product_view2)) { echo "style='display:none;'";} ?> >
506
  <input type='radio' value='1' name='wpsc_options[catsprods_display_type]' id='catsprods_display_type2' <?php echo $catsprods_display_type2; ?> /> <label for='catsprods_display_type2'><?php echo __('Sliding Product Groups (1 product per page)', 'wpsc');?></label>
507
  </td>
508
  </tr>
509
+
510
+
511
+ <tr>
512
+ <th scope="row">
513
+ <?php echo __( 'Show Subcategory Products in Parent Category', 'wpsc' ); ?>:
514
+ </th>
515
+ <td>
516
+ <?php
517
+ $show_subcatsprods_in_cat = get_option( 'show_subcatsprods_in_cat' );
518
+ $show_subcatsprods_in_cat_on = '';
519
+ $show_subcatsprods_in_cat_off = '';
520
+ switch ( $show_subcatsprods_in_cat ) {
521
+ case 1:
522
+ $show_subcatsprods_in_cat_on = 'checked="checked"';
523
+ break;
524
+ case 0:
525
+ $show_subcatsprods_in_cat_off = 'checked="checked"';
526
+ break;
527
+ }
528
+ ?>
529
+ <input type="radio" value="1" name="wpsc_options[show_subcatsprods_in_cat]" id="show_subcatsprods_in_cat_on" <?php echo $show_subcatsprods_in_cat_on; ?> /> <label for="show_subcatsprods_in_cat_on"><?php echo __( 'Yes', 'wpsc' ); ?></label> &nbsp;
530
+ <input type="radio" value="0" name="wpsc_options[show_subcatsprods_in_cat]" id="show_subcatsprods_in_cat_off" <?php echo $show_subcatsprods_in_cat_off; ?> /> <label for="show_subcatsprods_in_cat_off"><?php echo __( 'No', 'wpsc' ); ?></label>
531
+ </td>
532
+ </tr>
533
+
534
+
535
  <?php
536
  if(function_exists('gold_shpcrt_search_form')) {
537
  ?>
wpsc-admin/includes/settings-pages/shipping.php CHANGED
@@ -174,6 +174,7 @@ function selectgateway() {
174
  <?php if (IS_WP27) { ?>
175
  </div>
176
  </div>
 
177
  <?php } ?>
178
  <table id='gateway_options' >
179
  <tr>
174
  <?php if (IS_WP27) { ?>
175
  </div>
176
  </div>
177
+ <?php do_action('end-wpec-settings-shipping-general'); //1bigidea ?>
178
  <?php } ?>
179
  <table id='gateway_options' >
180
  <tr>
wpsc-admin/js/admin.js CHANGED
@@ -10,7 +10,9 @@ jQuery(document).ready( function () {
10
 
11
  jQuery('.wpsc_prod_thumb_option').livequery(function(){
12
  jQuery(this).blur(function(){
13
- jQuery('.wpsc_mass_resize').css('visibility', 'hidden');
 
 
14
  });
15
  });
16
 
10
 
11
  jQuery('.wpsc_prod_thumb_option').livequery(function(){
12
  jQuery(this).blur(function(){
13
+
14
+ // if(jQuery('.wpsc_mass_resize').css('visibility') != 'hidden')
15
+ // jQuery('.wpsc_mass_resize').css('visibility', 'hidden');
16
  });
17
  });
18
 
wpsc-includes/ajax.functions.php CHANGED
@@ -53,15 +53,16 @@ function wpsc_add_to_cart() {
53
 
54
 
55
  /// sanitise submitted values
56
- $product_id = (int)$_POST['product_id'];
57
  foreach((array)$_POST['variation'] as $key => $variation) {
58
  $provided_parameters['variation_values'][(int)$key] = (int)$variation;
59
  }
 
60
  if($_POST['quantity'] > 0 && (!isset($_POST['wpsc_quantity_update']))) {
61
  $provided_parameters['quantity'] = (int)$_POST['quantity'];
62
  } else if (isset($_POST['wpsc_quantity_update'])) {
63
  $wpsc_cart->remove_item($_POST['key']);
64
- $provided_parameters['quantity'] = (int)$_POST['wpsc_quantity_update'];
65
  }
66
  // exit('<pre>'.print_r($_POST, true).'</pre>');
67
  if($_POST['is_customisable'] == 'true') {
@@ -83,7 +84,7 @@ function wpsc_add_to_cart() {
83
  $state = $wpsc_cart->set_item($product_id,$parameters);
84
 
85
  $product = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='".$product_id."' LIMIT 1",ARRAY_A);
86
-
87
  if($state == true) {
88
  $cart_messages[] = str_replace("[product_name]", stripslashes($product['name']), __('You just added "[product_name]" to your cart.', 'wpsc'));
89
  } else {
@@ -96,6 +97,7 @@ function wpsc_add_to_cart() {
96
  }
97
  }
98
 
 
99
  if($_GET['ajax'] == 'true') {
100
  if(($product_id != null) &&(get_option('fancy_notifications') == 1)) {
101
  echo "if(jQuery('#fancy_notification_content')) {\n\r";
@@ -361,7 +363,52 @@ function wpsc_update_shipping_price() {
361
  global $wpdb, $wpsc_cart;
362
  $quote_shipping_method = $_POST['key1'];
363
  $quote_shipping_option = $_POST['key'];
 
 
 
 
 
364
  $wpsc_cart->update_shipping($quote_shipping_method, $quote_shipping_option);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  echo "jQuery('.pricedisplay.checkout-shipping').html('".wpsc_cart_shipping()."');\n\r";
366
  echo "jQuery('.pricedisplay.checkout-total').html('".wpsc_cart_total()."');\n\r";
367
  exit();
@@ -457,11 +504,12 @@ function wpsc_update_location() {
457
  $wpsc_cart->update_location();
458
  $wpsc_cart->get_shipping_method();
459
  $wpsc_cart->get_shipping_option();
460
- //echo $wpsc_cart->shipping_method;
461
  if($wpsc_cart->selected_shipping_method != '') {
462
  $wpsc_cart->update_shipping($wpsc_cart->selected_shipping_method, $wpsc_cart->selected_shipping_option);
463
- }
464
  //echo "<pre>".print_r($wpsc_cart, true)."</pre>";
 
 
465
  //exit();
466
  if($_GET['ajax'] == 'true') {
467
  exit();
@@ -498,7 +546,9 @@ if($_REQUEST['wpsc_action'] == 'cart_html_page') {
498
  function wpsc_submit_checkout() {
499
  global $wpdb, $wpsc_cart, $user_ID,$nzshpcrt_gateways, $wpsc_shipping_modules, $wpsc_gateways;
500
  //echo "break redirect";
501
- do_action('wpsc_before_submit_checkout');
 
 
502
  $_SESSION['wpsc_checkout_misc_error_messages'] = array();
503
  $wpsc_checkout = new wpsc_checkout();
504
  //exit('coupons:'.$wpsc_cart->coupons_name);
@@ -506,6 +556,7 @@ function wpsc_submit_checkout() {
506
  $submitted_gateway = $_POST['custom_gateway'];
507
 
508
  $options = get_option('custom_shipping_options');
 
509
  $form_validity = $wpsc_checkout->validate_forms();
510
 
511
  extract($form_validity); // extracts $is_valid and $error_messages
@@ -584,7 +635,7 @@ function wpsc_submit_checkout() {
584
  $total = $wpsc_cart->calculate_total_price();
585
  $sql = "INSERT INTO `".WPSC_TABLE_PURCHASE_LOGS."` (`totalprice`,`statusno`, `sessionid`, `user_ID`, `date`, `gateway`, `billing_country`,`shipping_country`, `billing_region`, `shipping_region`, `base_shipping`,`shipping_method`, `shipping_option`, `plugin_version`, `discount_value`, `discount_data`,`find_us`) VALUES ('$total' ,'0', '{$sessionid}', '".(int)$user_ID."', UNIX_TIMESTAMP(), '{$submitted_gateway}', '{$wpsc_cart->delivery_country}', '{$wpsc_cart->selected_country}','{$wpsc_cart->selected_region}', '{$wpsc_cart->delivery_region}', '{$base_shipping}', '{$wpsc_cart->selected_shipping_method}', '{$wpsc_cart->selected_shipping_option}', '".WPSC_VERSION."', '{$wpsc_cart->coupons_amount}','{$wpsc_cart->coupons_name}', '{$find_us}')";
586
 
587
- //exit($sql.'<br /><pre>'.print_r($wpsc_cart, true).'</pre>');
588
  $wpdb->query($sql);
589
 
590
 
@@ -978,4 +1029,4 @@ function nzshpcrt_download_file() {
978
  }
979
 
980
  add_action('init', 'nzshpcrt_download_file');
981
- ?>
53
 
54
 
55
  /// sanitise submitted values
56
+ $product_id = (int)$_REQUEST['product_id'];
57
  foreach((array)$_POST['variation'] as $key => $variation) {
58
  $provided_parameters['variation_values'][(int)$key] = (int)$variation;
59
  }
60
+ //exit('<pre>'.print_r($_POST['wpsc_quantity_update'][$_POST['product_id']], true).'</pre>');
61
  if($_POST['quantity'] > 0 && (!isset($_POST['wpsc_quantity_update']))) {
62
  $provided_parameters['quantity'] = (int)$_POST['quantity'];
63
  } else if (isset($_POST['wpsc_quantity_update'])) {
64
  $wpsc_cart->remove_item($_POST['key']);
65
+ $provided_parameters['quantity'] = (int)$_POST['wpsc_quantity_update'][$_POST['product_id']];
66
  }
67
  // exit('<pre>'.print_r($_POST, true).'</pre>');
68
  if($_POST['is_customisable'] == 'true') {
84
  $state = $wpsc_cart->set_item($product_id,$parameters);
85
 
86
  $product = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='".$product_id."' LIMIT 1",ARRAY_A);
87
+ // exit('<pre>'.print_r($product,true).'</pre>');
88
  if($state == true) {
89
  $cart_messages[] = str_replace("[product_name]", stripslashes($product['name']), __('You just added "[product_name]" to your cart.', 'wpsc'));
90
  } else {
97
  }
98
  }
99
 
100
+ $cart_messages = apply_filters('wpsc_cart_messages',$cart_messages);
101
  if($_GET['ajax'] == 'true') {
102
  if(($product_id != null) &&(get_option('fancy_notifications') == 1)) {
103
  echo "if(jQuery('#fancy_notification_content')) {\n\r";
363
  global $wpdb, $wpsc_cart;
364
  $quote_shipping_method = $_POST['key1'];
365
  $quote_shipping_option = $_POST['key'];
366
+ // exit('<pre>'.print_r($wpsc_cart, true).'</pre>');
367
+ if($quote_shipping_method == '' && $quote_shipping_option == ''){
368
+ $quote_shipping_method = $wpsc_cart->selected_shipping_method;
369
+
370
+ }
371
  $wpsc_cart->update_shipping($quote_shipping_method, $quote_shipping_option);
372
+ if($_POST['key1'] == '' && $_POST['key'] == ''){
373
+ $i=0;
374
+ foreach($wpsc_cart->cart_items as $cart_item){
375
+ $product_ship = $cart_item->calculate_shipping($quote_shipping_method);
376
+
377
+ echo "jQuery('#shipping_".$i."').html('".htmlspecialchars(nzshpcrt_currency_display($product_ship, false,true))."');\n\r";
378
+ $i++;
379
+ }
380
+ }
381
+ // if(count($wpsc_cart->shipping_quotes) > 0 && $_POST['key1'] == '' && $_POST['key'] == ''){
382
+ while (wpsc_have_shipping_methods()) : wpsc_the_shipping_method();
383
+ if (!wpsc_have_shipping_quotes()) { continue; } // Don't display shipping method if it doesn't have at least one quote
384
+ while (wpsc_have_shipping_quotes()) : wpsc_the_shipping_quote();
385
+ $output .="<tr class='shipping_quotes'>";
386
+ $output .="<td colspan='3'>";
387
+ $output .="<label for='".wpsc_shipping_quote_html_id()."'>".wpsc_shipping_quote_name()."</label>";
388
+ $output .="</td>";
389
+ $output .="<td style='text-align:center;'>";
390
+ $output .="<label for='".wpsc_shipping_quote_html_id()."'>".wpsc_shipping_quote_value()."</label>
391
+ </td>
392
+ <td style='text-align:center;'>";
393
+ if(wpsc_have_morethanone_shipping_methods_and_quotes()):
394
+ $output .="<input type='radio' id='".wpsc_shipping_quote_html_id()."'".wpsc_shipping_quote_selected_state()." onclick='switchmethod(\"".wpsc_shipping_quote_name()."\", \"".wpsc_shipping_method_internal_name()."\")' value='". wpsc_shipping_quote_value(true)."' name='shipping_method' />";
395
+ else:
396
+ $output .=" <input ". wpsc_shipping_quote_selected_state()." disabled='disabled' type='radio' id='". wpsc_shipping_quote_html_id()."' value='". wpsc_shipping_quote_value(true)."' name='shipping_method' />";
397
+ wpsc_update_shipping_single_method();
398
+ endif;
399
+ $output .="</td>";
400
+ $output .="</tr>";
401
+ endwhile;
402
+ endwhile;
403
+ $output = str_replace(Array("\n","\r") , Array("\\n","\\r"),addslashes($output));
404
+ echo "jQuery('tr.shipping_quotes').remove();";
405
+ echo "jQuery('#wpsc_shopping_cart_container .productcart :first').append(\"".$output."\");\n\r";
406
+ // }
407
+ $tax = $wpsc_cart->calculate_total_tax();
408
+ if($tax >0){
409
+ echo "jQuery(\"tr.total_tax\").show();\n\r";
410
+ echo "jQuery('#checkout_tax').html(\"<span class='pricedisplay'>".wpsc_cart_tax()."</span>\");\n\r";
411
+ }
412
  echo "jQuery('.pricedisplay.checkout-shipping').html('".wpsc_cart_shipping()."');\n\r";
413
  echo "jQuery('.pricedisplay.checkout-total').html('".wpsc_cart_total()."');\n\r";
414
  exit();
504
  $wpsc_cart->update_location();
505
  $wpsc_cart->get_shipping_method();
506
  $wpsc_cart->get_shipping_option();
507
+ // echo $wpsc_cart->shipping_method.'<br />';
508
  if($wpsc_cart->selected_shipping_method != '') {
509
  $wpsc_cart->update_shipping($wpsc_cart->selected_shipping_method, $wpsc_cart->selected_shipping_option);
 
510
  //echo "<pre>".print_r($wpsc_cart, true)."</pre>";
511
+ }
512
+
513
  //exit();
514
  if($_GET['ajax'] == 'true') {
515
  exit();
546
  function wpsc_submit_checkout() {
547
  global $wpdb, $wpsc_cart, $user_ID,$nzshpcrt_gateways, $wpsc_shipping_modules, $wpsc_gateways;
548
  //echo "break redirect";
549
+ //
550
+ do_action('wpsc_before_submit_checkout');
551
+
552
  $_SESSION['wpsc_checkout_misc_error_messages'] = array();
553
  $wpsc_checkout = new wpsc_checkout();
554
  //exit('coupons:'.$wpsc_cart->coupons_name);
556
  $submitted_gateway = $_POST['custom_gateway'];
557
 
558
  $options = get_option('custom_shipping_options');
559
+
560
  $form_validity = $wpsc_checkout->validate_forms();
561
 
562
  extract($form_validity); // extracts $is_valid and $error_messages
635
  $total = $wpsc_cart->calculate_total_price();
636
  $sql = "INSERT INTO `".WPSC_TABLE_PURCHASE_LOGS."` (`totalprice`,`statusno`, `sessionid`, `user_ID`, `date`, `gateway`, `billing_country`,`shipping_country`, `billing_region`, `shipping_region`, `base_shipping`,`shipping_method`, `shipping_option`, `plugin_version`, `discount_value`, `discount_data`,`find_us`) VALUES ('$total' ,'0', '{$sessionid}', '".(int)$user_ID."', UNIX_TIMESTAMP(), '{$submitted_gateway}', '{$wpsc_cart->delivery_country}', '{$wpsc_cart->selected_country}','{$wpsc_cart->selected_region}', '{$wpsc_cart->delivery_region}', '{$base_shipping}', '{$wpsc_cart->selected_shipping_method}', '{$wpsc_cart->selected_shipping_option}', '".WPSC_VERSION."', '{$wpsc_cart->coupons_amount}','{$wpsc_cart->coupons_name}', '{$find_us}')";
637
 
638
+ //exit($sql);
639
  $wpdb->query($sql);
640
 
641
 
1029
  }
1030
 
1031
  add_action('init', 'nzshpcrt_download_file');
1032
+ ?>
wpsc-includes/cart.class.php CHANGED
@@ -61,6 +61,7 @@ function wpsc_coupon_amount($forDisplay=true) {
61
  function wpsc_cart_total($forDisplay=true) {
62
  global $wpsc_cart;
63
  $total = $wpsc_cart->calculate_subtotal();
 
64
  $total += $wpsc_cart->calculate_total_shipping();
65
  $total -= $wpsc_cart->coupons_amount;
66
  if(wpsc_tax_isincluded() == false){
@@ -383,10 +384,11 @@ function wpsc_the_shipping_method() {
383
  * the shipping method name function, no parameters
384
  * @return string shipping method name
385
  */
386
- function wpsc_shipping_method_name() {
387
  global $wpsc_cart, $wpsc_shipping_modules;
388
- //exit('SHIPPING OPTION NAME'.$wpsc_cart->shipping_method);
389
- return $wpsc_shipping_modules[$wpsc_cart->shipping_method]->getName();
 
390
  }
391
 
392
 
@@ -458,6 +460,7 @@ function wpsc_shipping_quote_selected_state() {
458
  global $wpsc_cart;
459
 
460
  if(($wpsc_cart->selected_shipping_method == $wpsc_cart->shipping_method) && ($wpsc_cart->selected_shipping_option == $wpsc_cart->shipping_quote['name']) ) {
 
461
  return "checked='checked'";
462
  } else {
463
  return "";
@@ -532,6 +535,8 @@ class wpsc_cart {
532
  // var $shipping_quotes = null;
533
  var $selected_shipping_option = null;
534
 
 
 
535
  var $coupon;
536
  var $tax_percentage;
537
  var $unique_id;
@@ -577,7 +582,8 @@ class wpsc_cart {
577
  //currency values
578
  var $currency_conversion = 0;
579
  var $use_currency_converter = false;
580
-
 
581
  function wpsc_cart() {
582
  global $wpdb, $wpsc_shipping_modules;
583
  $coupon = 'percentage';
@@ -620,13 +626,11 @@ class wpsc_cart {
620
  $_SESSION['wpsc_delivery_region'] = get_option('base_region');
621
  }
622
 
623
- //exit('<pre>'.print_r($_SESSION, true).'</pre>');
624
  $this->delivery_country =& $_SESSION['wpsc_delivery_country'];
625
  $this->selected_country =& $_SESSION['wpsc_selected_country'];
626
  $this->delivery_region =& $_SESSION['wpsc_delivery_region'];
627
  $this->selected_region =& $_SESSION['wpsc_selected_region'];
628
 
629
-
630
  $this->get_tax_rate();
631
  }
632
 
@@ -711,9 +715,9 @@ class wpsc_cart {
711
  function update_shipping($method, $option) {
712
  global $wpdb, $wpsc_shipping_modules;
713
  $this->selected_shipping_method = $method;
714
-
715
  $this->shipping_quotes = $wpsc_shipping_modules[$method]->getQuote();
716
-
717
  //exit('<pre>'.print_r($this->shipping_quotes,true).'</pre> quotes');
718
  $this->selected_shipping_option = $option;
719
 
@@ -1016,6 +1020,8 @@ class wpsc_cart {
1016
  unset($this->coupons_name);
1017
  $this->clear_cache();
1018
  $this->cleanup();
 
 
1019
  }
1020
 
1021
 
@@ -1124,14 +1130,21 @@ class wpsc_cart {
1124
  global $wpdb, $wpsc_cart;
1125
  $total = 0;
1126
  if(wpsc_tax_isincluded() == false){
 
1127
  if($this->total_tax == null) {
1128
  foreach($this->cart_items as $key => $cart_item) {
1129
  $total += $cart_item->tax;
1130
  }
 
1131
  $this->total_tax = $total;
 
1132
  } else {
1133
  $total = $this->total_tax;
1134
  }
 
 
 
 
1135
  }else{
1136
  if($this->total_tax == null) {
1137
  foreach($this->cart_items as $key => $cart_item) {
@@ -1145,6 +1158,7 @@ class wpsc_cart {
1145
 
1146
  }
1147
  $total = apply_filters('wpsc_convert_tax_prices', $total);
 
1148
  return $total;
1149
  }
1150
 
@@ -1210,11 +1224,15 @@ class wpsc_cart {
1210
  function calculate_total_shipping() {
1211
  if( ! ( (get_option('shipping_discount')== 1) && (get_option('shipping_discount_value') <= $this->calculate_subtotal() ) ) ){
1212
  $total = $this->calculate_base_shipping();
 
 
1213
  $total += $this->calculate_per_item_shipping();
1214
  }else{
1215
  $total = 0;
1216
  }
1217
- $total = apply_filters('wpsc_convert_total_shipping',$total);
 
 
1218
  return $total;
1219
  }
1220
 
@@ -1238,15 +1256,19 @@ class wpsc_cart {
1238
  * @return float returns the shipping as a floating point value
1239
  */
1240
  function calculate_base_shipping() {
1241
- global $wpdb, $wpsc_shipping_modules;
1242
- if($this->uses_shipping()) {
1243
- if(empty($this->shipping_quotes) and is_callable(array($wpsc_shipping_modules[$this->selected_shipping_method]), "getQuote" )) {
 
1244
  $this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
 
1245
  }
1246
  if($this->selected_shipping_option == null){
1247
  $this->get_shipping_option();
1248
  }
 
1249
  $total = (float)$this->shipping_quotes[$this->selected_shipping_option];
 
1250
  $this->base_shipping = $total;
1251
  } else {
1252
 
@@ -1271,7 +1293,7 @@ class wpsc_cart {
1271
  if($method == $this->selected_shipping_method) {
1272
  $this->total_item_shipping = $total;
1273
  }
1274
- //echo("<pre>".print_r($method." ".$total,true)."</pre>");
1275
  return $total;
1276
  }
1277
 
@@ -1469,7 +1491,7 @@ class wpsc_cart {
1469
  // exit('here');
1470
  $this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
1471
  // use the selected shipping module
1472
- if(is_callable(array($wpsc_shipping_modules[$this->selected_shipping_method]), "getQuote" )) {
1473
 
1474
  $this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
1475
  }
@@ -1481,7 +1503,7 @@ class wpsc_cart {
1481
 
1482
  // if the shipping module does not require a weight, or requires one and the weight is larger than zero
1483
  $this->selected_shipping_method = $shipping_module;
1484
- if(is_callable(array($wpsc_shipping_modules[$this->selected_shipping_method]), "getQuote" )) {
1485
 
1486
  $this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
1487
  }
@@ -1690,13 +1712,13 @@ class wpsc_cart_item {
1690
  }
1691
  }
1692
  }
 
1693
  // create the string containing the product name.
1694
  $product_name = $product['name'];
1695
  if(count($variation_names) > 0) {
1696
  $product_name .= " (".implode(", ",$variation_names).")";
1697
  }
1698
- $price = apply_filters('wpsc_do_convert_price', $price);
1699
- //exit('<pre>'.print_r($this, true).'</pre>');
1700
  $this->product_name = $product_name;
1701
  $this->priceandstock_id = $priceandstock_id;
1702
  $this->is_donation = (bool)$product['donation'];
@@ -1710,10 +1732,9 @@ class wpsc_cart_item {
1710
  } else {
1711
  $this->unit_price = $price;
1712
  }
1713
-
1714
  $this->weight = $weight;
1715
  $this->total_price = $this->unit_price * $this->quantity;
1716
-
1717
  $category_data = $wpdb->get_results("SELECT `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`id`,`".WPSC_TABLE_PRODUCT_CATEGORIES."`.`nice-name` FROM `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` , `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."`.`product_id` IN ('".$product['id']."') AND `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."`.`category_id` = `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`id` AND `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`active` IN('1')", ARRAY_A);
1718
 
1719
  $this->category_list = array();
@@ -1756,8 +1777,7 @@ class wpsc_cart_item {
1756
  $this->is_downloadable = false;
1757
  }
1758
 
1759
-
1760
- if(is_callable(array($wpsc_shipping_modules[$this->cart->selected_shipping_method]), "get_item_shipping" )) {
1761
  $this->shipping = $wpsc_shipping_modules[$this->cart->selected_shipping_method]->get_item_shipping($this);
1762
  }
1763
  // update the claimed stock here
@@ -1779,7 +1799,7 @@ class wpsc_cart_item {
1779
  $method = $this->cart->selected_shipping_method;
1780
  }
1781
  if(method_exists( $wpsc_shipping_modules[$method], "get_item_shipping" )) {
1782
- $shipping = $wpsc_shipping_modules[$method]->get_item_shipping($this->unit_price, 1, $this->weight, $this->product_id);
1783
  //echo("<pre>".print_r($shipping,true)."</pre>");
1784
  }
1785
  if($method == $this->cart->selected_shipping_method) {
@@ -1881,7 +1901,7 @@ class wpsc_cart_item {
1881
  $method = $this->cart->selected_shipping_method;
1882
  }
1883
  if(method_exists( $wpsc_shipping_modules[$method], "get_item_shipping" )) {
1884
- $shipping = $wpsc_shipping_modules[$this->cart->selected_shipping_method]->get_item_shipping($this->unit_price, 1, $this->weight, $this->product_id);
1885
  }
1886
  if($this->cart->has_total_shipping_discount()) {
1887
  $shipping = 0;
61
  function wpsc_cart_total($forDisplay=true) {
62
  global $wpsc_cart;
63
  $total = $wpsc_cart->calculate_subtotal();
64
+ // echo 'cart shipping total'.$wpsc_cart->calculate_total_shipping();
65
  $total += $wpsc_cart->calculate_total_shipping();
66
  $total -= $wpsc_cart->coupons_amount;
67
  if(wpsc_tax_isincluded() == false){
384
  * the shipping method name function, no parameters
385
  * @return string shipping method name
386
  */
387
+ function wpsc_shipping_method_name(){
388
  global $wpsc_cart, $wpsc_shipping_modules;
389
+ if(is_object($wpsc_shipping_modules[$wpsc_cart->shipping_method])){
390
+ return $wpsc_shipping_modules[$wpsc_cart->shipping_method]->getName();
391
+ }
392
  }
393
 
394
 
460
  global $wpsc_cart;
461
 
462
  if(($wpsc_cart->selected_shipping_method == $wpsc_cart->shipping_method) && ($wpsc_cart->selected_shipping_option == $wpsc_cart->shipping_quote['name']) ) {
463
+ $wpsc_cart->selected_shipping_amount = $wpsc_cart->base_shipping;
464
  return "checked='checked'";
465
  } else {
466
  return "";
535
  // var $shipping_quotes = null;
536
  var $selected_shipping_option = null;
537
 
538
+ var $selected_shipping_amount = null;
539
+
540
  var $coupon;
541
  var $tax_percentage;
542
  var $unique_id;
582
  //currency values
583
  var $currency_conversion = 0;
584
  var $use_currency_converter = false;
585
+ var $selected_currency_code = '';
586
+
587
  function wpsc_cart() {
588
  global $wpdb, $wpsc_shipping_modules;
589
  $coupon = 'percentage';
626
  $_SESSION['wpsc_delivery_region'] = get_option('base_region');
627
  }
628
 
 
629
  $this->delivery_country =& $_SESSION['wpsc_delivery_country'];
630
  $this->selected_country =& $_SESSION['wpsc_selected_country'];
631
  $this->delivery_region =& $_SESSION['wpsc_delivery_region'];
632
  $this->selected_region =& $_SESSION['wpsc_selected_region'];
633
 
 
634
  $this->get_tax_rate();
635
  }
636
 
715
  function update_shipping($method, $option) {
716
  global $wpdb, $wpsc_shipping_modules;
717
  $this->selected_shipping_method = $method;
718
+ if(is_callable(array($wpsc_shipping_modules[$method]), "getQuote" )) {
719
  $this->shipping_quotes = $wpsc_shipping_modules[$method]->getQuote();
720
+ }
721
  //exit('<pre>'.print_r($this->shipping_quotes,true).'</pre> quotes');
722
  $this->selected_shipping_option = $option;
723
 
1020
  unset($this->coupons_name);
1021
  $this->clear_cache();
1022
  $this->cleanup();
1023
+
1024
+ do_action('wpsc-empty-cart', &$this);
1025
  }
1026
 
1027
 
1130
  global $wpdb, $wpsc_cart;
1131
  $total = 0;
1132
  if(wpsc_tax_isincluded() == false){
1133
+
1134
  if($this->total_tax == null) {
1135
  foreach($this->cart_items as $key => $cart_item) {
1136
  $total += $cart_item->tax;
1137
  }
1138
+
1139
  $this->total_tax = $total;
1140
+ // exit('<pre>'.print_r($this,true).'</pre>');
1141
  } else {
1142
  $total = $this->total_tax;
1143
  }
1144
+ if($this->total_tax != null && $this->coupons_amount > 0){
1145
+ $total = ($this->calculate_subtotal()-$this->coupons_amount)/$this->tax_percentage;
1146
+ //exit(($this->calculate_subtotal()-$this->coupons_amount)/$wpsc_cart->tax_percentage);
1147
+ }
1148
  }else{
1149
  if($this->total_tax == null) {
1150
  foreach($this->cart_items as $key => $cart_item) {
1158
 
1159
  }
1160
  $total = apply_filters('wpsc_convert_tax_prices', $total);
1161
+
1162
  return $total;
1163
  }
1164
 
1224
  function calculate_total_shipping() {
1225
  if( ! ( (get_option('shipping_discount')== 1) && (get_option('shipping_discount_value') <= $this->calculate_subtotal() ) ) ){
1226
  $total = $this->calculate_base_shipping();
1227
+ // echo 'Base shipping'.$total;
1228
+ // echo '<br /> Per Item:'.$this->calculate_per_item_shipping();
1229
  $total += $this->calculate_per_item_shipping();
1230
  }else{
1231
  $total = 0;
1232
  }
1233
+
1234
+ $total = apply_filters('wpsc_convert_total_shipping',$total);
1235
+
1236
  return $total;
1237
  }
1238
 
1256
  * @return float returns the shipping as a floating point value
1257
  */
1258
  function calculate_base_shipping() {
1259
+ global $wpdb, $wpsc_shipping_modules;
1260
+ if($this->uses_shipping()) {
1261
+ if(!empty($this->shipping_quotes) && !is_callable(array($wpsc_shipping_modules[$this->selected_shipping_method]), "getQuote" )) {
1262
+
1263
  $this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
1264
+ // exit('NOT EMPTY<pre>'.print_r($this, true).'</pre>');
1265
  }
1266
  if($this->selected_shipping_option == null){
1267
  $this->get_shipping_option();
1268
  }
1269
+
1270
  $total = (float)$this->shipping_quotes[$this->selected_shipping_option];
1271
+
1272
  $this->base_shipping = $total;
1273
  } else {
1274
 
1293
  if($method == $this->selected_shipping_method) {
1294
  $this->total_item_shipping = $total;
1295
  }
1296
+ // echo("<pre>".print_r($this->selected_shipping_method." ".$method." ".$total,true)."</pre>");
1297
  return $total;
1298
  }
1299
 
1491
  // exit('here');
1492
  $this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
1493
  // use the selected shipping module
1494
+ if ( is_callable( array( $wpsc_shipping_modules[$this->selected_shipping_method], 'getQuote' ) ) ) {
1495
 
1496
  $this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
1497
  }
1503
 
1504
  // if the shipping module does not require a weight, or requires one and the weight is larger than zero
1505
  $this->selected_shipping_method = $shipping_module;
1506
+ if ( is_callable( array( $wpsc_shipping_modules[$this->selected_shipping_method], 'getQuote' ) ) ) {
1507
 
1508
  $this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
1509
  }
1712
  }
1713
  }
1714
  }
1715
+ $price = apply_filters('wpsc_do_convert_price', $price);
1716
  // create the string containing the product name.
1717
  $product_name = $product['name'];
1718
  if(count($variation_names) > 0) {
1719
  $product_name .= " (".implode(", ",$variation_names).")";
1720
  }
1721
+
 
1722
  $this->product_name = $product_name;
1723
  $this->priceandstock_id = $priceandstock_id;
1724
  $this->is_donation = (bool)$product['donation'];
1732
  } else {
1733
  $this->unit_price = $price;
1734
  }
 
1735
  $this->weight = $weight;
1736
  $this->total_price = $this->unit_price * $this->quantity;
1737
+
1738
  $category_data = $wpdb->get_results("SELECT `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`id`,`".WPSC_TABLE_PRODUCT_CATEGORIES."`.`nice-name` FROM `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` , `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."`.`product_id` IN ('".$product['id']."') AND `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."`.`category_id` = `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`id` AND `".WPSC_TABLE_PRODUCT_CATEGORIES."`.`active` IN('1')", ARRAY_A);
1739
 
1740
  $this->category_list = array();
1777
  $this->is_downloadable = false;
1778
  }
1779
 
1780
+ if ( is_callable( array( $wpsc_shipping_modules[$this->cart->selected_shipping_method], 'get_item_shipping' ) ) ) {
 
1781
  $this->shipping = $wpsc_shipping_modules[$this->cart->selected_shipping_method]->get_item_shipping($this);
1782
  }
1783
  // update the claimed stock here
1799
  $method = $this->cart->selected_shipping_method;
1800
  }
1801
  if(method_exists( $wpsc_shipping_modules[$method], "get_item_shipping" )) {
1802
+ $shipping = $wpsc_shipping_modules[$method]->get_item_shipping( $this );
1803
  //echo("<pre>".print_r($shipping,true)."</pre>");
1804
  }
1805
  if($method == $this->cart->selected_shipping_method) {
1901
  $method = $this->cart->selected_shipping_method;
1902
  }
1903
  if(method_exists( $wpsc_shipping_modules[$method], "get_item_shipping" )) {
1904
+ $shipping = $wpsc_shipping_modules[$this->cart->selected_shipping_method]->get_item_shipping( $this );
1905
  }
1906
  if($this->cart->has_total_shipping_discount()) {
1907
  $shipping = 0;
wpsc-includes/checkout.class.php CHANGED
@@ -405,12 +405,13 @@ class wpsc_checkout {
405
  function form_field() {
406
  global $wpdb, $user_ID;
407
  //$meta_data[$form_field['id']]
408
- //exit('<pre>'.print_r($this, true).'</pre>');
 
409
  if((count($_SESSION['wpsc_checkout_saved_values']) <= 0) && ($user_ID > 0)) {
410
- $_SESSION['wpsc_checkout_saved_values'] = get_usermeta($user_ID, 'wpshpcrt_usr_profile');
411
  }
412
- $saved_form_data = htmlentities(stripslashes($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id]), ENT_QUOTES);
413
- //exit('<pre>'.print_r($_SESSION['wpsc_checkout_saved_values'], true).'</pre>');
414
  $an_array = '';
415
  if(function_exists('wpsc_get_ticket_checkout_set')){
416
  if($this->checkout_item->checkout_set == wpsc_get_ticket_checkout_set()){
@@ -442,11 +443,10 @@ class wpsc_checkout {
442
  $output = wpsc_country_region_list($this->checkout_item->id , false, $_SESSION['wpsc_selected_country'], $_SESSION['wpsc_selected_region'], $this->form_element_id());
443
  break;
444
 
445
- case "delivery_country":
446
-
447
  if(wpsc_uses_shipping()){
448
  $country_name = $wpdb->get_var("SELECT `country` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `isocode`='".$_SESSION['wpsc_delivery_country']."' LIMIT 1");
449
- $output = "<input title='".$this->checkout_item->unique_name."' type='hidden' id='".$this->form_element_id()."' class='shipping_country' name='collected_data[{$this->checkout_item->id}]' value='".$_SESSION['wpsc_delivery_country']."' size='4' /><span class='shipping_country_name'>".$country_name."</span> ";
450
  }else{
451
  $checkoutfields = true;
452
  //$output = wpsc_shipping_country_list($checkoutfields);
@@ -485,13 +485,18 @@ class wpsc_checkout {
485
  case "coupon":
486
  default:
487
  $country_data = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `isocode` IN('".$_SESSION['wpsc_delivery_country']."') LIMIT 1",ARRAY_A);
488
- if($this->checkout_item->unique_name == 'shippingstate' && (wpsc_uses_shipping())&&($country_data['has_regions'] == 1)){
 
489
  $region_name = $wpdb->get_var("SELECT `name` FROM `".WPSC_TABLE_REGION_TAX."` WHERE `id`='".$_SESSION['wpsc_delivery_region']."' LIMIT 1");
490
  $output = "<input title='".$this->checkout_item->unique_name."' type='hidden' id='".$this->form_element_id()."' class='shipping_region' name='collected_data[{$this->checkout_item->id}]' value='".$_SESSION['wpsc_delivery_region']."' size='4' /><span class='shipping_region_name'>".$region_name."</span> ";
491
 
 
 
 
 
492
  }else{
493
  $output = "<input title='".$this->checkout_item->unique_name."' type='text' id='".$this->form_element_id()."' class='text' value='".$saved_form_data."' name='collected_data[{$this->checkout_item->id}]".$an_array."' />";
494
-
495
  }
496
 
497
  break;
@@ -506,11 +511,13 @@ class wpsc_checkout {
506
  function validate_forms() {
507
  global $wpdb, $current_user, $user_ID;
508
  $any_bad_inputs = false;
 
509
  // Credit Card Number Validation for Paypal Pro and maybe others soon
510
  if(wpsc_cart_total(false) != 0){
511
 
512
  if(isset($_POST['card_number'])){
513
- if($_POST['card_number'] != ''){
 
514
  $ccregex='/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/';
515
  if(!preg_match($ccregex, $_POST['card_number'])){
516
  $any_bad_inputs = true;
@@ -520,6 +527,7 @@ class wpsc_checkout {
520
  }else{
521
  $_SESSION['wpsc_gateway_error_messages']['card_number'] = '';
522
  }
 
523
  }else{
524
 
525
 
@@ -626,6 +634,7 @@ class wpsc_checkout {
626
  case "select":
627
  case 'checkbox':
628
  if(is_array($value)){
 
629
  foreach($value as $v){
630
  if($v == '-1'){
631
  $select_bad_input++;
@@ -645,10 +654,25 @@ class wpsc_checkout {
645
  }
646
  break;
647
  default:
648
- if($value == null) {
649
- $any_bad_inputs = true;
650
- $bad_input = true;
651
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
652
  break;
653
  }
654
  if($bad_input === true) {
405
  function form_field() {
406
  global $wpdb, $user_ID;
407
  //$meta_data[$form_field['id']]
408
+ //exit('<pre>'.print_r($_SESSION['wpsc_checkout_saved_values'], true).'</pre>');
409
+
410
  if((count($_SESSION['wpsc_checkout_saved_values']) <= 0) && ($user_ID > 0)) {
411
+ //$_SESSION['wpsc_checkout_saved_values'] = get_usermeta($user_ID, 'wpshpcrt_usr_profile');
412
  }
413
+ $saved_form_data = htmlentities(stripslashes($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id]), ENT_QUOTES, 'UTF-8');
414
+ //exit('<pre>HERE'.print_r($_POST, true).'</pre>');
415
  $an_array = '';
416
  if(function_exists('wpsc_get_ticket_checkout_set')){
417
  if($this->checkout_item->checkout_set == wpsc_get_ticket_checkout_set()){
443
  $output = wpsc_country_region_list($this->checkout_item->id , false, $_SESSION['wpsc_selected_country'], $_SESSION['wpsc_selected_region'], $this->form_element_id());
444
  break;
445
 
446
+ case "delivery_country":
 
447
  if(wpsc_uses_shipping()){
448
  $country_name = $wpdb->get_var("SELECT `country` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `isocode`='".$_SESSION['wpsc_delivery_country']."' LIMIT 1");
449
+ $output = "<input title='".$this->checkout_item->unique_name."' type='hidden' id='".$this->form_element_id()."' class='shipping_country' name='collected_data[{$this->checkout_item->id}]' value='".$_SESSION['wpsc_delivery_country']."' /><span class='shipping_country_name'>".$country_name."</span> ";
450
  }else{
451
  $checkoutfields = true;
452
  //$output = wpsc_shipping_country_list($checkoutfields);
485
  case "coupon":
486
  default:
487
  $country_data = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `isocode` IN('".$_SESSION['wpsc_delivery_country']."') LIMIT 1",ARRAY_A);
488
+ if($this->checkout_item->unique_name == 'shippingstate'){
489
+ if(wpsc_uses_shipping()&&($country_data['has_regions'] == 1)){
490
  $region_name = $wpdb->get_var("SELECT `name` FROM `".WPSC_TABLE_REGION_TAX."` WHERE `id`='".$_SESSION['wpsc_delivery_region']."' LIMIT 1");
491
  $output = "<input title='".$this->checkout_item->unique_name."' type='hidden' id='".$this->form_element_id()."' class='shipping_region' name='collected_data[{$this->checkout_item->id}]' value='".$_SESSION['wpsc_delivery_region']."' size='4' /><span class='shipping_region_name'>".$region_name."</span> ";
492
 
493
+ }else{
494
+ $output = "<input class='shipping_region' title='".$this->checkout_item->unique_name."' type='text' id='".$this->form_element_id()."' class='text' value='".$saved_form_data."' name='collected_data[{$this->checkout_item->id}]".$an_array."' />";
495
+
496
+ }
497
  }else{
498
  $output = "<input title='".$this->checkout_item->unique_name."' type='text' id='".$this->form_element_id()."' class='text' value='".$saved_form_data."' name='collected_data[{$this->checkout_item->id}]".$an_array."' />";
499
+
500
  }
501
 
502
  break;
511
  function validate_forms() {
512
  global $wpdb, $current_user, $user_ID;
513
  $any_bad_inputs = false;
514
+
515
  // Credit Card Number Validation for Paypal Pro and maybe others soon
516
  if(wpsc_cart_total(false) != 0){
517
 
518
  if(isset($_POST['card_number'])){
519
+ if($_POST['card_number'] != ''){/*
520
+
521
  $ccregex='/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/';
522
  if(!preg_match($ccregex, $_POST['card_number'])){
523
  $any_bad_inputs = true;
527
  }else{
528
  $_SESSION['wpsc_gateway_error_messages']['card_number'] = '';
529
  }
530
+ */
531
  }else{
532
 
533
 
634
  case "select":
635
  case 'checkbox':
636
  if(is_array($value)){
637
+ $select_bad_input = 0;
638
  foreach($value as $v){
639
  if($v == '-1'){
640
  $select_bad_input++;
654
  }
655
  break;
656
  default:
657
+ if(is_array($value)){
658
+ $select_bad_input = 0;
659
+ foreach($value as $v){
660
+ if($v == ''){
661
+ $select_bad_input++;
662
+ }else{
663
+ $valid_select_input++;
664
+ }
665
+ }
666
+ if(count($value) == $select_bad_input){
667
+ $any_bad_inputs = true;
668
+ $bad_input = true;
669
+ }
670
+ }else{
671
+ if($value == ''){
672
+ $any_bad_inputs = true;
673
+ $bad_input = true;
674
+ }
675
+ }
676
  break;
677
  }
678
  if($bad_input === true) {
wpsc-includes/coupons.class.php CHANGED
@@ -103,19 +103,26 @@ class wpsc_coupons {
103
  function calculate_discount() {
104
  global $wpdb, $wpsc_cart;
105
 
106
- //echo "<pre>".print_r($wpsc_cart,true)."</pre>";
107
  $wpsc_cart->clear_cache();
 
 
108
  if ($this->conditions == '' || count($this->conditions) == 0) {
109
- //Calculates the discount for the whole cart if there is no condition on this coupon.
 
110
  if ($this->is_percentage == '2'){
111
- return $wpsc_cart->calculate_total_shipping();
112
  }
 
 
113
  if ($this->is_percentage == '1') {
114
 
115
  $total_price = $wpsc_cart->calculate_subtotal();
116
  $this->discount = $total_price*$this->value/100;
117
  return $this->discount;
 
 
118
  } else {
 
119
  if($this->every_product == 1) {
120
  $item_count = (int)wpsc_cart_item_count();
121
  return ($this->value * $item_count);
@@ -123,30 +130,29 @@ class wpsc_coupons {
123
  return $this->value;
124
  }
125
  }
 
 
126
  } else {
127
 
128
  //Loop throught all products in the shopping cart, apply coupons on the ones match the conditions.
129
  $cart =& $wpsc_cart->have_cart_items();
130
 
131
  foreach ($wpsc_cart->cart_items as $key => $item) {
132
- $match = true;
133
 
134
  $product_data = $wpdb->get_results("SELECT * FROM ".WPSC_TABLE_PRODUCT_LIST." WHERE id='{$item->product_id}'");
135
  $product_data = $product_data[0];
136
 
 
137
  foreach ($this->conditions as $c) {
138
 
139
  //Check if all the condictions are returning true, so it's an ALL logic, if anyone want to implement a ANY logic please do.
140
-
141
- /* $match && */ $match = $this->compare_logic($c, $item);
142
- if($match){
143
- $match = true;
144
- // exit('ture');
145
- }else{
146
  $match = false;
147
- break('false');
148
  }
149
  }
 
 
150
  if ($match) {
151
 
152
  if ($this->is_percentage == '1') {
@@ -158,19 +164,18 @@ class wpsc_coupons {
158
  }else{
159
  return $this->discount;
160
  }
161
- //echo $item->discount."-";
162
  } else {
163
  $item->discount = $this->value;
164
  if($this->every_product == 1){
165
- $return += $this->discount;
166
  }else{
167
  //exit('<pre>'.print_r($this,true).'</pre>');
168
- return $this->value;
169
  }
170
- //$return += $this->value;
171
  }
 
 
172
  }else{
173
- //exit('match not found');
174
  $this->discount = 0;
175
  $item->discount = $this->discount;
176
  $return += $this->discount;
@@ -337,6 +342,8 @@ class wpsc_coupons {
337
  default:
338
  return false;
339
  }
 
 
340
  }
341
  }
342
 
103
  function calculate_discount() {
104
  global $wpdb, $wpsc_cart;
105
 
 
106
  $wpsc_cart->clear_cache();
107
+
108
+ //Calculates the discount for the whole cart if there is no condition on this coupon.
109
  if ($this->conditions == '' || count($this->conditions) == 0) {
110
+
111
+ // $this->is_percentage == '2' means "Free Shipping"
112
  if ($this->is_percentage == '2'){
113
+ return $wpsc_cart->calculate_total_shipping();
114
  }
115
+
116
+ // $this->is_percentage == '1' means "%" discount
117
  if ($this->is_percentage == '1') {
118
 
119
  $total_price = $wpsc_cart->calculate_subtotal();
120
  $this->discount = $total_price*$this->value/100;
121
  return $this->discount;
122
+
123
+ // Anything else means "Fixed amount" discount
124
  } else {
125
+
126
  if($this->every_product == 1) {
127
  $item_count = (int)wpsc_cart_item_count();
128
  return ($this->value * $item_count);
130
  return $this->value;
131
  }
132
  }
133
+
134
+ // The coupon has conditions so may not apply to all items
135
  } else {
136
 
137
  //Loop throught all products in the shopping cart, apply coupons on the ones match the conditions.
138
  $cart =& $wpsc_cart->have_cart_items();
139
 
140
  foreach ($wpsc_cart->cart_items as $key => $item) {
 
141
 
142
  $product_data = $wpdb->get_results("SELECT * FROM ".WPSC_TABLE_PRODUCT_LIST." WHERE id='{$item->product_id}'");
143
  $product_data = $product_data[0];
144
 
145
+ $match = true;
146
  foreach ($this->conditions as $c) {
147
 
148
  //Check if all the condictions are returning true, so it's an ALL logic, if anyone want to implement a ANY logic please do.
149
+ if (!$this->compare_logic($c, $item)) {
 
 
 
 
 
150
  $match = false;
151
+ break;
152
  }
153
  }
154
+
155
+ // This product is eligible for discount
156
  if ($match) {
157
 
158
  if ($this->is_percentage == '1') {
164
  }else{
165
  return $this->discount;
166
  }
 
167
  } else {
168
  $item->discount = $this->value;
169
  if($this->every_product == 1){
170
+ $return += $item->discount;
171
  }else{
172
  //exit('<pre>'.print_r($this,true).'</pre>');
173
+ return $item->discount;
174
  }
 
175
  }
176
+
177
+ // This product is NOT eligible for discount
178
  }else{
 
179
  $this->discount = 0;
180
  $item->discount = $this->discount;
181
  $return += $this->discount;
342
  default:
343
  return false;
344
  }
345
+ } else {
346
+ return apply_filters( 'wpsc_coupon_compare_logic', false, $c, $product_obj );
347
  }
348
  }
349
 
wpsc-includes/deprecated.functions.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Deprecated functions that will be removed at a later date.
4
+ * @package Wp-e-commerce
5
+ * Since 3.7.6rc2
6
+ *
7
+ */
8
+ if(!wpsc_check_theme_versions()){
9
+ include_once(WPSC_FILE_PATH.'/languages/EN_en.php');
10
+ }
11
+
12
+
13
+
14
+ /**
15
+ * Filter: wpsc-purchlogitem-links-start
16
+ *
17
+ * This filter has been deprecated and replaced with one that follows the
18
+ * correct naming conventions with underscores.
19
+ *
20
+ * Since 3.7.6rc2
21
+ */
22
+ function wpsc_purchlogitem_links_start_deprecated() {
23
+
24
+ do_action( 'wpsc-purchlogitem-links-start' );
25
+
26
+ }
27
+ add_action( 'wpsc_purchlogitem_links_start', 'wpsc_purchlogitem_links_start_deprecated' );
28
+
29
+
30
+
31
+ ?>
wpsc-includes/display.functions.php CHANGED
@@ -31,6 +31,8 @@ function wpsc_buy_now_button($product_id, $replaced_shortcode = false) {
31
  wpsc_the_product();
32
  $price = calculate_product_price($wpsc_query->product['id'], $wpsc_query->first_variations);
33
  $shipping = $wpsc_query->product['pnp'];
 
 
34
  $output .= "<form onsubmit='log_paypal_buynow(this)' target='paypal' action='".get_option('paypal_multiple_url')."' method='post' />
35
  <input type='hidden' name='business' value='".get_option('paypal_multiple_business')."' />
36
  <input type='hidden' name='cmd' value='_xclick' />
@@ -39,10 +41,15 @@ function wpsc_buy_now_button($product_id, $replaced_shortcode = false) {
39
  <input type='hidden' id='amount' name='amount' value='".($price+$pnp)."' />
40
  <input type='hidden' id='unit' name='unit' value='".$price."' />
41
  <input type='hidden' id='shipping' name='ship11' value='".$shipping."' />
42
- <input type='hidden' name='handling' value='".get_option('base_local_shipping')."' />
43
- <input type='hidden' name='currency_code' value='".get_option('paypal_curcode')."' />
44
- <input type='hidden' name='undefined_quantity' value='0' />
45
- <input type='image' name='submit' border='0' src='https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif' alt='PayPal - The safer, easier way to pay online' />
 
 
 
 
 
46
  <img alt='' border='0' width='1' height='1' src='https://www.paypal.com/en_US/i/scr/pixel.gif' />
47
  </form>\n\r";
48
  endwhile;
31
  wpsc_the_product();
32
  $price = calculate_product_price($wpsc_query->product['id'], $wpsc_query->first_variations);
33
  $shipping = $wpsc_query->product['pnp'];
34
+ if(wpsc_uses_shipping()){$handling = get_option('base_local_shipping');}else{$handling = $shipping;}
35
+
36
  $output .= "<form onsubmit='log_paypal_buynow(this)' target='paypal' action='".get_option('paypal_multiple_url')."' method='post' />
37
  <input type='hidden' name='business' value='".get_option('paypal_multiple_business')."' />
38
  <input type='hidden' name='cmd' value='_xclick' />
41
  <input type='hidden' id='amount' name='amount' value='".($price+$pnp)."' />
42
  <input type='hidden' id='unit' name='unit' value='".$price."' />
43
  <input type='hidden' id='shipping' name='ship11' value='".$shipping."' />
44
+ <input type='hidden' name='handling' value='".$handling."' />
45
+ <input type='hidden' name='currency_code' value='".get_option('paypal_curcode')."' />";
46
+ if(get_option('multi_add') == 1){
47
+ $output .="<label for='quantity'>".__('Quantity','wpsc')."</label>";
48
+ $output .="<input type='text' size='4' id='quantity' name='quantity' value='' /><br />";
49
+ }else{
50
+ $output .="<input type='hidden' name='undefined_quantity' value='0' />";
51
+ }
52
+ $output .="<input type='image' name='submit' border='0' src='https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif' alt='PayPal - The safer, easier way to pay online' />
53
  <img alt='' border='0' width='1' height='1' src='https://www.paypal.com/en_US/i/scr/pixel.gif' />
54
  </form>\n\r";
55
  endwhile;
wpsc-includes/merchant.class.php CHANGED
@@ -115,7 +115,7 @@ class wpsc_merchant {
115
  'billing' => array(),
116
  'shipping' => array()
117
  );
118
- foreach($collected_form_data as $collected_form_row) {
119
  $address_data_set = 'billing';
120
  $address_key = array_search($collected_form_row['unique_name'], $address_keys['billing']);
121
  if($address_key === null) {
@@ -162,7 +162,7 @@ class wpsc_merchant {
162
  $original_cart_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE `purchaseid` = {$purchase_id}", ARRAY_A);
163
  //print_r($original_cart_data);
164
  //return;
165
- foreach($original_cart_data as $cart_row) {
166
  $is_downloadable = false;
167
  if($wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_DOWNLOAD_STATUS."` WHERE `cartid` = {$cart_row['id']}")) {
168
  $is_downloadable = true;
@@ -240,7 +240,7 @@ class wpsc_merchant {
240
  global $wpdb;
241
  $transaction_id = $wpdb->escape($transaction_id);
242
  $wpdb->query("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `processed` = '".absint($status)."', `transactid` ='{$transaction_id}' WHERE `id` = ".absint($this->purchase_id)." LIMIT 1");
243
- //exit("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `processed` = '".absint($status)."', `transactid` ='{$transaction_id}' WHERE `id` IN ('".absint($this->purchase_id)."') LIMIT 1");
244
  }
245
  /**
246
  * construct_value_array gateway specific data array, extended in merchant files
115
  'billing' => array(),
116
  'shipping' => array()
117
  );
118
+ foreach((array)$collected_form_data as $collected_form_row) {
119
  $address_data_set = 'billing';
120
  $address_key = array_search($collected_form_row['unique_name'], $address_keys['billing']);
121
  if($address_key === null) {
162
  $original_cart_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE `purchaseid` = {$purchase_id}", ARRAY_A);
163
  //print_r($original_cart_data);
164
  //return;
165
+ foreach((array)$original_cart_data as $cart_row) {
166
  $is_downloadable = false;
167
  if($wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_DOWNLOAD_STATUS."` WHERE `cartid` = {$cart_row['id']}")) {
168
  $is_downloadable = true;
240
  global $wpdb;
241
  $transaction_id = $wpdb->escape($transaction_id);
242
  $wpdb->query("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `processed` = '".absint($status)."', `transactid` ='{$transaction_id}' WHERE `id` = ".absint($this->purchase_id)." LIMIT 1");
243
+ //echo("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `processed` = '".absint($status)."', `transactid` ='{$transaction_id}' WHERE `id` IN ('".absint($this->purchase_id)."') LIMIT 1");
244
  }
245
  /**
246
  * construct_value_array gateway specific data array, extended in merchant files
wpsc-includes/misc.functions.php CHANGED
@@ -120,8 +120,9 @@ add_filter('single_post_title','wpsc_post_title_seo');
120
  * @return bool true or false
121
  */
122
  function wpsc_change_canonical_url($url) {
123
- global $wpdb, $wpsc_query;
124
- if($wpsc_query->is_single == true) {
 
125
  if(!is_numeric($_GET['product_id'])) {
126
  $product_id = $wpdb->get_var("SELECT `product_id` FROM `".WPSC_TABLE_PRODUCTMETA."` WHERE `meta_key` IN ( 'url_name' ) AND `meta_value` IN ( '".$wpsc_query->query_vars['product_url_name']."' ) ORDER BY `product_id` DESC LIMIT 1");
127
  } else {
@@ -157,7 +158,7 @@ function wpsc_insert_canonical_url() {
157
 
158
  function wpsc_canonical_url() {
159
  $wpsc_url = wpsc_change_canonical_url(null);
160
- if($wpsc_url != null) {
161
  remove_action( 'wp_head', 'rel_canonical' );
162
  add_action( 'wp_head', 'wpsc_insert_canonical_url');
163
  }
@@ -744,4 +745,4 @@ function wpsc_clear_stock_claims( ) {
744
  $wpdb->query("DELETE FROM `".WPSC_TABLE_CLAIMED_STOCK."` WHERE `last_activity` < '{$old_claimed_stock_datetime}' AND `cart_submitted` IN ('0')");
745
  }
746
  add_action('wpsc_daily_cron_tasks', 'wpsc_clear_stock_claims');
747
- ?>
120
  * @return bool true or false
121
  */
122
  function wpsc_change_canonical_url($url) {
123
+ global $wpdb, $wpsc_query, $post;
124
+ // exit('<pre>'.print_r($post,true).'</pre>');
125
+ if(preg_match("/\[productspage\]/",$post->post_content)) {
126
  if(!is_numeric($_GET['product_id'])) {
127
  $product_id = $wpdb->get_var("SELECT `product_id` FROM `".WPSC_TABLE_PRODUCTMETA."` WHERE `meta_key` IN ( 'url_name' ) AND `meta_value` IN ( '".$wpsc_query->query_vars['product_url_name']."' ) ORDER BY `product_id` DESC LIMIT 1");
128
  } else {
158
 
159
  function wpsc_canonical_url() {
160
  $wpsc_url = wpsc_change_canonical_url(null);
161
+ if(($wpsc_url != null) && ((count($aioseop_options) <= 1) || (($aioseop_options['aiosp_can'] != '1' && $aioseop_options['aiosp_can'] != 'on'))) ) {
162
  remove_action( 'wp_head', 'rel_canonical' );
163
  add_action( 'wp_head', 'wpsc_insert_canonical_url');
164
  }
745
  $wpdb->query("DELETE FROM `".WPSC_TABLE_CLAIMED_STOCK."` WHERE `last_activity` < '{$old_claimed_stock_datetime}' AND `cart_submitted` IN ('0')");
746
  }
747
  add_action('wpsc_daily_cron_tasks', 'wpsc_clear_stock_claims');
748
+ ?>
wpsc-includes/pagination.class.php ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ /**
6
+ * wpsc pagination
7
+ * It is intended to move some of this functionality to a paging class
8
+ * so that paging functionality can easily be created for multiple uses.
9
+ */
10
+
11
+
12
+
13
+ /**
14
+ * wpsc current_page
15
+ * @return (int) The current page number
16
+ */
17
+ function wpsc_current_page() {
18
+
19
+ global $wpsc_query;
20
+
21
+ $current_page = 1;
22
+
23
+ if ( $wpsc_query->query_vars['page'] > 1) {
24
+ $current_page = $wpsc_query->query_vars['page'];
25
+ }
26
+
27
+ return $current_page;
28
+
29
+ }
30
+
31
+ /**
32
+ * wpsc showing products
33
+ * Displays the number of page showing in the form "10 to 20".
34
+ * If only on page is being display it will return the total amount of products showing.
35
+ * @return (string) Number of products showing
36
+ */
37
+ function wpsc_showing_products() {
38
+
39
+ global $wpsc_query;
40
+
41
+ // If we are using pages...
42
+ if ( ( get_option( 'use_pagination' ) == 1 ) ) {
43
+ $products_per_page = $wpsc_query->query_vars['number_per_page'];
44
+ if ( $wpsc_query->query_vars['page'] > 0 ) {
45
+ $startnum = ( $wpsc_query->query_vars['page'] - 1 ) * $products_per_page;
46
+ } else {
47
+ $startnum = 0;
48
+ }
49
+ return ( $startnum + 1 ) . ' to ' . ( $startnum + wpsc_product_count() );
50
+ }
51
+
52
+ return wpsc_total_product_count();
53
+
54
+ }
55
+
56
+ /**
57
+ * wpsc showing products page
58
+ * Displays the number of page showing in the form "5 of 10".
59
+ * @return (string) Number of pages showing.
60
+ */
61
+ function wpsc_showing_products_page() {
62
+
63
+ global $wpsc_query;
64
+
65
+ $output = $wpsc_query->page_count;
66
+ $current_page = wpsc_current_page();
67
+
68
+ return $current_page . ' of ' . $output;
69
+
70
+ }
71
+
72
+ /**
73
+ * wpsc pagination
74
+ * Page numbers as links - limit by passing the $show parameter.
75
+ * @param $show (int) Number of pages to show, -1 shows all. Zero will be used to show default setting in a future release.
76
+ * @return (string) Linked page numbers.
77
+ */
78
+ function wpsc_pagination( $show = -1 ) {
79
+
80
+ global $wpsc_query;
81
+
82
+ $output = '';
83
+ $start = 1;
84
+ $end = $wpsc_query->page_count;
85
+ $show = intval( $show );
86
+
87
+ $current_page = wpsc_current_page();
88
+
89
+ if ( $show > 0 ) {
90
+ $start = $current_page - ( floor( $show / 2 ) );
91
+ if ( $start < 1 ) {
92
+ $start = 1;
93
+ }
94
+ $end = $start + $show - 1;
95
+ if ( $end > $wpsc_query->page_count ) {
96
+ $end = $wpsc_query->page_count;
97
+ if ( $end - $show + 1 > 0 ) {
98
+ $start = $end - $show + 1;
99
+ }
100
+ }
101
+ }
102
+ while ( wpsc_have_pages() ) : wpsc_the_page();
103
+ if ( wpsc_page_number() >= $start && wpsc_page_number() <= $end ) {
104
+ if ( wpsc_page_is_selected() ) :
105
+ $output .= '<a href="' . wpsc_page_url() . '" class="selected">' . wpsc_page_number() . '</a> ';
106
+ else :
107
+ $output .= '<a href="' . wpsc_page_url() . '">' . wpsc_page_number() . '</a> ';
108
+ endif;
109
+ }
110
+ endwhile;
111
+
112
+ $wpsc_query->rewind_pages();
113
+
114
+ return $output;
115
+
116
+ }
117
+
118
+ /**
119
+ * wpsc adjacent products url
120
+ * URL for the next or previous page of products on a category or group page.
121
+ * @param $n (int) Page number.
122
+ * @return (string) URL for the adjacent products page link.
123
+ */
124
+ function wpsc_adjacent_products_url( $n ) {
125
+
126
+ global $wpsc_query;
127
+
128
+ $current_page = wpsc_current_page();
129
+
130
+ $n = $current_page + $n;
131
+
132
+ if ( $n < 1 || $n > $wpsc_query->page_count ) {
133
+ return;
134
+ }
135
+
136
+ while ( wpsc_have_pages() ) : wpsc_the_page();
137
+ if ( wpsc_page_number() == $n ) {
138
+ $url = wpsc_page_url();
139
+ $wpsc_query->rewind_pages();
140
+ return $url;
141
+ }
142
+ endwhile;
143
+
144
+ $wpsc_query->rewind_pages();
145
+
146
+ return;
147
+
148
+ }
149
+
150
+ /**
151
+ * wpsc next products link
152
+ * Links to the next page of products on a category or group page.
153
+ * @param $text (string) Link text.
154
+ * @param $show_disabled (bool) Show unlinked text if last page.
155
+ * @return (string) Next page link or text.
156
+ */
157
+ function wpsc_next_products_link( $text = 'Next', $show_disabled = false ) {
158
+
159
+ $page_url = wpsc_adjacent_products_url( 1 );
160
+
161
+ if ( $page_url ) {
162
+ return '<a href="' . $page_url . '">' . $text . '</a>';
163
+ }
164
+
165
+ if ( $show_disabled ) {
166
+ return '<span>' . $text . '</span>';
167
+ }
168
+
169
+ return;
170
+
171
+ }
172
+
173
+ /**
174
+ * wpsc previous products link
175
+ * Links to the previous page of products on a category or group page.
176
+ * @param $text (string) Link text.
177
+ * @param $show_disabled (bool) Show unlinked text if first page.
178
+ * @return (string) Previous page link or text.
179
+ */
180
+ function wpsc_previous_products_link( $text = 'Previous', $show_disabled = false ) {
181
+
182
+ $page_url = wpsc_adjacent_products_url( -1 );
183
+
184
+ if ( $page_url ) {
185
+ return '<a href="' . $page_url . '">' . $text . '</a>';
186
+ }
187
+
188
+ if ( $show_disabled ) {
189
+ return '<span>' . $text . '</span>';
190
+ }
191
+
192
+ return;
193
+
194
+ }
195
+
196
+ /**
197
+ * wpsc first products link
198
+ * Links to the first page of products on a category or group page.
199
+ * @param $text (string) Link text.
200
+ * @param $show_disabled (bool) Show unlinked text if last page.
201
+ * @return (string) First page link or text.
202
+ */
203
+ function wpsc_first_products_link( $text = 'First', $show_disabled = false ) {
204
+
205
+ global $wpsc_query;
206
+
207
+ $page_url = '';
208
+
209
+ while ( wpsc_have_pages() ) : wpsc_the_page();
210
+ $page_url = wpsc_page_url();
211
+ break;
212
+ endwhile;
213
+
214
+ $wpsc_query->rewind_pages();
215
+
216
+ if ( $page_url && wpsc_current_page() > 1 ) {
217
+ return '<a href="' . $page_url . '">' . $text . '</a>';
218
+ }
219
+
220
+ if ( $show_disabled ) {
221
+ return '<span>' . $text . '</span>';
222
+ }
223
+
224
+ return;
225
+
226
+ }
227
+
228
+ /**
229
+ * wpsc last products link
230
+ * Links to the last page of products on a category or group page.
231
+ * @param $text (string) Link text.
232
+ * @param $show_disabled (bool) Show unlinked text if first page.
233
+ * @return (string) Last page link or text.
234
+ */
235
+ function wpsc_last_products_link( $text = 'Last', $show_disabled = false ) {
236
+
237
+ global $wpsc_query;
238
+
239
+ $page_url = '';
240
+
241
+ while ( wpsc_have_pages() ) : wpsc_the_page();
242
+ $page_url = wpsc_page_url();
243
+ endwhile;
244
+
245
+ $wpsc_query->rewind_pages();
246
+
247
+ if ( $page_url && wpsc_current_page() < $wpsc_query->page_count ) {
248
+ return '<a href="' . $page_url . '">' . $text . '</a>';
249
+ }
250
+
251
+ if ( $show_disabled ) {
252
+ return '<span>' . $text . '</span>';
253
+ }
254
+
255
+ return;
256
+
257
+ }
258
+
259
+
260
+
261
+ ?>
wpsc-includes/processing.functions.php CHANGED
@@ -302,8 +302,7 @@ function calculate_product_price($product_id, $variations = false, $no_special=f
302
  } else {
303
  $price = false;
304
  }
305
- $price = apply_filters('wpsc_do_convert_price', $price);
306
-
307
  return $price;
308
  }
309
 
302
  } else {
303
  $price = false;
304
  }
305
+ $price = apply_filters('wpsc_do_convert_price', $price);
 
306
  return $price;
307
  }
308
 
wpsc-includes/purchaselogs.class.php CHANGED
@@ -76,7 +76,7 @@ function wpsc_purchlogs_has_customfields($id = ''){
76
  //return true;
77
  if($id == ''){
78
  foreach((array)$purchlogitem->allcartcontent as $cartitem){
79
- if($cartitem->files != 'N;' || $cartitem->custom_message != ''){
80
  return true;
81
  }
82
  }
@@ -84,7 +84,7 @@ function wpsc_purchlogs_has_customfields($id = ''){
84
  }else{
85
  $purchlogitem = new wpsc_purchaselogs_items($id);
86
  foreach((array)$purchlogitem->allcartcontent as $cartitem){
87
- if($cartitem->files != 'N;' || $cartitem->custom_message != ''){
88
  return true;
89
  }
90
  }
@@ -223,17 +223,21 @@ function wpsc_the_purch_status_name(){
223
  function wpsc_purchlogs_getfirstdates(){
224
  global $purchlogs;
225
  $dates = $purchlogs->getdates();
226
-
227
  foreach($dates as $date){
228
  $is_selected = '';
229
  $cleanDate = date('M Y', $date['start']);
230
  $value = $date["start"]."_".$date["end"];
231
  if($value == $_GET['view_purchlogs_by']) {
232
  $is_selected = 'selected="selected"';
 
 
233
  }
 
234
  $fDate .= "<option value='{$value}' {$is_selected}>".$cleanDate."</option>";
 
235
  }
236
- // exit($i);
237
  return $fDate;
238
  }
239
  function wpsc_change_purchlog_view($viewby, $status=''){
@@ -455,12 +459,12 @@ function wpsc_display_purchlog_totalprice(){
455
  }
456
  function wpsc_display_purchlog_buyers_name(){
457
  global $purchlogitem;
458
- return htmlentities(stripslashes($purchlogitem->userinfo['billingfirstname']['value'] ), ENT_QUOTES).' '.htmlentities(stripslashes($purchlogitem->userinfo['billinglastname']['value'] ), ENT_QUOTES);
459
  }
460
  function wpsc_display_purchlog_buyers_email(){
461
  global $purchlogitem;
462
  //exit('<pre>'.print_r($purchlogitem->userinfo,true).'</pre>');
463
- return htmlentities(stripslashes($purchlogitem->userinfo['billingemail']['value'] ), ENT_QUOTES);
464
  }
465
  function wpsc_display_purchlog_buyers_address(){
466
  global $purchlogitem;
@@ -471,29 +475,29 @@ function wpsc_display_purchlog_buyers_address(){
471
  $country[1] = $purchlogitem->shippingstate($country[1]).', ';
472
  }
473
  $address = $purchlogitem->userinfo['billingaddress']['value'].', '.$country[1].$country[0];
474
- return htmlentities(stripslashes( $address ), ENT_QUOTES);
475
 
476
  }
477
 
478
  function wpsc_display_purchlog_buyers_phone(){
479
  global $purchlogitem;
480
  //exit('<pre>'.print_r($purchlogitem->userinfo,true).'</pre>');
481
- return htmlentities(stripslashes($purchlogitem->userinfo['billingphone']['value']), ENT_QUOTES);
482
  }
483
  function wpsc_display_purchlog_shipping_name(){
484
  global $purchlogitem;
485
 
486
- return htmlentities(stripslashes($purchlogitem->shippinginfo['shippingfirstname']['value']), ENT_QUOTES).' '.htmlentities(stripslashes($purchlogitem->shippinginfo['shippinglastname']['value']), ENT_QUOTES);
487
  }
488
  function wpsc_display_purchlog_shipping_address(){
489
  global $purchlogitem;
490
  // exit('<pre>'.print_r($purchlogitem->shippinginfo,true).'</pre>');
491
- return htmlentities(stripslashes($purchlogitem->shippinginfo['shippingaddress']['value']), ENT_QUOTES);
492
  }
493
  function wpsc_display_purchlog_shipping_city(){
494
  global $purchlogitem;
495
  // exit('<pre>'.print_r($purchlogitem->shippinginfo,true).'</pre>');
496
- return htmlentities(stripslashes($purchlogitem->shippinginfo['shippingcity']['value']), ENT_QUOTES);
497
  }
498
  function wpsc_has_regions($country){
499
  global $wpdb;
@@ -542,7 +546,7 @@ function wpsc_display_purchlog_shipping_country(){
542
  $country = $country[0];
543
  }
544
  }
545
- return htmlentities(stripslashes($country), ENT_QUOTES);
546
  }
547
  function wpsc_display_purchlog_shipping_method(){
548
  global $purchlogitem;
76
  //return true;
77
  if($id == ''){
78
  foreach((array)$purchlogitem->allcartcontent as $cartitem){
79
+ if ( ( $cartitem->files != 'N;' && $cartitem->files != '' ) || $cartitem->custom_message != '' ) {
80
  return true;
81
  }
82
  }
84
  }else{
85
  $purchlogitem = new wpsc_purchaselogs_items($id);
86
  foreach((array)$purchlogitem->allcartcontent as $cartitem){
87
+ if ( ( $cartitem->files != 'N;' && $cartitem->files != '' ) || $cartitem->custom_message != '' ) {
88
  return true;
89
  }
90
  }
223
  function wpsc_purchlogs_getfirstdates(){
224
  global $purchlogs;
225
  $dates = $purchlogs->getdates();
226
+ $i = 0;
227
  foreach($dates as $date){
228
  $is_selected = '';
229
  $cleanDate = date('M Y', $date['start']);
230
  $value = $date["start"]."_".$date["end"];
231
  if($value == $_GET['view_purchlogs_by']) {
232
  $is_selected = 'selected="selected"';
233
+ }elseif(!isset($_GET['view_purchlogs_by']) && $i == 0){
234
+ $is_selected = 'selected="selected"';
235
  }
236
+
237
  $fDate .= "<option value='{$value}' {$is_selected}>".$cleanDate."</option>";
238
+ $i++;
239
  }
240
+ // exit($i.' '.count($dates));
241
  return $fDate;
242
  }
243
  function wpsc_change_purchlog_view($viewby, $status=''){
459
  }
460
  function wpsc_display_purchlog_buyers_name(){
461
  global $purchlogitem;
462
+ return htmlentities(stripslashes($purchlogitem->userinfo['billingfirstname']['value'] ), ENT_QUOTES,'UTF-8').' '.htmlentities(stripslashes($purchlogitem->userinfo['billinglastname']['value'] ), ENT_QUOTES,'UTF-8');
463
  }
464
  function wpsc_display_purchlog_buyers_email(){
465
  global $purchlogitem;
466
  //exit('<pre>'.print_r($purchlogitem->userinfo,true).'</pre>');
467
+ return htmlentities(stripslashes($purchlogitem->userinfo['billingemail']['value'] ), ENT_QUOTES,'UTF-8');
468
  }
469
  function wpsc_display_purchlog_buyers_address(){
470
  global $purchlogitem;
475
  $country[1] = $purchlogitem->shippingstate($country[1]).', ';
476
  }
477
  $address = $purchlogitem->userinfo['billingaddress']['value'].', '.$country[1].$country[0];
478
+ return htmlentities(stripslashes( $address ), ENT_QUOTES,'UTF-8');
479
 
480
  }
481
 
482
  function wpsc_display_purchlog_buyers_phone(){
483
  global $purchlogitem;
484
  //exit('<pre>'.print_r($purchlogitem->userinfo,true).'</pre>');
485
+ return htmlentities(stripslashes($purchlogitem->userinfo['billingphone']['value']), ENT_QUOTES,'UTF-8');
486
  }
487
  function wpsc_display_purchlog_shipping_name(){
488
  global $purchlogitem;
489
 
490
+ return htmlentities(stripslashes($purchlogitem->shippinginfo['shippingfirstname']['value']), ENT_QUOTES,'UTF-8').' '.htmlentities(stripslashes($purchlogitem->shippinginfo['shippinglastname']['value']), ENT_QUOTES,'UTF-8');
491
  }
492
  function wpsc_display_purchlog_shipping_address(){
493
  global $purchlogitem;
494
  // exit('<pre>'.print_r($purchlogitem->shippinginfo,true).'</pre>');
495
+ return htmlentities(stripslashes($purchlogitem->shippinginfo['shippingaddress']['value']), ENT_QUOTES,'UTF-8');
496
  }
497
  function wpsc_display_purchlog_shipping_city(){
498
  global $purchlogitem;
499
  // exit('<pre>'.print_r($purchlogitem->shippinginfo,true).'</pre>');
500
+ return htmlentities(stripslashes($purchlogitem->shippinginfo['shippingcity']['value']), ENT_QUOTES,'UTF-8');
501
  }
502
  function wpsc_has_regions($country){
503
  global $wpdb;
546
  $country = $country[0];
547
  }
548
  }
549
+ return htmlentities(stripslashes($country), ENT_QUOTES,'UTF-8');
550
  }
551
  function wpsc_display_purchlog_shipping_method(){
552
  global $purchlogitem;
wpsc-includes/theme.functions.php CHANGED
@@ -16,7 +16,7 @@ function wpsc_check_theme_versions(){
16
  foreach((array)$theme_array as $theme){
17
  // exit($theme['Version']);
18
  if($theme['Name']=='Default Theme' ||$theme['Name']=='iShop Theme' ||$theme['Name']=='Marketplace Theme' ){
19
- if((float)$theme['Version'] < 3.5){
20
  $nag = true;
21
  }
22
  }
@@ -33,6 +33,10 @@ function wpsc_get_themes($themes_folder = '') {
33
  if( !empty($themes_folder) ){}
34
  //$themes_root .= $themes_folder;
35
 
 
 
 
 
36
  // Files in wp-content/uploads/themes directory
37
  //exit($themes_root);
38
  $themes_dir = opendir($themes_root);
@@ -111,6 +115,7 @@ function wpsc_get_theme_file_path($file) {
111
  *select_wpsc_theme_functions function, provides a place to override the e-commece theme path
112
  * add to switch "theme's functions file
113
  * © with xiligroup dev
 
114
  */
115
  function wpsc_select_theme_functions() {
116
  global $wpsc_theme_path;
@@ -122,7 +127,7 @@ function wpsc_select_theme_functions() {
122
  }
123
  // end add by xiligroup.dev
124
  }
125
- add_action('wp','wpsc_select_theme_functions',10,1);
126
 
127
  /**
128
  * wpsc_user_enqueues products function,
@@ -612,6 +617,11 @@ function wpsc_products_page($content = '') {
612
  * wpsc_count_themes_in_uploads_directory, does exactly what the name says
613
  */
614
  function wpsc_count_themes_in_uploads_directory() {
 
 
 
 
 
615
  $uploads_dir = @opendir(WPSC_THEMES_PATH);
616
  $file_names = array();
617
  while(($file = @readdir($uploads_dir)) !== false) {
16
  foreach((array)$theme_array as $theme){
17
  // exit($theme['Version']);
18
  if($theme['Name']=='Default Theme' ||$theme['Name']=='iShop Theme' ||$theme['Name']=='Marketplace Theme' ){
19
+ if((float)$theme['Version'] < 3.6){
20
  $nag = true;
21
  }
22
  }
33
  if( !empty($themes_folder) ){}
34
  //$themes_root .= $themes_folder;
35
 
36
+ if ( !is_dir( $themes_root ) ) {
37
+ return $wpsc_themes;
38
+ }
39
+
40
  // Files in wp-content/uploads/themes directory
41
  //exit($themes_root);
42
  $themes_dir = opendir($themes_root);
115
  *select_wpsc_theme_functions function, provides a place to override the e-commece theme path
116
  * add to switch "theme's functions file
117
  * © with xiligroup dev
118
+ * @todo - 1bigidea - shouldn't this load theme/functions.php rather than theme/theme.php???? (handy feature though)
119
  */
120
  function wpsc_select_theme_functions() {
121
  global $wpsc_theme_path;
127
  }
128
  // end add by xiligroup.dev
129
  }
130
+ add_action('init','wpsc_select_theme_functions',1);
131
 
132
  /**
133
  * wpsc_user_enqueues products function,
617
  * wpsc_count_themes_in_uploads_directory, does exactly what the name says
618
  */
619
  function wpsc_count_themes_in_uploads_directory() {
620
+
621
+ if ( !is_dir( WPSC_THEMES_PATH ) ) {
622
+ return 0;
623
+ }
624
+
625
  $uploads_dir = @opendir(WPSC_THEMES_PATH);
626
  $file_names = array();
627
  while(($file = @readdir($uploads_dir)) !== false) {
wpsc-includes/wpsc_query.php CHANGED
@@ -53,9 +53,11 @@ function wpsc_display_categories() {
53
  * @return boolean - true for yes, false for no
54
  */
55
  function wpsc_display_products() {
 
56
  //we have to display something, if we are not displaying categories, then we must display products
57
  $output = true;
58
- if(wpsc_display_categories()) {
 
59
  if(get_option('wpsc_default_category') == 'list') {
60
  $output = false;
61
  }
@@ -291,16 +293,22 @@ function wpsc_the_product_additional_description() {
291
  * wpsc product permalink function
292
  * @return string - the URL to the single product page for this product
293
  */
294
- function wpsc_the_product_permalink() {
295
  global $wpsc_query;
296
- return wpsc_product_url($wpsc_query->product['id']);
 
 
 
 
 
297
  }
298
 
 
299
  /**
300
  * wpsc product price function
301
  * @return string - the product price
302
  */
303
- function wpsc_the_product_price() {
304
  global $wpsc_query;
305
  $price = calculate_product_price($wpsc_query->product['id'], $wpsc_query->first_variations);
306
  if(($wpsc_query->product['special_price'] > 0) && (($wpsc_query->product['price'] - $wpsc_query->product['special_price'] ) >= 0) && ($variations_output[1] === null)) {
@@ -308,10 +316,10 @@ function wpsc_the_product_price() {
308
  } else {
309
  $output = nzshpcrt_currency_display($price, $wpsc_query->product['notax'], true);
310
  }
311
- if(get_option('display_pnp') == 1) {
312
- //$output = nzshpcrt_currency_display($wpsc_query->product['pnp'], 1);
313
  }
314
- //echo $price;
315
  //echo "<pre>".print_r($wpsc_query->product,true)."</pre>";
316
  return $output;
317
  }
@@ -484,13 +492,13 @@ function wpsc_product_postage_and_packaging() {
484
  */
485
  function wpsc_product_normal_price() {
486
  global $wpsc_query;
487
- $price = calculate_product_price($wpsc_query->product['id'], $wpsc_query->first_variations, true);
488
-
489
  if(($wpsc_query->product['special_price'] > 0) && (($wpsc_query->product['price'] - $wpsc_query->product['special_price']) >= 0) && ($variations_output[1] === null)) {
490
  $output = nzshpcrt_currency_display($price, $wpsc_query->product['notax'],true,$wpsc_query->product['id']);
491
  } else {
492
  $output = nzshpcrt_currency_display($price, $wpsc_query->product['notax'], true);
493
  }
 
494
  return $output;
495
  }
496
 
@@ -515,14 +523,37 @@ function wpsc_the_product_image($width = null, $height = null) {
515
  }
516
  $wpsc_query->product['image_file'] = $wpsc_query->product['image'];
517
  }
 
 
 
 
 
518
  if($image_file_name != null) {
519
- if(($width > 0) && ($height > 0)) {
520
- return "index.php?image_id=".$wpsc_query->product['image']."&amp;width=".$width."&amp;height=".$height;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
  } else {
522
- $image_url = WPSC_IMAGE_URL.$image_file_name;
523
- if(is_ssl()) {
524
- $image_url = str_replace("http://", "https://", $image_url);
525
- }
526
  return $image_url;
527
  }
528
  } else {
@@ -720,6 +751,52 @@ function wpsc_the_variation_name() {
720
  return stripslashes($wpsc_query->variation['name']);
721
  }
722
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
723
  /**
724
  * wpsc the variation ID function
725
  * @return integer - the variation ID
@@ -965,7 +1042,7 @@ function wpsc_page_number() {
965
  *
966
  */
967
  function wpsc_has_multi_adding(){
968
- if(get_option('multi_add') == 1){
969
  return true;
970
  }else{
971
  return false;
@@ -1076,9 +1153,6 @@ class WPSC_Query {
1076
 
1077
  var $is_single = false;
1078
  var $is_search = false;
1079
-
1080
-
1081
-
1082
 
1083
  /**
1084
  * The WPSC query constructor, if no query is passed to it, it makes one from the WP_Query data
@@ -1224,6 +1298,7 @@ class WPSC_Query {
1224
  , 'sort_order'
1225
  , 'number_per_page' // works
1226
  , 'page'
 
1227
  //, 'sku'
1228
  );
1229
 
@@ -1283,6 +1358,8 @@ class WPSC_Query {
1283
  $qv['sort_order'] = trim($qv['sort_order']);
1284
  $qv['number_per_page'] = absint($qv['number_per_page']);
1285
  $qv['page'] = absint($qv['page']);
 
 
1286
 
1287
  }
1288
 
@@ -1298,11 +1375,13 @@ class WPSC_Query {
1298
  } else if($this->query_vars['category_id'] > 0) {
1299
  $category_data = $wpdb->get_row("SELECT `image_height`, `image_width` FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `active`='1' AND `id` = '{$this->query_vars['category_id']}' LIMIT 1", ARRAY_A);
1300
  }
1301
- $this->category_id_list = array($this->query_vars['category_id']);
1302
- if($this->query_vars['category_id'] > 0) {
1303
- $this->category_id_list = array_merge((array)$this->category_id_list, (array)wpsc_list_subcategories($this->query_vars['category_id']));
 
 
 
1304
  }
1305
-
1306
 
1307
  //exit('Here:<pre>'.print_r($category_id_list, true).'</pre>');
1308
  if(is_array($category_data)) {
@@ -1464,11 +1543,6 @@ class WPSC_Query {
1464
 
1465
  // Invert this for alphabetical ordering.
1466
  if (get_option('wpsc_sort_by')=='name') {
1467
- if( $order == 'ASC'){
1468
- $order = 'DESC';
1469
- }else{
1470
- $order = 'ASC';
1471
- }
1472
  $order_by = "`products`.`name` $order";
1473
  } else if (get_option('wpsc_sort_by') == 'price') {
1474
  $order_by = "`products`.`price` $order";
@@ -1499,6 +1573,7 @@ class WPSC_Query {
1499
  WHERE `products`.`publish` = '1'
1500
  AND `products`.`active` = '1'
1501
  AND `cat_assoc`.`category_id` IN ( '".implode("','", $this->category_id_list)."' ) $no_donations_sql
 
1502
  ORDER BY $order_by LIMIT $startnum, $products_per_page";
1503
 
1504
  } else {
@@ -2077,9 +2152,7 @@ class WPSC_Query {
2077
 
2078
  ///////////////////////////////////////////////////////////////////////////////////////
2079
  /* END OF btray77 code for pagination */
2080
- function wpsc_query_end_of_class(){
2081
- do_action('wpsc_query_end_of_class');
2082
- }
2083
  }
2084
 
2085
  ?>
53
  * @return boolean - true for yes, false for no
54
  */
55
  function wpsc_display_products() {
56
+ global $wpsc_query;
57
  //we have to display something, if we are not displaying categories, then we must display products
58
  $output = true;
59
+
60
+ if(wpsc_display_categories() && ($wpsc_query->query_vars['custom_query'] == false)) {
61
  if(get_option('wpsc_default_category') == 'list') {
62
  $output = false;
63
  }
293
  * wpsc product permalink function
294
  * @return string - the URL to the single product page for this product
295
  */
296
+ function wpsc_the_product_permalink( $category_id = null ) {
297
  global $wpsc_query;
298
+ if ( !isset( $category_id ) || !absint( $category_id ) ) {
299
+ $category_id = $wpsc_query->category;
300
+ } else {
301
+ $category_id = absint( $category_id );
302
+ }
303
+ return wpsc_product_url( $wpsc_query->product['id'], $category_id );
304
  }
305
 
306
+
307
  /**
308
  * wpsc product price function
309
  * @return string - the product price
310
  */
311
+ function wpsc_the_product_price($no_decimals = false) {
312
  global $wpsc_query;
313
  $price = calculate_product_price($wpsc_query->product['id'], $wpsc_query->first_variations);
314
  if(($wpsc_query->product['special_price'] > 0) && (($wpsc_query->product['price'] - $wpsc_query->product['special_price'] ) >= 0) && ($variations_output[1] === null)) {
316
  } else {
317
  $output = nzshpcrt_currency_display($price, $wpsc_query->product['notax'], true);
318
  }
319
+ if($no_decimals == true) {
320
+ $output = array_shift(explode(".", $output));
321
  }
322
+ // echo 'NO DECIMALS VALUE:'.$no_decimals;
323
  //echo "<pre>".print_r($wpsc_query->product,true)."</pre>";
324
  return $output;
325
  }
492
  */
493
  function wpsc_product_normal_price() {
494
  global $wpsc_query;
495
+ $price = calculate_product_price($wpsc_query->product['id'], $wpsc_query->first_variations, true);
 
496
  if(($wpsc_query->product['special_price'] > 0) && (($wpsc_query->product['price'] - $wpsc_query->product['special_price']) >= 0) && ($variations_output[1] === null)) {
497
  $output = nzshpcrt_currency_display($price, $wpsc_query->product['notax'],true,$wpsc_query->product['id']);
498
  } else {
499
  $output = nzshpcrt_currency_display($price, $wpsc_query->product['notax'], true);
500
  }
501
+ $output = apply_filters('wpsc_price_display_changer', $output);
502
  return $output;
503
  }
504
 
523
  }
524
  $wpsc_query->product['image_file'] = $wpsc_query->product['image'];
525
  }
526
+
527
+ $image_path = WPSC_IMAGE_DIR . $image_file_name;
528
+ $image_file_name_parts = explode(".",$image_file_name);
529
+ $extension = array_pop($image_file_name_parts);
530
+
531
  if($image_file_name != null) {
532
+ if(($width > 0) && ($height > 0) && ($width <= 1024) && ($height <= 1024)) {
533
+ $cache_filename = basename("product_img_{$image_id}_{$height}x{$width}");
534
+
535
+ if(file_exists(WPSC_CACHE_DIR.$cache_filename.$extension)) {
536
+ $original_modification_time = filemtime($image_path);
537
+ $cache_modification_time = filemtime(WPSC_CACHE_DIR.$cache_filename.$extension);
538
+ if($original_modification_time < $cache_modification_time) {
539
+ $use_cache = true;
540
+ }
541
+ }
542
+ if($use_cache == true) {
543
+ $cache_url = WPSC_CACHE_URL;
544
+ if(is_ssl()) {
545
+ $cache_url = str_replace("http://", "https://", $cache_url);
546
+ }
547
+ $image_url = $cache_url.$cache_filename.$extension;
548
+ } else {
549
+ $image_url = "index.php?image_id=".$wpsc_query->product['image']."&amp;width=".$width."&amp;height=".$height;
550
+ }
551
+ return $image_url;
552
  } else {
553
+ $image_url = WPSC_IMAGE_URL.$image_file_name;
554
+ if(is_ssl()) {
555
+ $image_url = str_replace("http://", "https://", $image_url);
556
+ }
557
  return $image_url;
558
  }
559
  } else {
751
  return stripslashes($wpsc_query->variation['name']);
752
  }
753
 
754
+ /**
755
+ * wpsc the variation stock function
756
+ * @return string - HTML attribute to disable select options and radio buttons
757
+ */
758
+ function wpsc_the_variation_stock() {
759
+ global $wpsc_query, $wpdb;
760
+ $out_of_stock = false;
761
+ if(($wpsc_query->variation_group_count == 1) && ($wpsc_query->product['quantity_limited'] == 1)) {
762
+ $product_id = $wpsc_query->product['id'];
763
+ $variation_group_id = $wpsc_query->variation_group['variation_id'];
764
+ $variation_id = $wpsc_query->variation['id'];
765
+
766
+
767
+ $priceandstock_id = $wpdb->get_var("SELECT `priceandstock_id` FROM `".WPSC_TABLE_VARIATION_COMBINATIONS."` WHERE `product_id` = '{$product_id}' AND `value_id` IN ( '$variation_id' ) AND `all_variation_ids` IN('$variation_group_id') LIMIT 1");
768
+
769
+ $variation_stock_data = $wpdb->get_var("SELECT `stock` FROM `".WPSC_TABLE_VARIATION_PROPERTIES."` WHERE `id` = '{$priceandstock_id}' LIMIT 1");
770
+
771
+ }
772
+ return $variation_stock_data;
773
+ }
774
+
775
+
776
+ /**
777
+ * wpsc the variation price function
778
+ * @return string - the variation price
779
+ */
780
+ function wpsc_the_variation_price() {
781
+ global $wpdb, $wpsc_query;
782
+
783
+ if(count($wpsc_query->variation_groups) == 1) {
784
+ //echo "<pre>".print_r($wpsc_query->variation, true)."</pre>";
785
+ $product_id = $wpsc_query->product['id'];
786
+ $variation_group_id = $wpsc_query->variation_group['variation_id'];
787
+ $variation_id = $wpsc_query->variation['id'];
788
+
789
+ $priceandstock_id = $wpdb->get_var("SELECT `priceandstock_id` FROM `".WPSC_TABLE_VARIATION_COMBINATIONS."` WHERE `product_id` = '{$product_id}' AND `value_id` IN ( '$variation_id' ) AND `all_variation_ids` IN('$variation_group_id') LIMIT 1");
790
+
791
+ $variation_price = $wpdb->get_var("SELECT `price` FROM `".WPSC_TABLE_VARIATION_PROPERTIES."` WHERE `id` = '{$priceandstock_id}' LIMIT 1");
792
+
793
+ $output = nzshpcrt_currency_display($variation_price, $wpsc_query->product['notax'], true);
794
+ } else {
795
+ $output = false;
796
+ }
797
+
798
+ return $output;
799
+ }
800
  /**
801
  * wpsc the variation ID function
802
  * @return integer - the variation ID
1042
  *
1043
  */
1044
  function wpsc_has_multi_adding(){
1045
+ if(get_option('multi_add') == 1 && (get_option('addtocart_or_buynow') != 1)){
1046
  return true;
1047
  }else{
1048
  return false;
1153
 
1154
  var $is_single = false;
1155
  var $is_search = false;
 
 
 
1156
 
1157
  /**
1158
  * The WPSC query constructor, if no query is passed to it, it makes one from the WP_Query data
1298
  , 'sort_order'
1299
  , 'number_per_page' // works
1300
  , 'page'
1301
+ , 'custom_query'
1302
  //, 'sku'
1303
  );
1304
 
1358
  $qv['sort_order'] = trim($qv['sort_order']);
1359
  $qv['number_per_page'] = absint($qv['number_per_page']);
1360
  $qv['page'] = absint($qv['page']);
1361
+ $qv['custom_query'] = (bool)$qv['custom_query'];
1362
+
1363
 
1364
  }
1365
 
1375
  } else if($this->query_vars['category_id'] > 0) {
1376
  $category_data = $wpdb->get_row("SELECT `image_height`, `image_width` FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `active`='1' AND `id` = '{$this->query_vars['category_id']}' LIMIT 1", ARRAY_A);
1377
  }
1378
+
1379
+ // Show subcategory products on parent category page?
1380
+ $show_subcatsprods_in_cat = get_option( 'show_subcatsprods_in_cat' );
1381
+ $this->category_id_list = array( $this->query_vars['category_id'] );
1382
+ if ( $show_subcatsprods_in_cat && $this->query_vars['category_id'] > 0 ) {
1383
+ $this->category_id_list = array_merge( (array)$this->category_id_list, (array)wpsc_list_subcategories( $this->query_vars['category_id'] ) );
1384
  }
 
1385
 
1386
  //exit('Here:<pre>'.print_r($category_id_list, true).'</pre>');
1387
  if(is_array($category_data)) {
1543
 
1544
  // Invert this for alphabetical ordering.
1545
  if (get_option('wpsc_sort_by')=='name') {
 
 
 
 
 
1546
  $order_by = "`products`.`name` $order";
1547
  } else if (get_option('wpsc_sort_by') == 'price') {
1548
  $order_by = "`products`.`price` $order";
1573
  WHERE `products`.`publish` = '1'
1574
  AND `products`.`active` = '1'
1575
  AND `cat_assoc`.`category_id` IN ( '".implode("','", $this->category_id_list)."' ) $no_donations_sql
1576
+ GROUP BY `products`.`id`
1577
  ORDER BY $order_by LIMIT $startnum, $products_per_page";
1578
 
1579
  } else {
2152
 
2153
  ///////////////////////////////////////////////////////////////////////////////////////
2154
  /* END OF btray77 code for pagination */
2155
+
 
 
2156
  }
2157
 
2158
  ?>