WordPress Simple PayPal Shopping Cart - Version 3.8.2

Version Description

None

Download this release

Release Info

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

Code changes from version 3.8.1 to 3.8.2

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.1
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.
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.2
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.
wp_shopping_cart.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WP Simple Paypal Shopping cart
4
- Version: v3.8.1
5
  Plugin URI: http://www.tipsandtricks-hq.com/?p=768
6
  Author: Ruhul Amin
7
  Author URI: http://www.tipsandtricks-hq.com/
@@ -12,7 +12,7 @@ if(!isset($_SESSION)){
12
  session_start();
13
  }
14
 
15
- define('WP_CART_VERSION', '3.8.1');
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__));
@@ -106,154 +106,132 @@ function reset_wp_cart()
106
  unset($_SESSION['simple_cart_id']);
107
  }
108
 
109
- if (isset($_POST['addcart']))
110
  {
111
- $domain_url = $_SERVER['SERVER_NAME'];
112
- $cookie_domain = str_replace("www","",$domain_url);
113
- setcookie("cart_in_use","true",time()+21600,"/",$cookie_domain); //useful to not serve cached page when using with a caching plugin
114
-
115
- //sanitize data
116
- $_POST['product'] = strip_tags($_POST['product']);//for PHP5.2 use filter_var($_POST['product'], FILTER_SANITIZE_STRING);
117
- $_POST['item_number'] = strip_tags($_POST['item_number']);
118
- if(isset($_POST['price']))$_POST['price'] = strip_tags($_POST['price']);
119
- isset($_POST['shipping'])?$_POST['shipping'] = strip_tags($_POST['shipping']):$_POST['shipping']='';
120
- isset($_POST['cartLink'])?$_POST['cartLink'] = strip_tags($_POST['cartLink']):$_POST['cartLink']='';
121
-
122
- $count = 1;
123
- $products = $_SESSION['simpleCart'];
124
- if (is_array($products))
125
  {
126
- foreach ($products as $key => $item)
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  {
128
- if ($item['name'] == stripslashes($_POST['product']))
129
  {
130
- $count += $item['quantity'];
131
- $item['quantity']++;
132
- unset($products[$key]);
133
- array_push($products, $item);
 
 
 
134
  }
135
  }
136
- }
137
- else
138
- {
139
- $products = array();
140
- }
141
-
142
- if ($count == 1)
143
- {
144
- if (!empty($_POST[$_POST['product']])){
145
- $price = $_POST[$_POST['product']];
146
  }
147
- else{
148
- $price = $_POST['price'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  }
150
-
151
- $default_cur_symbol = get_option('cart_currency_symbol');
152
- $price = str_replace($default_cur_symbol,"",$price);
153
-
154
- $shipping = $_POST['shipping'];
155
- $shipping = str_replace($default_cur_symbol,"",$shipping);
156
-
157
- $product = array('name' => stripslashes($_POST['product']), 'price' => $price, 'quantity' => $count, 'shipping' => $shipping, 'cartLink' => $_POST['cartLink'], 'item_number' => $_POST['item_number']);
158
- if(isset($_POST['file_url']) && !empty($_POST['file_url'])){
159
- $file_url = strip_tags($_POST['file_url']);
160
- $product['file_url'] = $file_url;
161
  }
162
- array_push($products, $product);
163
- }
164
-
165
- sort($products);
166
- $_SESSION['simpleCart'] = $products;
167
- if(!isset($_SESSION['simple_cart_id']) && empty($_SESSION['simple_cart_id']))
168
- {
169
- //First time adding to the cart
170
- //$cart_id = uniqid();
171
- //$_SESSION['simple_cart_id'] = $cart_id;
172
- $wpsc_order = array(
173
- 'post_title' => 'WPSC Cart Order',
174
- 'post_type' => 'wpsc_cart_orders',
175
- 'post_content' => '',
176
- 'post_status' => 'trash',
177
- );
178
- // Insert the post into the database
179
- $post_id = wp_insert_post($wpsc_order);
180
- if($post_id){
181
- //echo "post id: ".$post_id;
182
- $_SESSION['simple_cart_id'] = $post_id;
183
- $updated_wpsc_order = array(
184
- 'ID' => $post_id,
185
- 'post_title' => $post_id,
186
- 'post_type' => 'wpsc_cart_orders',
187
- );
188
- wp_update_post($updated_wpsc_order);
189
- $status = "In Progress";
190
- update_post_meta($post_id, 'wpsc_order_status', $status);
191
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  }
193
- else
194
  {
195
- //cart updating
196
- if(isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id']))
197
  {
198
- //echo "siimplecart id set";
199
- $post_id = $_SESSION['simple_cart_id'];
200
- if(isset($_SESSION['simpleCart']) && !empty($_SESSION['simpleCart']))
201
  {
202
- //echo "updated cart id: ".$post_id;
203
- update_post_meta( $post_id, 'wpsc_cart_items', $_SESSION['simpleCart']);
 
204
  }
 
 
205
  }
206
- else{
207
- echo "<p>Error! Your session is out of sync. Please reset your session.</p>";
 
 
 
208
  }
209
  }
210
-
211
-
212
- if (get_option('wp_shopping_cart_auto_redirect_to_checkout_page'))
213
  {
214
- $checkout_url = get_option('cart_checkout_page_url');
215
- if(empty($checkout_url))
216
- {
217
- echo "<br /><strong>".(__("Shopping Cart Configuration Error! You must specify a value in the 'Checkout Page URL' field for the automatic redirection feature to work!", "WSPSC"))."</strong><br />";
218
- }
219
- else
220
- {
221
- $redirection_parameter = 'Location: '.$checkout_url;
222
- header($redirection_parameter);
223
- exit;
224
- }
225
- }
226
- }
227
- else if (isset($_POST['cquantity']))
228
- {
229
- $products = $_SESSION['simpleCart'];
230
- foreach ($products as $key => $item)
231
- {
232
- if ((stripslashes($item['name']) == stripslashes($_POST['product'])) && $_POST['quantity'])
233
  {
234
- $item['quantity'] = $_POST['quantity'];
235
- unset($products[$key]);
236
- array_push($products, $item);
 
 
 
 
237
  }
238
- else if (($item['name'] == stripslashes($_POST['product'])) && !$_POST['quantity'])
239
- unset($products[$key]);
240
- }
241
- sort($products);
242
- $_SESSION['simpleCart'] = $products;
243
- }
244
- else if (isset($_POST['delcart']))
245
- {
246
- $products = $_SESSION['simpleCart'];
247
- foreach ($products as $key => $item)
248
- {
249
- if ($item['name'] == stripslashes($_POST['product']))
250
- unset($products[$key]);
251
- }
252
- $_SESSION['simpleCart'] = $products;
253
- if(isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id']))
254
- {
255
- $post_id = $_SESSION['simple_cart_id'];
256
- update_post_meta( $post_id, 'wpsc_cart_items', $_SESSION['simpleCart']);
257
  }
258
  }
259
 
@@ -721,291 +699,6 @@ function cart_current_page_url() {
721
  return $pageURL;
722
  }
723
 
724
- function show_wp_cart_options_page ()
725
- {
726
- if(isset($_POST['wspsc_reset_logfile'])) {
727
- // Reset the debug log file
728
- if(wspsc_reset_logfile()){
729
- echo '<div id="message" class="updated fade"><p><strong>Debug log file has been reset!</strong></p></div>';
730
- }
731
- else{
732
- echo '<div id="message" class="updated fade"><p><strong>Debug log file could not be reset!</strong></p></div>';
733
- }
734
- }
735
- if (isset($_POST['info_update']))
736
- {
737
- $nonce = $_REQUEST['_wpnonce'];
738
- if ( !wp_verify_nonce($nonce, 'wp_simple_cart_settings_update')){
739
- wp_die('Error! Nonce Security Check Failed! Go back to settings menu and save the settings again.');
740
- }
741
-
742
- update_option('cart_payment_currency', (string)$_POST["cart_payment_currency"]);
743
- update_option('cart_currency_symbol', (string)$_POST["cart_currency_symbol"]);
744
- update_option('cart_base_shipping_cost', (string)$_POST["cart_base_shipping_cost"]);
745
- update_option('cart_free_shipping_threshold', (string)$_POST["cart_free_shipping_threshold"]);
746
- update_option('wp_shopping_cart_collect_address', ($_POST['wp_shopping_cart_collect_address']!='') ? 'checked="checked"':'' );
747
- update_option('wp_shopping_cart_use_profile_shipping', ($_POST['wp_shopping_cart_use_profile_shipping']!='') ? 'checked="checked"':'' );
748
-
749
- update_option('cart_paypal_email', (string)$_POST["cart_paypal_email"]);
750
- update_option('addToCartButtonName', (string)$_POST["addToCartButtonName"]);
751
- update_option('wp_cart_title', (string)$_POST["wp_cart_title"]);
752
- update_option('wp_cart_empty_text', (string)$_POST["wp_cart_empty_text"]);
753
- update_option('cart_return_from_paypal_url', (string)$_POST["cart_return_from_paypal_url"]);
754
- update_option('cart_products_page_url', (string)$_POST["cart_products_page_url"]);
755
-
756
- update_option('wp_shopping_cart_auto_redirect_to_checkout_page', ($_POST['wp_shopping_cart_auto_redirect_to_checkout_page']!='') ? 'checked="checked"':'' );
757
- update_option('cart_checkout_page_url', (string)$_POST["cart_checkout_page_url"]);
758
- update_option('wp_shopping_cart_reset_after_redirection_to_return_page', ($_POST['wp_shopping_cart_reset_after_redirection_to_return_page']!='') ? 'checked="checked"':'' );
759
-
760
- update_option('wp_shopping_cart_image_hide', ($_POST['wp_shopping_cart_image_hide']!='') ? 'checked="checked"':'' );
761
- update_option('wp_cart_note_to_seller_text', (string)$_POST["wp_cart_note_to_seller_text"]);
762
- update_option('wp_use_aff_platform', ($_POST['wp_use_aff_platform']!='') ? 'checked="checked"':'' );
763
-
764
- update_option('wp_shopping_cart_enable_sandbox', ($_POST['wp_shopping_cart_enable_sandbox']!='') ? 'checked="checked"':'' );
765
- update_option('wp_shopping_cart_enable_debug', ($_POST['wp_shopping_cart_enable_debug']!='') ? 'checked="checked"':'' );
766
-
767
- echo '<div id="message" class="updated fade">';
768
- echo '<p><strong>'.(__("Options Updated!", "WSPSC")).'</strong></p></div>';
769
- }
770
-
771
- $defaultCurrency = get_option('cart_payment_currency');
772
- if (empty($defaultCurrency)) $defaultCurrency = __("USD", "WSPSC");
773
-
774
- $defaultSymbol = get_option('cart_currency_symbol');
775
- if (empty($defaultSymbol)) $defaultSymbol = __("$", "WSPSC");
776
-
777
- $baseShipping = get_option('cart_base_shipping_cost');
778
- if (empty($baseShipping)) $baseShipping = 0;
779
-
780
- $cart_free_shipping_threshold = get_option('cart_free_shipping_threshold');
781
-
782
- $defaultEmail = get_option('cart_paypal_email');
783
- if (empty($defaultEmail)) $defaultEmail = get_bloginfo('admin_email');
784
-
785
- $return_url = get_option('cart_return_from_paypal_url');
786
-
787
- $addcart = get_option('addToCartButtonName');
788
- if (empty($addcart)) $addcart = __("Add to Cart", "WSPSC");
789
-
790
- $title = get_option('wp_cart_title');
791
- //if (empty($title)) $title = __("Your Shopping Cart", "WSPSC");
792
-
793
- $emptyCartText = get_option('wp_cart_empty_text');
794
- $cart_products_page_url = get_option('cart_products_page_url');
795
-
796
- $cart_checkout_page_url = get_option('cart_checkout_page_url');
797
- if (get_option('wp_shopping_cart_auto_redirect_to_checkout_page'))
798
- $wp_shopping_cart_auto_redirect_to_checkout_page = 'checked="checked"';
799
- else
800
- $wp_shopping_cart_auto_redirect_to_checkout_page = '';
801
-
802
- if (get_option('wp_shopping_cart_reset_after_redirection_to_return_page'))
803
- $wp_shopping_cart_reset_after_redirection_to_return_page = 'checked="checked"';
804
- else
805
- $wp_shopping_cart_reset_after_redirection_to_return_page = '';
806
-
807
- if (get_option('wp_shopping_cart_collect_address'))
808
- $wp_shopping_cart_collect_address = 'checked="checked"';
809
- else
810
- $wp_shopping_cart_collect_address = '';
811
-
812
- if (get_option('wp_shopping_cart_use_profile_shipping'))
813
- $wp_shopping_cart_use_profile_shipping = 'checked="checked"';
814
- else
815
- $wp_shopping_cart_use_profile_shipping = '';
816
-
817
- if (get_option('wp_shopping_cart_image_hide'))
818
- $wp_cart_image_hide = 'checked="checked"';
819
- else
820
- $wp_cart_image_hide = '';
821
-
822
- $wp_cart_note_to_seller_text = get_option('wp_cart_note_to_seller_text');
823
-
824
- if (get_option('wp_use_aff_platform'))
825
- $wp_use_aff_platform = 'checked="checked"';
826
- else
827
- $wp_use_aff_platform = '';
828
-
829
- //$wp_shopping_cart_enable_sandbox = get_option('wp_shopping_cart_enable_sandbox');
830
- if (get_option('wp_shopping_cart_enable_sandbox'))
831
- $wp_shopping_cart_enable_sandbox = 'checked="checked"';
832
- else
833
- $wp_shopping_cart_enable_sandbox = '';
834
-
835
- $wp_shopping_cart_enable_debug = '';
836
- if (get_option('wp_shopping_cart_enable_debug')){
837
- $wp_shopping_cart_enable_debug = 'checked="checked"';
838
- }
839
- ?>
840
- <h2><?php _e("Simple PayPal Shopping Cart Settings", "WSPSC"); ?> v <?php echo WP_CART_VERSION; ?></h2>
841
-
842
- <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;">
843
- <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "WSPSC"); ?><br />
844
- <a href="http://www.tipsandtricks-hq.com/?p=768" target="_blank"><?php _e("WP simple cart homepage", "WSPSC"); ?></a></p>
845
- </div>
846
-
847
- <div class="postbox">
848
- <h3><label for="title"><?php _e("Quick Usage Guide", "WSPSC"); ?></label></h3>
849
- <div class="inside">
850
-
851
- <p><?php _e("1. To add an 'Add to Cart' button for a product simply add the shortcode", "WSPSC"); ?> <strong>[wp_cart:<?php _e("PRODUCT-NAME", "WSPSC"); ?>:price:<?php _e("PRODUCT-PRICE", "WSPSC"); ?>:end]</strong> <?php _e("to a post or page next to the product. Replace PRODUCT-NAME and PRODUCT-PRICE with the actual name and price. For example: [wp_cart:Test Product:price:15.00:end]", "WSPSC"); ?></p>
852
- <p><?php _e("2. To add the shopping cart to a post or page (example, checkout page) simply add the shortcode", "WSPSC"); ?><strong>[show_wp_shopping_cart]</strong> <?php _e("to a post or page or use the sidebar widget to add the shopping cart to the sidebar.", "WSPSC"); ?></p>
853
-
854
- </div></div>
855
-
856
- <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
857
- <?php wp_nonce_field('wp_simple_cart_settings_update'); ?>
858
- <input type="hidden" name="info_update" id="info_update" value="true" />
859
- <?php
860
- echo '
861
- <div class="postbox">
862
- <h3><label for="title">'.(__("PayPal and Shopping Cart Settings", "WSPSC")).'</label></h3>
863
- <div class="inside">';
864
-
865
- echo '
866
- <table class="form-table">
867
- <tr valign="top">
868
- <th scope="row">'.(__("Paypal Email Address", "WSPSC")).'</th>
869
- <td><input type="text" name="cart_paypal_email" value="'.$defaultEmail.'" size="40" /></td>
870
- </tr>
871
- <tr valign="top">
872
- <th scope="row">'.(__("Shopping Cart title", "WSPSC")).'</th>
873
- <td><input type="text" name="wp_cart_title" value="'.$title.'" size="40" /></td>
874
- </tr>
875
- <tr valign="top">
876
- <th scope="row">'.(__("Text/Image to Show When Cart Empty", "WSPSC")).'</th>
877
- <td><input type="text" name="wp_cart_empty_text" value="'.$emptyCartText.'" size="60" /><br />'.(__("You can either enter plain text or the URL of an image that you want to show when the shopping cart is empty", "WSPSC")).'</td>
878
- </tr>
879
- <tr valign="top">
880
- <th scope="row">'.(__("Currency", "WSPSC")).'</th>
881
- <td><input type="text" name="cart_payment_currency" value="'.$defaultCurrency.'" size="6" /> ('.(__("e.g.", "WSPSC")).' USD, EUR, GBP, AUD)</td>
882
- </tr>
883
- <tr valign="top">
884
- <th scope="row">'.(__("Currency Symbol", "WSPSC")).'</th>
885
- <td><input type="text" name="cart_currency_symbol" value="'.$defaultSymbol.'" size="2" style="width: 1.5em;" /> ('.(__("e.g.", "WSPSC")).' $, &#163;, &#8364;)
886
- </td>
887
- </tr>
888
-
889
- <tr valign="top">
890
- <th scope="row">'.(__("Base Shipping Cost", "WSPSC")).'</th>
891
- <td><input type="text" name="cart_base_shipping_cost" value="'.$baseShipping.'" size="5" /> <br />'.(__("This is the base shipping cost that will be added to the total of individual products shipping cost. Put 0 if you do not want to charge shipping cost or use base shipping cost.", "WSPSC")).' <a href="http://www.tipsandtricks-hq.com/ecommerce/?p=297" target="_blank">'.(__("Learn More on Shipping Calculation", "WSPSC")).'</a></td>
892
- </tr>
893
-
894
- <tr valign="top">
895
- <th scope="row">'.(__("Free Shipping for Orders Over", "WSPSC")).'</th>
896
- <td><input type="text" name="cart_free_shipping_threshold" value="'.$cart_free_shipping_threshold.'" size="5" /> <br />'.(__("When a customer orders more than this amount he/she will get free shipping. Leave empty if you do not want to use it.", "WSPSC")).'</td>
897
- </tr>
898
-
899
- <tr valign="top">
900
- <th scope="row">'.(__("Must Collect Shipping Address on PayPal", "WSPSC")).'</th>
901
- <td><input type="checkbox" name="wp_shopping_cart_collect_address" value="1" '.$wp_shopping_cart_collect_address.' /><br />'.(__("If checked the customer will be forced to enter a shipping address on PayPal when checking out.", "WSPSC")).'</td>
902
- </tr>
903
-
904
- <tr valign="top">
905
- <th scope="row">'.(__("Use PayPal Profile Based Shipping", "WSPSC")).'</th>
906
- <td><input type="checkbox" name="wp_shopping_cart_use_profile_shipping" value="1" '.$wp_shopping_cart_use_profile_shipping.' /><br />'.(__("Check this if you want to use", "WSPSC")).' <a href="https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_html_ProfileAndTools#id08A9EF00IQY" target="_blank">'.(__("PayPal profile based shipping", "WSPSC")).'</a>. '.(__("Using this will ignore any other shipping options that you have specified in this plugin.", "WSPSC")).'</td>
907
- </tr>
908
-
909
- <tr valign="top">
910
- <th scope="row">'.(__("Add to Cart button text or Image", "WSPSC")).'</th>
911
- <td><input type="text" name="addToCartButtonName" value="'.$addcart.'" size="100" />
912
- <br />'.(__("To use a customized image as the button simply enter the URL of the image file.", "WSPSC")).' '.(__("e.g.", "WSPSC")).' http://www.your-domain.com/wp-content/plugins/wordpress-paypal-shopping-cart/images/buy_now_button.png
913
- <br />You can download nice add to cart button images from <a href="http://www.tipsandtricks-hq.com/ecommerce/add-to-cart-button-images-for-shopping-cart-631" target="_blank">this page</a>.
914
- </td>
915
- </tr>
916
-
917
- <tr valign="top">
918
- <th scope="row">'.(__("Return URL", "WSPSC")).'</th>
919
- <td><input type="text" name="cart_return_from_paypal_url" value="'.$return_url.'" size="100" /><br />'.(__("This is the URL the customer will be redirected to after a successful payment", "WSPSC")).'</td>
920
- </tr>
921
-
922
- <tr valign="top">
923
- <th scope="row">'.(__("Products Page URL", "WSPSC")).'</th>
924
- <td><input type="text" name="cart_products_page_url" value="'.$cart_products_page_url.'" size="100" /><br />'.(__("This is the URL of your products page if you have any. If used, the shopping cart widget will display a link to this page when cart is empty", "WSPSC")).'</td>
925
- </tr>
926
-
927
- <tr valign="top">
928
- <th scope="row">'.(__("Automatic redirection to checkout page", "WSPSC")).'</th>
929
- <td><input type="checkbox" name="wp_shopping_cart_auto_redirect_to_checkout_page" value="1" '.$wp_shopping_cart_auto_redirect_to_checkout_page.' />
930
- '.(__("Checkout Page URL", "WSPSC")).': <input type="text" name="cart_checkout_page_url" value="'.$cart_checkout_page_url.'" size="60" />
931
- <br />'.(__("If checked the visitor will be redirected to the Checkout page after a product is added to the cart. You must enter a URL in the Checkout Page URL field for this to work.", "WSPSC")).'</td>
932
- </tr>
933
-
934
- <tr valign="top">
935
- <th scope="row">'.(__("Reset Cart After Redirection to Return Page", "WSPSC")).'</th>
936
- <td><input type="checkbox" name="wp_shopping_cart_reset_after_redirection_to_return_page" value="1" '.$wp_shopping_cart_reset_after_redirection_to_return_page.' />
937
- <br />'.(__("If checked the shopping cart will be reset when the customer lands on the return URL (Thank You) page.", "WSPSC")).'</td>
938
- </tr>
939
- </table>
940
-
941
-
942
- <table class="form-table">
943
- <tr valign="top">
944
- <th scope="row">'.(__("Hide Shopping Cart Image", "WSPSC")).'</th>
945
- <td><input type="checkbox" name="wp_shopping_cart_image_hide" value="1" '.$wp_cart_image_hide.' /><br />'.(__("If ticked the shopping cart image will not be shown.", "WSPSC")).'</td>
946
- </tr>
947
- </table>
948
-
949
- <table class="form-table">
950
- <tr valign="top">
951
- <th scope="row">'.(__("Customize the Note to Seller Text", "WSPSC")).'</th>
952
- <td><input type="text" name="wp_cart_note_to_seller_text" value="'.$wp_cart_note_to_seller_text.'" size="100" />
953
- <br />'.(__("Specify the text that you want to use for the note field on PayPal checkout page to collect special instruction (leave this field empty if you don't need to customize it). The default label for the note field is \"Add special instructions to merchant\".", "WSPSC")).'</td>
954
- </tr>
955
- </table>
956
-
957
- <table class="form-table">
958
- <tr valign="top">
959
- <th scope="row">'.(__("Use WP Affiliate Platform", "WSPSC")).'</th>
960
- <td><input type="checkbox" name="wp_use_aff_platform" value="1" '.$wp_use_aff_platform.' />
961
- <br />'.(__("Check this if using with the", "WSPSC")).' <a href="http://www.tipsandtricks-hq.com/?p=1474" target="_blank">WP Affiliate Platform plugin</a>. '.(__("This plugin lets you run your own affiliate campaign/program and allows you to reward (pay commission) your affiliates for referred sales", "WSPSC")).'</td>
962
- </tr>
963
- </table>
964
- </div></div>
965
-
966
- <div class="postbox">
967
- <h3><label for="title">'.(__("Testing and Debugging Settings", "WSPSC")).'</label></h3>
968
- <div class="inside">
969
-
970
- <table class="form-table">
971
-
972
- <tr valign="top">
973
- <th scope="row">'.(__("Enable Debug", "WSPSC")).'</th>
974
- <td><input type="checkbox" name="wp_shopping_cart_enable_debug" value="1" '.$wp_shopping_cart_enable_debug.' />
975
- <br />'.(__("If checked, debug output will be written to the log file. This is useful for troubleshooting post payment failures", "WSPSC")).'
976
- <p><i>You can check the debug log file by clicking on the link below (The log file can be viewed using any text editor):</i>
977
- <ul>
978
- <li><a href="'.WP_CART_URL.'/ipn_handle_debug.log" target="_blank">ipn_handle_debug.log</a></li>
979
- </ul>
980
- </p>
981
- <input type="submit" name="wspsc_reset_logfile" style="font-weight:bold; color:red" value="Reset Debug Log file"/> Simple PayPal Shopping Cart debug log file is "reset" and timestamped with a log file reset message.
982
- </td></tr>
983
-
984
- <tr valign="top">
985
- <th scope="row">'.(__("Enable Sandbox Testing", "WSPSC")).'</th>
986
- <td><input type="checkbox" name="wp_shopping_cart_enable_sandbox" value="1" '.$wp_shopping_cart_enable_sandbox.' />
987
- <br />'.(__("Check this option if you want to do PayPal sandbox testing. You will need to create a PayPal sandbox account from PayPal Developer site", "WSPSC")).'</td>
988
- </tr>
989
-
990
- </table>
991
-
992
- </div>
993
- </div>
994
-
995
- <div class="submit">
996
- <input type="submit" name="info_update" value="'.(__("Update Options &raquo;", "WSPSC")).'" />
997
- </div>
998
- </form>
999
- ';
1000
- echo (__("Like the Simple WordPress Shopping Cart Plugin?", "WSPSC")).' <a href="http://wordpress.org/extend/plugins/wordpress-simple-paypal-shopping-cart" target="_blank">'.(__("Give it a good rating", "WSPSC")).'</a>';
1001
- ?>
1002
- <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;">
1003
- <p><?php _e("Need a shopping cart plugin with more features? Checkout my ", "WSPSC"); ?>
1004
- <a href="http://www.tipsandtricks-hq.com/?p=1059" target="_blank"><?php _e("WP eStore Plugin", "WSPSC"); ?></a></p>
1005
- </div>
1006
- <?php
1007
- }
1008
-
1009
  function simple_cart_total()
1010
  {
1011
  $grand_total = 0;
@@ -1020,11 +713,12 @@ function simple_cart_total()
1020
 
1021
  function wp_cart_options()
1022
  {
1023
- echo '<div class="wrap"><h2>'.(__("WP Paypal Shopping Cart Options", "WSPSC")).'</h2>';
1024
- echo '<div id="poststuff"><div id="post-body">';
1025
- show_wp_cart_options_page();
1026
- echo '</div></div>';
1027
- echo '</div>';
 
1028
  }
1029
 
1030
  // Display The Options Page
1
  <?php
2
  /*
3
  Plugin Name: WP Simple Paypal Shopping cart
4
+ Version: v3.8.2
5
  Plugin URI: http://www.tipsandtricks-hq.com/?p=768
6
  Author: Ruhul Amin
7
  Author URI: http://www.tipsandtricks-hq.com/
12
  session_start();
13
  }
14
 
15
+ define('WP_CART_VERSION', '3.8.2');
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__));
106
  unset($_SESSION['simple_cart_id']);
107
  }
108
 
109
+ function wpspc_cart_actions_handler()
110
  {
111
+ if (isset($_POST['addcart']))
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  {
113
+ $domain_url = $_SERVER['SERVER_NAME'];
114
+ $cookie_domain = str_replace("www","",$domain_url);
115
+ setcookie("cart_in_use","true",time()+21600,"/",$cookie_domain); //useful to not serve cached page when using with a caching plugin
116
+
117
+ //sanitize data
118
+ $_POST['product'] = strip_tags($_POST['product']);//for PHP5.2 use filter_var($_POST['product'], FILTER_SANITIZE_STRING);
119
+ $_POST['item_number'] = strip_tags($_POST['item_number']);
120
+ if(isset($_POST['price']))$_POST['price'] = strip_tags($_POST['price']);
121
+ isset($_POST['shipping'])?$_POST['shipping'] = strip_tags($_POST['shipping']):$_POST['shipping']='';
122
+ isset($_POST['cartLink'])?$_POST['cartLink'] = strip_tags($_POST['cartLink']):$_POST['cartLink']='';
123
+
124
+ $count = 1;
125
+ $products = $_SESSION['simpleCart'];
126
+ if (is_array($products))
127
  {
128
+ foreach ($products as $key => $item)
129
  {
130
+ if ($item['name'] == stripslashes($_POST['product']))
131
+ {
132
+ $count += $item['quantity'];
133
+ $item['quantity']++;
134
+ unset($products[$key]);
135
+ array_push($products, $item);
136
+ }
137
  }
138
  }
139
+ else
140
+ {
141
+ $products = array();
 
 
 
 
 
 
 
142
  }
143
+
144
+ if ($count == 1)
145
+ {
146
+ if (!empty($_POST[$_POST['product']])){
147
+ $price = $_POST[$_POST['product']];
148
+ }
149
+ else{
150
+ $price = $_POST['price'];
151
+ }
152
+
153
+ $default_cur_symbol = get_option('cart_currency_symbol');
154
+ $price = str_replace($default_cur_symbol,"",$price);
155
+
156
+ $shipping = $_POST['shipping'];
157
+ $shipping = str_replace($default_cur_symbol,"",$shipping);
158
+
159
+ $product = array('name' => stripslashes($_POST['product']), 'price' => $price, 'quantity' => $count, 'shipping' => $shipping, 'cartLink' => $_POST['cartLink'], 'item_number' => $_POST['item_number']);
160
+ if(isset($_POST['file_url']) && !empty($_POST['file_url'])){
161
+ $file_url = strip_tags($_POST['file_url']);
162
+ $product['file_url'] = $file_url;
163
+ }
164
+ array_push($products, $product);
165
  }
166
+
167
+ sort($products);
168
+ $_SESSION['simpleCart'] = $products;
169
+ if(!isset($_SESSION['simple_cart_id']) && empty($_SESSION['simple_cart_id']))
170
+ {
171
+ wpspc_insert_new_record();
 
 
 
 
 
172
  }
173
+ else
174
+ {
175
+ //cart updating
176
+ if(isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id']))
177
+ {
178
+ wpspc_update_cart_items_record();
179
+ }
180
+ else{
181
+ echo "<p>Error! Your session is out of sync. Please reset your session.</p>";
182
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
184
+
185
+
186
+ if (get_option('wp_shopping_cart_auto_redirect_to_checkout_page'))
187
+ {
188
+ $checkout_url = get_option('cart_checkout_page_url');
189
+ if(empty($checkout_url))
190
+ {
191
+ echo "<br /><strong>".(__("Shopping Cart Configuration Error! You must specify a value in the 'Checkout Page URL' field for the automatic redirection feature to work!", "WSPSC"))."</strong><br />";
192
+ }
193
+ else
194
+ {
195
+ $redirection_parameter = 'Location: '.$checkout_url;
196
+ header($redirection_parameter);
197
+ exit;
198
+ }
199
+ }
200
  }
201
+ else if (isset($_POST['cquantity']))
202
  {
203
+ $products = $_SESSION['simpleCart'];
204
+ foreach ($products as $key => $item)
205
  {
206
+ if ((stripslashes($item['name']) == stripslashes($_POST['product'])) && $_POST['quantity'])
 
 
207
  {
208
+ $item['quantity'] = $_POST['quantity'];
209
+ unset($products[$key]);
210
+ array_push($products, $item);
211
  }
212
+ else if (($item['name'] == stripslashes($_POST['product'])) && !$_POST['quantity'])
213
+ unset($products[$key]);
214
  }
215
+ sort($products);
216
+ $_SESSION['simpleCart'] = $products;
217
+ if(isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id']))
218
+ {
219
+ wpspc_update_cart_items_record();
220
  }
221
  }
222
+ else if (isset($_POST['delcart']))
 
 
223
  {
224
+ $products = $_SESSION['simpleCart'];
225
+ foreach ($products as $key => $item)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  {
227
+ if ($item['name'] == stripslashes($_POST['product']))
228
+ unset($products[$key]);
229
+ }
230
+ $_SESSION['simpleCart'] = $products;
231
+ if(isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id']))
232
+ {
233
+ wpspc_update_cart_items_record();
234
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  }
236
  }
237
 
699
  return $pageURL;
700
  }
701
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
702
  function simple_cart_total()
703
  {
704
  $grand_total = 0;
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
wp_shopping_cart_misc_functions.php CHANGED
@@ -16,6 +16,7 @@ function wp_cart_init_handler()
16
  }
17
  else//Init hook handing code for front end
18
  {
 
19
  add_filter('ngg_render_template','wp_cart_ngg_template_handler',10,2);
20
  if(isset($_REQUEST['simple_cart_ipn']))
21
  {
@@ -90,4 +91,44 @@ function wp_cart_ngg_template_handler($arg1,$arg2)
90
  return $gallery_template;
91
  }
92
  return $arg2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
16
  }
17
  else//Init hook handing code for front end
18
  {
19
+ wpspc_cart_actions_handler();
20
  add_filter('ngg_render_template','wp_cart_ngg_template_handler',10,2);
21
  if(isset($_REQUEST['simple_cart_ipn']))
22
  {
91
  return $gallery_template;
92
  }
93
  return $arg2;
94
+ }
95
+
96
+ function wpspc_insert_new_record()
97
+ {
98
+ //First time adding to the cart
99
+ //$cart_id = uniqid();
100
+ //$_SESSION['simple_cart_id'] = $cart_id;
101
+ $wpsc_order = array(
102
+ 'post_title' => 'WPSC Cart Order',
103
+ 'post_type' => 'wpsc_cart_orders',
104
+ 'post_content' => '',
105
+ 'post_status' => 'trash',
106
+ );
107
+ // Insert the post into the database
108
+ $post_id = wp_insert_post($wpsc_order);
109
+ if($post_id){
110
+ //echo "post id: ".$post_id;
111
+ $_SESSION['simple_cart_id'] = $post_id;
112
+ $updated_wpsc_order = array(
113
+ 'ID' => $post_id,
114
+ 'post_title' => $post_id,
115
+ 'post_type' => 'wpsc_cart_orders',
116
+ );
117
+ wp_update_post($updated_wpsc_order);
118
+ $status = "In Progress";
119
+ update_post_meta($post_id, 'wpsc_order_status', $status);
120
+ if(isset($_SESSION['simpleCart']) && !empty($_SESSION['simpleCart']))
121
+ {
122
+ update_post_meta( $post_id, 'wpsc_cart_items', $_SESSION['simpleCart']);
123
+ }
124
+ }
125
+ }
126
+
127
+ function wpspc_update_cart_items_record()
128
+ {
129
+ if(isset($_SESSION['simpleCart']) && !empty($_SESSION['simpleCart']))
130
+ {
131
+ $post_id = $_SESSION['simple_cart_id'];
132
+ update_post_meta( $post_id, 'wpsc_cart_items', $_SESSION['simpleCart']);
133
+ }
134
  }
wp_shopping_cart_settings.php ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function show_wp_cart_options_page ()
4
+ {
5
+ if(isset($_POST['wspsc_reset_logfile'])) {
6
+ // Reset the debug log file
7
+ if(wspsc_reset_logfile()){
8
+ echo '<div id="message" class="updated fade"><p><strong>Debug log file has been reset!</strong></p></div>';
9
+ }
10
+ else{
11
+ echo '<div id="message" class="updated fade"><p><strong>Debug log file could not be reset!</strong></p></div>';
12
+ }
13
+ }
14
+ if (isset($_POST['info_update']))
15
+ {
16
+ $nonce = $_REQUEST['_wpnonce'];
17
+ if ( !wp_verify_nonce($nonce, 'wp_simple_cart_settings_update')){
18
+ wp_die('Error! Nonce Security Check Failed! Go back to settings menu and save the settings again.');
19
+ }
20
+
21
+ update_option('cart_payment_currency', (string)$_POST["cart_payment_currency"]);
22
+ update_option('cart_currency_symbol', (string)$_POST["cart_currency_symbol"]);
23
+ update_option('cart_base_shipping_cost', (string)$_POST["cart_base_shipping_cost"]);
24
+ update_option('cart_free_shipping_threshold', (string)$_POST["cart_free_shipping_threshold"]);
25
+ update_option('wp_shopping_cart_collect_address', ($_POST['wp_shopping_cart_collect_address']!='') ? 'checked="checked"':'' );
26
+ update_option('wp_shopping_cart_use_profile_shipping', ($_POST['wp_shopping_cart_use_profile_shipping']!='') ? 'checked="checked"':'' );
27
+
28
+ update_option('cart_paypal_email', (string)$_POST["cart_paypal_email"]);
29
+ update_option('addToCartButtonName', (string)$_POST["addToCartButtonName"]);
30
+ update_option('wp_cart_title', (string)$_POST["wp_cart_title"]);
31
+ update_option('wp_cart_empty_text', (string)$_POST["wp_cart_empty_text"]);
32
+ update_option('cart_return_from_paypal_url', (string)$_POST["cart_return_from_paypal_url"]);
33
+ update_option('cart_products_page_url', (string)$_POST["cart_products_page_url"]);
34
+
35
+ update_option('wp_shopping_cart_auto_redirect_to_checkout_page', ($_POST['wp_shopping_cart_auto_redirect_to_checkout_page']!='') ? 'checked="checked"':'' );
36
+ update_option('cart_checkout_page_url', (string)$_POST["cart_checkout_page_url"]);
37
+ update_option('wp_shopping_cart_reset_after_redirection_to_return_page', ($_POST['wp_shopping_cart_reset_after_redirection_to_return_page']!='') ? 'checked="checked"':'' );
38
+
39
+ update_option('wp_shopping_cart_image_hide', ($_POST['wp_shopping_cart_image_hide']!='') ? 'checked="checked"':'' );
40
+ update_option('wp_cart_note_to_seller_text', (string)$_POST["wp_cart_note_to_seller_text"]);
41
+ update_option('wp_use_aff_platform', ($_POST['wp_use_aff_platform']!='') ? 'checked="checked"':'' );
42
+
43
+ update_option('wp_shopping_cart_enable_sandbox', ($_POST['wp_shopping_cart_enable_sandbox']!='') ? 'checked="checked"':'' );
44
+ update_option('wp_shopping_cart_enable_debug', ($_POST['wp_shopping_cart_enable_debug']!='') ? 'checked="checked"':'' );
45
+
46
+ echo '<div id="message" class="updated fade">';
47
+ echo '<p><strong>'.(__("Options Updated!", "WSPSC")).'</strong></p></div>';
48
+ }
49
+
50
+ $defaultCurrency = get_option('cart_payment_currency');
51
+ if (empty($defaultCurrency)) $defaultCurrency = __("USD", "WSPSC");
52
+
53
+ $defaultSymbol = get_option('cart_currency_symbol');
54
+ if (empty($defaultSymbol)) $defaultSymbol = __("$", "WSPSC");
55
+
56
+ $baseShipping = get_option('cart_base_shipping_cost');
57
+ if (empty($baseShipping)) $baseShipping = 0;
58
+
59
+ $cart_free_shipping_threshold = get_option('cart_free_shipping_threshold');
60
+
61
+ $defaultEmail = get_option('cart_paypal_email');
62
+ if (empty($defaultEmail)) $defaultEmail = get_bloginfo('admin_email');
63
+
64
+ $return_url = get_option('cart_return_from_paypal_url');
65
+
66
+ $addcart = get_option('addToCartButtonName');
67
+ if (empty($addcart)) $addcart = __("Add to Cart", "WSPSC");
68
+
69
+ $title = get_option('wp_cart_title');
70
+ //if (empty($title)) $title = __("Your Shopping Cart", "WSPSC");
71
+
72
+ $emptyCartText = get_option('wp_cart_empty_text');
73
+ $cart_products_page_url = get_option('cart_products_page_url');
74
+
75
+ $cart_checkout_page_url = get_option('cart_checkout_page_url');
76
+ if (get_option('wp_shopping_cart_auto_redirect_to_checkout_page'))
77
+ $wp_shopping_cart_auto_redirect_to_checkout_page = 'checked="checked"';
78
+ else
79
+ $wp_shopping_cart_auto_redirect_to_checkout_page = '';
80
+
81
+ if (get_option('wp_shopping_cart_reset_after_redirection_to_return_page'))
82
+ $wp_shopping_cart_reset_after_redirection_to_return_page = 'checked="checked"';
83
+ else
84
+ $wp_shopping_cart_reset_after_redirection_to_return_page = '';
85
+
86
+ if (get_option('wp_shopping_cart_collect_address'))
87
+ $wp_shopping_cart_collect_address = 'checked="checked"';
88
+ else
89
+ $wp_shopping_cart_collect_address = '';
90
+
91
+ if (get_option('wp_shopping_cart_use_profile_shipping'))
92
+ $wp_shopping_cart_use_profile_shipping = 'checked="checked"';
93
+ else
94
+ $wp_shopping_cart_use_profile_shipping = '';
95
+
96
+ if (get_option('wp_shopping_cart_image_hide'))
97
+ $wp_cart_image_hide = 'checked="checked"';
98
+ else
99
+ $wp_cart_image_hide = '';
100
+
101
+ $wp_cart_note_to_seller_text = get_option('wp_cart_note_to_seller_text');
102
+
103
+ if (get_option('wp_use_aff_platform'))
104
+ $wp_use_aff_platform = 'checked="checked"';
105
+ else
106
+ $wp_use_aff_platform = '';
107
+
108
+ //$wp_shopping_cart_enable_sandbox = get_option('wp_shopping_cart_enable_sandbox');
109
+ if (get_option('wp_shopping_cart_enable_sandbox'))
110
+ $wp_shopping_cart_enable_sandbox = 'checked="checked"';
111
+ else
112
+ $wp_shopping_cart_enable_sandbox = '';
113
+
114
+ $wp_shopping_cart_enable_debug = '';
115
+ if (get_option('wp_shopping_cart_enable_debug')){
116
+ $wp_shopping_cart_enable_debug = 'checked="checked"';
117
+ }
118
+ ?>
119
+ <h2><?php _e("Simple PayPal Shopping Cart Settings", "WSPSC"); ?> v <?php echo WP_CART_VERSION; ?></h2>
120
+
121
+ <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;">
122
+ <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "WSPSC"); ?><br />
123
+ <a href="http://www.tipsandtricks-hq.com/?p=768" target="_blank"><?php _e("WP simple cart homepage", "WSPSC"); ?></a></p>
124
+ </div>
125
+
126
+ <div class="postbox">
127
+ <h3><label for="title"><?php _e("Quick Usage Guide", "WSPSC"); ?></label></h3>
128
+ <div class="inside">
129
+
130
+ <p><?php _e("1. To add an 'Add to Cart' button for a product simply add the shortcode", "WSPSC"); ?> <strong>[wp_cart:<?php _e("PRODUCT-NAME", "WSPSC"); ?>:price:<?php _e("PRODUCT-PRICE", "WSPSC"); ?>:end]</strong> <?php _e("to a post or page next to the product. Replace PRODUCT-NAME and PRODUCT-PRICE with the actual name and price. For example: [wp_cart:Test Product:price:15.00:end]", "WSPSC"); ?></p>
131
+ <p><?php _e("2. To add the shopping cart to a post or page (example, checkout page) simply add the shortcode", "WSPSC"); ?><strong>[show_wp_shopping_cart]</strong> <?php _e("to a post or page or use the sidebar widget to add the shopping cart to the sidebar.", "WSPSC"); ?></p>
132
+
133
+ </div></div>
134
+
135
+ <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
136
+ <?php wp_nonce_field('wp_simple_cart_settings_update'); ?>
137
+ <input type="hidden" name="info_update" id="info_update" value="true" />
138
+ <?php
139
+ echo '
140
+ <div class="postbox">
141
+ <h3><label for="title">'.(__("PayPal and Shopping Cart Settings", "WSPSC")).'</label></h3>
142
+ <div class="inside">';
143
+
144
+ echo '
145
+ <table class="form-table">
146
+ <tr valign="top">
147
+ <th scope="row">'.(__("Paypal Email Address", "WSPSC")).'</th>
148
+ <td><input type="text" name="cart_paypal_email" value="'.$defaultEmail.'" size="40" /></td>
149
+ </tr>
150
+ <tr valign="top">
151
+ <th scope="row">'.(__("Shopping Cart title", "WSPSC")).'</th>
152
+ <td><input type="text" name="wp_cart_title" value="'.$title.'" size="40" /></td>
153
+ </tr>
154
+ <tr valign="top">
155
+ <th scope="row">'.(__("Text/Image to Show When Cart Empty", "WSPSC")).'</th>
156
+ <td><input type="text" name="wp_cart_empty_text" value="'.$emptyCartText.'" size="60" /><br />'.(__("You can either enter plain text or the URL of an image that you want to show when the shopping cart is empty", "WSPSC")).'</td>
157
+ </tr>
158
+ <tr valign="top">
159
+ <th scope="row">'.(__("Currency", "WSPSC")).'</th>
160
+ <td><input type="text" name="cart_payment_currency" value="'.$defaultCurrency.'" size="6" /> ('.(__("e.g.", "WSPSC")).' USD, EUR, GBP, AUD)</td>
161
+ </tr>
162
+ <tr valign="top">
163
+ <th scope="row">'.(__("Currency Symbol", "WSPSC")).'</th>
164
+ <td><input type="text" name="cart_currency_symbol" value="'.$defaultSymbol.'" size="2" style="width: 1.5em;" /> ('.(__("e.g.", "WSPSC")).' $, &#163;, &#8364;)
165
+ </td>
166
+ </tr>
167
+
168
+ <tr valign="top">
169
+ <th scope="row">'.(__("Base Shipping Cost", "WSPSC")).'</th>
170
+ <td><input type="text" name="cart_base_shipping_cost" value="'.$baseShipping.'" size="5" /> <br />'.(__("This is the base shipping cost that will be added to the total of individual products shipping cost. Put 0 if you do not want to charge shipping cost or use base shipping cost.", "WSPSC")).' <a href="http://www.tipsandtricks-hq.com/ecommerce/?p=297" target="_blank">'.(__("Learn More on Shipping Calculation", "WSPSC")).'</a></td>
171
+ </tr>
172
+
173
+ <tr valign="top">
174
+ <th scope="row">'.(__("Free Shipping for Orders Over", "WSPSC")).'</th>
175
+ <td><input type="text" name="cart_free_shipping_threshold" value="'.$cart_free_shipping_threshold.'" size="5" /> <br />'.(__("When a customer orders more than this amount he/she will get free shipping. Leave empty if you do not want to use it.", "WSPSC")).'</td>
176
+ </tr>
177
+
178
+ <tr valign="top">
179
+ <th scope="row">'.(__("Must Collect Shipping Address on PayPal", "WSPSC")).'</th>
180
+ <td><input type="checkbox" name="wp_shopping_cart_collect_address" value="1" '.$wp_shopping_cart_collect_address.' /><br />'.(__("If checked the customer will be forced to enter a shipping address on PayPal when checking out.", "WSPSC")).'</td>
181
+ </tr>
182
+
183
+ <tr valign="top">
184
+ <th scope="row">'.(__("Use PayPal Profile Based Shipping", "WSPSC")).'</th>
185
+ <td><input type="checkbox" name="wp_shopping_cart_use_profile_shipping" value="1" '.$wp_shopping_cart_use_profile_shipping.' /><br />'.(__("Check this if you want to use", "WSPSC")).' <a href="http://www.tipsandtricks-hq.com/setup-paypal-profile-based-shipping-5865" target="_blank">'.(__("PayPal profile based shipping", "WSPSC")).'</a>. '.(__("Using this will ignore any other shipping options that you have specified in this plugin.", "WSPSC")).'</td>
186
+ </tr>
187
+
188
+ <tr valign="top">
189
+ <th scope="row">'.(__("Add to Cart button text or Image", "WSPSC")).'</th>
190
+ <td><input type="text" name="addToCartButtonName" value="'.$addcart.'" size="100" />
191
+ <br />'.(__("To use a customized image as the button simply enter the URL of the image file.", "WSPSC")).' '.(__("e.g.", "WSPSC")).' http://www.your-domain.com/wp-content/plugins/wordpress-paypal-shopping-cart/images/buy_now_button.png
192
+ <br />You can download nice add to cart button images from <a href="http://www.tipsandtricks-hq.com/ecommerce/add-to-cart-button-images-for-shopping-cart-631" target="_blank">this page</a>.
193
+ </td>
194
+ </tr>
195
+
196
+ <tr valign="top">
197
+ <th scope="row">'.(__("Return URL", "WSPSC")).'</th>
198
+ <td><input type="text" name="cart_return_from_paypal_url" value="'.$return_url.'" size="100" /><br />'.(__("This is the URL the customer will be redirected to after a successful payment", "WSPSC")).'</td>
199
+ </tr>
200
+
201
+ <tr valign="top">
202
+ <th scope="row">'.(__("Products Page URL", "WSPSC")).'</th>
203
+ <td><input type="text" name="cart_products_page_url" value="'.$cart_products_page_url.'" size="100" /><br />'.(__("This is the URL of your products page if you have any. If used, the shopping cart widget will display a link to this page when cart is empty", "WSPSC")).'</td>
204
+ </tr>
205
+
206
+ <tr valign="top">
207
+ <th scope="row">'.(__("Automatic redirection to checkout page", "WSPSC")).'</th>
208
+ <td><input type="checkbox" name="wp_shopping_cart_auto_redirect_to_checkout_page" value="1" '.$wp_shopping_cart_auto_redirect_to_checkout_page.' />
209
+ '.(__("Checkout Page URL", "WSPSC")).': <input type="text" name="cart_checkout_page_url" value="'.$cart_checkout_page_url.'" size="60" />
210
+ <br />'.(__("If checked the visitor will be redirected to the Checkout page after a product is added to the cart. You must enter a URL in the Checkout Page URL field for this to work.", "WSPSC")).'</td>
211
+ </tr>
212
+
213
+ <tr valign="top">
214
+ <th scope="row">'.(__("Reset Cart After Redirection to Return Page", "WSPSC")).'</th>
215
+ <td><input type="checkbox" name="wp_shopping_cart_reset_after_redirection_to_return_page" value="1" '.$wp_shopping_cart_reset_after_redirection_to_return_page.' />
216
+ <br />'.(__("If checked the shopping cart will be reset when the customer lands on the return URL (Thank You) page.", "WSPSC")).'</td>
217
+ </tr>
218
+ </table>
219
+
220
+
221
+ <table class="form-table">
222
+ <tr valign="top">
223
+ <th scope="row">'.(__("Hide Shopping Cart Image", "WSPSC")).'</th>
224
+ <td><input type="checkbox" name="wp_shopping_cart_image_hide" value="1" '.$wp_cart_image_hide.' /><br />'.(__("If ticked the shopping cart image will not be shown.", "WSPSC")).'</td>
225
+ </tr>
226
+ </table>
227
+
228
+ <table class="form-table">
229
+ <tr valign="top">
230
+ <th scope="row">'.(__("Customize the Note to Seller Text", "WSPSC")).'</th>
231
+ <td><input type="text" name="wp_cart_note_to_seller_text" value="'.$wp_cart_note_to_seller_text.'" size="100" />
232
+ <br />'.(__("Specify the text that you want to use for the note field on PayPal checkout page to collect special instruction (leave this field empty if you don't need to customize it). The default label for the note field is \"Add special instructions to merchant\".", "WSPSC")).'</td>
233
+ </tr>
234
+ </table>
235
+
236
+ <table class="form-table">
237
+ <tr valign="top">
238
+ <th scope="row">'.(__("Use WP Affiliate Platform", "WSPSC")).'</th>
239
+ <td><input type="checkbox" name="wp_use_aff_platform" value="1" '.$wp_use_aff_platform.' />
240
+ <br />'.(__("Check this if using with the", "WSPSC")).' <a href="http://www.tipsandtricks-hq.com/?p=1474" target="_blank">WP Affiliate Platform plugin</a>. '.(__("This plugin lets you run your own affiliate campaign/program and allows you to reward (pay commission) your affiliates for referred sales", "WSPSC")).'</td>
241
+ </tr>
242
+ </table>
243
+ </div></div>
244
+
245
+ <div class="postbox">
246
+ <h3><label for="title">'.(__("Testing and Debugging Settings", "WSPSC")).'</label></h3>
247
+ <div class="inside">
248
+
249
+ <table class="form-table">
250
+
251
+ <tr valign="top">
252
+ <th scope="row">'.(__("Enable Debug", "WSPSC")).'</th>
253
+ <td><input type="checkbox" name="wp_shopping_cart_enable_debug" value="1" '.$wp_shopping_cart_enable_debug.' />
254
+ <br />'.(__("If checked, debug output will be written to the log file. This is useful for troubleshooting post payment failures", "WSPSC")).'
255
+ <p><i>You can check the debug log file by clicking on the link below (The log file can be viewed using any text editor):</i>
256
+ <ul>
257
+ <li><a href="'.WP_CART_URL.'/ipn_handle_debug.log" target="_blank">ipn_handle_debug.log</a></li>
258
+ </ul>
259
+ </p>
260
+ <input type="submit" name="wspsc_reset_logfile" style="font-weight:bold; color:red" value="Reset Debug Log file"/> Simple PayPal Shopping Cart debug log file is "reset" and timestamped with a log file reset message.
261
+ </td></tr>
262
+
263
+ <tr valign="top">
264
+ <th scope="row">'.(__("Enable Sandbox Testing", "WSPSC")).'</th>
265
+ <td><input type="checkbox" name="wp_shopping_cart_enable_sandbox" value="1" '.$wp_shopping_cart_enable_sandbox.' />
266
+ <br />'.(__("Check this option if you want to do PayPal sandbox testing. You will need to create a PayPal sandbox account from PayPal Developer site", "WSPSC")).'</td>
267
+ </tr>
268
+
269
+ </table>
270
+
271
+ </div>
272
+ </div>
273
+
274
+ <div class="submit">
275
+ <input type="submit" name="info_update" value="'.(__("Update Options &raquo;", "WSPSC")).'" />
276
+ </div>
277
+ </form>
278
+ ';
279
+ echo (__("Like the Simple WordPress Shopping Cart Plugin?", "WSPSC")).' <a href="http://wordpress.org/extend/plugins/wordpress-simple-paypal-shopping-cart" target="_blank">'.(__("Give it a good rating", "WSPSC")).'</a>';
280
+ ?>
281
+ <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;">
282
+ <p><?php _e("Need a shopping cart plugin with more features? Checkout my ", "WSPSC"); ?>
283
+ <a href="http://www.tipsandtricks-hq.com/?p=1059" target="_blank"><?php _e("WP eStore Plugin", "WSPSC"); ?></a></p>
284
+ </div>
285
+ <?php
286
+ }