WordPress Simple PayPal Shopping Cart - Version 3.8.5

Version Description

  • Added an email settings menu where the site admin can customize the buyer email that gets sent after a transaction
  • Also, added the following dynamic email tags for the email body field:

{first_name} First name of the buyer {last_name} Last name of the buyer {product_details} The item details of the purchased product (this will include the download link for digital items).

Download this release

Release Info

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

Code changes from version 3.8.4 to 3.8.5

paypal.php CHANGED
@@ -147,22 +147,37 @@ class paypal_ipn_handler {
147
$status = "Paid";
148
update_post_meta( $post_id, 'wpsc_order_status', $status );
149
$cart_items = get_post_meta( $post_id, 'wpsc_cart_items', true );
150
- $subject = "Thank you for the purchase";
151
- $body .= "Dear $first_name $last_name"."\n";
152
- $body .= "\nThank you for your purchase! You ordered the following item(s):\n";
153
if($cart_items){
154
foreach ($cart_items as $item){
155
- $body .= "\n".$item['name']." x ".$item['quantity']." - ".$currency_symbol.$item['price']."\n";
156
if($item['file_url']){
157
$file_url = base64_decode($item['file_url']);
158
- $body .= "Download Link: ".$file_url."\n";
159
}
160
}
161
}
162
if($buyer_email){
163
- wp_mail($buyer_email, $subject, $body);
164
- $this->debug_log('Product Email successfully sent to '.$buyer_email,true);
165
- update_post_meta( $post_id, 'wpsc_buyer_email_sent', 'Email sent to: '.$buyer_email);
166
}
167
}
168
147
$status = "Paid";
148
update_post_meta( $post_id, 'wpsc_order_status', $status );
149
$cart_items = get_post_meta( $post_id, 'wpsc_cart_items', true );
150
+ $product_details = "";
151
+ $item_counter = 1;
152
if($cart_items){
153
foreach ($cart_items as $item){
154
+ if($item_counter != 1){
155
+ $product_details .= "\n";
156
+ }
157
+ $product_details .= $item['name']." x ".$item['quantity']." - ".$currency_symbol.$item['price']."\n";
158
if($item['file_url']){
159
$file_url = base64_decode($item['file_url']);
160
+ $product_details .= "Download Link: ".$file_url."\n";
161
}
162
+ $item_counter++;
163
}
164
}
165
+ $args = array();
166
+ $args['product_details'] = $product_details;
167
+ $from_email = get_option('wpspc_buyer_from_email');
168
+ $subject = get_option('wpspc_buyer_email_subj');
169
+ $body = get_option('wpspc_buyer_email_body');
170
+ $args['email_body'] = $body;
171
+ $body = wpspc_apply_dynamic_tags_on_email_body($this->ipn_data, $args);
172
+
173
if($buyer_email){
174
+ if(get_option('wpspc_send_buyer_email'))
175
+ {
176
+ $headers = 'From: '.$from_email . "\r\n";
177
+ wp_mail($buyer_email, $subject, $body, $headers);
178
+ $this->debug_log('Product Email successfully sent to '.$buyer_email,true);
179
+ update_post_meta( $post_id, 'wpsc_buyer_email_sent', 'Email sent to: '.$buyer_email);
180
+ }
181
}
182
}
183
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.tipsandtricks-hq.com
4
Tags: cart, shopping cart, WordPress shopping cart, Paypal shopping cart, sell products, online shop, shop, e-commerce, wordpress ecommerce, wordpress store, store, PayPal cart widget, sell digital products, digital downloads, paypal, paypal cart, e-shop,
5
Requires at least: 3.0
6
Tested up to: 3.6
7
- Stable tag: 3.8.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,6 +15,8 @@ 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
It can be easily integrated with the NextGen Photo Gallery plugin to accommodate the selling of photographs from your gallery.
19
20
WP simple Paypal Cart Plugin, interfaces with the Paypal sandbox to allow for testing.
@@ -38,6 +40,7 @@ or
38
* You can use Paypal sandbox to do testing if needed (before you go live).
39
* Collect special instructions from your customers on the PayPal checkout page.
40
* The orders menu will show you all the orders that you have received from your site.
41
* Compatible with WordPress Multi-site Installation.
42
* and more...
43
@@ -115,6 +118,13 @@ Visit the plugin site at http://www.tipsandtricks-hq.com/?p=768 for screenshots.
115
None
116
117
== Changelog ==
118
119
= 3.8.4 =
120
- Fixing an issue that resulted from doing a commit when wordpress.org plugin repository was undergoing maintenance
4
Tags: cart, shopping cart, WordPress shopping cart, Paypal shopping cart, sell products, online shop, shop, e-commerce, wordpress ecommerce, wordpress store, store, PayPal cart widget, sell digital products, digital downloads, paypal, paypal cart, e-shop,
5
Requires at least: 3.0
6
Tested up to: 3.6
7
+ Stable tag: 3.8.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.
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
It can be easily integrated with the NextGen Photo Gallery plugin to accommodate the selling of photographs from your gallery.
21
22
WP simple Paypal Cart Plugin, interfaces with the Paypal sandbox to allow for testing.
40
* You can use Paypal sandbox to do testing if needed (before you go live).
41
* Collect special instructions from your customers on the PayPal checkout page.
42
* The orders menu will show you all the orders that you have received from your site.
43
+ * Ability to configure an email that will get sent to your buyers after they purchase your product.
44
* Compatible with WordPress Multi-site Installation.
45
* and more...
46
118
None
119
120
== Changelog ==
121
+ = 3.8.5 =
122
+ - Added an email settings menu where the site admin can customize the buyer email that gets sent after a transaction
123
+ - Also, added the following dynamic email tags for the email body field:
124
+
125
+ {first_name} – First name of the buyer
126
+ {last_name} – Last name of the buyer
127
+ {product_details} – The item details of the purchased product (this will include the download link for digital items).
128
129
= 3.8.4 =
130
- Fixing an issue that resulted from doing a commit when wordpress.org plugin repository was undergoing maintenance
wp_shopping_cart.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/*
3
Plugin Name: WP Simple Paypal Shopping cart
4
- Version: v3.8.4
5
Plugin URI: http://www.tipsandtricks-hq.com/?p=768
6
Author: Ruhul Amin
7
Author URI: http://www.tipsandtricks-hq.com/
@@ -9,25 +9,20 @@ Description: Simple WordPress Shopping Cart Plugin, very easy to use and great f
9
*/
10
11
if(!isset($_SESSION)){
12
- session_start();
13
}
14
15
- define('WP_CART_VERSION', '3.8.4');
16
define('WP_CART_FOLDER', dirname(plugin_basename(__FILE__)));
17
define('WP_CART_PATH',plugin_dir_path( __FILE__ ));
18
define('WP_CART_URL', plugins_url('',__FILE__));
19
define('WP_CART_SITE_URL',site_url());
20
-
21
define('WP_CART_LIVE_PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr');
22
define('WP_CART_SANDBOX_PAYPAL_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
23
24
// loading language files
25
load_plugin_textdomain('WSPSC', false, WP_CART_FOLDER . '/languages');
26
27
- add_option('wp_cart_title', __("Your Shopping Cart", "WSPSC"));
28
- add_option('wp_cart_empty_text', __("Your cart is empty", "WSPSC"));
29
- add_option('cart_return_from_paypal_url', get_bloginfo('wpurl'));
30
-
31
include_once('wp_shopping_cart_shortcodes.php');
32
include_once('wp_shopping_cart_misc_functions.php');
33
include_once('wp_shopping_cart_orders.php');
@@ -711,20 +706,11 @@ function simple_cart_total()
711
return number_format($grand_total,2);
712
}
713
714
- function wp_cart_options()
715
- {
716
- include_once('wp_shopping_cart_settings.php');
717
- echo '<div class="wrap"><h2>'.(__("WP Paypal Shopping Cart Options", "WSPSC")).'</h2>';
718
- echo '<div id="poststuff"><div id="post-body">';
719
- show_wp_cart_options_page();
720
- echo '</div></div>';
721
- echo '</div>';
722
- }
723
-
724
- // Display The Options Page
725
function wp_cart_options_page ()
726
{
727
- add_options_page(__("WP Paypal Shopping Cart", "WSPSC"), __("WP Shopping Cart", "WSPSC"), 'manage_options', __FILE__, 'wp_cart_options');
728
}
729
730
function wp_paypal_shopping_cart_load_widgets()
@@ -763,6 +749,12 @@ function wp_cart_css()
763
echo '<link type="text/css" rel="stylesheet" href="'.WP_CART_URL.'/wp_shopping_cart_style.css" />'."\n";
764
}
765
766
// Add the settings link
767
function wp_simple_cart_add_settings_link($links, $file)
768
{
1
<?php
2
/*
3
Plugin Name: WP Simple Paypal Shopping cart
4
+ Version: v3.8.5
5
Plugin URI: http://www.tipsandtricks-hq.com/?p=768
6
Author: Ruhul Amin
7
Author URI: http://www.tipsandtricks-hq.com/
9
*/
10
11
if(!isset($_SESSION)){
12
+ session_start();
13
}
14
15
+ define('WP_CART_VERSION', '3.8.5');
16
define('WP_CART_FOLDER', dirname(plugin_basename(__FILE__)));
17
define('WP_CART_PATH',plugin_dir_path( __FILE__ ));
18
define('WP_CART_URL', plugins_url('',__FILE__));
19
define('WP_CART_SITE_URL',site_url());
20
define('WP_CART_LIVE_PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr');
21
define('WP_CART_SANDBOX_PAYPAL_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
22
23
// loading language files
24
load_plugin_textdomain('WSPSC', false, WP_CART_FOLDER . '/languages');
25
26
include_once('wp_shopping_cart_shortcodes.php');
27
include_once('wp_shopping_cart_misc_functions.php');
28
include_once('wp_shopping_cart_orders.php');
706
return number_format($grand_total,2);
707
}
708
709
+ // Handle the options page display
710
function wp_cart_options_page ()
711
{
712
+ include_once('wp_shopping_cart_settings.php');
713
+ add_options_page(__("WP Paypal Shopping Cart", "WSPSC"), __("WP Shopping Cart", "WSPSC"), 'manage_options', 'wordpress-paypal-shopping-cart', 'wp_cart_options');
714
}
715
716
function wp_paypal_shopping_cart_load_widgets()
749
echo '<link type="text/css" rel="stylesheet" href="'.WP_CART_URL.'/wp_shopping_cart_style.css" />'."\n";
750
}
751
752
+ function wpspc_plugin_install()
753
+ {
754
+ wpspc_run_activation();
755
+ }
756
+ register_activation_hook(__FILE__,'wpspc_plugin_install');
757
+
758
// Add the settings link
759
function wp_simple_cart_add_settings_link($links, $file)
760
{
wp_shopping_cart_misc_functions.php CHANGED
@@ -131,4 +131,33 @@ function wpspc_update_cart_items_record()
131
$post_id = $_SESSION['simple_cart_id'];
132
update_post_meta( $post_id, 'wpsc_cart_items', $_SESSION['simpleCart']);
133
}
134
}
131
$post_id = $_SESSION['simple_cart_id'];
132
update_post_meta( $post_id, 'wpsc_cart_items', $_SESSION['simpleCart']);
133
}
134
+ }
135
+
136
+ function wpspc_apply_dynamic_tags_on_email_body($ipn_data, $args)
137
+ {
138
+ $tags = array("{first_name}","{last_name}","{product_details}");
139
+ $vals = array($ipn_data['first_name'], $ipn_data['last_name'], $args['product_details']);
140
+
141
+ $body = stripslashes(str_replace($tags, $vals, $args['email_body']));
142
+ return $body;
143
+ }
144
+
145
+ function wpspc_run_activation()
146
+ {
147
+ //General options
148
+ add_option('wp_cart_title', __("Your Shopping Cart", "WSPSC"));
149
+ add_option('wp_cart_empty_text', __("Your cart is empty", "WSPSC"));
150
+ add_option('cart_return_from_paypal_url', get_bloginfo('wpurl'));
151
+
152
+ //Add Confirmation Email Settings
153
+ add_option("wpspc_send_buyer_email", 1);
154
+ $from_email_address = get_bloginfo('name')." <sales@your-domain.com>";
155
+ add_option('wpspc_buyer_from_email', $from_email_address);
156
+ $buyer_email_subj = "Thank you for the purchase";
157
+ add_option('wpspc_buyer_email_subj', $buyer_email_subj);
158
+ $email_body .= "Dear {first_name} {last_name}"."\n";
159
+ $email_body .= "\nThank you for your purchase! You ordered the following item(s):\n";
160
+ $email_body .= "\n{product_details}";
161
+ add_option('wpspc_buyer_email_body', $email_body);
162
+
163
}
wp_shopping_cart_settings.php CHANGED
@@ -1,5 +1,47 @@
1
<?php
2
3
function show_wp_cart_options_page ()
4
{
5
if(isset($_POST['wspsc_reset_logfile'])) {
@@ -273,7 +315,7 @@ echo '
273
</div>
274
275
<div class="submit">
276
- <input type="submit" name="info_update" value="'.(__("Update Options &raquo;", "WSPSC")).'" />
277
</div>
278
</form>
279
';
@@ -285,3 +327,86 @@ echo '
285
</div>
286
<?php
287
}
1
<?php
2
3
+ function wp_cart_options()
4
+ {
5
+ $wpspc_plugin_tabs = array(
6
+ 'wordpress-paypal-shopping-cart' => 'General Settings',
7
+ 'wordpress-paypal-shopping-cart&action=email-settings' => 'Email Settings'
8
+ );
9
+ echo '<div class="wrap">'.screen_icon( ).'<h2>'.(__("WP Paypal Shopping Cart Options", "WSPSC")).'</h2>';
10
+ $current = "";
11
+ if(isset($_GET['page'])){
12
+ $current = $_GET['page'];
13
+ if(isset($_GET['action'])){
14
+ $current .= "&action=".$_GET['action'];
15
+ }
16
+ }
17
+ $content = '';
18
+ $content .= '<h2 class="nav-tab-wrapper">';
19
+ foreach($wpspc_plugin_tabs as $location => $tabname)
20
+ {
21
+ if($current == $location){
22
+ $class = ' nav-tab-active';
23
+ } else{
24
+ $class = '';
25
+ }
26
+ $content .= '<a class="nav-tab'.$class.'" href="?page='.$location.'">'.$tabname.'</a>';
27
+ }
28
+ $content .= '</h2>';
29
+ echo $content;
30
+ echo '<div id="poststuff"><div id="post-body">';
31
+
32
+ switch ($_GET['action'])
33
+ {
34
+ case 'email-settings':
35
+ show_wp_cart_email_settings_page();
36
+ break;
37
+ default:
38
+ show_wp_cart_options_page();
39
+ break;
40
+ }
41
+ echo '</div></div>';
42
+ echo '</div>';
43
+ }
44
+
45
function show_wp_cart_options_page ()
46
{
47
if(isset($_POST['wspsc_reset_logfile'])) {
315
</div>
316
317
<div class="submit">
318
+ <input type="submit" class="button-primary" name="info_update" value="'.(__("Update Options &raquo;", "WSPSC")).'" />
319
</div>
320
</form>
321
';
327
</div>
328
<?php
329
}
330
+
331
+ function show_wp_cart_email_settings_page()
332
+ {
333
+ if (isset($_POST['wpspc_email_settings_update']))
334
+ {
335
+ $nonce = $_REQUEST['_wpnonce'];
336
+ if ( !wp_verify_nonce($nonce, 'wpspc_email_settings_update')){
337
+ wp_die('Error! Nonce Security Check Failed! Go back to email settings menu and save the settings again.');
338
+ }
339
+ update_option('wpspc_send_buyer_email', ($_POST['wpspc_send_buyer_email']!='') ? 'checked="checked"':'' );
340
+ update_option('wpspc_buyer_from_email', stripslashes((string)$_POST["wpspc_buyer_from_email"]));
341
+ update_option('wpspc_buyer_email_subj', stripslashes((string)$_POST["wpspc_buyer_email_subj"]));
342
+ update_option('wpspc_buyer_email_body', stripslashes((string)$_POST["wpspc_buyer_email_body"]));;
343
+
344
+ echo '<div id="message" class="updated fade"><p><strong>';
345
+ echo 'Email Settings Updated!';
346
+ echo '</strong></p></div>';
347
+ }
348
+ $wpspc_send_buyer_email = '';
349
+ if (get_option('wpspc_send_buyer_email')){
350
+ $wpspc_send_buyer_email = 'checked="checked"';
351
+ }
352
+ $wpspc_buyer_from_email = get_option('wpspc_buyer_from_email');
353
+ $wpspc_buyer_email_subj = get_option('wpspc_buyer_email_subj');
354
+ $wpspc_buyer_email_body = get_option('wpspc_buyer_email_body');
355
+ ?>
356
+
357
+ <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;">
358
+ <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "WSPSC"); ?><br />
359
+ <a href="http://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "WSPSC"); ?></a></p>
360
+ </div>
361
+
362
+ <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
363
+ <?php wp_nonce_field('wpspc_email_settings_update'); ?>
364
+ <input type="hidden" name="info_update" id="info_update" value="true" />
365
+
366
+ <div class="postbox">
367
+ <h3><label for="title">Purchase Confirmation Email Settings</label></h3>
368
+ <div class="inside">
369
+
370
+ <p><i>The following options affect the emails that gets sent to your buyers after a purchase.</i></p>
371
+
372
+ <table class="form-table">
373
+
374
+ <tr valign="top">
375
+ <th scope="row">Send Emails to Buyer After Purchase</th>
376
+ <td><input type="checkbox" name="wpspc_send_buyer_email" value="1" <?php echo $wpspc_send_buyer_email; ?> /><span class="description"> If checked the plugin will send an email to the buyer with the sale details. If digital goods are purchased then the email will contain the download links for the purchased products.</a></span></td>
377
+ </tr>
378
+
379
+ <tr valign="top">
380
+ <th scope="row">From Email Address</th>
381
+ <td><input type="text" name="wpspc_buyer_from_email" value="<?php echo $wpspc_buyer_from_email; ?>" size="50" />
382
+ <br /><p class="description">Example: Your Name &lt;sales@your-domain.com&gt; This is the email address that will be used to send the email to the buyer. This name and email address will appear in the from field of the email.</p></td>
383
+ </tr>
384
+
385
+ <tr valign="top">
386
+ <th scope="row">Buyer Email Subject</th>
387
+ <td><input type="text" name="wpspc_buyer_email_subj" value="<?php echo $wpspc_buyer_email_subj; ?>" size="50" />
388
+ <br /><p class="description">This is the subject of the email that will be sent to the buyer.</p></td>
389
+ </tr>
390
+
391
+ <tr valign="top">
392
+ <th scope="row">Buyer Email Body</th>
393
+ <td>
394
+ <textarea name="wpspc_buyer_email_body" cols="90" rows="7"><?php echo $wpspc_buyer_email_body; ?></textarea>
395
+ <br /><p class="description">This is the body of the email that will be sent to the buyer. Do not change the text within the braces {}. You can use the following email tags in this email body field:
396
+ <br />{first_name} – First name of the buyer
397
+ <br />{last_name} – Last name of the buyer
398
+ <br />{product_details} – The item details of the purchased product (this will include the download link for digital items).
399
+ </p></td>
400
+ </tr>
401
+
402
+ </table>
403
+
404
+ </div></div>
405
+
406
+ <div class="submit">
407
+ <input type="submit" class="button-primary" name="wpspc_email_settings_update" value="<?php echo (__("Update Options &raquo;", "WSPSC")) ?>" />
408
+ </div>
409
+ </form>
410
+
411
+ <?php
412
+ }