Version Description
Download this release
Release Info
| Developer | mra13 |
| Plugin | |
| Version | 2.8.1 |
| Comparing to | |
| See all releases | |
Code changes from version 2.6 to 2.8.1
- images/add_to_cart_button.png +0 -0
- images/buy_now_button.png +0 -0
- readme.txt +2 -2
- wp_shopping_cart.php +54 -20
images/add_to_cart_button.png
ADDED
|
Binary file
|
images/buy_now_button.png
ADDED
|
Binary file
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: Ruhul Amin
|
|
| 3 |
Donate link: http://www.tipsandtricks-hq.com
|
| 4 |
Tags: WordPress shopping cart, Paypal shopping cart, online shop, shopping cart, wordperss ecommerce, sell digital products
|
| 5 |
Requires at least: 2.6
|
| 6 |
-
Tested up to: 2.
|
| 7 |
-
Stable tag:2.
|
| 8 |
|
| 9 |
Very easy to use Simple WordPress Paypal Shopping Cart Plugin. Great for selling products online in one click from your WordPress site.
|
| 10 |
|
| 3 |
Donate link: http://www.tipsandtricks-hq.com
|
| 4 |
Tags: WordPress shopping cart, Paypal shopping cart, online shop, shopping cart, wordperss ecommerce, sell digital products
|
| 5 |
Requires at least: 2.6
|
| 6 |
+
Tested up to: 2.9.2
|
| 7 |
+
Stable tag:2.8
|
| 8 |
|
| 9 |
Very easy to use Simple WordPress Paypal Shopping Cart Plugin. Great for selling products online in one click from your WordPress site.
|
| 10 |
|
wp_shopping_cart.php
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
Plugin Name: WP Simple Paypal Shopping cart
|
| 4 |
-
Version: v2.
|
| 5 |
Plugin URI: http://www.tipsandtricks-hq.com/?p=768
|
| 6 |
Author: Ruhul Amin
|
| 7 |
Author URI: http://www.tipsandtricks-hq.com/
|
|
@@ -24,13 +24,16 @@ session_start();
|
|
| 24 |
$siteurl = get_option('siteurl');
|
| 25 |
define('WP_CART_FOLDER', dirname(plugin_basename(__FILE__)));
|
| 26 |
define('WP_CART_URL', get_option('siteurl').'/wp-content/plugins/' . WP_CART_FOLDER);
|
| 27 |
-
//define('WP_CART_FILE_PATH', dirname(__FILE__));
|
| 28 |
-
//define('WP_CART_DIR_NAME', basename(WP_CART_FILE_PATH));
|
| 29 |
|
| 30 |
add_option('wp_cart_title', 'Your Shopping Cart');
|
| 31 |
add_option('wp_cart_empty_text', 'Your cart is empty');
|
| 32 |
add_option('cart_return_from_paypal_url', get_bloginfo('wpurl'));
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
function show_wp_shopping_cart_handler()
|
| 35 |
{
|
| 36 |
if (cart_not_empty())
|
|
@@ -87,7 +90,7 @@ if ($_POST['addcart'])
|
|
| 87 |
{
|
| 88 |
foreach ($products as $key => $item)
|
| 89 |
{
|
| 90 |
-
if ($item['name'] == $_POST['product'])
|
| 91 |
{
|
| 92 |
$count += $item['quantity'];
|
| 93 |
$item['quantity']++;
|
|
@@ -120,13 +123,13 @@ else if ($_POST['cquantity'])
|
|
| 120 |
$products = $_SESSION['simpleCart'];
|
| 121 |
foreach ($products as $key => $item)
|
| 122 |
{
|
| 123 |
-
if (($item['name'] == $_POST['product']) && $_POST['quantity'])
|
| 124 |
{
|
| 125 |
$item['quantity'] = $_POST['quantity'];
|
| 126 |
unset($products[$key]);
|
| 127 |
array_push($products, $item);
|
| 128 |
}
|
| 129 |
-
else if (($item['name'] == $_POST['product']) && !$_POST['quantity'])
|
| 130 |
unset($products[$key]);
|
| 131 |
}
|
| 132 |
sort($products);
|
|
@@ -137,7 +140,7 @@ else if ($_POST['delcart'])
|
|
| 137 |
$products = $_SESSION['simpleCart'];
|
| 138 |
foreach ($products as $key => $item)
|
| 139 |
{
|
| 140 |
-
if ($item['name'] == $_POST['product'])
|
| 141 |
unset($products[$key]);
|
| 142 |
}
|
| 143 |
$_SESSION['simpleCart'] = $products;
|
|
@@ -236,21 +239,20 @@ function print_wp_shopping_cart()
|
|
| 236 |
{
|
| 237 |
$postage_cost = 0;
|
| 238 |
}
|
| 239 |
-
|
| 240 |
foreach ($_SESSION['simpleCart'] as $item)
|
| 241 |
-
{
|
| 242 |
-
$output .= "
|
| 243 |
<tr><td style='overflow: hidden;'><a href='".$item['cartLink']."'>".$item['name']."</a></td>
|
| 244 |
<td style='text-align: center'><form method=\"post\" action=\"\" name='pcquantity' style='display: inline'>
|
| 245 |
-
|
| 246 |
-
|
| 247 |
<input type='hidden' name='cquantity' value='1' /><input type='text' name='quantity' value='".$item['quantity']."' size='1' onchange='document.pcquantity.submit();' onkeypress='document.getElementById(\"pinfo\").style.display = \"\";' /></form></td>
|
| 248 |
<td style='text-align: center'>".print_payment_currency(($item['price'] * $item['quantity']), $paypal_symbol, $decimal)."</td>
|
| 249 |
<td><form method=\"post\" action=\"\">
|
| 250 |
<input type=\"hidden\" name=\"product\" value=\"".$item['name']."\" />
|
| 251 |
<input type='hidden' name='delcart' value='1' />
|
| 252 |
<input type='image' src='".WP_CART_URL."/images/Shoppingcart_delete.png' value='Remove' title='Remove' /></form></td></tr>
|
| 253 |
-
|
| 254 |
";
|
| 255 |
|
| 256 |
$form .= "
|
|
@@ -261,7 +263,14 @@ function print_wp_shopping_cart()
|
|
| 261 |
";
|
| 262 |
$count++;
|
| 263 |
}
|
| 264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
}
|
| 266 |
|
| 267 |
$count--;
|
|
@@ -404,7 +413,7 @@ function print_wp_cart_button_new($content)
|
|
| 404 |
|
| 405 |
$pieces = explode(':',$m);
|
| 406 |
|
| 407 |
-
$replacement = '<object><form method="post" action=""
|
| 408 |
if (!empty($var_output))
|
| 409 |
{
|
| 410 |
$replacement .= $var_output;
|
|
@@ -474,7 +483,7 @@ function print_wp_cart_button_for_product($name, $price, $shipping=0)
|
|
| 474 |
$addcart = 'Add to Cart';
|
| 475 |
|
| 476 |
|
| 477 |
-
$replacement = '<object><form method="post" action=""
|
| 478 |
if (preg_match("/http:/", $addcart)) // Use the image as the 'add to cart' button
|
| 479 |
{
|
| 480 |
$replacement .= '<input type="image" src="'.$addcart.'" class="wp_cart_button" alt="Add to Cart"/>';
|
|
@@ -520,13 +529,16 @@ function cart_current_page_url() {
|
|
| 520 |
}
|
| 521 |
|
| 522 |
function show_wp_cart_options_page () {
|
| 523 |
-
$wp_simple_paypal_shopping_cart_version = "2.
|
| 524 |
if (isset($_POST['info_update']))
|
| 525 |
{
|
| 526 |
update_option('cart_payment_currency', (string)$_POST["cart_payment_currency"]);
|
| 527 |
update_option('cart_currency_symbol', (string)$_POST["cart_currency_symbol"]);
|
| 528 |
update_option('cart_base_shipping_cost', (string)$_POST["cart_base_shipping_cost"]);
|
| 529 |
-
update_option('cart_free_shipping_threshold', (string)$_POST["cart_free_shipping_threshold"]);
|
|
|
|
|
|
|
|
|
|
| 530 |
update_option('cart_paypal_email', (string)$_POST["cart_paypal_email"]);
|
| 531 |
update_option('addToCartButtonName', (string)$_POST["addToCartButtonName"]);
|
| 532 |
update_option('wp_cart_title', (string)$_POST["wp_cart_title"]);
|
|
@@ -563,8 +575,18 @@ function show_wp_cart_options_page () {
|
|
| 563 |
//if (empty($title)) $title = 'Your Shopping Cart';
|
| 564 |
|
| 565 |
$emptyCartText = get_option('wp_cart_empty_text');
|
| 566 |
-
$cart_products_page_url = get_option('cart_products_page_url');
|
| 567 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 568 |
if (get_option('wp_shopping_cart_image_hide'))
|
| 569 |
$wp_cart_image_hide = 'checked="checked"';
|
| 570 |
else
|
|
@@ -630,6 +652,16 @@ echo '
|
|
| 630 |
<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.</td>
|
| 631 |
</tr>
|
| 632 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 633 |
<tr valign="top">
|
| 634 |
<th scope="row">Add to Cart button text or Image</th>
|
| 635 |
<td><input type="text" name="addToCartButtonName" value="'.$addcart.'" size="100" /><br />To use a cusomized image as the button simply enter the URL of the image file. eg. http://www.tipsandtricks-hq.com/wp-content/plugins/wordpress-paypal-shopping-cart/images/buy_now_button.png</td>
|
|
@@ -728,6 +760,8 @@ add_filter('the_content', 'shopping_cart_show');
|
|
| 728 |
|
| 729 |
add_shortcode('show_wp_shopping_cart', 'show_wp_shopping_cart_handler');
|
| 730 |
|
|
|
|
|
|
|
| 731 |
add_action('wp_head', 'wp_cart_css');
|
| 732 |
add_action('wp_head', 'wp_cart_add_read_form_javascript');
|
| 733 |
?>
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
Plugin Name: WP Simple Paypal Shopping cart
|
| 4 |
+
Version: v2.8.1
|
| 5 |
Plugin URI: http://www.tipsandtricks-hq.com/?p=768
|
| 6 |
Author: Ruhul Amin
|
| 7 |
Author URI: http://www.tipsandtricks-hq.com/
|
| 24 |
$siteurl = get_option('siteurl');
|
| 25 |
define('WP_CART_FOLDER', dirname(plugin_basename(__FILE__)));
|
| 26 |
define('WP_CART_URL', get_option('siteurl').'/wp-content/plugins/' . WP_CART_FOLDER);
|
|
|
|
|
|
|
| 27 |
|
| 28 |
add_option('wp_cart_title', 'Your Shopping Cart');
|
| 29 |
add_option('wp_cart_empty_text', 'Your cart is empty');
|
| 30 |
add_option('cart_return_from_paypal_url', get_bloginfo('wpurl'));
|
| 31 |
|
| 32 |
+
function always_show_cart_handler($atts)
|
| 33 |
+
{
|
| 34 |
+
return print_wp_shopping_cart();
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
function show_wp_shopping_cart_handler()
|
| 38 |
{
|
| 39 |
if (cart_not_empty())
|
| 90 |
{
|
| 91 |
foreach ($products as $key => $item)
|
| 92 |
{
|
| 93 |
+
if ($item['name'] == stripslashes($_POST['product']))
|
| 94 |
{
|
| 95 |
$count += $item['quantity'];
|
| 96 |
$item['quantity']++;
|
| 123 |
$products = $_SESSION['simpleCart'];
|
| 124 |
foreach ($products as $key => $item)
|
| 125 |
{
|
| 126 |
+
if ((stripslashes($item['name']) == stripslashes($_POST['product'])) && $_POST['quantity'])
|
| 127 |
{
|
| 128 |
$item['quantity'] = $_POST['quantity'];
|
| 129 |
unset($products[$key]);
|
| 130 |
array_push($products, $item);
|
| 131 |
}
|
| 132 |
+
else if (($item['name'] == stripslashes($_POST['product'])) && !$_POST['quantity'])
|
| 133 |
unset($products[$key]);
|
| 134 |
}
|
| 135 |
sort($products);
|
| 140 |
$products = $_SESSION['simpleCart'];
|
| 141 |
foreach ($products as $key => $item)
|
| 142 |
{
|
| 143 |
+
if ($item['name'] == stripslashes($_POST['product']))
|
| 144 |
unset($products[$key]);
|
| 145 |
}
|
| 146 |
$_SESSION['simpleCart'] = $products;
|
| 239 |
{
|
| 240 |
$postage_cost = 0;
|
| 241 |
}
|
| 242 |
+
|
| 243 |
foreach ($_SESSION['simpleCart'] as $item)
|
| 244 |
+
{
|
| 245 |
+
$output .= "
|
| 246 |
<tr><td style='overflow: hidden;'><a href='".$item['cartLink']."'>".$item['name']."</a></td>
|
| 247 |
<td style='text-align: center'><form method=\"post\" action=\"\" name='pcquantity' style='display: inline'>
|
| 248 |
+
<input type=\"hidden\" name=\"product\" value=\"".$item['name']."\" />
|
| 249 |
+
|
| 250 |
<input type='hidden' name='cquantity' value='1' /><input type='text' name='quantity' value='".$item['quantity']."' size='1' onchange='document.pcquantity.submit();' onkeypress='document.getElementById(\"pinfo\").style.display = \"\";' /></form></td>
|
| 251 |
<td style='text-align: center'>".print_payment_currency(($item['price'] * $item['quantity']), $paypal_symbol, $decimal)."</td>
|
| 252 |
<td><form method=\"post\" action=\"\">
|
| 253 |
<input type=\"hidden\" name=\"product\" value=\"".$item['name']."\" />
|
| 254 |
<input type='hidden' name='delcart' value='1' />
|
| 255 |
<input type='image' src='".WP_CART_URL."/images/Shoppingcart_delete.png' value='Remove' title='Remove' /></form></td></tr>
|
|
|
|
| 256 |
";
|
| 257 |
|
| 258 |
$form .= "
|
| 263 |
";
|
| 264 |
$count++;
|
| 265 |
}
|
| 266 |
+
if (!get_option('wp_shopping_cart_use_profile_shipping'))
|
| 267 |
+
{
|
| 268 |
+
$form .= "<input type=\"hidden\" name=\"shipping_1\" value='".$postage_cost."' />";
|
| 269 |
+
}
|
| 270 |
+
if (get_option('wp_shopping_cart_collect_address'))//force address collection
|
| 271 |
+
{
|
| 272 |
+
$form .= "<input type=\"hidden\" name=\"no_shipping\" value=\"2\" />";
|
| 273 |
+
}
|
| 274 |
}
|
| 275 |
|
| 276 |
$count--;
|
| 413 |
|
| 414 |
$pieces = explode(':',$m);
|
| 415 |
|
| 416 |
+
$replacement = '<object><form method="post" action="" style="display:inline" onsubmit="return ReadForm(this, true);">';
|
| 417 |
if (!empty($var_output))
|
| 418 |
{
|
| 419 |
$replacement .= $var_output;
|
| 483 |
$addcart = 'Add to Cart';
|
| 484 |
|
| 485 |
|
| 486 |
+
$replacement = '<object><form method="post" action="" style="display:inline">';
|
| 487 |
if (preg_match("/http:/", $addcart)) // Use the image as the 'add to cart' button
|
| 488 |
{
|
| 489 |
$replacement .= '<input type="image" src="'.$addcart.'" class="wp_cart_button" alt="Add to Cart"/>';
|
| 529 |
}
|
| 530 |
|
| 531 |
function show_wp_cart_options_page () {
|
| 532 |
+
$wp_simple_paypal_shopping_cart_version = "2.8.1";
|
| 533 |
if (isset($_POST['info_update']))
|
| 534 |
{
|
| 535 |
update_option('cart_payment_currency', (string)$_POST["cart_payment_currency"]);
|
| 536 |
update_option('cart_currency_symbol', (string)$_POST["cart_currency_symbol"]);
|
| 537 |
update_option('cart_base_shipping_cost', (string)$_POST["cart_base_shipping_cost"]);
|
| 538 |
+
update_option('cart_free_shipping_threshold', (string)$_POST["cart_free_shipping_threshold"]);
|
| 539 |
+
update_option('wp_shopping_cart_collect_address', ($_POST['wp_shopping_cart_collect_address']!='') ? 'checked="checked"':'' );
|
| 540 |
+
update_option('wp_shopping_cart_use_profile_shipping', ($_POST['wp_shopping_cart_use_profile_shipping']!='') ? 'checked="checked"':'' );
|
| 541 |
+
|
| 542 |
update_option('cart_paypal_email', (string)$_POST["cart_paypal_email"]);
|
| 543 |
update_option('addToCartButtonName', (string)$_POST["addToCartButtonName"]);
|
| 544 |
update_option('wp_cart_title', (string)$_POST["wp_cart_title"]);
|
| 575 |
//if (empty($title)) $title = 'Your Shopping Cart';
|
| 576 |
|
| 577 |
$emptyCartText = get_option('wp_cart_empty_text');
|
| 578 |
+
$cart_products_page_url = get_option('cart_products_page_url');
|
| 579 |
+
|
| 580 |
+
if (get_option('wp_shopping_cart_collect_address'))
|
| 581 |
+
$wp_shopping_cart_collect_address = 'checked="checked"';
|
| 582 |
+
else
|
| 583 |
+
$wp_shopping_cart_collect_address = '';
|
| 584 |
+
|
| 585 |
+
if (get_option('wp_shopping_cart_use_profile_shipping'))
|
| 586 |
+
$wp_shopping_cart_use_profile_shipping = 'checked="checked"';
|
| 587 |
+
else
|
| 588 |
+
$wp_shopping_cart_use_profile_shipping = '';
|
| 589 |
+
|
| 590 |
if (get_option('wp_shopping_cart_image_hide'))
|
| 591 |
$wp_cart_image_hide = 'checked="checked"';
|
| 592 |
else
|
| 652 |
<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.</td>
|
| 653 |
</tr>
|
| 654 |
|
| 655 |
+
<tr valign="top">
|
| 656 |
+
<th scope="row">Must Collect Shipping Address on PayPal</th>
|
| 657 |
+
<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.</td>
|
| 658 |
+
</tr>
|
| 659 |
+
|
| 660 |
+
<tr valign="top">
|
| 661 |
+
<th scope="row">Use PayPal Profile Based Shipping</th>
|
| 662 |
+
<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 <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</a>. Using this will ignore any other shipping options that you have specified in this plugin.</td>
|
| 663 |
+
</tr>
|
| 664 |
+
|
| 665 |
<tr valign="top">
|
| 666 |
<th scope="row">Add to Cart button text or Image</th>
|
| 667 |
<td><input type="text" name="addToCartButtonName" value="'.$addcart.'" size="100" /><br />To use a cusomized image as the button simply enter the URL of the image file. eg. http://www.tipsandtricks-hq.com/wp-content/plugins/wordpress-paypal-shopping-cart/images/buy_now_button.png</td>
|
| 760 |
|
| 761 |
add_shortcode('show_wp_shopping_cart', 'show_wp_shopping_cart_handler');
|
| 762 |
|
| 763 |
+
add_shortcode('always_show_wp_shopping_cart', 'always_show_cart_handler');
|
| 764 |
+
|
| 765 |
add_action('wp_head', 'wp_cart_css');
|
| 766 |
add_action('wp_head', 'wp_cart_add_read_form_javascript');
|
| 767 |
?>
|
