WordPress Simple PayPal Shopping Cart - Version 4.3.7

Version Description

  • Added Russian Ruble currency to the currency dropdown option.
  • Added CSS class to the quantity input field in the cart.
  • Copied the nextgen gallery template to the root folder.
  • The email merge tags can now be used in the sale notification email subject.
  • Added a new parameter (button_text) for the add to cart button shortcode. This parameter can be used to specify a custom button text for the add to cart button. Usage instructions at the following page: https://www.tipsandtricks-hq.com/ecommerce/simple-shopping-cart-customize-the-add-to-cart-button-text-via-shortcode-4383
Download this release

Release Info

Developer mra13
Plugin Icon 128x128 WordPress Simple PayPal Shopping Cart
Version 4.3.7
Comparing to
See all releases

Code changes from version 4.3.5 to 4.3.7

assets/js/tinymce/wp_shopping_cart_plugin.js ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () {
2
+
3
+ tinymce.create('tinymce.plugins.wpCartShortcode', {
4
+ /**
5
+ * Initializes the plugin, this will be executed after the plugin has been created.
6
+ * This call is done before the editor instance has finished it's initialization so use the onInit event
7
+ * of the editor instance to intercept that event.
8
+ *
9
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
10
+ * @param {string} url Absolute URL to where the plugin is located.
11
+ */
12
+ init: function (ed, url) {
13
+ ed.addButton('wp_cart_shortcode', {
14
+ icon: 'wp-cart-tinymce',
15
+ tooltip: 'WP Cart Shortcode',
16
+ cmd: 'wp_cart_shortcode'
17
+ });
18
+
19
+ ed.addCommand('wp_cart_shortcode', function () {
20
+ // bind event on modal close
21
+ jQuery(window).one('tb_unload', function () {
22
+ jQuery('div#wpCartAjaxContainer').html(wpCartLoadingTpl.html());
23
+ });
24
+ var width = jQuery(window).width(),
25
+ H = jQuery(window).height(),
26
+ W = (720 < width) ? 720 : width;
27
+ // W = W - 80;
28
+ tb_show('WP Cart Insert Shortcode', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=wpCartHighlightForm');
29
+ jQuery.post(
30
+ wp_cart_admin_ajax_url,
31
+ {
32
+ action: 'wp_cart_get_tinymce_form',
33
+ dataType: 'html',
34
+ },
35
+ function (response) {
36
+ if (response) { // ** If response was successful
37
+
38
+ jQuery('div#wpCartAjaxContainer').html(response).hide().fadeIn('fast');
39
+
40
+ } else { // ** Else response was unsuccessful
41
+ alert('WP Cart AJAX Error! Please deactivate the plugin to permanently dismiss this alert.');
42
+ }
43
+ }
44
+ );
45
+ });
46
+ },
47
+
48
+ /**
49
+ * Creates control instances based in the incomming name. This method is normally not
50
+ * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
51
+ * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
52
+ * method can be used to create those.
53
+ *
54
+ * @param {String} n Name of the control to create.
55
+ * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
56
+ * @return {tinymce.ui.Control} New control instance or null if no control was created.
57
+ */
58
+ createControl: function (n, cm) {
59
+ return null;
60
+ },
61
+
62
+ /**
63
+ * Returns information about the plugin as a name/value array.
64
+ * The current keys are longname, author, authorurl, infourl and version.
65
+ *
66
+ * @return {Object} Name/value array containing information about the plugin.
67
+ */
68
+ getInfo: function () {
69
+ return {
70
+ longname: 'WP Simple Paypal Shopping cart',
71
+ author: 'Tips and Tricks HQ',
72
+ authorurl: 'http://www.tipsandtricks-hq.com/development-center',
73
+ infourl: 'http://www.tipsandtricks-hq.com/development-center',
74
+ version: "1.0"
75
+ };
76
+ }
77
+ });
78
+
79
+ // Register plugin
80
+ tinymce.PluginManager.add('wp_cart_shortcode', tinymce.plugins.wpCartShortcode);
81
+ })();
82
+
83
+ var wpCartLoadingTpl = jQuery('<p><i style="float: none; vertical-align: bottom;" class="spinner is-active"></i> Loading content, please wait...</p>');
84
+
85
+ jQuery(function () {
86
+ var container = jQuery('<div id="wpCartHighlightForm"><div id="wpCartAjaxContainer"></div></div>');
87
+ container.find('#wpCartAjaxContainer').html(wpCartLoadingTpl.html());
88
+ container.appendTo('body').hide();
89
+ });
assets/wspsc-admin-styles.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /* Cart button TinyMCE icon */
3
+ i.mce-i-wp-cart-tinymce::before {
4
+ content: "\f174";
5
+ font: 400 20px/1 dashicons;
6
+ vertical-align: top;
7
+ }
8
+
9
+ .wspsc_yellow_box {
10
+ background: #FFF6D5;
11
+ border: 1px solid #D1B655;
12
+ color: #3F2502;
13
+ margin: 10px 0;
14
+ padding: 5px 5px 5px 10px;
15
+ text-shadow: 1px 1px #FFFFFF;
16
+ }
gallery-wp-cart.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ Template Page for the gallery overview
4
+
5
+ Follow variables are useable :
6
+
7
+ $gallery : Contain all about the gallery
8
+ $images : Contain all images, path, title
9
+ $pagination : Contain the pagination content
10
+
11
+ You can check the content when you insert the tag <?php var_dump($variable) ?>
12
+ If you would like to show the timestamp of the image ,you can use <?php echo $exif['created_timestamp'] ?>
13
+ **/
14
+ ?>
15
+ <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
16
+
17
+ <div class="ngg-galleryoverview" id="ngg-gallery-<?php echo $gallery->ID ?>">
18
+
19
+ <?php if ($gallery->show_slideshow) { ?>
20
+ <!-- Slideshow link -->
21
+ <div class="slideshowlink">
22
+ <a class="slideshowlink" href="<?php echo $gallery->slideshow_link ?>">
23
+ <?php echo $gallery->slideshow_link_text ?>
24
+ </a>
25
+ </div>
26
+ <?php } ?>
27
+
28
+ <?php if ($gallery->show_piclens) { ?>
29
+ <!-- Piclense link -->
30
+ <div class="piclenselink">
31
+ <a class="piclenselink" href="<?php echo $gallery->piclens_link ?>">
32
+ <?php _e('[View with PicLens]','nggallery'); ?>
33
+ </a>
34
+ </div>
35
+ <?php } ?>
36
+
37
+ <!-- Thumbnails -->
38
+ <?php foreach ($images as $image) : ?>
39
+
40
+ <div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $gallery->imagewidth ?> >
41
+ <div class="ngg-gallery-thumbnail" >
42
+ <a href="<?php echo $image->imageURL ?>" title="" <?php echo $image->thumbcode ?> >
43
+ <img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
44
+ </a>
45
+ <span><?php echo do_shortcode($image->caption); ?></span>
46
+ </div>
47
+ </div>
48
+ <?php if ( $gallery->columns > 0 && ++$i % $gallery->columns == 0 ) { ?>
49
+ <br style="clear: both" />
50
+ <?php } ?>
51
+ <?php endforeach; ?>
52
+
53
+ <!-- Pagination -->
54
+ <?php echo $pagination ?>
55
+
56
+ </div>
57
+
58
+ <?php endif; ?>
includes/admin/wp_shopping_cart_menu_discounts.php CHANGED
@@ -52,7 +52,7 @@ function show_wp_cart_coupon_discount_settings_page()
52
  }
53
  ?>
54
 
55
- <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
56
  <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wordpress-simple-paypal-shopping-cart"); ?><br />
57
  <a href="https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "wordpress-simple-paypal-shopping-cart"); ?></a></p>
58
  </div>
52
  }
53
  ?>
54
 
55
+ <div class="wspsc_yellow_box">
56
  <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wordpress-simple-paypal-shopping-cart"); ?><br />
57
  <a href="https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "wordpress-simple-paypal-shopping-cart"); ?></a></p>
58
  </div>
includes/admin/wp_shopping_cart_menu_email_settings.php CHANGED
@@ -55,7 +55,7 @@ function show_wp_cart_email_settings_page()
55
  }
56
  ?>
57
 
58
- <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
59
  <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wordpress-simple-paypal-shopping-cart"); ?><br />
60
  <a href="https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "wordpress-simple-paypal-shopping-cart"); ?></a></p>
61
  </div>
55
  }
56
  ?>
57
 
58
+ <div class="wspsc_yellow_box">
59
  <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wordpress-simple-paypal-shopping-cart"); ?><br />
60
  <a href="https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "wordpress-simple-paypal-shopping-cart"); ?></a></p>
61
  </div>
includes/admin/wp_shopping_cart_menu_general_settings.php CHANGED
@@ -148,7 +148,7 @@ function show_wp_cart_options_page ()
148
  ?>
149
  <h2><?php _e("Simple PayPal Shopping Cart Settings", "wordpress-simple-paypal-shopping-cart"); ?> v<?php echo WP_CART_VERSION; ?></h2>
150
 
151
- <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
152
  <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wordpress-simple-paypal-shopping-cart"); ?><br />
153
  <a href="https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "wordpress-simple-paypal-shopping-cart"); ?></a></p>
154
  </div>
@@ -222,6 +222,7 @@ echo '
222
  <option value="THB" <?php echo ($defaultCurrency == 'THB') ? 'selected="selected"' : ''; ?>>Thai Baht (THB)</option>
223
  <option value="TRY" <?php echo ($defaultCurrency == 'TRY') ? 'selected="selected"' : ''; ?>>Turkish Lira (TRY)</option>
224
  <option value="VND" <?php echo ($defaultCurrency == 'VND') ? 'selected="selected"' : ''; ?>>Vietnamese Dong (VND)</option>
 
225
  </select>
226
  </td>
227
  </tr>
148
  ?>
149
  <h2><?php _e("Simple PayPal Shopping Cart Settings", "wordpress-simple-paypal-shopping-cart"); ?> v<?php echo WP_CART_VERSION; ?></h2>
150
 
151
+ <div class="wspsc_yellow_box">
152
  <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wordpress-simple-paypal-shopping-cart"); ?><br />
153
  <a href="https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "wordpress-simple-paypal-shopping-cart"); ?></a></p>
154
  </div>
222
  <option value="THB" <?php echo ($defaultCurrency == 'THB') ? 'selected="selected"' : ''; ?>>Thai Baht (THB)</option>
223
  <option value="TRY" <?php echo ($defaultCurrency == 'TRY') ? 'selected="selected"' : ''; ?>>Turkish Lira (TRY)</option>
224
  <option value="VND" <?php echo ($defaultCurrency == 'VND') ? 'selected="selected"' : ''; ?>>Vietnamese Dong (VND)</option>
225
+ <option value="RUB" <?php echo ($defaultCurrency == 'RUB') ? 'selected="selected"' : ''; ?>>Russian Ruble (RUB)</option>
226
  </select>
227
  </td>
228
  </tr>
includes/admin/wp_shopping_cart_menu_tools.php CHANGED
@@ -19,7 +19,7 @@ function show_wp_cart_tools_menu_page() {
19
  }
20
  ?>
21
 
22
- <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
23
  <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wordpress-simple-paypal-shopping-cart"); ?><br />
24
  <a href="https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "wordpress-simple-paypal-shopping-cart"); ?></a></p>
25
  </div>
19
  }
20
  ?>
21
 
22
+ <div class="wspsc_yellow_box">
23
  <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wordpress-simple-paypal-shopping-cart"); ?><br />
24
  <a href="https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "wordpress-simple-paypal-shopping-cart"); ?></a></p>
25
  </div>
includes/admin/wp_shopping_cart_tinymce.php ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function wp_cart_add_tinymce_button() {
4
+
5
+ // Don't bother doing this stuff if the current user lacks permissions
6
+ if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) {
7
+ return;
8
+ }
9
+
10
+ // Add only in Rich Editor mode
11
+ if (get_user_option('rich_editing') == 'true') {
12
+
13
+ add_action('admin_print_scripts', 'wp_cart_print_admin_scripts');
14
+ add_action('wp_ajax_wp_cart_get_tinymce_form', 'wp_cart_tinymce_ajax_handler'); // Add ajax action handler for tinymce
15
+ add_filter('mce_external_plugins', "wp_cart_add_tinymce_plugin", 5);
16
+ add_filter('mce_buttons', 'wp_cart_register_button', 5);
17
+
18
+ // Required by TinyMCE button
19
+ // add_action('wp_ajax_orbsius_ui_for_paypal_shopping_cart_ajax_render_popup_content', 'orbsius_ui_for_paypal_shopping_cart_ajax_render_popup_content');
20
+ // add_action('wp_ajax_orbsius_ui_for_paypal_shopping_cart_ajax_render_popup_content', 'orbsius_ui_for_paypal_shopping_cart_ajax_render_popup_content');
21
+ }
22
+ }
23
+
24
+ function wp_cart_add_tinymce_plugin($plugin_array) {
25
+ $plugin_array['wp_cart_shortcode'] = WP_CART_URL . '/assets/js/tinymce/wp_shopping_cart_plugin.js';
26
+ return $plugin_array;
27
+ }
28
+
29
+ function wp_cart_register_button($buttons) {
30
+ $buttons[] = 'wp_cart_shortcode';
31
+ return $buttons;
32
+ }
33
+
34
+ function wp_cart_print_admin_scripts() {
35
+ //The following is used by the TinyMCE button.
36
+ ?>
37
+ <script type="text/javascript">
38
+ var wp_cart_admin_ajax_url = '<?php echo admin_url('admin-ajax.php?action=ajax'); ?>';
39
+ </script>
40
+ <?php
41
+ }
42
+
43
+ function wp_cart_tinymce_ajax_handler() {
44
+ ?>
45
+ <style>
46
+ #TB_window, #TB_ajaxContent {height: auto !important}
47
+ .mceActionPanel {padding: 20px; margin-top: 10px; border-top: 1px solid silver;}
48
+ </style>
49
+ <script>
50
+ function ui_for_ppsc_insert_content() {
51
+ var extra = '';
52
+ var content;
53
+ var template = '<p>[wp_cart_button name="%%PRODUCT-NAME%%" price="%%PRODUCT-PRICE%%"%%EXTRA%%]</p>';
54
+
55
+ var wpsppsc = document.getElementById('wpsppsc_panel');
56
+
57
+ var product_name = document.getElementById('wpsppsc_product_name').value;
58
+ var product_price = document.getElementById('wpsppsc_product_price').value;
59
+ var shipping = document.getElementById('wpsppsc_shipping').value;
60
+ var file_url = document.getElementById('wpsppsc_file_url').value;
61
+
62
+ var custom1_id = document.getElementById('wpsppsc_custom1_id').value;
63
+ var custom1_vals = document.getElementById('wpsppsc_custom1_values').value;
64
+
65
+ var custom2_id = document.getElementById('wpsppsc_custom2_id').value;
66
+ var custom2_vals = document.getElementById('wpsppsc_custom2_values').value;
67
+
68
+ var custom3_id = document.getElementById('wpsppsc_custom3_id').value;
69
+ var custom3_vals = document.getElementById('wpsppsc_custom3_values').value;
70
+
71
+ var seq = 1; // Shopping cart needs VAR1, VAR2 etc.
72
+
73
+ // who is active ?
74
+ if (wpsppsc.className.indexOf('current') != -1) {
75
+ product_name = product_name.replace(/</g, '').replace(/\n/g, '').replace(/^\s*/g, '').replace(/\s*$/g, '').replace(/:+/g, '-');
76
+ product_price = product_price.replace(/[^\d-.]/g, '');
77
+ shipping = shipping.replace(/[^\d-.]/gi, '');
78
+ //file_url = file_url.replace(/[<>\r\n:]+/g, '').replace(/^\s*/g, '').replace(/\s*$/g, '');
79
+
80
+ custom1_id = custom1_id.replace(/[<>\r\n:]+/g, '').replace(/^\s*/g, '').replace(/\s*$/g, '');
81
+ custom1_vals = custom1_vals.replace(/[<>\r\n:]+/gi, '').replace(/^[\s,]*/g, '').replace(/[\s,]*$/g, '').replace(/\s*,+\s*/g, '|');
82
+
83
+ custom2_id = custom2_id.replace(/[<>\r\n:]+/g, '').replace(/^\s*/g, '').replace(/\s*$/g, '');
84
+ custom2_vals = custom2_vals.replace(/[<>\r\n:]+/gi, '').replace(/^[\s,]*/g, '').replace(/[\s,]*$/g, '').replace(/\s*,+\s*/g, '|');
85
+
86
+ custom3_id = custom3_id.replace(/[<>\r\n:]+/g, '').replace(/^\s*/g, '').replace(/\s*$/g, '');
87
+ custom3_vals = custom3_vals.replace(/[<>\r\n:]+/gi, '').replace(/^[\s,]*/g, '').replace(/[\s,]*$/g, '').replace(/\s*,+\s*/g, '|');
88
+
89
+ // Validations
90
+ if (product_name == '') {
91
+ alert('Please enter product name');
92
+ document.getElementById('wpsppsc_product_name').focus();
93
+ return false;
94
+ }
95
+
96
+ product_price = product_price || 0;
97
+
98
+ if (product_price == 0) {
99
+ alert('Please enter product price');
100
+ document.getElementById('wpsppsc_product_price').focus();
101
+ return false;
102
+ }
103
+
104
+ shipping = shipping || 0;
105
+
106
+ if (shipping) {
107
+ extra += ' shipping="' + shipping + '"';
108
+ }
109
+
110
+ //File URL
111
+ if (file_url){
112
+ extra += ' file_url="' + file_url + '"';
113
+ }
114
+
115
+ //Product Variations. Example custom1_id: Format | custom1_vals: PAL, Secam
116
+ if (custom1_id) {
117
+ extra += ' var' + seq + '="' + custom1_id + '|' + custom1_vals + '"';
118
+ seq++;
119
+ }
120
+
121
+ if (custom2_id) {
122
+ extra += ' var' + seq + '="' + custom2_id + '|' + custom2_vals + '"';
123
+ seq++;
124
+ }
125
+
126
+ if (custom3_id) {
127
+ extra += ' var' + seq + '="' + custom3_id + '|' + custom3_vals + '"';
128
+ seq++;
129
+ }
130
+
131
+ content = template;
132
+ content = content.replace(/%%PRODUCT-NAME%%/ig, product_name).replace(/%%PRODUCT-PRICE%%/ig, product_price);
133
+ content = content.replace(/%%EXTRA%%/ig, extra);
134
+ }
135
+
136
+ parent.tinyMCE.execCommand('mceInsertContent', false, content);
137
+
138
+ tb_remove();
139
+
140
+ return false;
141
+ }
142
+ </script>
143
+ <form name="wpsppsc_form" action="#">
144
+ <div class="panel_wrapper">
145
+ <!-- panel -->
146
+ <div id="wpsppsc_panel" class="panel current">
147
+
148
+ <p>Visit the <a href="https://www.tipsandtricks-hq.com/ecommerce/wp-shopping-cart" target="_blank">Simple Cart Documentation</a> page to learn all the shortcode usage.</p>
149
+ <br />
150
+
151
+ <table border="0" cellpadding="4" cellspacing="0">
152
+ <tr>
153
+ <td nowrap="nowrap">
154
+ <label for="wpsppsc_product_name"><?php _e("Product Name", 'wordpress-simple-paypal-shopping-cart'); ?></label>
155
+ </td>
156
+ <td>
157
+ <input type="text" id="wpsppsc_product_name" name="wpsppsc_product_name" value="" />
158
+ </td>
159
+ <td>
160
+ Example: My Great Product
161
+ </td>
162
+ </tr>
163
+ <tr>
164
+ <td nowrap="nowrap">
165
+ <label for="wpsppsc_product_price"><?php _e("Price", 'wordpress-simple-paypal-shopping-cart'); ?></label>
166
+ </td>
167
+ <td>
168
+ <input type="text" id="wpsppsc_product_price" name="wpsppsc_product_price" value="" />
169
+ </td>
170
+ <td>
171
+ Example: 10 or 10.50
172
+ </td>
173
+ </tr>
174
+ <tr>
175
+ <td nowrap="nowrap">
176
+ <label for="wpsppsc_shipping"><?php _e("Shipping (Optional)", 'wordpress-simple-paypal-shopping-cart'); ?></label>
177
+ </td>
178
+ <td>
179
+ <input type="text" id="wpsppsc_shipping" name="wpsppsc_shipping" value="" />
180
+ </td>
181
+ <td>
182
+ Example: 10 or 10.50
183
+ </td>
184
+ </tr>
185
+ <tr>
186
+ <td nowrap="nowrap">
187
+ <label for="wpsppsc_file_url"><?php _e("File URL (Optional)", 'wordpress-simple-paypal-shopping-cart'); ?></label>
188
+ </td>
189
+ <td>
190
+ <input type="text" id="wpsppsc_file_url" name="wpsppsc_shipping" value="" />
191
+ </td>
192
+ <td>
193
+ Example: http://www.your-site.com/wp-content/uploads/my-ebook.zip
194
+ </td>
195
+ </tr>
196
+ <tr>
197
+ <td nowrap="nowrap" colspan="3">
198
+ <br/>
199
+ <strong>Product Variations (Optional)</strong>
200
+ <p>Example: For a T-Shirt product you may want to use a variation with name "Size" and values as "Small, Medium, Large"</p>
201
+ </td>
202
+ </tr>
203
+ <tr>
204
+ <td nowrap="nowrap">
205
+ <label for="wpsppsc_custom1_id"><?php _e("Variation 1: Name", 'wordpress-simple-paypal-shopping-cart'); ?></label>
206
+ </td>
207
+ <td><input type="text" id="wpsppsc_custom1_id" name="wpsppsc_custom1_id" value="" />
208
+ </td>
209
+ <td>
210
+ <?php _e("Values", 'wordpress-simple-paypal-shopping-cart'); ?>
211
+ <input type="text" id="wpsppsc_custom1_values" name="wpsppsc_custom1_values" value="" /> Example: Small, Medium, Large
212
+ </td>
213
+ </tr>
214
+ <tr>
215
+ <td nowrap="nowrap">
216
+ <label for="wpsppsc_custom2_id"><?php _e("Variation 2: Name", 'wordpress-simple-paypal-shopping-cart'); ?></label>
217
+ </td>
218
+ <td><input type="text" id="wpsppsc_custom2_id" name="wpsppsc_custom2_id" value="" />
219
+ </td>
220
+ <td>
221
+ <?php _e("Values", 'wordpress-simple-paypal-shopping-cart'); ?>
222
+ <input type="text" id="wpsppsc_custom2_values" name="wpsppsc_custom2_values" value="" /> Example: Blue, Red, Black, White
223
+ </td>
224
+ </tr>
225
+ <tr>
226
+ <td nowrap="nowrap">
227
+ <label for="wpsppsc_custom3_id"><?php _e("Variation 3: Name", 'wordpress-simple-paypal-shopping-cart'); ?></label>
228
+ </td>
229
+ <td><input type="text" id="wpsppsc_custom3_id" name="wpsppsc_custom3_id" value="" />
230
+ </td>
231
+ <td>
232
+ <?php _e("Values", 'wordpress-simple-paypal-shopping-cart'); ?>
233
+ <input type="text" id="wpsppsc_custom3_values" name="wpsppsc_custom3_values" value="" /> Example: Short, Full
234
+ </td>
235
+ </tr>
236
+ </table>
237
+ </div>
238
+ <!-- end panel -->
239
+
240
+ <div class="mceActionPanel">
241
+
242
+ <div style="float: left">
243
+ <input type="submit" id="insert" name="insert" value="<?php _e("Insert", 'wordpress-simple-paypal-shopping-cart'); ?>"
244
+ class='app_positive_button mceButton button-primary'
245
+ onclick="ui_for_ppsc_insert_content();
246
+ return false;" />
247
+ </div>
248
+
249
+ <div style="float: right">
250
+ <input type="button" id="cancel" name="cancel" value="<?php _e("Cancel", 'wordpress-simple-paypal-shopping-cart'); ?>"
251
+ class='app_negative_button button'
252
+ onclick="tb_remove();" />
253
+ </div>
254
+
255
+ <br />
256
+ </div>
257
+ </div>
258
+ </form>
259
+ <?php
260
+ die();
261
+ }
includes/wspsc-cart-functions.php CHANGED
@@ -103,7 +103,7 @@ function print_wp_shopping_cart($args = array()) {
103
 
104
  foreach ($_SESSION['simpleCart'] as $item) {
105
 
106
- $output .= '<tr class="wspsc_cart_item_thumb"><td style="overflow: hidden;">';
107
  $output .= '<div class="wp_cart_item_info">';
108
  if(isset($args['show_thumbnail'])){
109
  $output .= '<span class="wp_cart_item_thumbnail"><img src="'.esc_url($item['thumbnail']).'" class="wp_cart_thumb_image" alt="'.esc_attr($item['name']).'" ></span>';
@@ -114,9 +114,9 @@ function print_wp_shopping_cart($args = array()) {
114
  $output .= '</div>';
115
  $output .= '</td>';
116
 
117
- $output .= "<td style='text-align: center'><form method=\"post\" action=\"\" name='pcquantity' style='display: inline'>".wp_nonce_field('wspsc_cquantity', '_wpnonce', true, false)."
118
  <input type=\"hidden\" name=\"wspsc_product\" value=\"" . htmlspecialchars($item['name']) . "\" />
119
- <input type='hidden' name='cquantity' value='1' /><input type='text' name='quantity' value='" . esc_attr($item['quantity']) . "' size='1' onchange='document.pcquantity.submit();' onkeypress='document.getElementById(\"pinfo\").style.display = \"\";' /></form></td>
120
  <td style='text-align: center'>" . print_payment_currency(($item['price'] * $item['quantity']), $paypal_symbol, $decimal) . "</td>
121
  <td><form method=\"post\" action=\"\" class=\"wp_cart_remove_item_form\">".wp_nonce_field('wspsc_delcart', '_wpnonce', true, false)."
122
  <input type=\"hidden\" name=\"wspsc_product\" value=\"" . esc_attr($item['name']) . "\" />
103
 
104
  foreach ($_SESSION['simpleCart'] as $item) {
105
 
106
+ $output .= '<tr class="wspsc_cart_item_thumb"><td class="wspsc_cart_item_name_td" style="overflow: hidden;">';
107
  $output .= '<div class="wp_cart_item_info">';
108
  if(isset($args['show_thumbnail'])){
109
  $output .= '<span class="wp_cart_item_thumbnail"><img src="'.esc_url($item['thumbnail']).'" class="wp_cart_thumb_image" alt="'.esc_attr($item['name']).'" ></span>';
114
  $output .= '</div>';
115
  $output .= '</td>';
116
 
117
+ $output .= "<td class='wspsc_cart_qty_td' style='text-align: center'><form method=\"post\" action=\"\" name='pcquantity' style='display: inline'>".wp_nonce_field('wspsc_cquantity', '_wpnonce', true, false)."
118
  <input type=\"hidden\" name=\"wspsc_product\" value=\"" . htmlspecialchars($item['name']) . "\" />
119
+ <input type='hidden' name='cquantity' value='1' /><input type='text' class='wspsc_cart_item_qty' name='quantity' value='" . esc_attr($item['quantity']) . "' size='1' onchange='document.pcquantity.submit();' onkeypress='document.getElementById(\"pinfo\").style.display = \"\";' /></form></td>
120
  <td style='text-align: center'>" . print_payment_currency(($item['price'] * $item['quantity']), $paypal_symbol, $decimal) . "</td>
121
  <td><form method=\"post\" action=\"\" class=\"wp_cart_remove_item_form\">".wp_nonce_field('wspsc_delcart', '_wpnonce', true, false)."
122
  <input type=\"hidden\" name=\"wspsc_product\" value=\"" . esc_attr($item['name']) . "\" />
paypal.php CHANGED
@@ -263,9 +263,11 @@ class paypal_ipn_handler {
263
 
264
  $from_email = get_option('wpspc_buyer_from_email');
265
  $subject = get_option('wpspc_buyer_email_subj');
 
 
266
  $body = get_option('wpspc_buyer_email_body');
267
  $args['email_body'] = $body;
268
- $body = wpspc_apply_dynamic_tags_on_email_body($this->ipn_data, $args);
269
 
270
  $this->debug_log('Applying filter - wspsc_buyer_notification_email_body', true);
271
  $body = apply_filters('wspsc_buyer_notification_email_body', $body, $this->ipn_data, $cart_items);
@@ -281,9 +283,11 @@ class paypal_ipn_handler {
281
  }
282
  $notify_email = get_option('wpspc_notify_email_address');
283
  $seller_email_subject = get_option('wpspc_seller_email_subj');
 
 
284
  $seller_email_body = get_option('wpspc_seller_email_body');
285
  $args['email_body'] = $seller_email_body;
286
- $seller_email_body = wpspc_apply_dynamic_tags_on_email_body($this->ipn_data, $args);
287
 
288
  $this->debug_log('Applying filter - wspsc_seller_notification_email_body', true);
289
  $seller_email_body = apply_filters('wspsc_seller_notification_email_body', $seller_email_body, $this->ipn_data, $cart_items);
263
 
264
  $from_email = get_option('wpspc_buyer_from_email');
265
  $subject = get_option('wpspc_buyer_email_subj');
266
+ $subject = wpspc_apply_dynamic_tags_on_email($subject, $this->ipn_data, $args);
267
+
268
  $body = get_option('wpspc_buyer_email_body');
269
  $args['email_body'] = $body;
270
+ $body = wpspc_apply_dynamic_tags_on_email($body, $this->ipn_data, $args);
271
 
272
  $this->debug_log('Applying filter - wspsc_buyer_notification_email_body', true);
273
  $body = apply_filters('wspsc_buyer_notification_email_body', $body, $this->ipn_data, $cart_items);
283
  }
284
  $notify_email = get_option('wpspc_notify_email_address');
285
  $seller_email_subject = get_option('wpspc_seller_email_subj');
286
+ $seller_email_subject = wpspc_apply_dynamic_tags_on_email($seller_email_subject, $this->ipn_data, $args);
287
+
288
  $seller_email_body = get_option('wpspc_seller_email_body');
289
  $args['email_body'] = $seller_email_body;
290
+ $seller_email_body = wpspc_apply_dynamic_tags_on_email($seller_email_body, $this->ipn_data, $args);
291
 
292
  $this->debug_log('Applying filter - wspsc_seller_notification_email_body', true);
293
  $seller_email_body = apply_filters('wspsc_seller_notification_email_body', $seller_email_body, $this->ipn_data, $cart_items);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.tipsandtricks-hq.com
4
  Tags: cart, shopping cart, WordPress shopping cart, Paypal shopping cart, sell, selling, sell products, online shop, shop, e-commerce, wordpress ecommerce, wordpress store, store, PayPal cart widget, sell digital products, sell service, digital downloads, paypal, paypal cart, e-shop, compact cart, coupon, discount
5
  Requires at least: 3.0
6
  Tested up to: 4.8
7
- Stable tag: 4.3.5
8
  License: GPLv2 or later
9
 
10
  Very easy to use Simple WordPress Paypal Shopping Cart Plugin. Great for selling products online in one click from your WordPress site.
@@ -53,11 +53,13 @@ or
53
  * Compatible with WordPress Multi-site Installation.
54
  * Ability to specify SKU (item number) for each of your products in the shortcode.
55
  * Ability to customize the add to cart button image and use a custom image for your purchase buttons.
 
56
  * Track coupons with the order to see which customer used which coupon code.
57
  * Ability to add a compact shopping cart to your site using a shortcode.
58
  * Ability to show shopping cart with product image thumbnails.
59
  * Ability to use a custom checkout page style.
60
  * Ability to open checkout page in a new browser tab/window.
 
61
  * Works nicely with responsive WordPress themes.
62
  * Can be translated into any language.
63
  * and more...
@@ -187,6 +189,20 @@ None
187
 
188
  == Changelog ==
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  = 4.3.5 =
191
  - The deprecated page styles field has been replaced with an image URL field in the settings.
192
  - The Image URL field can be used to specify an image/logo URL that will be displayed in the paypal checkout page.
4
  Tags: cart, shopping cart, WordPress shopping cart, Paypal shopping cart, sell, selling, sell products, online shop, shop, e-commerce, wordpress ecommerce, wordpress store, store, PayPal cart widget, sell digital products, sell service, digital downloads, paypal, paypal cart, e-shop, compact cart, coupon, discount
5
  Requires at least: 3.0
6
  Tested up to: 4.8
7
+ Stable tag: 4.3.7
8
  License: GPLv2 or later
9
 
10
  Very easy to use Simple WordPress Paypal Shopping Cart Plugin. Great for selling products online in one click from your WordPress site.
53
  * Compatible with WordPress Multi-site Installation.
54
  * Ability to specify SKU (item number) for each of your products in the shortcode.
55
  * Ability to customize the add to cart button image and use a custom image for your purchase buttons.
56
+ * Ability to customize the add to cart button text via shortcode parameter on a per product basis.
57
  * Track coupons with the order to see which customer used which coupon code.
58
  * Ability to add a compact shopping cart to your site using a shortcode.
59
  * Ability to show shopping cart with product image thumbnails.
60
  * Ability to use a custom checkout page style.
61
  * Ability to open checkout page in a new browser tab/window.
62
+ * Ability to use TinyMCE shortcode inserter to add shortcodes to your posts/pages.
63
  * Works nicely with responsive WordPress themes.
64
  * Can be translated into any language.
65
  * and more...
189
 
190
  == Changelog ==
191
 
192
+ = 4.3.7 =
193
+ - Added Russian Ruble currency to the currency dropdown option.
194
+ - Added CSS class to the quantity input field in the cart.
195
+ - Copied the nextgen gallery template to the root folder.
196
+ - The email merge tags can now be used in the sale notification email subject.
197
+ - Added a new parameter (button_text) for the add to cart button shortcode. This parameter can be used to specify a custom button text for the add to cart button. Usage instructions at the following page:
198
+ https://www.tipsandtricks-hq.com/ecommerce/simple-shopping-cart-customize-the-add-to-cart-button-text-via-shortcode-4383
199
+
200
+ = 4.3.6 =
201
+ - There is now a basic shortcode inserter for this plugin in the wp post/page editor.
202
+ - The cart orders search functionality can now search records using customer's email and name.
203
+ - Added CSS classes to the variation drop-downs.
204
+ - CSS optimization in the settings interface of the plugin.
205
+
206
  = 4.3.5 =
207
  - The deprecated page styles field has been replaced with an image URL field in the settings.
208
  - The Image URL field can be used to specify an image/logo URL that will be displayed in the paypal checkout page.
wp_shopping_cart.php CHANGED
@@ -1,18 +1,19 @@
1
  <?php
 
2
  /*
3
- Plugin Name: WP Simple Paypal Shopping cart
4
- Version: 4.3.5
5
- Plugin URI: https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768
6
- Author: Tips and Tricks HQ, Ruhul Amin, mra13
7
- Author URI: https://www.tipsandtricks-hq.com/
8
- Description: Simple WordPress Shopping Cart Plugin, very easy to use and great for selling products and services from your blog!
9
- Text Domain: wordpress-simple-paypal-shopping-cart
10
- Domain Path: /languages/
11
- */
12
 
13
  //Slug - wspsc
14
 
15
- if (!defined('ABSPATH')){//Exit if accessed directly
16
  exit;
17
  }
18
 
@@ -26,7 +27,7 @@ if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
26
  }
27
  }
28
 
29
- define('WP_CART_VERSION', '4.3.5');
30
  define('WP_CART_FOLDER', dirname(plugin_basename(__FILE__)));
31
  define('WP_CART_PATH', plugin_dir_path(__FILE__));
32
  define('WP_CART_URL', plugins_url('', __FILE__));
@@ -34,7 +35,7 @@ define('WP_CART_SITE_URL', site_url());
34
  define('WP_CART_LIVE_PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr');
35
  define('WP_CART_SANDBOX_PAYPAL_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
36
  define('WP_CART_CURRENCY_SYMBOL', get_option('cart_currency_symbol'));
37
- if (!defined('WP_CART_MANAGEMENT_PERMISSION')){//This will allow the user to define custom capability for this constant in wp-config file
38
  define('WP_CART_MANAGEMENT_PERMISSION', 'manage_options');
39
  }
40
  define('WP_CART_MAIN_MENU_SLUG', 'wspsc-main');
@@ -42,8 +43,8 @@ define('WP_CART_MAIN_MENU_SLUG', 'wspsc-main');
42
 
43
  // loading language files
44
  //Set up localisation. First loaded overrides strings present in later loaded file
45
- $locale = apply_filters( 'plugin_locale', get_locale(), 'wordpress-simple-paypal-shopping-cart' );
46
- load_textdomain( 'wordpress-simple-paypal-shopping-cart', WP_LANG_DIR . "/wordpress-simple-paypal-shopping-cart-$locale.mo" );
47
  load_plugin_textdomain('wordpress-simple-paypal-shopping-cart', false, WP_CART_FOLDER . '/languages');
48
 
49
  include_once('wp_shopping_cart_utility_functions.php');
@@ -52,6 +53,7 @@ include_once('wp_shopping_cart_misc_functions.php');
52
  include_once('wp_shopping_cart_orders.php');
53
  include_once('class-coupon.php');
54
  include_once('includes/wspsc-cart-functions.php');
 
55
 
56
  function always_show_cart_handler($atts) {
57
  return print_wp_shopping_cart($atts);
@@ -91,7 +93,7 @@ if (get_option('wp_shopping_cart_reset_after_redirection_to_return_page')) {
91
  }
92
 
93
  function reset_wp_cart() {
94
- if (!isset($_SESSION['simpleCart'])){
95
  return;
96
  }
97
  $products = $_SESSION['simpleCart'];
@@ -109,27 +111,26 @@ function reset_wp_cart() {
109
  }
110
 
111
  function wpspc_cart_actions_handler() {
112
- unset($_SESSION['wpspsc_cart_action_msg']);
113
-
114
  if (isset($_POST['addcart'])) {//Add to cart action
115
-
116
  //Some sites using caching need to be able to disable nonce on the add cart button. Otherwise 48 hour old cached pages will have stale nonce value and fail for valid users.
117
- if (get_option('wspsc_disable_nonce_add_cart')){
118
  //This site has disabled the nonce check for add cart button.
119
  //Do not check nonce for this site since the site admin has indicated that he does not want to check nonce for add cart button.
120
  } else {
121
  //Check nonce
122
  $nonce = $_REQUEST['_wpnonce'];
123
- if ( !wp_verify_nonce($nonce, 'wspsc_addcart')){
124
- wp_die('Error! Nonce Security Check Failed!');
125
  }
126
  }
127
-
128
  setcookie("cart_in_use", "true", time() + 21600, "/", COOKIE_DOMAIN); //useful to not serve cached page when using with a caching plugin
129
  if (function_exists('wp_cache_serve_cache_file')) {//WP Super cache workaround
130
  setcookie("comment_author_", "wp_cart", time() + 21600, "/", COOKIE_DOMAIN);
131
  }
132
-
133
  //Sanitize post data
134
  $post_wspsc_product = isset($_POST['wspsc_product']) ? stripslashes(sanitize_text_field($_POST['wspsc_product'])) : '';
135
  $post_item_number = isset($_POST['item_number']) ? sanitize_text_field($_POST['item_number']) : '';
@@ -138,68 +139,66 @@ function wpspc_cart_actions_handler() {
138
  $post_encoded_file_val = isset($_POST['file_url']) ? sanitize_text_field($_POST['file_url']) : '';
139
  $post_thumbnail = isset($_POST['thumbnail']) ? esc_url_raw(sanitize_text_field($_POST['thumbnail'])) : '';
140
  //Sanitize and validate price
141
- if (isset($_POST['price'])){
142
  $price = sanitize_text_field($_POST['price']);
143
  $hash_once_p = sanitize_text_field($_POST['hash_one']);
144
  $p_key = get_option('wspsc_private_key_one');
145
- $hash_one_cm = md5($p_key.'|'.$price);
146
- if($hash_once_p != $hash_one_cm){//Security check failed. Price field has been tampered. Fail validation.
147
  wp_die('Error! The price field may have been tampered. Security check failed.');
148
  }
149
- $price = str_replace(WP_CART_CURRENCY_SYMBOL, "", $price);//Remove any currency symbol from the price.
150
  //Check that the price field is numeric.
151
- if(!is_numeric($price)){//Price validation failed
152
  wp_die('Error! The price validation failed. The value must be numeric.');
153
  }
154
  //At this stage the price amt has already been sanitized and validated.
155
-
156
  } else {
157
  wp_die('Error! Missing price value. The price must be set.');
158
  }
159
-
160
  //Sanitize and validate shipping price
161
- if (isset($_POST['shipping'])){
162
  $shipping = sanitize_text_field($_POST['shipping']);
163
  $hash_two_val = sanitize_text_field($_POST['hash_two']);
164
  $p_key = get_option('wspsc_private_key_one');
165
- $hash_two_cm = md5($p_key.'|'.$shipping);
166
- if($hash_two_val != $hash_two_cm){//Shipping validation failed
167
  wp_die('Error! The shipping price validation failed.');
168
  }
169
-
170
- $shipping = str_replace(WP_CART_CURRENCY_SYMBOL, "", $shipping);//Remove any currency symbol from the price.
171
  //Check that the shipping price field is numeric.
172
- if(!is_numeric($shipping)){//Shipping price validation failed
173
  wp_die('Error! The shipping price validation failed. The value must be numeric.');
174
  }
175
  //At this stage the shipping price amt has already been sanitized and validated.
176
-
177
  } else {
178
  wp_die('Error! Missing shipping price value. The price must be set.');
179
- }
180
-
181
 
182
  $count = 1;
183
  $products = array();
184
- if(isset($_SESSION['simpleCart'])){
185
  $products = $_SESSION['simpleCart'];
186
  if (is_array($products)) {
187
  foreach ($products as $key => $item) {
188
  if ($item['name'] == $post_wspsc_product) {
189
  $count += $item['quantity'];
190
- $item['quantity']++;
191
  unset($products[$key]);
192
  array_push($products, $item);
193
  }
194
  }
195
- }else {
196
  $products = array();
197
  }
198
  }
199
 
200
  if ($count == 1) {
201
  //This is the first quantity of this item.
202
-
203
  $product = array('name' => $post_wspsc_product, 'price' => $price, 'price_orig' => $price, 'quantity' => $count, 'shipping' => $shipping, 'cartLink' => $post_cart_link, 'item_number' => $post_item_number);
204
  if (!empty($post_encoded_file_val)) {
205
  $product['file_url'] = $post_encoded_file_val;
@@ -208,7 +207,7 @@ function wpspc_cart_actions_handler() {
208
  $product['thumbnail'] = $post_thumbnail;
209
  }
210
  $product['stamp_pdf'] = $post_stamp_pdf;
211
-
212
  array_push($products, $product);
213
  }
214
 
@@ -241,12 +240,12 @@ function wpspc_cart_actions_handler() {
241
  }
242
  } else if (isset($_POST['cquantity'])) {
243
  $nonce = $_REQUEST['_wpnonce'];
244
- if ( !wp_verify_nonce($nonce, 'wspsc_cquantity')){
245
- wp_die('Error! Nonce Security Check Failed!');
246
  }
247
  $post_wspsc_product = isset($_POST['wspsc_product']) ? stripslashes(sanitize_text_field($_POST['wspsc_product'])) : '';
248
  $post_quantity = isset($_POST['quantity']) ? sanitize_text_field($_POST['quantity']) : '';
249
- if (!is_numeric($post_quantity)){
250
  wp_die('Error! The quantity value must be numeric.');
251
  }
252
  $products = $_SESSION['simpleCart'];
@@ -269,8 +268,8 @@ function wpspc_cart_actions_handler() {
269
  }
270
  } else if (isset($_POST['delcart'])) {
271
  $nonce = $_REQUEST['_wpnonce'];
272
- if ( !wp_verify_nonce($nonce, 'wspsc_delcart')){
273
- wp_die('Error! Nonce Security Check Failed!');
274
  }
275
  $post_wspsc_product = isset($_POST['wspsc_product']) ? stripslashes(sanitize_text_field($_POST['wspsc_product'])) : '';
276
  $products = $_SESSION['simpleCart'];
@@ -290,8 +289,8 @@ function wpspc_cart_actions_handler() {
290
  }
291
  } else if (isset($_POST['wpspsc_coupon_code'])) {
292
  $nonce = $_REQUEST['_wpnonce'];
293
- if ( !wp_verify_nonce($nonce, 'wspsc_coupon')){
294
- wp_die('Error! Nonce Security Check Failed!');
295
  }
296
  $coupon_code = isset($_POST['wpspsc_coupon_code']) ? sanitize_text_field($_POST['wpspsc_coupon_code']) : '';
297
  wpspsc_apply_cart_discount($coupon_code);
@@ -335,7 +334,7 @@ function wp_cart_add_custom_field() {
335
  }
336
 
337
  $custom_field_val = apply_filters('wpspc_cart_custom_field_value', $custom_field_val);
338
- $custom_field_val = urlencode($custom_field_val);//URL encode the custom field value so nothing gets lost when it is passed around.
339
  $output = '<input type="hidden" name="custom" value="' . $custom_field_val . '" />';
340
  return $output;
341
  }
@@ -411,13 +410,13 @@ function print_wp_cart_button_new($content) {
411
 
412
  $replacement = '<div class="wp_cart_button_wrapper">';
413
  $replacement .= '<form method="post" class="wp-cart-button-form" action="" style="display:inline" onsubmit="return ReadForm(this, true);" ' . apply_filters("wspsc_add_cart_button_form_attr", "") . '>';
414
- $replacement .= wp_nonce_field('wspsc_addcart', '_wpnonce', true, false);//nonce value
415
-
416
  if (!empty($var_output)) {
417
  $replacement .= $var_output;
418
  }
419
 
420
- if (preg_match("/http/", $addcart)) {
421
  //Use the image as the add to cart button
422
  $replacement .= '<input type="image" src="' . $addcart . '" class="wp_cart_button" alt="' . (__("Add to Cart", "wordpress-simple-paypal-shopping-cart")) . '"/>';
423
  } else {
@@ -429,27 +428,27 @@ function print_wp_cart_button_new($content) {
429
  $replacement .= '<input type="hidden" name="product_tmp" value="' . $pieces['0'] . '" />';
430
  if (sizeof($pieces) > 2) {
431
  //We likely have shipping
432
- if(!is_numeric($pieces['2'])){//Shipping parameter has non-numeric value. Discard it and set it to 0.
433
  $pieces['2'] = 0;
434
  }
435
  $replacement .= '<input type="hidden" name="shipping" value="' . $pieces['2'] . '" />';
436
  } else {
437
  //Set shipping to 0 by default (when no shipping is specified in the shortcode)
438
  $pieces['2'] = 0;
439
- $replacement .= '<input type="hidden" name="shipping" value="'.$pieces['2'].'" />';
440
  }
441
-
442
  $p_key = get_option('wspsc_private_key_one');
443
- if(empty($p_key)){
444
  $p_key = uniqid('', true);
445
- update_option('wspsc_private_key_one',$p_key);
446
  }
447
- $hash_one = md5($p_key.'|'.$pieces['1']);//Price hash
448
  $replacement .= '<input type="hidden" name="hash_one" value="' . $hash_one . '" />';
449
 
450
- $hash_two = md5($p_key.'|'.$pieces['2']);//Shipping hash
451
- $replacement .= '<input type="hidden" name="hash_two" value="' . $hash_two . '" />';
452
-
453
  $replacement .= '<input type="hidden" name="cartLink" value="' . esc_url(cart_current_page_url()) . '" />';
454
  $replacement .= '<input type="hidden" name="addcart" value="1" /></form>';
455
  $replacement .= '</div>';
@@ -460,7 +459,7 @@ function print_wp_cart_button_new($content) {
460
 
461
  function wp_cart_add_read_form_javascript() {
462
  $debug_marker = "<!-- WP Simple Shopping Cart plugin v" . WP_CART_VERSION . " - https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768/ -->";
463
- echo "\n${debug_marker}\n";
464
  echo '
465
  <script type="text/javascript">
466
  <!--
@@ -495,7 +494,7 @@ function wp_cart_add_read_form_javascript() {
495
 
496
  function print_wp_cart_button_for_product($name, $price, $shipping = 0, $var1 = '', $var2 = '', $var3 = '', $atts = array()) {
497
  $addcart = get_option('addToCartButtonName');
498
- if (!$addcart || ($addcart == '')){
499
  $addcart = __("Add to Cart", "wordpress-simple-paypal-shopping-cart");
500
  }
501
 
@@ -504,7 +503,7 @@ function print_wp_cart_button_for_product($name, $price, $shipping = 0, $var1 =
504
  $var1_pieces = explode('|', $var1);
505
  $variation1_name = $var1_pieces[0];
506
  $var_output .= '<span class="wp_cart_variation_name">' . $variation1_name . ' : </span>';
507
- $var_output .= '<select name="variation1" onchange="ReadForm (this.form, false);">';
508
  for ($i = 1; $i < sizeof($var1_pieces); $i++) {
509
  $var_output .= '<option value="' . $var1_pieces[$i] . '">' . $var1_pieces[$i] . '</option>';
510
  }
@@ -514,7 +513,7 @@ function print_wp_cart_button_for_product($name, $price, $shipping = 0, $var1 =
514
  $var2_pieces = explode('|', $var2);
515
  $variation2_name = $var2_pieces[0];
516
  $var_output .= '<span class="wp_cart_variation_name">' . $variation2_name . ' : </span>';
517
- $var_output .= '<select name="variation2" onchange="ReadForm (this.form, false);">';
518
  for ($i = 1; $i < sizeof($var2_pieces); $i++) {
519
  $var_output .= '<option value="' . $var2_pieces[$i] . '">' . $var2_pieces[$i] . '</option>';
520
  }
@@ -524,7 +523,7 @@ function print_wp_cart_button_for_product($name, $price, $shipping = 0, $var1 =
524
  $var3_pieces = explode('|', $var3);
525
  $variation3_name = $var3_pieces[0];
526
  $var_output .= '<span class="wp_cart_variation_name">' . $variation3_name . ' : </span>';
527
- $var_output .= '<select name="variation3" onchange="ReadForm (this.form, false);">';
528
  for ($i = 1; $i < sizeof($var3_pieces); $i++) {
529
  $var_output .= '<option value="' . $var3_pieces[$i] . '">' . $var3_pieces[$i] . '</option>';
530
  }
@@ -539,11 +538,14 @@ function print_wp_cart_button_for_product($name, $price, $shipping = 0, $var1 =
539
  }
540
 
541
  if (isset($atts['button_image']) && !empty($atts['button_image'])) {
542
- //Use the custom button image for this shortcode
543
  $replacement .= '<input type="image" src="' . $atts['button_image'] . '" class="wp_cart_button" alt="' . (__("Add to Cart", "wordpress-simple-paypal-shopping-cart")) . '"/>';
 
 
 
544
  } else {
545
  //Use the button text or image value from the settings
546
- if (preg_match("/http:/", $addcart) || preg_match("/https:/", $addcart)) {
547
  //Use the image as the add to cart button
548
  $replacement .= '<input type="image" src="' . $addcart . '" class="wp_cart_button" alt="' . (__("Add to Cart", "wordpress-simple-paypal-shopping-cart")) . '"/>';
549
  } else {
@@ -572,18 +574,18 @@ function print_wp_cart_button_for_product($name, $price, $shipping = 0, $var1 =
572
  if (isset($atts['stamp_pdf'])) {
573
  $replacement .= '<input type="hidden" name="stamp_pdf" value="' . $atts['stamp_pdf'] . '" />';
574
  }
575
-
576
  $p_key = get_option('wspsc_private_key_one');
577
- if(empty($p_key)){
578
  $p_key = uniqid('', true);
579
- update_option('wspsc_private_key_one',$p_key);
580
  }
581
- $hash_one = md5($p_key.'|'.$price);
582
  $replacement .= '<input type="hidden" name="hash_one" value="' . $hash_one . '" />';
583
-
584
- $hash_two = md5($p_key.'|'.$shipping);
585
  $replacement .= '<input type="hidden" name="hash_two" value="' . $hash_two . '" />';
586
-
587
  $replacement .= '</form>';
588
  $replacement .= '</div>';
589
  return $replacement;
@@ -595,15 +597,14 @@ function cart_not_empty() {
595
  foreach ($_SESSION['simpleCart'] as $item)
596
  $count++;
597
  return $count;
598
- }
599
- else
600
  return 0;
601
  }
602
 
603
  function print_payment_currency($price, $symbol, $decimal = '.') {
604
  $formatted_price = '';
605
  $formatted_price = apply_filters('wspsc_print_formatted_price', $formatted_price, $price, $symbol);
606
- if(!empty($formatted_price)){
607
  return $formatted_price;
608
  }
609
  $formatted_price = $symbol . number_format($price, 2, $decimal, ',');
@@ -645,13 +646,12 @@ function simple_cart_total() {
645
  function wp_cart_options_page() {
646
  include_once('wp_shopping_cart_settings.php');
647
  add_options_page(__("WP Paypal Shopping Cart", "wordpress-simple-paypal-shopping-cart"), __("WP Shopping Cart", "wordpress-simple-paypal-shopping-cart"), WP_CART_MANAGEMENT_PERMISSION, 'wordpress-paypal-shopping-cart', 'wp_cart_options');
648
-
649
  //Main menu - Complete this when the dashboard menu is ready
650
  //$menu_icon_url = '';//TODO - use
651
  //add_menu_page(__('Simple Cart', 'wordpress-simple-paypal-shopping-cart'), __('Simple Cart', 'wordpress-simple-paypal-shopping-cart'), WP_CART_MANAGEMENT_PERMISSION, WP_CART_MAIN_MENU_SLUG , 'wp_cart_options', $menu_icon_url);
652
  //add_submenu_page(WP_CART_MAIN_MENU_SLUG, __('Settings', 'wordpress-simple-paypal-shopping-cart'), __('Settings', 'wordpress-simple-paypal-shopping-cart') , WP_CART_MANAGEMENT_PERMISSION, WP_CART_MAIN_MENU_SLUG, 'wp_cart_options');
653
  //add_submenu_page(WP_CART_MAIN_MENU_SLUG, __('Bla', 'wordpress-simple-paypal-shopping-cart'), __('Bla', 'wordpress-simple-paypal-shopping-cart') , WP_CART_MANAGEMENT_PERMISSION, 'wspsc-bla', 'wp_cart_options');
654
-
655
  }
656
 
657
  function wp_paypal_shopping_cart_load_widgets() {
@@ -688,16 +688,18 @@ class WP_PayPal_Cart_Widget extends WP_Widget {
688
 
689
  }
690
 
691
- function wspsc_admin_side_enqueue_scripts()
692
- {
693
- if (isset($_GET['page']) && $_GET['page'] == 'wordpress-paypal-shopping-cart') //simple paypal shopping cart discount page
694
- {
695
  wp_enqueue_style('jquery-ui-style', '//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css');
696
- wp_register_script('wpspsc-admin', WP_CART_URL.'/lib/wpspsc_admin_side.js', array('jquery', 'jquery-ui-datepicker'));
697
  wp_enqueue_script('wpspsc-admin');
698
  }
699
  }
700
 
 
 
 
 
701
  function wspsc_front_side_enqueue_scripts() {
702
  wp_enqueue_style('wspsc-style', WP_CART_URL . '/wp_shopping_cart_style.css', array(), WP_CART_VERSION);
703
  }
@@ -735,4 +737,5 @@ if (!is_admin()) {
735
 
736
  add_action('wp_head', 'wp_cart_add_read_form_javascript');
737
  add_action('wp_enqueue_scripts', 'wspsc_front_side_enqueue_scripts');
738
- add_action('admin_enqueue_scripts', 'wspsc_admin_side_enqueue_scripts' );
 
1
  <?php
2
+
3
  /*
4
+ Plugin Name: WP Simple Paypal Shopping cart
5
+ Version: 4.3.7
6
+ Plugin URI: https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768
7
+ Author: Tips and Tricks HQ, Ruhul Amin, mra13
8
+ Author URI: https://www.tipsandtricks-hq.com/
9
+ Description: Simple WordPress Shopping Cart Plugin, very easy to use and great for selling products and services from your blog!
10
+ Text Domain: wordpress-simple-paypal-shopping-cart
11
+ Domain Path: /languages/
12
+ */
13
 
14
  //Slug - wspsc
15
 
16
+ if (!defined('ABSPATH')) {//Exit if accessed directly
17
  exit;
18
  }
19
 
27
  }
28
  }
29
 
30
+ define('WP_CART_VERSION', '4.3.7');
31
  define('WP_CART_FOLDER', dirname(plugin_basename(__FILE__)));
32
  define('WP_CART_PATH', plugin_dir_path(__FILE__));
33
  define('WP_CART_URL', plugins_url('', __FILE__));
35
  define('WP_CART_LIVE_PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr');
36
  define('WP_CART_SANDBOX_PAYPAL_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
37
  define('WP_CART_CURRENCY_SYMBOL', get_option('cart_currency_symbol'));
38
+ if (!defined('WP_CART_MANAGEMENT_PERMISSION')) {//This will allow the user to define custom capability for this constant in wp-config file
39
  define('WP_CART_MANAGEMENT_PERMISSION', 'manage_options');
40
  }
41
  define('WP_CART_MAIN_MENU_SLUG', 'wspsc-main');
43
 
44
  // loading language files
45
  //Set up localisation. First loaded overrides strings present in later loaded file
46
+ $locale = apply_filters('plugin_locale', get_locale(), 'wordpress-simple-paypal-shopping-cart');
47
+ load_textdomain('wordpress-simple-paypal-shopping-cart', WP_LANG_DIR . "/wordpress-simple-paypal-shopping-cart-$locale.mo");
48
  load_plugin_textdomain('wordpress-simple-paypal-shopping-cart', false, WP_CART_FOLDER . '/languages');
49
 
50
  include_once('wp_shopping_cart_utility_functions.php');
53
  include_once('wp_shopping_cart_orders.php');
54
  include_once('class-coupon.php');
55
  include_once('includes/wspsc-cart-functions.php');
56
+ include_once('includes/admin/wp_shopping_cart_tinymce.php');
57
 
58
  function always_show_cart_handler($atts) {
59
  return print_wp_shopping_cart($atts);
93
  }
94
 
95
  function reset_wp_cart() {
96
+ if (!isset($_SESSION['simpleCart'])) {
97
  return;
98
  }
99
  $products = $_SESSION['simpleCart'];
111
  }
112
 
113
  function wpspc_cart_actions_handler() {
114
+ unset($_SESSION['wpspsc_cart_action_msg']);
115
+
116
  if (isset($_POST['addcart'])) {//Add to cart action
 
117
  //Some sites using caching need to be able to disable nonce on the add cart button. Otherwise 48 hour old cached pages will have stale nonce value and fail for valid users.
118
+ if (get_option('wspsc_disable_nonce_add_cart')) {
119
  //This site has disabled the nonce check for add cart button.
120
  //Do not check nonce for this site since the site admin has indicated that he does not want to check nonce for add cart button.
121
  } else {
122
  //Check nonce
123
  $nonce = $_REQUEST['_wpnonce'];
124
+ if (!wp_verify_nonce($nonce, 'wspsc_addcart')) {
125
+ wp_die('Error! Nonce Security Check Failed!');
126
  }
127
  }
128
+
129
  setcookie("cart_in_use", "true", time() + 21600, "/", COOKIE_DOMAIN); //useful to not serve cached page when using with a caching plugin
130
  if (function_exists('wp_cache_serve_cache_file')) {//WP Super cache workaround
131
  setcookie("comment_author_", "wp_cart", time() + 21600, "/", COOKIE_DOMAIN);
132
  }
133
+
134
  //Sanitize post data
135
  $post_wspsc_product = isset($_POST['wspsc_product']) ? stripslashes(sanitize_text_field($_POST['wspsc_product'])) : '';
136
  $post_item_number = isset($_POST['item_number']) ? sanitize_text_field($_POST['item_number']) : '';
139
  $post_encoded_file_val = isset($_POST['file_url']) ? sanitize_text_field($_POST['file_url']) : '';
140
  $post_thumbnail = isset($_POST['thumbnail']) ? esc_url_raw(sanitize_text_field($_POST['thumbnail'])) : '';
141
  //Sanitize and validate price
142
+ if (isset($_POST['price'])) {
143
  $price = sanitize_text_field($_POST['price']);
144
  $hash_once_p = sanitize_text_field($_POST['hash_one']);
145
  $p_key = get_option('wspsc_private_key_one');
146
+ $hash_one_cm = md5($p_key . '|' . $price);
147
+ if ($hash_once_p != $hash_one_cm) {//Security check failed. Price field has been tampered. Fail validation.
148
  wp_die('Error! The price field may have been tampered. Security check failed.');
149
  }
150
+ $price = str_replace(WP_CART_CURRENCY_SYMBOL, "", $price); //Remove any currency symbol from the price.
151
  //Check that the price field is numeric.
152
+ if (!is_numeric($price)) {//Price validation failed
153
  wp_die('Error! The price validation failed. The value must be numeric.');
154
  }
155
  //At this stage the price amt has already been sanitized and validated.
 
156
  } else {
157
  wp_die('Error! Missing price value. The price must be set.');
158
  }
159
+
160
  //Sanitize and validate shipping price
161
+ if (isset($_POST['shipping'])) {
162
  $shipping = sanitize_text_field($_POST['shipping']);
163
  $hash_two_val = sanitize_text_field($_POST['hash_two']);
164
  $p_key = get_option('wspsc_private_key_one');
165
+ $hash_two_cm = md5($p_key . '|' . $shipping);
166
+ if ($hash_two_val != $hash_two_cm) {//Shipping validation failed
167
  wp_die('Error! The shipping price validation failed.');
168
  }
169
+
170
+ $shipping = str_replace(WP_CART_CURRENCY_SYMBOL, "", $shipping); //Remove any currency symbol from the price.
171
  //Check that the shipping price field is numeric.
172
+ if (!is_numeric($shipping)) {//Shipping price validation failed
173
  wp_die('Error! The shipping price validation failed. The value must be numeric.');
174
  }
175
  //At this stage the shipping price amt has already been sanitized and validated.
 
176
  } else {
177
  wp_die('Error! Missing shipping price value. The price must be set.');
178
+ }
179
+
180
 
181
  $count = 1;
182
  $products = array();
183
+ if (isset($_SESSION['simpleCart'])) {
184
  $products = $_SESSION['simpleCart'];
185
  if (is_array($products)) {
186
  foreach ($products as $key => $item) {
187
  if ($item['name'] == $post_wspsc_product) {
188
  $count += $item['quantity'];
189
+ $item['quantity'] ++;
190
  unset($products[$key]);
191
  array_push($products, $item);
192
  }
193
  }
194
+ } else {
195
  $products = array();
196
  }
197
  }
198
 
199
  if ($count == 1) {
200
  //This is the first quantity of this item.
201
+
202
  $product = array('name' => $post_wspsc_product, 'price' => $price, 'price_orig' => $price, 'quantity' => $count, 'shipping' => $shipping, 'cartLink' => $post_cart_link, 'item_number' => $post_item_number);
203
  if (!empty($post_encoded_file_val)) {
204
  $product['file_url'] = $post_encoded_file_val;
207
  $product['thumbnail'] = $post_thumbnail;
208
  }
209
  $product['stamp_pdf'] = $post_stamp_pdf;
210
+
211
  array_push($products, $product);
212
  }
213
 
240
  }
241
  } else if (isset($_POST['cquantity'])) {
242
  $nonce = $_REQUEST['_wpnonce'];
243
+ if (!wp_verify_nonce($nonce, 'wspsc_cquantity')) {
244
+ wp_die('Error! Nonce Security Check Failed!');
245
  }
246
  $post_wspsc_product = isset($_POST['wspsc_product']) ? stripslashes(sanitize_text_field($_POST['wspsc_product'])) : '';
247
  $post_quantity = isset($_POST['quantity']) ? sanitize_text_field($_POST['quantity']) : '';
248
+ if (!is_numeric($post_quantity)) {
249
  wp_die('Error! The quantity value must be numeric.');
250
  }
251
  $products = $_SESSION['simpleCart'];
268
  }
269
  } else if (isset($_POST['delcart'])) {
270
  $nonce = $_REQUEST['_wpnonce'];
271
+ if (!wp_verify_nonce($nonce, 'wspsc_delcart')) {
272
+ wp_die('Error! Nonce Security Check Failed!');
273
  }
274
  $post_wspsc_product = isset($_POST['wspsc_product']) ? stripslashes(sanitize_text_field($_POST['wspsc_product'])) : '';
275
  $products = $_SESSION['simpleCart'];
289
  }
290
  } else if (isset($_POST['wpspsc_coupon_code'])) {
291
  $nonce = $_REQUEST['_wpnonce'];
292
+ if (!wp_verify_nonce($nonce, 'wspsc_coupon')) {
293
+ wp_die('Error! Nonce Security Check Failed!');
294
  }
295
  $coupon_code = isset($_POST['wpspsc_coupon_code']) ? sanitize_text_field($_POST['wpspsc_coupon_code']) : '';
296
  wpspsc_apply_cart_discount($coupon_code);
334
  }
335
 
336
  $custom_field_val = apply_filters('wpspc_cart_custom_field_value', $custom_field_val);
337
+ $custom_field_val = urlencode($custom_field_val); //URL encode the custom field value so nothing gets lost when it is passed around.
338
  $output = '<input type="hidden" name="custom" value="' . $custom_field_val . '" />';
339
  return $output;
340
  }
410
 
411
  $replacement = '<div class="wp_cart_button_wrapper">';
412
  $replacement .= '<form method="post" class="wp-cart-button-form" action="" style="display:inline" onsubmit="return ReadForm(this, true);" ' . apply_filters("wspsc_add_cart_button_form_attr", "") . '>';
413
+ $replacement .= wp_nonce_field('wspsc_addcart', '_wpnonce', true, false); //nonce value
414
+
415
  if (!empty($var_output)) {
416
  $replacement .= $var_output;
417
  }
418
 
419
+ if (preg_match("/http/", $addcart)) {
420
  //Use the image as the add to cart button
421
  $replacement .= '<input type="image" src="' . $addcart . '" class="wp_cart_button" alt="' . (__("Add to Cart", "wordpress-simple-paypal-shopping-cart")) . '"/>';
422
  } else {
428
  $replacement .= '<input type="hidden" name="product_tmp" value="' . $pieces['0'] . '" />';
429
  if (sizeof($pieces) > 2) {
430
  //We likely have shipping
431
+ if (!is_numeric($pieces['2'])) {//Shipping parameter has non-numeric value. Discard it and set it to 0.
432
  $pieces['2'] = 0;
433
  }
434
  $replacement .= '<input type="hidden" name="shipping" value="' . $pieces['2'] . '" />';
435
  } else {
436
  //Set shipping to 0 by default (when no shipping is specified in the shortcode)
437
  $pieces['2'] = 0;
438
+ $replacement .= '<input type="hidden" name="shipping" value="' . $pieces['2'] . '" />';
439
  }
440
+
441
  $p_key = get_option('wspsc_private_key_one');
442
+ if (empty($p_key)) {
443
  $p_key = uniqid('', true);
444
+ update_option('wspsc_private_key_one', $p_key);
445
  }
446
+ $hash_one = md5($p_key . '|' . $pieces['1']); //Price hash
447
  $replacement .= '<input type="hidden" name="hash_one" value="' . $hash_one . '" />';
448
 
449
+ $hash_two = md5($p_key . '|' . $pieces['2']); //Shipping hash
450
+ $replacement .= '<input type="hidden" name="hash_two" value="' . $hash_two . '" />';
451
+
452
  $replacement .= '<input type="hidden" name="cartLink" value="' . esc_url(cart_current_page_url()) . '" />';
453
  $replacement .= '<input type="hidden" name="addcart" value="1" /></form>';
454
  $replacement .= '</div>';
459
 
460
  function wp_cart_add_read_form_javascript() {
461
  $debug_marker = "<!-- WP Simple Shopping Cart plugin v" . WP_CART_VERSION . " - https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768/ -->";
462
+ echo "\n${debug_marker}\n";
463
  echo '
464
  <script type="text/javascript">
465
  <!--
494
 
495
  function print_wp_cart_button_for_product($name, $price, $shipping = 0, $var1 = '', $var2 = '', $var3 = '', $atts = array()) {
496
  $addcart = get_option('addToCartButtonName');
497
+ if (!$addcart || ($addcart == '')) {
498
  $addcart = __("Add to Cart", "wordpress-simple-paypal-shopping-cart");
499
  }
500
 
503
  $var1_pieces = explode('|', $var1);
504
  $variation1_name = $var1_pieces[0];
505
  $var_output .= '<span class="wp_cart_variation_name">' . $variation1_name . ' : </span>';
506
+ $var_output .= '<select name="variation1" class="wp_cart_variation1_select" onchange="ReadForm (this.form, false);">';
507
  for ($i = 1; $i < sizeof($var1_pieces); $i++) {
508
  $var_output .= '<option value="' . $var1_pieces[$i] . '">' . $var1_pieces[$i] . '</option>';
509
  }
513
  $var2_pieces = explode('|', $var2);
514
  $variation2_name = $var2_pieces[0];
515
  $var_output .= '<span class="wp_cart_variation_name">' . $variation2_name . ' : </span>';
516
+ $var_output .= '<select name="variation2" class="wp_cart_variation2_select" onchange="ReadForm (this.form, false);">';
517
  for ($i = 1; $i < sizeof($var2_pieces); $i++) {
518
  $var_output .= '<option value="' . $var2_pieces[$i] . '">' . $var2_pieces[$i] . '</option>';
519
  }
523
  $var3_pieces = explode('|', $var3);
524
  $variation3_name = $var3_pieces[0];
525
  $var_output .= '<span class="wp_cart_variation_name">' . $variation3_name . ' : </span>';
526
+ $var_output .= '<select name="variation3" class="wp_cart_variation3_select" onchange="ReadForm (this.form, false);">';
527
  for ($i = 1; $i < sizeof($var3_pieces); $i++) {
528
  $var_output .= '<option value="' . $var3_pieces[$i] . '">' . $var3_pieces[$i] . '</option>';
529
  }
538
  }
539
 
540
  if (isset($atts['button_image']) && !empty($atts['button_image'])) {
541
+ //Use the custom button image specified in the shortcode
542
  $replacement .= '<input type="image" src="' . $atts['button_image'] . '" class="wp_cart_button" alt="' . (__("Add to Cart", "wordpress-simple-paypal-shopping-cart")) . '"/>';
543
+ } else if (isset($atts['button_text']) && !empty($atts['button_text'])) {
544
+ //Use the custom button text specified in the shortcode
545
+ $replacement .= '<input type="submit" class="wspsc_add_cart_submit" name="wspsc_add_cart_submit" value="' . apply_filters('wspsc_add_cart_submit_button_value', $atts['button_text'], $price) . '" />';
546
  } else {
547
  //Use the button text or image value from the settings
548
+ if (preg_match("/http:/", $addcart) || preg_match("/https:/", $addcart)) {
549
  //Use the image as the add to cart button
550
  $replacement .= '<input type="image" src="' . $addcart . '" class="wp_cart_button" alt="' . (__("Add to Cart", "wordpress-simple-paypal-shopping-cart")) . '"/>';
551
  } else {
574
  if (isset($atts['stamp_pdf'])) {
575
  $replacement .= '<input type="hidden" name="stamp_pdf" value="' . $atts['stamp_pdf'] . '" />';
576
  }
577
+
578
  $p_key = get_option('wspsc_private_key_one');
579
+ if (empty($p_key)) {
580
  $p_key = uniqid('', true);
581
+ update_option('wspsc_private_key_one', $p_key);
582
  }
583
+ $hash_one = md5($p_key . '|' . $price);
584
  $replacement .= '<input type="hidden" name="hash_one" value="' . $hash_one . '" />';
585
+
586
+ $hash_two = md5($p_key . '|' . $shipping);
587
  $replacement .= '<input type="hidden" name="hash_two" value="' . $hash_two . '" />';
588
+
589
  $replacement .= '</form>';
590
  $replacement .= '</div>';
591
  return $replacement;
597
  foreach ($_SESSION['simpleCart'] as $item)
598
  $count++;
599
  return $count;
600
+ } else
 
601
  return 0;
602
  }
603
 
604
  function print_payment_currency($price, $symbol, $decimal = '.') {
605
  $formatted_price = '';
606
  $formatted_price = apply_filters('wspsc_print_formatted_price', $formatted_price, $price, $symbol);
607
+ if (!empty($formatted_price)) {
608
  return $formatted_price;
609
  }
610
  $formatted_price = $symbol . number_format($price, 2, $decimal, ',');
646
  function wp_cart_options_page() {
647
  include_once('wp_shopping_cart_settings.php');
648
  add_options_page(__("WP Paypal Shopping Cart", "wordpress-simple-paypal-shopping-cart"), __("WP Shopping Cart", "wordpress-simple-paypal-shopping-cart"), WP_CART_MANAGEMENT_PERMISSION, 'wordpress-paypal-shopping-cart', 'wp_cart_options');
649
+
650
  //Main menu - Complete this when the dashboard menu is ready
651
  //$menu_icon_url = '';//TODO - use
652
  //add_menu_page(__('Simple Cart', 'wordpress-simple-paypal-shopping-cart'), __('Simple Cart', 'wordpress-simple-paypal-shopping-cart'), WP_CART_MANAGEMENT_PERMISSION, WP_CART_MAIN_MENU_SLUG , 'wp_cart_options', $menu_icon_url);
653
  //add_submenu_page(WP_CART_MAIN_MENU_SLUG, __('Settings', 'wordpress-simple-paypal-shopping-cart'), __('Settings', 'wordpress-simple-paypal-shopping-cart') , WP_CART_MANAGEMENT_PERMISSION, WP_CART_MAIN_MENU_SLUG, 'wp_cart_options');
654
  //add_submenu_page(WP_CART_MAIN_MENU_SLUG, __('Bla', 'wordpress-simple-paypal-shopping-cart'), __('Bla', 'wordpress-simple-paypal-shopping-cart') , WP_CART_MANAGEMENT_PERMISSION, 'wspsc-bla', 'wp_cart_options');
 
655
  }
656
 
657
  function wp_paypal_shopping_cart_load_widgets() {
688
 
689
  }
690
 
691
+ function wspsc_admin_side_enqueue_scripts() {
692
+ if (isset($_GET['page']) && $_GET['page'] == 'wordpress-paypal-shopping-cart') { //simple paypal shopping cart discount page
 
 
693
  wp_enqueue_style('jquery-ui-style', '//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css');
694
+ wp_register_script('wpspsc-admin', WP_CART_URL . '/lib/wpspsc_admin_side.js', array('jquery', 'jquery-ui-datepicker'));
695
  wp_enqueue_script('wpspsc-admin');
696
  }
697
  }
698
 
699
+ function wspsc_admin_side_styles() {
700
+ wp_enqueue_style('wspsc-admin-style', WP_CART_URL . '/assets/wspsc-admin-styles.css', array(), WP_CART_VERSION);
701
+ }
702
+
703
  function wspsc_front_side_enqueue_scripts() {
704
  wp_enqueue_style('wspsc-style', WP_CART_URL . '/wp_shopping_cart_style.css', array(), WP_CART_VERSION);
705
  }
737
 
738
  add_action('wp_head', 'wp_cart_add_read_form_javascript');
739
  add_action('wp_enqueue_scripts', 'wspsc_front_side_enqueue_scripts');
740
+ add_action('admin_enqueue_scripts', 'wspsc_admin_side_enqueue_scripts');
741
+ add_action('admin_print_styles', 'wspsc_admin_side_styles');
wp_shopping_cart_misc_functions.php CHANGED
@@ -20,6 +20,9 @@ function wp_cart_init_handler()
20
  exit;
21
  }
22
  }
 
 
 
23
  }
24
 
25
  function wp_cart_admin_init_handler()
@@ -142,7 +145,7 @@ function wpspc_update_cart_items_record()
142
  }
143
  }
144
 
145
- function wpspc_apply_dynamic_tags_on_email_body($ipn_data, $args)
146
  {
147
  $order_id = $args['order_id'];
148
  $purchase_amount = get_post_meta( $order_id, 'wpsc_total_amount', true );
@@ -150,7 +153,7 @@ function wpspc_apply_dynamic_tags_on_email_body($ipn_data, $args)
150
  $tags = array("{first_name}","{last_name}","{product_details}","{payer_email}","{transaction_id}","{purchase_amt}","{purchase_date}","{coupon_code}","{address}","{phone}");
151
  $vals = array($ipn_data['first_name'], $ipn_data['last_name'], $args['product_details'], $args['payer_email'], $ipn_data['txn_id'], $purchase_amount, $purchase_date, $args['coupon_code'], $args['address'], $ipn_data['contact_phone']);
152
 
153
- $body = stripslashes(str_replace($tags, $vals, $args['email_body']));
154
  return $body;
155
  }
156
 
@@ -191,7 +194,7 @@ function wpspc_run_activation()
191
  function wpspsc_settings_menu_footer()
192
  {
193
  ?>
194
- <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
195
  <p><?php _e("Need a shopping cart plugin with a lot of features and good support? Check out our ", "wordpress-simple-paypal-shopping-cart"); ?>
196
  <a href="https://www.tipsandtricks-hq.com/?p=1059" target="_blank"><?php _e("WP eStore Plugin", "wordpress-simple-paypal-shopping-cart"); ?></a></p>
197
  </div>
20
  exit;
21
  }
22
  }
23
+ if (is_admin()) {
24
+ add_action('admin_init','wp_cart_add_tinymce_button');
25
+ }
26
  }
27
 
28
  function wp_cart_admin_init_handler()
145
  }
146
  }
147
 
148
+ function wpspc_apply_dynamic_tags_on_email($text, $ipn_data, $args)
149
  {
150
  $order_id = $args['order_id'];
151
  $purchase_amount = get_post_meta( $order_id, 'wpsc_total_amount', true );
153
  $tags = array("{first_name}","{last_name}","{product_details}","{payer_email}","{transaction_id}","{purchase_amt}","{purchase_date}","{coupon_code}","{address}","{phone}");
154
  $vals = array($ipn_data['first_name'], $ipn_data['last_name'], $args['product_details'], $args['payer_email'], $ipn_data['txn_id'], $purchase_amount, $purchase_date, $args['coupon_code'], $args['address'], $ipn_data['contact_phone']);
155
 
156
+ $body = stripslashes(str_replace($tags, $vals, $text));
157
  return $body;
158
  }
159
 
194
  function wpspsc_settings_menu_footer()
195
  {
196
  ?>
197
+ <div class="wspsc_yellow_box">
198
  <p><?php _e("Need a shopping cart plugin with a lot of features and good support? Check out our ", "wordpress-simple-paypal-shopping-cart"); ?>
199
  <a href="https://www.tipsandtricks-hq.com/?p=1059" target="_blank"><?php _e("WP eStore Plugin", "wordpress-simple-paypal-shopping-cart"); ?></a></p>
200
  </div>
wp_shopping_cart_orders.php CHANGED
@@ -1,107 +1,102 @@
1
  <?php
2
-
3
  /*
4
  * This page handles the orders menu page in the admin dashboard
5
  */
6
 
7
- add_action( 'save_post', 'wpspc_cart_save_orders', 10, 2 );
8
-
9
- function wpspc_create_orders_page()
10
- {
11
- register_post_type( 'wpsc_cart_orders',
12
- array(
13
- 'labels' => array(
14
- 'name' => __("Cart Orders", "wordpress-simple-paypal-shopping-cart"),
15
- 'singular_name' => __("Cart Order", "wordpress-simple-paypal-shopping-cart"),
16
- 'add_new' => __("Add New", "wordpress-simple-paypal-shopping-cart"),
17
- 'add_new_item' => __("Add New Order", "wordpress-simple-paypal-shopping-cart"),
18
- 'edit' => __("Edit", "wordpress-simple-paypal-shopping-cart"),
19
- 'edit_item' => __("Edit Order", "wordpress-simple-paypal-shopping-cart"),
20
- 'new_item' => __("New Order", "wordpress-simple-paypal-shopping-cart"),
21
- 'view' => __("View", "wordpress-simple-paypal-shopping-cart"),
22
- 'view_item' => __("View Order", "wordpress-simple-paypal-shopping-cart"),
23
- 'search_items' => __("Search Order", "wordpress-simple-paypal-shopping-cart"),
24
- 'not_found' => __("No order found", "wordpress-simple-paypal-shopping-cart"),
25
- 'not_found_in_trash' => __("No order found in Trash", "wordpress-simple-paypal-shopping-cart"),
26
- 'parent' => __("Parent Order", "wordpress-simple-paypal-shopping-cart")
27
- ),
28
-
29
- 'public' => true,
30
- 'menu_position' => 80,
31
- 'supports' => false,
32
- 'taxonomies' => array( '' ),
33
- 'menu_icon' => 'dashicons-cart',
34
- 'has_archive' => true
35
- )
36
  );
37
  }
38
 
39
- function wpspc_add_meta_boxes()
40
- {
41
- add_meta_box( 'order_review_meta_box',
42
- __("Order Review", "wordpress-simple-paypal-shopping-cart"),
43
- 'wpspc_order_review_meta_box',
44
- 'wpsc_cart_orders',
45
- 'normal',
46
- 'high'
47
  );
48
  }
49
 
50
- function wpspc_order_review_meta_box($wpsc_cart_orders)
51
- {
52
  $order_id = $wpsc_cart_orders->ID;
53
- $first_name = get_post_meta( $wpsc_cart_orders->ID, 'wpsc_first_name', true );
54
- $last_name = get_post_meta( $wpsc_cart_orders->ID, 'wpsc_last_name', true );
55
- $email = get_post_meta( $wpsc_cart_orders->ID, 'wpsc_email_address', true );
56
- $txn_id = get_post_meta( $wpsc_cart_orders->ID, 'wpsc_txn_id', true );
57
- $ip_address = get_post_meta( $wpsc_cart_orders->ID, 'wpsc_ipaddress', true );
58
- $total_amount = get_post_meta( $wpsc_cart_orders->ID, 'wpsc_total_amount', true );
59
- $shipping_amount = get_post_meta( $wpsc_cart_orders->ID, 'wpsc_shipping_amount', true );
60
- $address = get_post_meta( $wpsc_cart_orders->ID, 'wpsc_address', true );
61
- $phone = get_post_meta( $wpsc_cart_orders->ID, 'wpspsc_phone', true );
62
- $email_sent_value = get_post_meta( $wpsc_cart_orders->ID, 'wpsc_buyer_email_sent', true );
63
-
64
  $email_sent_field_msg = "No";
65
- if(!empty($email_sent_value)){
66
- $email_sent_field_msg = "Yes. ".$email_sent_value;
67
  }
68
-
69
- $items_ordered = get_post_meta( $wpsc_cart_orders->ID, 'wpspsc_items_ordered', true );
70
- $applied_coupon = get_post_meta( $wpsc_cart_orders->ID, 'wpsc_applied_coupon', true );
71
  ?>
72
  <table>
73
- <p><?php _e("Order ID: #", "wordpress-simple-paypal-shopping-cart"); echo esc_attr($order_id);?></p>
74
- <?php if($txn_id){?>
75
- <p><?php _e("Transaction ID: #", "wordpress-simple-paypal-shopping-cart"); echo esc_attr($txn_id);?></p>
 
 
 
 
 
 
76
  <?php } ?>
77
  <tr>
78
- <td><?php _e("First Name", "wordpress-simple-paypal-shopping-cart");?></td>
79
  <td><input type="text" size="40" name="wpsc_first_name" value="<?php echo esc_attr($first_name); ?>" /></td>
80
  </tr>
81
  <tr>
82
- <td><?php _e("Last Name", "wordpress-simple-paypal-shopping-cart");?></td>
83
  <td><input type="text" size="40" name="wpsc_last_name" value="<?php echo esc_attr($last_name); ?>" /></td>
84
  </tr>
85
  <tr>
86
- <td><?php _e("Email Address", "wordpress-simple-paypal-shopping-cart");?></td>
87
  <td><input type="text" size="40" name="wpsc_email_address" value="<?php echo esc_attr($email); ?>" /></td>
88
  </tr>
89
  <tr>
90
- <td><?php _e("IP Address", "wordpress-simple-paypal-shopping-cart");?></td>
91
  <td><input type="text" size="40" name="wpsc_ipaddress" value="<?php echo esc_attr($ip_address); ?>" /></td>
92
  </tr>
93
  <tr>
94
- <td><?php _e("Total", "wordpress-simple-paypal-shopping-cart");?></td>
95
  <td><input type="text" size="20" name="wpsc_total_amount" value="<?php echo esc_attr($total_amount); ?>" /></td>
96
  </tr>
97
  <tr>
98
- <td><?php _e("Shipping", "wordpress-simple-paypal-shopping-cart");?></td>
99
  <td><input type="text" size="20" name="wpsc_shipping_amount" value="<?php echo esc_attr($shipping_amount); ?>" /></td>
100
  </tr>
101
  <tr>
102
- <td><?php _e("Address", "wordpress-simple-paypal-shopping-cart");?></td>
103
  <td>
104
- <textarea name="wpsc_address" cols="83" rows="2"><?php echo esc_attr($address);?></textarea>
105
  <p class="description">
106
  <?php _e("An address value will only be present if the order has physical item(s) with shipping amount. ", "wordpress-simple-paypal-shopping-cart"); ?>
107
  <?php _e("If you want to collect address for all orders then enable the 'Must Collect Shipping Address on PayPal' option from the plugin settings.", "wordpress-simple-paypal-shopping-cart"); ?>
@@ -109,7 +104,7 @@ function wpspc_order_review_meta_box($wpsc_cart_orders)
109
  </td>
110
  </tr>
111
  <tr>
112
- <td><?php _e("Phone", "wordpress-simple-paypal-shopping-cart");?></td>
113
  <td>
114
  <input type="text" size="40" name="wpspsc_phone" value="<?php echo esc_attr($phone); ?>" />
115
  <p class="description">
@@ -118,18 +113,18 @@ function wpspc_order_review_meta_box($wpsc_cart_orders)
118
  </td>
119
  </tr>
120
  <tr>
121
- <td><?php _e("Buyer Email Sent?", "wordpress-simple-paypal-shopping-cart");?></td>
122
  <td><input type="text" size="80" name="wpsc_buyer_email_sent" value="<?php echo esc_attr($email_sent_field_msg); ?>" readonly /></td>
123
  </tr>
124
  <tr>
125
- <td><?php _e("Item(s) Ordered:", "wordpress-simple-paypal-shopping-cart");?></td>
126
  <td><textarea name="wpspsc_items_ordered" cols="83" rows="5"><?php echo esc_attr($items_ordered); ?></textarea></td>
127
  </tr>
128
  <tr>
129
- <td><?php _e("Applied Coupon Code:", "wordpress-simple-paypal-shopping-cart");?></td>
130
  <td><input type="text" size="20" name="wpsc_applied_coupon" value="<?php echo esc_attr($applied_coupon); ?>" readonly /></td>
131
  </tr>
132
-
133
  </table>
134
  <?php
135
  }
@@ -138,62 +133,62 @@ function wpspc_order_review_meta_box($wpsc_cart_orders)
138
  * Save the order data from the edit order interface.
139
  * This function is hooked to save_post action. so it only gets executed for a logged in wp user
140
  */
141
- function wpspc_cart_save_orders( $order_id, $wpsc_cart_orders ) {
 
142
  // Check post type for movie reviews
143
- if ( $wpsc_cart_orders->post_type == 'wpsc_cart_orders' ) {
144
  // Store data in post meta table if present in post data
145
- if ( isset( $_POST['wpsc_first_name'] ) && $_POST['wpsc_first_name'] != '' ) {
146
  $first_name = sanitize_text_field($_POST['wpsc_first_name']);
147
- update_post_meta( $order_id, 'wpsc_first_name', $first_name );
148
  }
149
- if ( isset( $_POST['wpsc_last_name'] ) && $_POST['wpsc_last_name'] != '' ) {
150
  $last_name = sanitize_text_field($_POST['wpsc_last_name']);
151
- update_post_meta( $order_id, 'wpsc_last_name', $last_name );
152
  }
153
- if ( isset( $_POST['wpsc_email_address'] ) && $_POST['wpsc_email_address'] != '' ) {
154
  $email_address = sanitize_email($_POST['wpsc_email_address']);
155
- update_post_meta( $order_id, 'wpsc_email_address', $email_address );
156
  }
157
- if ( isset( $_POST['wpsc_ipaddress'] ) && $_POST['wpsc_ipaddress'] != '' ) {
158
  $ipaddress = sanitize_text_field($_POST['wpsc_ipaddress']);
159
- update_post_meta( $order_id, 'wpsc_ipaddress', $ipaddress );
160
  }
161
- if ( isset( $_POST['wpsc_total_amount'] ) && $_POST['wpsc_total_amount'] != '' ) {
162
  $total_amount = sanitize_text_field($_POST['wpsc_total_amount']);
163
- if(!is_numeric($total_amount)){
164
  wp_die('Error! Total amount must be a numeric number.');
165
  }
166
- update_post_meta( $order_id, 'wpsc_total_amount', $total_amount );
167
  }
168
- if ( isset( $_POST['wpsc_shipping_amount'] ) && $_POST['wpsc_shipping_amount'] != '' ) {
169
  $shipping_amount = sanitize_text_field($_POST['wpsc_shipping_amount']);
170
- if(!is_numeric($shipping_amount)){
171
  wp_die('Error! Shipping amount must be a numeric number.');
172
- }
173
- update_post_meta( $order_id, 'wpsc_shipping_amount', $shipping_amount );
174
  }
175
- if ( isset( $_POST['wpsc_address'] ) && $_POST['wpsc_address'] != '' ) {
176
  $address = sanitize_text_field($_POST['wpsc_address']);
177
- update_post_meta( $order_id, 'wpsc_address', $address );
178
  }
179
- if ( isset( $_POST['wpspsc_phone'] ) && $_POST['wpspsc_phone'] != '' ) {
180
  $phone = sanitize_text_field($_POST['wpspsc_phone']);
181
- update_post_meta( $order_id, 'wpspsc_phone', $phone );
182
  }
183
- if ( isset( $_POST['wpspsc_items_ordered'] ) && $_POST['wpspsc_items_ordered'] != '' ) {
184
  $items_ordered = stripslashes(esc_textarea($_POST['wpspsc_items_ordered']));
185
- update_post_meta( $order_id, 'wpspsc_items_ordered', $items_ordered );
186
  }
187
  }
188
  }
189
 
190
- add_filter( 'manage_edit-wpsc_cart_orders_columns', 'wpspc_orders_display_columns' );
191
- function wpspc_orders_display_columns( $columns )
192
- {
193
  //unset( $columns['title'] );
194
- unset( $columns['comments'] );
195
- unset( $columns['date'] );
196
- //$columns['wpsc_order_id'] = 'Order ID';
197
  $columns['title'] = __("Order ID", "wordpress-simple-paypal-shopping-cart");
198
  $columns['wpsc_first_name'] = __("First Name", "wordpress-simple-paypal-shopping-cart");
199
  $columns['wpsc_last_name'] = __("Last Name", "wordpress-simple-paypal-shopping-cart");
@@ -206,35 +201,78 @@ function wpspc_orders_display_columns( $columns )
206
 
207
  //add_action( 'manage_posts_custom_column', 'wpsc_populate_order_columns' , 10, 2);
208
  add_action('manage_wpsc_cart_orders_posts_custom_column', 'wpspc_populate_order_columns', 10, 2);
209
- function wpspc_populate_order_columns($column, $post_id)
210
- {
211
- if ( 'wpsc_first_name' == $column ) {
212
- $first_name = get_post_meta( $post_id, 'wpsc_first_name', true );
213
  echo esc_attr($first_name);
214
- }
215
- else if ( 'wpsc_last_name' == $column ) {
216
- $last_name = get_post_meta( $post_id, 'wpsc_last_name', true );
217
  echo esc_attr($last_name);
218
- }
219
- else if ( 'wpsc_email_address' == $column ) {
220
- $email = get_post_meta( $post_id, 'wpsc_email_address', true );
221
  echo esc_attr($email);
222
- }
223
- else if ( 'wpsc_total_amount' == $column ) {
224
- $total_amount = get_post_meta( $post_id, 'wpsc_total_amount', true );
225
  echo esc_attr($total_amount);
226
- }
227
- else if ( 'wpsc_order_status' == $column ) {
228
- $status = get_post_meta( $post_id, 'wpsc_order_status', true );
229
  echo esc_attr($status);
230
  }
231
  }
232
 
233
- function wpspsc_customize_order_link( $permalink, $post ) {
234
- if( $post->post_type == 'wpsc_cart_orders' ) { // assuming the post type is video
235
- $permalink = get_admin_url().'post.php?post='.$post->ID.'&action=edit';
 
 
236
  }
237
  return $permalink;
238
  }
239
- add_filter('post_type_link',"wpspsc_customize_order_link",10,2);
240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
 
2
  /*
3
  * This page handles the orders menu page in the admin dashboard
4
  */
5
 
6
+ add_action('save_post', 'wpspc_cart_save_orders', 10, 2);
7
+
8
+ function wpspc_create_orders_page() {
9
+ register_post_type('wpsc_cart_orders', array(
10
+ 'labels' => array(
11
+ 'name' => __("Cart Orders", "wordpress-simple-paypal-shopping-cart"),
12
+ 'singular_name' => __("Cart Order", "wordpress-simple-paypal-shopping-cart"),
13
+ 'add_new' => __("Add New", "wordpress-simple-paypal-shopping-cart"),
14
+ 'add_new_item' => __("Add New Order", "wordpress-simple-paypal-shopping-cart"),
15
+ 'edit' => __("Edit", "wordpress-simple-paypal-shopping-cart"),
16
+ 'edit_item' => __("Edit Order", "wordpress-simple-paypal-shopping-cart"),
17
+ 'new_item' => __("New Order", "wordpress-simple-paypal-shopping-cart"),
18
+ 'view' => __("View", "wordpress-simple-paypal-shopping-cart"),
19
+ 'view_item' => __("View Order", "wordpress-simple-paypal-shopping-cart"),
20
+ 'search_items' => __("Search Order", "wordpress-simple-paypal-shopping-cart"),
21
+ 'not_found' => __("No order found", "wordpress-simple-paypal-shopping-cart"),
22
+ 'not_found_in_trash' => __("No order found in Trash", "wordpress-simple-paypal-shopping-cart"),
23
+ 'parent' => __("Parent Order", "wordpress-simple-paypal-shopping-cart")
24
+ ),
25
+ 'public' => true,
26
+ 'menu_position' => 80,
27
+ 'supports' => false,
28
+ 'taxonomies' => array(''),
29
+ 'menu_icon' => 'dashicons-cart',
30
+ 'has_archive' => true
31
+ )
 
 
 
32
  );
33
  }
34
 
35
+ function wpspc_add_meta_boxes() {
36
+ add_meta_box('order_review_meta_box', __("Order Review", "wordpress-simple-paypal-shopping-cart"), 'wpspc_order_review_meta_box', 'wpsc_cart_orders', 'normal', 'high'
 
 
 
 
 
 
37
  );
38
  }
39
 
40
+ function wpspc_order_review_meta_box($wpsc_cart_orders) {
 
41
  $order_id = $wpsc_cart_orders->ID;
42
+ $first_name = get_post_meta($wpsc_cart_orders->ID, 'wpsc_first_name', true);
43
+ $last_name = get_post_meta($wpsc_cart_orders->ID, 'wpsc_last_name', true);
44
+ $email = get_post_meta($wpsc_cart_orders->ID, 'wpsc_email_address', true);
45
+ $txn_id = get_post_meta($wpsc_cart_orders->ID, 'wpsc_txn_id', true);
46
+ $ip_address = get_post_meta($wpsc_cart_orders->ID, 'wpsc_ipaddress', true);
47
+ $total_amount = get_post_meta($wpsc_cart_orders->ID, 'wpsc_total_amount', true);
48
+ $shipping_amount = get_post_meta($wpsc_cart_orders->ID, 'wpsc_shipping_amount', true);
49
+ $address = get_post_meta($wpsc_cart_orders->ID, 'wpsc_address', true);
50
+ $phone = get_post_meta($wpsc_cart_orders->ID, 'wpspsc_phone', true);
51
+ $email_sent_value = get_post_meta($wpsc_cart_orders->ID, 'wpsc_buyer_email_sent', true);
52
+
53
  $email_sent_field_msg = "No";
54
+ if (!empty($email_sent_value)) {
55
+ $email_sent_field_msg = "Yes. " . $email_sent_value;
56
  }
57
+
58
+ $items_ordered = get_post_meta($wpsc_cart_orders->ID, 'wpspsc_items_ordered', true);
59
+ $applied_coupon = get_post_meta($wpsc_cart_orders->ID, 'wpsc_applied_coupon', true);
60
  ?>
61
  <table>
62
+ <p><?php
63
+ _e("Order ID: #", "wordpress-simple-paypal-shopping-cart");
64
+ echo esc_attr($order_id);
65
+ ?></p>
66
+ <?php if ($txn_id) { ?>
67
+ <p><?php
68
+ _e("Transaction ID: #", "wordpress-simple-paypal-shopping-cart");
69
+ echo esc_attr($txn_id);
70
+ ?></p>
71
  <?php } ?>
72
  <tr>
73
+ <td><?php _e("First Name", "wordpress-simple-paypal-shopping-cart"); ?></td>
74
  <td><input type="text" size="40" name="wpsc_first_name" value="<?php echo esc_attr($first_name); ?>" /></td>
75
  </tr>
76
  <tr>
77
+ <td><?php _e("Last Name", "wordpress-simple-paypal-shopping-cart"); ?></td>
78
  <td><input type="text" size="40" name="wpsc_last_name" value="<?php echo esc_attr($last_name); ?>" /></td>
79
  </tr>
80
  <tr>
81
+ <td><?php _e("Email Address", "wordpress-simple-paypal-shopping-cart"); ?></td>
82
  <td><input type="text" size="40" name="wpsc_email_address" value="<?php echo esc_attr($email); ?>" /></td>
83
  </tr>
84
  <tr>
85
+ <td><?php _e("IP Address", "wordpress-simple-paypal-shopping-cart"); ?></td>
86
  <td><input type="text" size="40" name="wpsc_ipaddress" value="<?php echo esc_attr($ip_address); ?>" /></td>
87
  </tr>
88
  <tr>
89
+ <td><?php _e("Total", "wordpress-simple-paypal-shopping-cart"); ?></td>
90
  <td><input type="text" size="20" name="wpsc_total_amount" value="<?php echo esc_attr($total_amount); ?>" /></td>
91
  </tr>
92
  <tr>
93
+ <td><?php _e("Shipping", "wordpress-simple-paypal-shopping-cart"); ?></td>
94
  <td><input type="text" size="20" name="wpsc_shipping_amount" value="<?php echo esc_attr($shipping_amount); ?>" /></td>
95
  </tr>
96
  <tr>
97
+ <td><?php _e("Address", "wordpress-simple-paypal-shopping-cart"); ?></td>
98
  <td>
99
+ <textarea name="wpsc_address" cols="83" rows="2"><?php echo esc_attr($address); ?></textarea>
100
  <p class="description">
101
  <?php _e("An address value will only be present if the order has physical item(s) with shipping amount. ", "wordpress-simple-paypal-shopping-cart"); ?>
102
  <?php _e("If you want to collect address for all orders then enable the 'Must Collect Shipping Address on PayPal' option from the plugin settings.", "wordpress-simple-paypal-shopping-cart"); ?>
104
  </td>
105
  </tr>
106
  <tr>
107
+ <td><?php _e("Phone", "wordpress-simple-paypal-shopping-cart"); ?></td>
108
  <td>
109
  <input type="text" size="40" name="wpspsc_phone" value="<?php echo esc_attr($phone); ?>" />
110
  <p class="description">
113
  </td>
114
  </tr>
115
  <tr>
116
+ <td><?php _e("Buyer Email Sent?", "wordpress-simple-paypal-shopping-cart"); ?></td>
117
  <td><input type="text" size="80" name="wpsc_buyer_email_sent" value="<?php echo esc_attr($email_sent_field_msg); ?>" readonly /></td>
118
  </tr>
119
  <tr>
120
+ <td><?php _e("Item(s) Ordered:", "wordpress-simple-paypal-shopping-cart"); ?></td>
121
  <td><textarea name="wpspsc_items_ordered" cols="83" rows="5"><?php echo esc_attr($items_ordered); ?></textarea></td>
122
  </tr>
123
  <tr>
124
+ <td><?php _e("Applied Coupon Code:", "wordpress-simple-paypal-shopping-cart"); ?></td>
125
  <td><input type="text" size="20" name="wpsc_applied_coupon" value="<?php echo esc_attr($applied_coupon); ?>" readonly /></td>
126
  </tr>
127
+
128
  </table>
129
  <?php
130
  }
133
  * Save the order data from the edit order interface.
134
  * This function is hooked to save_post action. so it only gets executed for a logged in wp user
135
  */
136
+
137
+ function wpspc_cart_save_orders($order_id, $wpsc_cart_orders) {
138
  // Check post type for movie reviews
139
+ if ($wpsc_cart_orders->post_type == 'wpsc_cart_orders') {
140
  // Store data in post meta table if present in post data
141
+ if (isset($_POST['wpsc_first_name']) && $_POST['wpsc_first_name'] != '') {
142
  $first_name = sanitize_text_field($_POST['wpsc_first_name']);
143
+ update_post_meta($order_id, 'wpsc_first_name', $first_name);
144
  }
145
+ if (isset($_POST['wpsc_last_name']) && $_POST['wpsc_last_name'] != '') {
146
  $last_name = sanitize_text_field($_POST['wpsc_last_name']);
147
+ update_post_meta($order_id, 'wpsc_last_name', $last_name);
148
  }
149
+ if (isset($_POST['wpsc_email_address']) && $_POST['wpsc_email_address'] != '') {
150
  $email_address = sanitize_email($_POST['wpsc_email_address']);
151
+ update_post_meta($order_id, 'wpsc_email_address', $email_address);
152
  }
153
+ if (isset($_POST['wpsc_ipaddress']) && $_POST['wpsc_ipaddress'] != '') {
154
  $ipaddress = sanitize_text_field($_POST['wpsc_ipaddress']);
155
+ update_post_meta($order_id, 'wpsc_ipaddress', $ipaddress);
156
  }
157
+ if (isset($_POST['wpsc_total_amount']) && $_POST['wpsc_total_amount'] != '') {
158
  $total_amount = sanitize_text_field($_POST['wpsc_total_amount']);
159
+ if (!is_numeric($total_amount)) {
160
  wp_die('Error! Total amount must be a numeric number.');
161
  }
162
+ update_post_meta($order_id, 'wpsc_total_amount', $total_amount);
163
  }
164
+ if (isset($_POST['wpsc_shipping_amount']) && $_POST['wpsc_shipping_amount'] != '') {
165
  $shipping_amount = sanitize_text_field($_POST['wpsc_shipping_amount']);
166
+ if (!is_numeric($shipping_amount)) {
167
  wp_die('Error! Shipping amount must be a numeric number.');
168
+ }
169
+ update_post_meta($order_id, 'wpsc_shipping_amount', $shipping_amount);
170
  }
171
+ if (isset($_POST['wpsc_address']) && $_POST['wpsc_address'] != '') {
172
  $address = sanitize_text_field($_POST['wpsc_address']);
173
+ update_post_meta($order_id, 'wpsc_address', $address);
174
  }
175
+ if (isset($_POST['wpspsc_phone']) && $_POST['wpspsc_phone'] != '') {
176
  $phone = sanitize_text_field($_POST['wpspsc_phone']);
177
+ update_post_meta($order_id, 'wpspsc_phone', $phone);
178
  }
179
+ if (isset($_POST['wpspsc_items_ordered']) && $_POST['wpspsc_items_ordered'] != '') {
180
  $items_ordered = stripslashes(esc_textarea($_POST['wpspsc_items_ordered']));
181
+ update_post_meta($order_id, 'wpspsc_items_ordered', $items_ordered);
182
  }
183
  }
184
  }
185
 
186
+ add_filter('manage_edit-wpsc_cart_orders_columns', 'wpspc_orders_display_columns');
187
+
188
+ function wpspc_orders_display_columns($columns) {
189
  //unset( $columns['title'] );
190
+ unset($columns['comments']);
191
+ unset($columns['date']);
 
192
  $columns['title'] = __("Order ID", "wordpress-simple-paypal-shopping-cart");
193
  $columns['wpsc_first_name'] = __("First Name", "wordpress-simple-paypal-shopping-cart");
194
  $columns['wpsc_last_name'] = __("Last Name", "wordpress-simple-paypal-shopping-cart");
201
 
202
  //add_action( 'manage_posts_custom_column', 'wpsc_populate_order_columns' , 10, 2);
203
  add_action('manage_wpsc_cart_orders_posts_custom_column', 'wpspc_populate_order_columns', 10, 2);
204
+
205
+ function wpspc_populate_order_columns($column, $post_id) {
206
+ if ('wpsc_first_name' == $column) {
207
+ $first_name = get_post_meta($post_id, 'wpsc_first_name', true);
208
  echo esc_attr($first_name);
209
+ } else if ('wpsc_last_name' == $column) {
210
+ $last_name = get_post_meta($post_id, 'wpsc_last_name', true);
 
211
  echo esc_attr($last_name);
212
+ } else if ('wpsc_email_address' == $column) {
213
+ $email = get_post_meta($post_id, 'wpsc_email_address', true);
 
214
  echo esc_attr($email);
215
+ } else if ('wpsc_total_amount' == $column) {
216
+ $total_amount = get_post_meta($post_id, 'wpsc_total_amount', true);
 
217
  echo esc_attr($total_amount);
218
+ } else if ('wpsc_order_status' == $column) {
219
+ $status = get_post_meta($post_id, 'wpsc_order_status', true);
 
220
  echo esc_attr($status);
221
  }
222
  }
223
 
224
+ add_filter('post_type_link', "wpspsc_customize_order_link", 10, 2);
225
+
226
+ function wpspsc_customize_order_link($permalink, $post) {
227
+ if ($post->post_type == 'wpsc_cart_orders') { //The post type is cart orders
228
+ $permalink = get_admin_url() . 'post.php?post=' . $post->ID . '&action=edit';
229
  }
230
  return $permalink;
231
  }
 
232
 
233
+ add_filter('posts_join', 'wp_cart_search_join');
234
+
235
+ function wp_cart_search_join($join) {
236
+ // this function joins postmeta table to the search results in order for us to be able to search post meta values as well
237
+ global $pagenow, $wpdb;
238
+ if (is_admin() && $pagenow == 'edit.php' && (isset($_GET['post_type']) && $_GET['post_type'] == 'wpsc_cart_orders') && (isset($_GET['s']) && $_GET['s'] != '')) {
239
+ $join .= 'LEFT JOIN ' . $wpdb->postmeta . ' ON ' . $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';
240
+ }
241
+ return $join;
242
+ }
243
+
244
+ add_filter('posts_where', 'wp_cart_search_where');
245
+
246
+ function wp_cart_search_where($where) {
247
+ global $pagenow, $wpdb;
248
+ if (is_admin() && $pagenow == 'edit.php' && (isset($_GET['post_type']) && $_GET['post_type'] == 'wpsc_cart_orders') && (isset($_GET['s']) && $_GET['s'] != '')) {
249
+ $where = preg_replace(
250
+ "/\(\s*" . $wpdb->posts . ".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/", "(" . $wpdb->postmeta . ".meta_key=\"wpsc_first_name\" AND " . $wpdb->postmeta . ".meta_value LIKE $1)"
251
+ . " OR (" . $wpdb->postmeta . ".meta_key=\"wpsc_last_name\" AND " . $wpdb->postmeta . ".meta_value LIKE $1)"
252
+ . " OR (" . $wpdb->postmeta . ".meta_key=\"wpsc_email_address\" AND " . $wpdb->postmeta . ".meta_value LIKE $1)"
253
+ , $where);
254
+ }
255
+ return $where;
256
+ }
257
+
258
+ add_filter('posts_distinct', 'wp_cart_search_distinct');
259
+
260
+ function wp_cart_search_distinct($where) {
261
+ // this function removes duplicates in search results
262
+ global $pagenow;
263
+
264
+ if (is_admin() && $pagenow == 'edit.php' && (isset($_GET['post_type']) && $_GET['post_type'] == 'wpsc_cart_orders') && (isset($_GET['s']) && $_GET['s'] != '')) {
265
+ return "DISTINCT";
266
+ }
267
+ return $where;
268
+ }
269
+
270
+ add_filter('title_save_pre', 'wp_cart_save_title');
271
+
272
+ function wp_cart_save_title($post_title) {
273
+ //this function replaces title with post_ID in wpsc_cart_orders to avoid WP from assigning "Auto Draft" title to the post
274
+ if (isset($_POST['post_type']) && $_POST['post_type'] == 'wpsc_cart_orders') {
275
+ $post_title = $_POST['post_ID'];
276
+ }
277
+ return $post_title;
278
+ }
wp_shopping_cart_settings.php CHANGED
@@ -11,10 +11,10 @@ function wp_cart_options() {
11
  }
12
 
13
  $wpspc_plugin_tabs = array(
14
- 'wordpress-paypal-shopping-cart' => 'General Settings',
15
- 'wordpress-paypal-shopping-cart&action=email-settings' => 'Email Settings',
16
- 'wordpress-paypal-shopping-cart&action=discount-settings' => 'Coupon/Discount',
17
- 'wordpress-paypal-shopping-cart&action=tools' => 'Tools'
18
  );
19
  echo '<div class="wrap">';
20
  echo '<h1>' . (__("WP Paypal Shopping Cart Options", "wordpress-simple-paypal-shopping-cart")) . '</h1>';
11
  }
12
 
13
  $wpspc_plugin_tabs = array(
14
+ 'wordpress-paypal-shopping-cart' => __('General Settings', 'wordpress-simple-paypal-shopping-cart'),
15
+ 'wordpress-paypal-shopping-cart&action=email-settings' => __('Email Settings', 'wordpress-simple-paypal-shopping-cart'),
16
+ 'wordpress-paypal-shopping-cart&action=discount-settings' => __('Coupon/Discount', 'wordpress-simple-paypal-shopping-cart'),
17
+ 'wordpress-paypal-shopping-cart&action=tools' => __('Tools', 'wordpress-simple-paypal-shopping-cart')
18
  );
19
  echo '<div class="wrap">';
20
  echo '<h1>' . (__("WP Paypal Shopping Cart Options", "wordpress-simple-paypal-shopping-cart")) . '</h1>';
wp_shopping_cart_shortcodes.php CHANGED
@@ -17,6 +17,7 @@ function wp_cart_button_handler($atts){
17
  'var2' => '',
18
  'var3' => '',
19
  'thumbnail' => '',
 
20
  'button_image' => '',
21
  'file_url' => '',
22
  'stamp_pdf' => '',
@@ -48,6 +49,7 @@ function wp_cart_display_product_handler($atts)
48
  'thumb_target' => '',
49
  'thumb_alt' => '',
50
  'description' => '',
 
51
  'button_image' => '',
52
  'file_url' => '',
53
  'stamp_pdf' => '',
17
  'var2' => '',
18
  'var3' => '',
19
  'thumbnail' => '',
20
+ 'button_text' => '',
21
  'button_image' => '',
22
  'file_url' => '',
23
  'stamp_pdf' => '',
49
  'thumb_target' => '',
50
  'thumb_alt' => '',
51
  'description' => '',
52
+ 'button_text' => '',
53
  'button_image' => '',
54
  'file_url' => '',
55
  'stamp_pdf' => '',
wp_shopping_cart_style.css CHANGED
@@ -153,4 +153,4 @@ text-decoration: none;
153
  color: #FFFFFF !important;
154
  text-decoration: none;
155
  }
156
- /* End of compact cart 2 css */
153
  color: #FFFFFF !important;
154
  text-decoration: none;
155
  }
156
+ /* End of compact cart 2 css */