WordPress Simple PayPal Shopping Cart - Version 4.2.8

Version Description

  • Fixed an issue with the {payer_email} tag not working in the buyer notification email.
Download this release

Release Info

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

Code changes from version 4.2.4 to 4.2.8

includes/wspsc-cart-functions.php CHANGED
@@ -61,7 +61,9 @@ function print_wp_shopping_cart($args = array()) {
61
  global $plugin_dir_name;
62
  $output .= '<div class="shopping_cart">';
63
  if (!get_option('wp_shopping_cart_image_hide')) {
64
- $output .= "<img src='" . WP_CART_URL . "/images/shopping_cart_icon.png' class='wspsc_cart_header_image' value='" . (__("Cart", "wordpress-simple-paypal-shopping-cart")) . "' alt='" . (__("Cart", "wordpress-simple-paypal-shopping-cart")) . "' />";
 
 
65
  }
66
  if (!empty($title)) {
67
  $output .= '<h2>';
61
  global $plugin_dir_name;
62
  $output .= '<div class="shopping_cart">';
63
  if (!get_option('wp_shopping_cart_image_hide')) {
64
+ $cart_icon_img_src = WP_CART_URL . "/images/shopping_cart_icon.png";
65
+ $cart_icon_img_src = apply_filters('wspsc_cart_icon_image_src', $cart_icon_img_src);
66
+ $output .= "<img src='" . $cart_icon_img_src . "' class='wspsc_cart_header_image' value='" . (__("Cart", "wordpress-simple-paypal-shopping-cart")) . "' alt='" . (__("Cart", "wordpress-simple-paypal-shopping-cart")) . "' />";
67
  }
68
  if (!empty($title)) {
69
  $output .= '<h2>';
paypal.php CHANGED
@@ -235,12 +235,15 @@ class paypal_ipn_handler {
235
  $shipping = wpspsc_number_format_price($shipping);
236
  }
237
  update_post_meta( $post_id, 'wpsc_shipping_amount', $shipping);
 
 
238
  $args = array();
239
  $args['product_details'] = $product_details;
240
  $args['order_id'] = $post_id;
241
  $args['coupon_code'] = $applied_coupon_code;
242
  $args['address'] = $address;
243
- update_post_meta($post_id, 'wpspsc_items_ordered', $product_details);
 
244
  $from_email = get_option('wpspc_buyer_from_email');
245
  $subject = get_option('wpspc_buyer_email_subj');
246
  $body = get_option('wpspc_buyer_email_body');
@@ -252,7 +255,6 @@ class paypal_ipn_handler {
252
 
253
  $headers = 'From: '.$from_email . "\r\n";
254
  if(!empty($buyer_email)){
255
- $args['payer_email'] = $buyer_email;
256
  if(get_option('wpspc_send_buyer_email'))
257
  {
258
  wp_mail($buyer_email, $subject, $body, $headers);
235
  $shipping = wpspsc_number_format_price($shipping);
236
  }
237
  update_post_meta( $post_id, 'wpsc_shipping_amount', $shipping);
238
+ update_post_meta( $post_id, 'wpspsc_items_ordered', $product_details);
239
+
240
  $args = array();
241
  $args['product_details'] = $product_details;
242
  $args['order_id'] = $post_id;
243
  $args['coupon_code'] = $applied_coupon_code;
244
  $args['address'] = $address;
245
+ $args['payer_email'] = $buyer_email;
246
+
247
  $from_email = get_option('wpspc_buyer_from_email');
248
  $subject = get_option('wpspc_buyer_email_subj');
249
  $body = get_option('wpspc_buyer_email_body');
255
 
256
  $headers = 'From: '.$from_email . "\r\n";
257
  if(!empty($buyer_email)){
 
258
  if(get_option('wpspc_send_buyer_email'))
259
  {
260
  wp_mail($buyer_email, $subject, $body, $headers);
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WordPress Simple Paypal Shopping Cart ===
2
- Contributors: Tips and Tricks HQ, Ruhul Amin, wptipsntricks, mbrsolution
3
  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.5
7
- Stable tag: 4.2.4
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.
@@ -15,7 +15,7 @@ WordPress Simple Paypal Shopping Cart allows you to add an 'Add to Cart' button
15
 
16
  It also allows you to add/display the shopping cart on any post or page or sidebar easily. The shopping cart shows the user what they currently have in the cart and allows them to change quantity or remove the items.
17
 
18
- http://www.youtube.com/watch?v=tEZWfTmZ2kk
19
 
20
  You will be able to create products by using shortcodes dynamically.
21
 
@@ -87,7 +87,7 @@ The following language translations are already available:
87
  * Turkish
88
  * Dutch
89
 
90
- You can translate the plugin using [this documentation](http://www.tipsandtricks-hq.com/ecommerce/translating-the-wp-simple-shopping-cart-plugin-2627).
91
 
92
  = Note =
93
 
@@ -157,9 +157,9 @@ example usage: [wp_cart_button name="Test Product" price="29.95" var1="Size|smal
157
  5. Is the 'Add to Cart' button customizable? Yes.
158
  6. Does this plugin use a return URL to redirect customers to a specified page after Paypal has processed the payment? Yes.
159
  7. How can I add a buy button on the sidebar widget of my site?
160
- Check the documentation on [how to add buy buttons to the sidebar](http://www.tipsandtricks-hq.com/ecommerce/wordpress-shopping-cart-additional-resources-322#add_button_in_sidebar)
161
  8. Can I use this plugin to sell digital downloads?
162
- Yes. See the [digital download usage documentation] (http://www.tipsandtricks-hq.com/ecommerce/wp-simple-cart-sell-digital-downloads-2468)
163
  9. Can I configure discount coupon with this shopping cart plugin?
164
  Yes. you can setup discount coupons from the "Coupon/Discount" interface of the plugin.
165
  10. Can I configure product sale notification so I get notified when a sale is made?
@@ -180,11 +180,26 @@ None
180
 
181
  == Changelog ==
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  = 4.2.4 =
184
- - Added a new filter for the checkout button image (wspsc_cart_checkout_button_image_src). It can used to specify a custom button image for the checkout button.
185
  Example code: https://www.tipsandtricks-hq.com/ecommerce/customize-the-paypal-checkout-button-image-4026
186
  - Incomplete old cart orders will now be automatically cleaned by the plugin.
187
- - Made some improvements to the PayPal IPN validation code.
188
 
189
  = 4.2.2 =
190
  - Minor update for backwards compatibility with an old shortcode.
1
  === WordPress Simple Paypal Shopping Cart ===
2
+ Contributors: Tips and Tricks HQ, Ruhul Amin, wptipsntricks, mbrsolution, mra13
3
  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.6
7
+ Stable tag: 4.2.8
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.
15
 
16
  It also allows you to add/display the shopping cart on any post or page or sidebar easily. The shopping cart shows the user what they currently have in the cart and allows them to change quantity or remove the items.
17
 
18
+ https://www.youtube.com/watch?v=tEZWfTmZ2kk
19
 
20
  You will be able to create products by using shortcodes dynamically.
21
 
87
  * Turkish
88
  * Dutch
89
 
90
+ You can translate the plugin using [this documentation](https://www.tipsandtricks-hq.com/ecommerce/translating-the-wp-simple-shopping-cart-plugin-2627).
91
 
92
  = Note =
93
 
157
  5. Is the 'Add to Cart' button customizable? Yes.
158
  6. Does this plugin use a return URL to redirect customers to a specified page after Paypal has processed the payment? Yes.
159
  7. How can I add a buy button on the sidebar widget of my site?
160
+ Check the documentation on [how to add buy buttons to the sidebar](https://www.tipsandtricks-hq.com/ecommerce/wordpress-shopping-cart-additional-resources-322#add_button_in_sidebar)
161
  8. Can I use this plugin to sell digital downloads?
162
+ Yes. See the [digital download usage documentation] (https://www.tipsandtricks-hq.com/ecommerce/wp-simple-cart-sell-digital-downloads-2468)
163
  9. Can I configure discount coupon with this shopping cart plugin?
164
  Yes. you can setup discount coupons from the "Coupon/Discount" interface of the plugin.
165
  10. Can I configure product sale notification so I get notified when a sale is made?
180
 
181
  == Changelog ==
182
 
183
+ = 4.2.8 =
184
+ - Fixed an issue with the {payer_email} tag not working in the buyer notification email.
185
+
186
+ = 4.2.7 =
187
+ - Added a new filter for the cart icon image (wspsc_cart_icon_image_src). It can be used to customize the cart icon image.
188
+ - Added escaping for the cart link parameter.
189
+
190
+ = 4.2.6 =
191
+ - Added a new email merge tag for phone number (when available). The new email tag is {phone}. Note that the phone number is an optional field on PayPal checkout page. So it may not be present if the customer doesn't enter a phone number during the checkout.
192
+ - Added a new shortcode parameter (thumb_alt) for the product box shortcode. It can be used to specify an alt tag for the product thumbnail image.
193
+ - Added url_decode in the cart link parameter. So the link works even when the URL contains foreign characters.
194
+
195
+ = 4.2.5 =
196
+ - Minor update for backwards compatibility with an old shortcode using variation.
197
+
198
  = 4.2.4 =
199
+ - Added a new filter for the checkout button image. It can be used to specify a custom button image for the checkout button.
200
  Example code: https://www.tipsandtricks-hq.com/ecommerce/customize-the-paypal-checkout-button-image-4026
201
  - Incomplete old cart orders will now be automatically cleaned by the plugin.
202
+ - Made some improvements to the PayPal IPN validation code. It is fully compatible with the upcoming PayPal IPN changes.
203
 
204
  = 4.2.2 =
205
  - Minor update for backwards compatibility with an old shortcode.
wp_shopping_cart.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
  Plugin Name: WP Simple Paypal Shopping cart
4
- Version: 4.2.4
5
  Plugin URI: https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768
6
- Author: Tips and Tricks HQ, Ruhul Amin
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
@@ -26,7 +26,7 @@ if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
26
  }
27
  }
28
 
29
- define('WP_CART_VERSION', '4.2.4');
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__));
@@ -133,7 +133,7 @@ function wpspc_cart_actions_handler() {
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']) : '';
136
- $post_cart_link = isset($_POST['cartLink']) ? esc_url_raw(sanitize_text_field($_POST['cartLink'])) : '';
137
  $post_stamp_pdf = isset($_POST['stamp_pdf']) ? sanitize_text_field($_POST['stamp_pdf']) : '';
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'])) : '';
@@ -355,11 +355,9 @@ function print_wp_cart_button_new($content) {
355
  // Variation control is used
356
  $pos2 = strpos($match, ":var2");
357
  if ($pos2) {
358
- //echo '<br />'.$match_tmp.'<br />';
359
  $pattern = '#var2\[.*]:#';
360
  preg_match_all($pattern, $match_tmp, $matches3);
361
  $match3 = $matches3[0][0];
362
- //echo '<br />'.$match3.'<br />';
363
  $match_tmp = str_replace($match3, '', $match_tmp);
364
 
365
  $pattern = 'var2[';
@@ -429,7 +427,10 @@ function print_wp_cart_button_new($content) {
429
  $replacement .= '<input type="hidden" name="wspsc_product" value="' . $pieces['0'] . '" /><input type="hidden" name="price" value="' . $pieces['1'] . '" />';
430
  $replacement .= '<input type="hidden" name="product_tmp" value="' . $pieces['0'] . '" />';
431
  if (sizeof($pieces) > 2) {
432
- //we have shipping
 
 
 
433
  $replacement .= '<input type="hidden" name="shipping" value="' . $pieces['2'] . '" />';
434
  } else {
435
  //Set shipping to 0 by default (when no shipping is specified in the shortcode)
@@ -448,7 +449,7 @@ function print_wp_cart_button_new($content) {
448
  $hash_two = md5($p_key.'|'.$pieces['2']);//Shipping hash
449
  $replacement .= '<input type="hidden" name="hash_two" value="' . $hash_two . '" />';
450
 
451
- $replacement .= '<input type="hidden" name="cartLink" value="' . cart_current_page_url() . '" />';
452
  $replacement .= '<input type="hidden" name="addcart" value="1" /></form>';
453
  $replacement .= '</div>';
454
  $content = str_replace($match, $replacement, $content);
@@ -549,7 +550,11 @@ function print_wp_cart_button_for_product($name, $price, $shipping = 0, $var1 =
549
  }
550
  }
551
 
552
- $replacement .= '<input type="hidden" name="wspsc_product" value="' . $name . '" /><input type="hidden" name="price" value="' . $price . '" /><input type="hidden" name="shipping" value="' . $shipping . '" /><input type="hidden" name="addcart" value="1" /><input type="hidden" name="cartLink" value="' . cart_current_page_url() . '" />';
 
 
 
 
553
  $replacement .= '<input type="hidden" name="product_tmp" value="' . $name . '" />';
554
  isset($atts['item_number']) ? $item_num = $atts['item_number'] : $item_num = '';
555
  $replacement .= '<input type="hidden" name="item_number" value="' . $item_num . '" />';
1
  <?php
2
  /*
3
  Plugin Name: WP Simple Paypal Shopping cart
4
+ Version: 4.2.8
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
26
  }
27
  }
28
 
29
+ define('WP_CART_VERSION', '4.2.8');
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__));
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']) : '';
136
+ $post_cart_link = isset($_POST['cartLink']) ? esc_url_raw(sanitize_text_field(urldecode($_POST['cartLink']))) : '';
137
  $post_stamp_pdf = isset($_POST['stamp_pdf']) ? sanitize_text_field($_POST['stamp_pdf']) : '';
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'])) : '';
355
  // Variation control is used
356
  $pos2 = strpos($match, ":var2");
357
  if ($pos2) {
 
358
  $pattern = '#var2\[.*]:#';
359
  preg_match_all($pattern, $match_tmp, $matches3);
360
  $match3 = $matches3[0][0];
 
361
  $match_tmp = str_replace($match3, '', $match_tmp);
362
 
363
  $pattern = 'var2[';
427
  $replacement .= '<input type="hidden" name="wspsc_product" value="' . $pieces['0'] . '" /><input type="hidden" name="price" value="' . $pieces['1'] . '" />';
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)
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>';
455
  $content = str_replace($match, $replacement, $content);
550
  }
551
  }
552
 
553
+ $replacement .= '<input type="hidden" name="wspsc_product" value="' . $name . '" />';
554
+ $replacement .= '<input type="hidden" name="price" value="' . $price . '" />';
555
+ $replacement .= '<input type="hidden" name="shipping" value="' . $shipping . '" />';
556
+ $replacement .= '<input type="hidden" name="addcart" value="1" />';
557
+ $replacement .= '<input type="hidden" name="cartLink" value="' . esc_url(cart_current_page_url()) . '" />';
558
  $replacement .= '<input type="hidden" name="product_tmp" value="' . $name . '" />';
559
  isset($atts['item_number']) ? $item_num = $atts['item_number'] : $item_num = '';
560
  $replacement .= '<input type="hidden" name="item_number" value="' . $item_num . '" />';
wp_shopping_cart_misc_functions.php CHANGED
@@ -147,8 +147,8 @@ function wpspc_apply_dynamic_tags_on_email_body($ipn_data, $args)
147
  $order_id = $args['order_id'];
148
  $purchase_amount = get_post_meta( $order_id, 'wpsc_total_amount', true );
149
  $purchase_date = date("Y-m-d");
150
- $tags = array("{first_name}","{last_name}","{product_details}","{payer_email}","{transaction_id}","{purchase_amt}","{purchase_date}","{coupon_code}","{address}");
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']);
152
 
153
  $body = stripslashes(str_replace($tags, $vals, $args['email_body']));
154
  return $body;
147
  $order_id = $args['order_id'];
148
  $purchase_amount = get_post_meta( $order_id, 'wpsc_total_amount', true );
149
  $purchase_date = date("Y-m-d");
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;
wp_shopping_cart_settings.php CHANGED
@@ -19,9 +19,9 @@ function wp_cart_options()
19
 
20
  $current = "";
21
  if(isset($_GET['page'])){
22
- $current = $_GET['page'];
23
  if(isset($_GET['action'])){
24
- $current .= "&action=".$_GET['action'];
25
  }
26
  }
27
  $content = '';
19
 
20
  $current = "";
21
  if(isset($_GET['page'])){
22
+ $current = sanitize_text_field($_GET['page']);
23
  if(isset($_GET['action'])){
24
+ $current .= "&action=" . sanitize_text_field($_GET['action']);
25
  }
26
  }
27
  $content = '';
wp_shopping_cart_shortcodes.php CHANGED
@@ -39,6 +39,7 @@ function wp_cart_display_product_handler($atts)
39
  'var3' => '',
40
  'thumbnail' => '',
41
  'thumb_target' => '',
 
42
  'description' => '',
43
  'button_image' => '',
44
  'file_url' => '',
@@ -54,11 +55,16 @@ function wp_cart_display_product_handler($atts)
54
  if(empty($thumbnail)){
55
  return '<div style="color:red;">'.(__("Error! You must specify a thumbnail image for your product in the shortcode.", "wordpress-simple-paypal-shopping-cart")).'</div>';
56
  }
 
 
 
 
 
57
  $price = wspsc_strip_char_from_price_amount($price);
58
  $shipping = wspsc_strip_char_from_price_amount($shipping);
59
- $thumbnail_code = '<img src="'.$thumbnail.'">';
60
  if(!empty($thumb_target) && preg_match("/http/", $thumb_target)){
61
- $thumbnail_code = '<a href="'.$thumb_target.'"><img src="'.$thumbnail.'"></a>';
62
  }
63
  $thumbnail_code = apply_filters('wspsc_product_box_thumbnail_code', $thumbnail_code, $atts);
64
  $currency_symbol = WP_CART_CURRENCY_SYMBOL;
39
  'var3' => '',
40
  'thumbnail' => '',
41
  'thumb_target' => '',
42
+ 'thumb_alt' => '',
43
  'description' => '',
44
  'button_image' => '',
45
  'file_url' => '',
55
  if(empty($thumbnail)){
56
  return '<div style="color:red;">'.(__("Error! You must specify a thumbnail image for your product in the shortcode.", "wordpress-simple-paypal-shopping-cart")).'</div>';
57
  }
58
+ if(empty($thumb_alt)){
59
+ //Use the product name as alt if the thumb_alt is not defined.
60
+ $thumb_alt = $name;
61
+ }
62
+
63
  $price = wspsc_strip_char_from_price_amount($price);
64
  $shipping = wspsc_strip_char_from_price_amount($shipping);
65
+ $thumbnail_code = '<img src="'.$thumbnail.'" alt="'.$thumb_alt.'">';
66
  if(!empty($thumb_target) && preg_match("/http/", $thumb_target)){
67
+ $thumbnail_code = '<a href="'.$thumb_target.'"><img src="'.$thumbnail.'" alt="'.$thumb_alt.'"></a>';
68
  }
69
  $thumbnail_code = apply_filters('wspsc_product_box_thumbnail_code', $thumbnail_code, $atts);
70
  $currency_symbol = WP_CART_CURRENCY_SYMBOL;