Version Description
- Add: User can duplicate a product in admin panel
- Add: WooThemes integration support
- Change: Total in Cart widget now excludes shipping and tax
- Fix: Invalid country code in paypal-standard.merchant.php
- Fix: Tax is not passed properly to Paypal Pro
- Fix: Currency code preference not correctly selected in Paypal gateways
- Fix: Paypal gateways doesn't check whether the currency being sent to Paypal is accepted or not, resulting in wrong currency
- Fix: Checkout form selecting the wrong field when a previous field with the same uniquename was deleted
- Fix: Various issues with Google Checkout
- Fix: State data outside of US is not passed to payment gateways
- Fix: State is not displaying correctly in the users purchase history
- Fix: Wrong generated product permalink when a product is assigned multiple cats, and a product category is being viewed
- Fix: Submitting a checkout form with mandatory billing state only refreshes the form although everything is filled out correctly
- Fix: Billing Country is trimmed, and Billing State is not properly decoded
- Fix: Billing and shipping state no longer stored correctly
- Fix: Checkout form validation skips mandatory custom checkout fields on default form set
- Fix: Paystation does not properly update purchase logs
- Fix: When there's no product, and Sort Product By is set to 'dragndrop', viewing the admin product list would produce a Division by zero warning
- Fix: Store sub-pages return 404 error
- Fix: Only Purchase History in Your Account show the login option
- Fix: Weight on Variations contain too many decimals
- Fix: Add to Cart in grid view bypasses Variations selection
- Fix: get_queried_object() requires WP 3.1
- Fix: Invalid version number in display-update.page.php
- Fix: Correct HTML, to stop Free Shipping Discount getting blanked
- Fix: Support taxonomy archives for product_tag taxonomy
Download this release
Release Info
Developer | garyc40 |
Plugin | WP eCommerce |
Version | 3.8.4 |
Comparing to | |
See all releases |
Code changes from version 3.8.3 to 3.8.4
- readme.txt +29 -1
- woo-integration/css/main_frame_style.css +12 -0
- woo-integration/css/style.css +155 -0
- woo-integration/js/script.js +51 -0
- woo-integration/options_presentation.php +16 -0
- woo-integration/woo_integration.php +61 -0
- wp-shopping-cart.php +2 -2
- wpsc-admin/admin-form-functions.php +2 -2
- wpsc-admin/admin.php +7 -14
- wpsc-admin/ajax-and-init.php +12 -13
- wpsc-admin/display-items.page.php +19 -2
- wpsc-admin/display-sales-logs.php +2 -1
- wpsc-admin/display-update.page.php +1 -1
- wpsc-admin/includes/products.php +1 -1
- wpsc-admin/includes/settings-pages/presentation.php +1 -1
- wpsc-admin/includes/settings-pages/shipping.php +2 -2
- wpsc-admin/js/admin.js +4 -5
- wpsc-core/js/wp-e-commerce.js +1 -1
- wpsc-core/wpsc-constants.php +3 -3
- wpsc-core/wpsc-functions.php +23 -13
- wpsc-includes/ajax.functions.php +3 -3
- wpsc-includes/checkout.class.php +43 -15
- wpsc-includes/currency_converter.inc.php +29 -58
- wpsc-includes/merchant.class.php +8 -16
- wpsc-includes/theme.functions.php +18 -10
- wpsc-merchants/GoogleCheckout-XML.php +97 -102
- wpsc-merchants/paypal-express.merchant.php +64 -46
- wpsc-merchants/paypal-pro.merchant.php +91 -19
- wpsc-merchants/paypal-standard.merchant.php +53 -46
- wpsc-theme/functions/wpsc-transaction_results_functions.php +17 -0
- wpsc-theme/functions/wpsc-user_log_functions.php +15 -10
- wpsc-theme/wpsc-cart_widget.php +2 -21
- wpsc-theme/wpsc-user-log.php +8 -6
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://getshopped.org
|
|
4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1.1
|
7 |
-
Stable tag: 3.8.
|
8 |
|
9 |
WP e-Commerce is a Web 2.0 application designed with usability, aesthetics, and presentation in mind.
|
10 |
|
@@ -37,6 +37,34 @@ After upgrading from earlier versions look for link "Update Store". This will up
|
|
37 |
|
38 |
|
39 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
= 3.8.3 =
|
41 |
* New: Individual item details are sent to Paypal Express Checkout
|
42 |
* Change: Automatically reload database update page when PHP maximum execution time is detected
|
4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1.1
|
7 |
+
Stable tag: 3.8.4
|
8 |
|
9 |
WP e-Commerce is a Web 2.0 application designed with usability, aesthetics, and presentation in mind.
|
10 |
|
37 |
|
38 |
|
39 |
== Changelog ==
|
40 |
+
= 3.8.4 =
|
41 |
+
* Add: User can duplicate a product in admin panel
|
42 |
+
* Add: WooThemes integration support
|
43 |
+
* Change: Total in Cart widget now excludes shipping and tax
|
44 |
+
* Fix: Invalid country code in paypal-standard.merchant.php
|
45 |
+
* Fix: Tax is not passed properly to Paypal Pro
|
46 |
+
* Fix: Currency code preference not correctly selected in Paypal gateways
|
47 |
+
* Fix: Paypal gateways doesn't check whether the currency being sent to Paypal is accepted or not, resulting in wrong currency
|
48 |
+
* Fix: Checkout form selecting the wrong field when a previous field with the same uniquename was deleted
|
49 |
+
* Fix: Various issues with Google Checkout
|
50 |
+
* Fix: State data outside of US is not passed to payment gateways
|
51 |
+
* Fix: State is not displaying correctly in the users purchase history
|
52 |
+
* Fix: Wrong generated product permalink when a product is assigned multiple cats, and a product category is being viewed
|
53 |
+
* Fix: Submitting a checkout form with mandatory billing state only refreshes the form although everything is filled out correctly
|
54 |
+
* Fix: Billing Country is trimmed, and Billing State is not properly decoded
|
55 |
+
* Fix: Billing and shipping state no longer stored correctly
|
56 |
+
* Fix: Checkout form validation skips mandatory custom checkout fields on default form set
|
57 |
+
* Fix: Paystation does not properly update purchase logs
|
58 |
+
* Fix: When there's no product, and Sort Product By is set to 'dragndrop', viewing the admin product list would produce a Division by zero warning
|
59 |
+
* Fix: Store sub-pages return 404 error
|
60 |
+
* Fix: Only Purchase History in Your Account show the login option
|
61 |
+
* Fix: Weight on Variations contain too many decimals
|
62 |
+
* Fix: Add to Cart in grid view bypasses Variations selection
|
63 |
+
* Fix: get_queried_object() requires WP 3.1
|
64 |
+
* Fix: Invalid version number in display-update.page.php
|
65 |
+
* Fix: Correct HTML, to stop Free Shipping Discount getting blanked
|
66 |
+
* Fix: Support taxonomy archives for product_tag taxonomy
|
67 |
+
|
68 |
= 3.8.3 =
|
69 |
* New: Individual item details are sent to Paypal Express Checkout
|
70 |
* Change: Automatically reload database update page when PHP maximum execution time is detected
|
woo-integration/css/main_frame_style.css
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* CSS Document */
|
2 |
+
|
3 |
+
li.wpsc_presentation a{
|
4 |
+
padding-left: 40px !important;
|
5 |
+
background: url(../../wpsc-core/images/credit_cards.png) no-repeat;
|
6 |
+
background-position: 12px center;
|
7 |
+
}
|
8 |
+
|
9 |
+
iframe#wpsc-presentation{
|
10 |
+
height: 2210px;
|
11 |
+
width: 100%;
|
12 |
+
}
|
woo-integration/css/style.css
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* CSS Document */
|
2 |
+
|
3 |
+
*{
|
4 |
+
font-family: 'Lucida Grande', Verdana, sans-serif;
|
5 |
+
font-size: 11px;
|
6 |
+
color: #666;
|
7 |
+
list-style: none;
|
8 |
+
}
|
9 |
+
|
10 |
+
h3{
|
11 |
+
font-size: 14px;
|
12 |
+
color: #333;
|
13 |
+
display: block;
|
14 |
+
border-bottom: solid 1px #e7e7e7;
|
15 |
+
padding-bottom: 7px;
|
16 |
+
}
|
17 |
+
|
18 |
+
tr{
|
19 |
+
display: block;
|
20 |
+
padding-bottom: 10px;
|
21 |
+
}
|
22 |
+
|
23 |
+
th[scope=row], th[score=row]{
|
24 |
+
text-align: left;
|
25 |
+
}
|
26 |
+
|
27 |
+
input[type=text]{
|
28 |
+
border: solid #CCC #EEE #EEE #CCC;
|
29 |
+
border-width: 1px;
|
30 |
+
background-color: #fafafa;
|
31 |
+
-moz-border-radius: 3px;
|
32 |
+
-webkit-border-radius: 3px;
|
33 |
+
-border-radius: 3px;
|
34 |
+
padding: 5px;
|
35 |
+
-webkit-bor
|
36 |
+
}
|
37 |
+
|
38 |
+
input[type=text]:hover{
|
39 |
+
background-color: #FFF;
|
40 |
+
}
|
41 |
+
|
42 |
+
.allign_top{
|
43 |
+
vertical-align: top;
|
44 |
+
}
|
45 |
+
|
46 |
+
.button_settings_th{
|
47 |
+
width: 180px;
|
48 |
+
}
|
49 |
+
|
50 |
+
.button_settings_desc{
|
51 |
+
width: 260px;
|
52 |
+
padding-left: 20px;
|
53 |
+
}
|
54 |
+
|
55 |
+
.product_settings_th{
|
56 |
+
width: 350px;
|
57 |
+
}
|
58 |
+
|
59 |
+
.product_page_settings_th, .product_category_settings_th, .thumbnail_settings_th{
|
60 |
+
width: 260px;
|
61 |
+
padding-right: 10px;
|
62 |
+
}
|
63 |
+
|
64 |
+
.shopping_cart_settings_th{
|
65 |
+
width: 240px;
|
66 |
+
padding-right: 10px;
|
67 |
+
}
|
68 |
+
|
69 |
+
.pagination_settings_th{
|
70 |
+
width: 200px;
|
71 |
+
}
|
72 |
+
|
73 |
+
.wpsc_select_wrapper{
|
74 |
+
-moz-border-radius: 4px;
|
75 |
+
-webkit-border-radius: 4px;
|
76 |
+
border-radius: 4px;
|
77 |
+
font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
|
78 |
+
font-size: 12px;
|
79 |
+
background: #FAFAFA url(../../functions/images/select.png) no-repeat right center;
|
80 |
+
border-color: #CCC #EEE #EEE #CCC;
|
81 |
+
border-style: solid;
|
82 |
+
border-width: 1px;
|
83 |
+
float: left;
|
84 |
+
height: 26px;
|
85 |
+
width: 280px;
|
86 |
+
margin: 0;
|
87 |
+
margin-bottom: 9px !important;
|
88 |
+
display: block;
|
89 |
+
color: #555;
|
90 |
+
}
|
91 |
+
|
92 |
+
.wpsc_select{
|
93 |
+
cursor: pointer;
|
94 |
+
height: 28px;
|
95 |
+
margin: 0;
|
96 |
+
opacity: 0;
|
97 |
+
padding: 0;
|
98 |
+
position: relative;
|
99 |
+
width: inherit;
|
100 |
+
z-index: 4;
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
.wpsc_select_span{
|
105 |
+
height: 26px;
|
106 |
+
line-height: 26px;
|
107 |
+
position: absolute;
|
108 |
+
z-index: 2;
|
109 |
+
padding-left: 6px;
|
110 |
+
}
|
111 |
+
|
112 |
+
.wpsc_select:hover{
|
113 |
+
color: #333;
|
114 |
+
background: white;
|
115 |
+
}
|
116 |
+
|
117 |
+
input[type=submit][name=updateoption]{
|
118 |
+
border-color: #BBB !important;
|
119 |
+
cursor: pointer;
|
120 |
+
background-color: #FAFAFA;
|
121 |
+
border: 1px solid;
|
122 |
+
padding: 5px;
|
123 |
+
font-family: "Lucida Grande", Verdana, sans-serif;
|
124 |
+
color: #555;
|
125 |
+
-moz-border-radius: 4px;
|
126 |
+
-webkit-border-radius: 4px;
|
127 |
+
-border-radius: 4px;
|
128 |
+
border-style: solid;
|
129 |
+
border-width: 1px;
|
130 |
+
position: fixed;
|
131 |
+
bottom: 10px;
|
132 |
+
}
|
133 |
+
|
134 |
+
input[type=submit][name=updateoption]:hover{
|
135 |
+
border-color: #666 !important;
|
136 |
+
color: black;
|
137 |
+
}
|
138 |
+
|
139 |
+
.comment_settings_th{
|
140 |
+
width: 250px;
|
141 |
+
}
|
142 |
+
|
143 |
+
#message{
|
144 |
+
position: fixed;
|
145 |
+
bottom: 10px;
|
146 |
+
right: 0px;
|
147 |
+
display: block;
|
148 |
+
width: 400px;
|
149 |
+
text-align: center;
|
150 |
+
background-color: #FFFFE0;
|
151 |
+
border: 1px solid #E6DB55;
|
152 |
+
-moz-border-radius: 4px;
|
153 |
+
-webkit-border-radius: 4px;
|
154 |
+
-border-radius: 4px;
|
155 |
+
}
|
woo-integration/js/script.js
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// JavaScript Document
|
2 |
+
$(document).ready(function() {
|
3 |
+
//Button Settings Block
|
4 |
+
$("h3:contains('Button Settings')").next().find('th[scope="row"]').addClass('button_settings_th allign_top');
|
5 |
+
|
6 |
+
var i = $("h3:contains('Button Settings')").next().find('td').first();
|
7 |
+
i.html(i.html().replace('Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.',''));
|
8 |
+
i.after("<td class='button_settings_desc'>Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.</td>");
|
9 |
+
i.addClass('allign_top');
|
10 |
+
|
11 |
+
//Products Settings Block
|
12 |
+
$("h3:contains('Product Settings')").next().find('th[scope="row"]').addClass('product_settings_th allign_top');
|
13 |
+
$("h3:contains('Product Settings')").next().find('th[score="row"]').addClass('product_settings_th allign_top');
|
14 |
+
|
15 |
+
//Product Page Settings
|
16 |
+
$("h3:contains('Product Page Settings')").next().find('th[scope="row"]').addClass('product_page_settings_th allign_top');
|
17 |
+
|
18 |
+
//Shopping Cart Settings
|
19 |
+
$("h3:contains('Shopping Cart Settings')").next().find('th[scope="row"]').addClass('shopping_cart_settings_th allign_top');
|
20 |
+
|
21 |
+
//Product category Settings
|
22 |
+
$("h3:contains('Product Category Settings')").next().find('th[scope="row"]').addClass('product_category_settings_th allign_top');
|
23 |
+
|
24 |
+
//Thumbnail Settings
|
25 |
+
$("h3:contains('Thumbnail Settings')").next().next().find('th[scope="row"]').addClass('thumbnail_settings_th');
|
26 |
+
|
27 |
+
//Pagination Settings
|
28 |
+
$("h3:contains('Pagination settings')").next().find('th[scope="row"]').addClass('pagination_settings_th');
|
29 |
+
|
30 |
+
//Comment Settings
|
31 |
+
$("h3:contains('Comment Settings')").next().find('th[scope="row"]').addClass('comment_settings_th');
|
32 |
+
|
33 |
+
//Select control
|
34 |
+
$("select").wrap('<div class="wpsc_select_wrapper" />');
|
35 |
+
$("select").before('<span class="wpsc_select_span"></span>');
|
36 |
+
$("select").addClass("wpsc_select");
|
37 |
+
$("select").change(function (){
|
38 |
+
$(this).prev().text($(this).find('option:selected').text());
|
39 |
+
});
|
40 |
+
|
41 |
+
//Initialize select valua
|
42 |
+
$("select").each(function(index, element) {
|
43 |
+
$(this).prev().text($(this).find('option:selected').text());
|
44 |
+
});
|
45 |
+
|
46 |
+
//Remove Advanced Theme Setting
|
47 |
+
$('#themes_and_appearance').remove();
|
48 |
+
|
49 |
+
//Remove redundant 0 after the form
|
50 |
+
$('body').html($('#cart_options'));
|
51 |
+
});
|
woo-integration/options_presentation.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
3 |
+
<head>
|
4 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5 |
+
<link rel="stylesheet" type="text/css" href="<?php echo WPSC_URL; ?>/woo-integration/css/style.css"/>
|
6 |
+
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
|
7 |
+
<script type="text/javascript" src="<?php echo WPSC_URL; ?>/woo-integration/js/script.js"></script>
|
8 |
+
<title>Dirty Options Presentaion</title>
|
9 |
+
</head>
|
10 |
+
<body>
|
11 |
+
<?php
|
12 |
+
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/presentation.php' );
|
13 |
+
echo wpsc_options_presentation();
|
14 |
+
?>
|
15 |
+
</body>
|
16 |
+
</html>
|
woo-integration/woo_integration.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//Remove presentation tab on wpsc option menu
|
4 |
+
function woo_wpsc_remove_presentation_tab($default_tabs){
|
5 |
+
unset( $default_tabs['presentation'] );
|
6 |
+
return $default_tabs;
|
7 |
+
}
|
8 |
+
|
9 |
+
//Filter redirect url so that WPSC presentation page will loac correctly after update
|
10 |
+
function woo_wpsc_filter_redirect_url($query){
|
11 |
+
if ($_GET['page']=='woothemes'){
|
12 |
+
$query = remove_query_arg('tab', $query);
|
13 |
+
$query = add_query_arg( 'page' , 'woothemes' , $query);
|
14 |
+
}
|
15 |
+
return $query;
|
16 |
+
}
|
17 |
+
|
18 |
+
//Print presentation menu subpage
|
19 |
+
function woo_wpsc_filter_option($return){
|
20 |
+
$return[1] .= '<li class="wpsc_presentation">
|
21 |
+
<a title="WPSC_presentation" href="#wpsc-option-presentation">
|
22 |
+
WPSC Presentation
|
23 |
+
</a>
|
24 |
+
</li>';
|
25 |
+
|
26 |
+
$return[0] .= ' <div class="group" id="wpsc-option-presentation">
|
27 |
+
<iframe id="wpsc-presentation" src="'.get_bloginfo('wpurl').'/wp-admin/admin-ajax.php?action=print_wpsc_presentation">
|
28 |
+
</iframe>
|
29 |
+
</div>';
|
30 |
+
|
31 |
+
return $return;
|
32 |
+
}
|
33 |
+
|
34 |
+
//Ajax respont for wp_ajax_print_wpsc_presentation
|
35 |
+
function woo_wpsc_presentation_menu(){
|
36 |
+
require_once( WPSC_FILE_PATH . '/woo-integration/options_presentation.php' );
|
37 |
+
}
|
38 |
+
|
39 |
+
//Add main frame style sheet
|
40 |
+
function add_my_stylesheet() {
|
41 |
+
wp_register_style('gb_admin_style', get_bloginfo('template_url') . '/wpsc/css/main_frame_style.css' );
|
42 |
+
wp_enqueue_style('gb_admin_style');
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
function woo_wpsc_integration(){
|
47 |
+
add_filter( 'wpsc_settings_tabs' , 'woo_wpsc_remove_presentation_tab');
|
48 |
+
add_filter( 'woo_before_option_page' , 'woo_wpsc_filter_option');
|
49 |
+
add_filter( 'wpsc_settings_redirect_url' , 'woo_wpsc_filter_redirect_url');
|
50 |
+
add_action( 'wp_ajax_print_wpsc_presentation' , 'woo_wpsc_presentation_menu');
|
51 |
+
add_action( 'admin_init' , 'add_my_stylesheet');
|
52 |
+
}
|
53 |
+
|
54 |
+
function wpsc_detect_woo(){
|
55 |
+
if (function_exists('woo_version')){
|
56 |
+
woo_wpsc_integration();
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
add_action('after_setup_theme', 'wpsc_detect_woo');
|
61 |
+
?>
|
wp-shopping-cart.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WP e-Commerce
|
4 |
* Plugin URI: http://getshopped.org/
|
5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
6 |
-
* Version: 3.8.
|
7 |
* Author: Instinct Entertainment
|
8 |
* Author URI: http://getshopped.org/
|
9 |
**/
|
@@ -99,7 +99,7 @@ class WP_eCommerce {
|
|
99 |
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-functions.php' );
|
100 |
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
|
101 |
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-includes.php' );
|
102 |
-
|
103 |
// Any additional file includes can hook in here
|
104 |
do_action( 'wpsc_includes' );
|
105 |
}
|
3 |
* Plugin Name: WP e-Commerce
|
4 |
* Plugin URI: http://getshopped.org/
|
5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
6 |
+
* Version: 3.8.4
|
7 |
* Author: Instinct Entertainment
|
8 |
* Author URI: http://getshopped.org/
|
9 |
**/
|
99 |
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-functions.php' );
|
100 |
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
|
101 |
require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-includes.php' );
|
102 |
+
|
103 |
// Any additional file includes can hook in here
|
104 |
do_action( 'wpsc_includes' );
|
105 |
}
|
wpsc-admin/admin-form-functions.php
CHANGED
@@ -192,8 +192,8 @@ function wpsc_right_now() {
|
|
192 |
$monthtotal = wpsc_currency_display( admin_display_total_price( $start_timestamp,$end_timestamp ) );
|
193 |
$overaltotal = wpsc_currency_display( admin_display_total_price() );
|
194 |
$variation_count = count(get_terms("wpsc-variation", array('parent' => 0)));
|
195 |
-
$pending_sales = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('1')");
|
196 |
-
$accept_sales = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('
|
197 |
$theme = get_option('wpsc_selected_theme');
|
198 |
?>
|
199 |
<div class='table'>
|
192 |
$monthtotal = wpsc_currency_display( admin_display_total_price( $start_timestamp,$end_timestamp ) );
|
193 |
$overaltotal = wpsc_currency_display( admin_display_total_price() );
|
194 |
$variation_count = count(get_terms("wpsc-variation", array('parent' => 0)));
|
195 |
+
$pending_sales = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('1','2')");
|
196 |
+
$accept_sales = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('3' ,'4', '5')");
|
197 |
$theme = get_option('wpsc_selected_theme');
|
198 |
?>
|
199 |
<div class='table'>
|
wpsc-admin/admin.php
CHANGED
@@ -25,6 +25,10 @@ require_once( WPSC_FILE_PATH . '/wpsc-admin/display-sales-logs.php' );
|
|
25 |
if ( ( isset( $_SESSION['wpsc_activate_debug_page'] ) && ( $_SESSION['wpsc_activate_debug_page'] == true ) ) || ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && ( constant( 'WPSC_ADD_DEBUG_PAGE' ) == true ) ) )
|
26 |
require_once( WPSC_FILE_PATH . '/wpsc-admin/display-debug.page.php' );
|
27 |
|
|
|
|
|
|
|
|
|
28 |
//settings pages include
|
29 |
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/general.php' );
|
30 |
|
@@ -93,20 +97,9 @@ add_filter('set-screen-option', 'wpsc_set_screen_option', 99, 3);
|
|
93 |
*/
|
94 |
function wpsc_drag_and_drop_ordering($per_page, $post_type){
|
95 |
global $wpdb;
|
96 |
-
if('wpsc-product' == $post_type ){
|
97 |
-
|
98 |
-
|
99 |
-
}else{
|
100 |
-
$_post_type = str_replace('-', '_', $post_type);
|
101 |
-
$edit_per_page = 'edit_' . $_post_type . '_per_page';
|
102 |
-
$per_page = ((int) get_user_option( $edit_per_page ))?(int) get_user_option( $edit_per_page ):$per_page;
|
103 |
-
}
|
104 |
-
|
105 |
-
return $per_page;
|
106 |
-
}else{
|
107 |
-
return $per_page;
|
108 |
-
}
|
109 |
-
|
110 |
}
|
111 |
add_filter( 'request', 'wpsc_query_vars_product_list' );
|
112 |
add_filter('edit_posts_per_page' , 'wpsc_drag_and_drop_ordering', 10, 2 );
|
25 |
if ( ( isset( $_SESSION['wpsc_activate_debug_page'] ) && ( $_SESSION['wpsc_activate_debug_page'] == true ) ) || ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && ( constant( 'WPSC_ADD_DEBUG_PAGE' ) == true ) ) )
|
26 |
require_once( WPSC_FILE_PATH . '/wpsc-admin/display-debug.page.php' );
|
27 |
|
28 |
+
|
29 |
+
//Woothemes integration
|
30 |
+
require_once( WPSC_FILE_PATH . '/woo-integration/woo_integration.php' );
|
31 |
+
|
32 |
//settings pages include
|
33 |
require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/general.php' );
|
34 |
|
97 |
*/
|
98 |
function wpsc_drag_and_drop_ordering($per_page, $post_type){
|
99 |
global $wpdb;
|
100 |
+
if ( 'wpsc-product' == $post_type && 'dragndrop' == get_option( 'wpsc_sort_by' ) && $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE `post_type`='wpsc-product' AND `post_parent`=0" ) )
|
101 |
+
$per_page = $count;
|
102 |
+
return $per_page;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
add_filter( 'request', 'wpsc_query_vars_product_list' );
|
105 |
add_filter('edit_posts_per_page' , 'wpsc_drag_and_drop_ordering', 10, 2 );
|
wpsc-admin/ajax-and-init.php
CHANGED
@@ -140,9 +140,10 @@ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action']
|
|
140 |
* Purposely not duplicating stick post status (logically, products are most often duplicated because they share many attributes, where products are generally 'featured' uniquely.)
|
141 |
*/
|
142 |
function wpsc_duplicate_product() {
|
|
|
143 |
// Get the original post
|
144 |
$id = absint( $_GET['product'] );
|
145 |
-
$post =
|
146 |
|
147 |
// Copy the post and insert it
|
148 |
if ( isset( $post ) && $post != null ) {
|
@@ -159,11 +160,6 @@ function wpsc_duplicate_product() {
|
|
159 |
}
|
160 |
}
|
161 |
|
162 |
-
function wpsc_duplicate_this_dangit( $id ) {
|
163 |
-
$post = get_post($id);
|
164 |
-
return $post;
|
165 |
-
}
|
166 |
-
|
167 |
function wpsc_duplicate_product_process( $post ) {
|
168 |
|
169 |
$new_post_date = $post->post_date;
|
@@ -264,6 +260,7 @@ function wpsc_duplicate_children( $old_parent_id, $new_parent_id ) {
|
|
264 |
$comment_status = str_replace( "'", "''", $child_post->comment_status );
|
265 |
$ping_status = str_replace( "'", "''", $child_post->ping_status );
|
266 |
|
|
|
267 |
$wpdb->query(
|
268 |
"INSERT INTO $wpdb->posts
|
269 |
(post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type)
|
@@ -283,10 +280,6 @@ function wpsc_duplicate_children( $old_parent_id, $new_parent_id ) {
|
|
283 |
}
|
284 |
}
|
285 |
|
286 |
-
if ( isset( $_GET['wpsc_admin_action'] ) && ($_GET['wpsc_admin_action'] == 'duplicate_product') ) {
|
287 |
-
add_action( 'admin_init', 'wpsc_duplicate_product' );
|
288 |
-
}
|
289 |
-
|
290 |
function wpsc_purchase_log_csv() {
|
291 |
global $wpdb, $wpsc_gateways;
|
292 |
get_currentuserinfo();
|
@@ -921,6 +914,7 @@ function wpsc_submit_options( $selected='' ) {
|
|
921 |
}
|
922 |
|
923 |
$sendback = add_query_arg( 'page', 'wpsc-settings', $sendback );
|
|
|
924 |
wp_redirect( $sendback );
|
925 |
exit();
|
926 |
}
|
@@ -1262,8 +1256,10 @@ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action']
|
|
1262 |
function wpsc_checkout_settings() {
|
1263 |
global $wpdb;
|
1264 |
$wpdb->show_errors = true;
|
1265 |
-
$filter = isset( $_POST['selected_form_set'] ) ? $_POST['selected_form_set'] : 0;
|
1266 |
-
|
|
|
|
|
1267 |
if ( $_POST['new_form_set'] != null ) {
|
1268 |
$checkout_sets = get_option( 'wpsc_checkout_form_sets' );
|
1269 |
$checkout_sets[] = $_POST['new_form_set'];
|
@@ -1331,13 +1327,14 @@ function wpsc_checkout_settings() {
|
|
1331 |
foreach ( $_POST['new_form_name'] as $form_id => $form_name ) {
|
1332 |
$form_type = $_POST['new_form_type'][$form_id];
|
1333 |
$form_mandatory = 0;
|
1334 |
-
if ( $_POST['new_form_mandatory'][$form_id]
|
1335 |
$form_mandatory = 1;
|
1336 |
}
|
1337 |
$form_display_log = 0;
|
1338 |
if ( isset( $_POST['new_form_display_log'][$form_id] ) && $_POST['new_form_display_log'][$form_id] == 1 ) {
|
1339 |
$form_display_log = 1;
|
1340 |
}
|
|
|
1341 |
if ( $_POST['new_form_unique_name'][$form_id] != '-1' ) {
|
1342 |
$form_unique_name = $_POST['new_form_unique_name'][$form_id];
|
1343 |
}
|
@@ -1350,6 +1347,7 @@ function wpsc_checkout_settings() {
|
|
1350 |
$max_order_sql = $wpdb->get_results( $max_order_sql, ARRAY_A );
|
1351 |
$order_number = $max_order_sql[0]['checkout_order'] + 1;
|
1352 |
}
|
|
|
1353 |
$wpdb->insert(
|
1354 |
WPSC_TABLE_CHECKOUT_FORMS,
|
1355 |
array(
|
@@ -1365,6 +1363,7 @@ function wpsc_checkout_settings() {
|
|
1365 |
),
|
1366 |
array( '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%s' )
|
1367 |
);
|
|
|
1368 |
$added++;
|
1369 |
}
|
1370 |
}
|
140 |
* Purposely not duplicating stick post status (logically, products are most often duplicated because they share many attributes, where products are generally 'featured' uniquely.)
|
141 |
*/
|
142 |
function wpsc_duplicate_product() {
|
143 |
+
|
144 |
// Get the original post
|
145 |
$id = absint( $_GET['product'] );
|
146 |
+
$post = get_post( $id );
|
147 |
|
148 |
// Copy the post and insert it
|
149 |
if ( isset( $post ) && $post != null ) {
|
160 |
}
|
161 |
}
|
162 |
|
|
|
|
|
|
|
|
|
|
|
163 |
function wpsc_duplicate_product_process( $post ) {
|
164 |
|
165 |
$new_post_date = $post->post_date;
|
260 |
$comment_status = str_replace( "'", "''", $child_post->comment_status );
|
261 |
$ping_status = str_replace( "'", "''", $child_post->ping_status );
|
262 |
|
263 |
+
//Definitely doing this wrong.
|
264 |
$wpdb->query(
|
265 |
"INSERT INTO $wpdb->posts
|
266 |
(post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type)
|
280 |
}
|
281 |
}
|
282 |
|
|
|
|
|
|
|
|
|
283 |
function wpsc_purchase_log_csv() {
|
284 |
global $wpdb, $wpsc_gateways;
|
285 |
get_currentuserinfo();
|
914 |
}
|
915 |
|
916 |
$sendback = add_query_arg( 'page', 'wpsc-settings', $sendback );
|
917 |
+
$sendback = apply_filters( 'wpsc_settings_redirect_url', $sendback );
|
918 |
wp_redirect( $sendback );
|
919 |
exit();
|
920 |
}
|
1256 |
function wpsc_checkout_settings() {
|
1257 |
global $wpdb;
|
1258 |
$wpdb->show_errors = true;
|
1259 |
+
$filter = isset( $_POST['selected_form_set'] ) ? $_POST['selected_form_set'] : '0';
|
1260 |
+
if ( ! isset( $_POST['new_form_mandatory'] ) )
|
1261 |
+
$_POST['new_form_mandatory'] = array();
|
1262 |
+
|
1263 |
if ( $_POST['new_form_set'] != null ) {
|
1264 |
$checkout_sets = get_option( 'wpsc_checkout_form_sets' );
|
1265 |
$checkout_sets[] = $_POST['new_form_set'];
|
1327 |
foreach ( $_POST['new_form_name'] as $form_id => $form_name ) {
|
1328 |
$form_type = $_POST['new_form_type'][$form_id];
|
1329 |
$form_mandatory = 0;
|
1330 |
+
if ( ! empty( $_POST['new_form_mandatory'][$form_id] ) ) {
|
1331 |
$form_mandatory = 1;
|
1332 |
}
|
1333 |
$form_display_log = 0;
|
1334 |
if ( isset( $_POST['new_form_display_log'][$form_id] ) && $_POST['new_form_display_log'][$form_id] == 1 ) {
|
1335 |
$form_display_log = 1;
|
1336 |
}
|
1337 |
+
$form_unique_name = '';
|
1338 |
if ( $_POST['new_form_unique_name'][$form_id] != '-1' ) {
|
1339 |
$form_unique_name = $_POST['new_form_unique_name'][$form_id];
|
1340 |
}
|
1347 |
$max_order_sql = $wpdb->get_results( $max_order_sql, ARRAY_A );
|
1348 |
$order_number = $max_order_sql[0]['checkout_order'] + 1;
|
1349 |
}
|
1350 |
+
|
1351 |
$wpdb->insert(
|
1352 |
WPSC_TABLE_CHECKOUT_FORMS,
|
1353 |
array(
|
1363 |
),
|
1364 |
array( '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%s' )
|
1365 |
);
|
1366 |
+
|
1367 |
$added++;
|
1368 |
}
|
1369 |
}
|
wpsc-admin/display-items.page.php
CHANGED
@@ -355,6 +355,23 @@ function wpsc_update_featured_products() {
|
|
355 |
exit();
|
356 |
}
|
357 |
|
358 |
-
|
359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
}
|
|
|
|
|
|
|
|
|
|
|
|
355 |
exit();
|
356 |
}
|
357 |
|
358 |
+
add_filter( 'page_row_actions','my_action_row', 10, 2 );
|
359 |
+
|
360 |
+
function my_action_row( $actions, $post ) {
|
361 |
+
|
362 |
+
if ( $post->post_type != "wpsc-product" )
|
363 |
+
return $actions;
|
364 |
+
|
365 |
+
$url = admin_url( 'edit.php' );
|
366 |
+
$url = add_query_arg( array( 'wpsc_admin_action' => 'duplicate_product', 'product' => $post->ID ), $url );
|
367 |
+
|
368 |
+
$actions['duplicate'] = '<a href="'.esc_url( $url ).'">'._x( 'Duplicate', 'row-actions', 'wpsc' ).'</a>';
|
369 |
+
|
370 |
+
return $actions;
|
371 |
}
|
372 |
+
|
373 |
+
if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'update_featured_product' ) )
|
374 |
+
add_action( 'admin_init', 'wpsc_update_featured_products' );
|
375 |
+
|
376 |
+
if ( isset( $_GET['wpsc_admin_action'] ) && ( $_GET['wpsc_admin_action'] == 'duplicate_product' ) )
|
377 |
+
add_action( 'admin_init', 'wpsc_duplicate_product' );
|
wpsc-admin/display-sales-logs.php
CHANGED
@@ -280,6 +280,7 @@ function _wpsc_purchlogs_need_update() {
|
|
280 |
</select></p>
|
281 |
</form>
|
282 |
</div>
|
|
|
283 |
<?php wpsc_purchlogs_custom_fields(); ?>
|
284 |
|
285 |
|
@@ -609,4 +610,4 @@ function wpec_display_product_tax()
|
|
609 |
function wpsc_upgrade_purchase_logs() {
|
610 |
include(WPSC_FILE_PATH.'/wpsc-admin/includes/purchlogs_upgrade.php');
|
611 |
}
|
612 |
-
?>
|
280 |
</select></p>
|
281 |
</form>
|
282 |
</div>
|
283 |
+
<br style="clear: both;">
|
284 |
<?php wpsc_purchlogs_custom_fields(); ?>
|
285 |
|
286 |
|
610 |
function wpsc_upgrade_purchase_logs() {
|
611 |
include(WPSC_FILE_PATH.'/wpsc-admin/includes/purchlogs_upgrade.php');
|
612 |
}
|
613 |
+
?>
|
wpsc-admin/display-update.page.php
CHANGED
@@ -44,7 +44,7 @@ if ( ! get_option( 'wpsc_needs_update', false ) ) {
|
|
44 |
|
45 |
// There weren't any products, so mark the update as complete
|
46 |
} else {
|
47 |
-
update_option( 'wpsc_version',
|
48 |
}
|
49 |
}
|
50 |
|
44 |
|
45 |
// There weren't any products, so mark the update as complete
|
46 |
} else {
|
47 |
+
update_option( 'wpsc_version', WPSC_VERSION );
|
48 |
}
|
49 |
}
|
50 |
|
wpsc-admin/includes/products.php
CHANGED
@@ -263,7 +263,7 @@ function wpsc_product_row(&$product, $parent_product = null) {
|
|
263 |
if(!isset($product_data['meta']['_wpsc_product_metadata']['weight'])) $product_data['meta']['_wpsc_product_metadata']['weight'] = "";
|
264 |
if(!isset($product_data['meta']['_wpsc_product_metadata']['weight_unit'])) $product_data['meta']['_wpsc_product_metadata']['weight_unit'] = "";
|
265 |
|
266 |
-
$product_data['transformed']['weight'] = wpsc_convert_weight($product_data['meta']['_wpsc_product_metadata']['weight'], "pound", $product_data['meta']['_wpsc_product_metadata']['weight_unit'],
|
267 |
$weight = $product_data['transformed']['weight'];
|
268 |
if($weight == ''){
|
269 |
$weight = '0';
|
263 |
if(!isset($product_data['meta']['_wpsc_product_metadata']['weight'])) $product_data['meta']['_wpsc_product_metadata']['weight'] = "";
|
264 |
if(!isset($product_data['meta']['_wpsc_product_metadata']['weight_unit'])) $product_data['meta']['_wpsc_product_metadata']['weight_unit'] = "";
|
265 |
|
266 |
+
$product_data['transformed']['weight'] = wpsc_convert_weight($product_data['meta']['_wpsc_product_metadata']['weight'], "pound", $product_data['meta']['_wpsc_product_metadata']['weight_unit'], false);
|
267 |
$weight = $product_data['transformed']['weight'];
|
268 |
if($weight == ''){
|
269 |
$weight = '0';
|
wpsc-admin/includes/settings-pages/presentation.php
CHANGED
@@ -305,7 +305,7 @@ function wpsc_options_presentation() {
|
|
305 |
else
|
306 |
$list_view_quantity_value2 = 'checked="checked"';
|
307 |
?>
|
308 |
-
<th
|
309 |
<?php _e('Show Stock Availability','wpsc'); ?>
|
310 |
</th>
|
311 |
<td>
|
305 |
else
|
306 |
$list_view_quantity_value2 = 'checked="checked"';
|
307 |
?>
|
308 |
+
<th scope="row">
|
309 |
<?php _e('Show Stock Availability','wpsc'); ?>
|
310 |
</th>
|
311 |
<td>
|
wpsc-admin/includes/settings-pages/shipping.php
CHANGED
@@ -155,7 +155,7 @@ function wpsc_options_shipping() {
|
|
155 |
<td> </td>
|
156 |
<td colspan="2">
|
157 |
<?php
|
158 |
-
$value =
|
159 |
?>
|
160 |
<div <?php echo $shipping_discount_settings; ?> id='shipping_discount_value'>
|
161 |
|
@@ -271,4 +271,4 @@ function wpsc_options_shipping() {
|
|
271 |
</form>
|
272 |
<?php
|
273 |
}
|
274 |
-
?>
|
155 |
<td> </td>
|
156 |
<td colspan="2">
|
157 |
<?php
|
158 |
+
$value = esc_attr ( get_option( 'shipping_discount_value' ) );
|
159 |
?>
|
160 |
<div <?php echo $shipping_discount_settings; ?> id='shipping_discount_value'>
|
161 |
|
271 |
</form>
|
272 |
<?php
|
273 |
}
|
274 |
+
?>
|
wpsc-admin/js/admin.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
// This is the wp-e-commerce front end javascript "library"
|
2 |
|
3 |
jQuery(document).ready(function(){
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
jQuery('table.widefat tbody tr').each(function(){
|
6 |
-
id = jQuery(this).attr("id");
|
7 |
-
jQuery('#' + id + ' td.hidden_alerts img').appendTo('#' + id + ' td.column-title strong');
|
8 |
-
});
|
9 |
jQuery('label[for=wpsc-variationdiv-hide]').css('display', 'none');
|
10 |
|
11 |
jQuery('a.update_variations_action').click(function(){
|
@@ -411,7 +411,6 @@ jQuery(document).ready(function(){
|
|
411 |
}
|
412 |
);
|
413 |
|
414 |
-
|
415 |
jQuery('tr.wpsc_trackingid_row').hide();
|
416 |
|
417 |
jQuery('.wpsc_show_trackingid').click(function(event){
|
1 |
// This is the wp-e-commerce front end javascript "library"
|
2 |
|
3 |
jQuery(document).ready(function(){
|
4 |
+
jQuery('td.hidden_alerts img').each(function(){
|
5 |
+
var t = jQuery(this);
|
6 |
+
t.appendTo(t.parents('tr').find('td.column-title strong'));
|
7 |
+
});
|
8 |
|
|
|
|
|
|
|
|
|
9 |
jQuery('label[for=wpsc-variationdiv-hide]').css('display', 'none');
|
10 |
|
11 |
jQuery('a.update_variations_action').click(function(){
|
411 |
}
|
412 |
);
|
413 |
|
|
|
414 |
jQuery('tr.wpsc_trackingid_row').hide();
|
415 |
|
416 |
jQuery('.wpsc_show_trackingid').click(function(event){
|
wpsc-core/js/wp-e-commerce.js
CHANGED
@@ -506,7 +506,7 @@ jQuery(document).ready(function(){
|
|
506 |
|
507 |
//Javascript for variations: bounce the variation box when nothing is selected and return false for add to cart button.
|
508 |
jQuery(document).ready(function(){
|
509 |
-
jQuery('.productcol, .textcol').each(function(){
|
510 |
jQuery('.wpsc_buy_button', this).click(function(){
|
511 |
jQuery(this).parents('form:first').find('select.wpsc_select_variation').each(function(){
|
512 |
if(jQuery(this).val() <= 0){
|
506 |
|
507 |
//Javascript for variations: bounce the variation box when nothing is selected and return false for add to cart button.
|
508 |
jQuery(document).ready(function(){
|
509 |
+
jQuery('.productcol, .textcol, .product_grid_item').each(function(){
|
510 |
jQuery('.wpsc_buy_button', this).click(function(){
|
511 |
jQuery(this).parents('form:first').find('select.wpsc_select_variation').each(function(){
|
512 |
if(jQuery(this).val() <= 0){
|
wpsc-core/wpsc-constants.php
CHANGED
@@ -26,9 +26,9 @@ function wpsc_core_constants() {
|
|
26 |
if(!defined('WPSC_URL'))
|
27 |
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
28 |
// Define Plugin version
|
29 |
-
define( 'WPSC_VERSION', '3.8.
|
30 |
-
define( 'WPSC_MINOR_VERSION', '
|
31 |
-
define( 'WPSC_PRESENTABLE_VERSION', '3.8.
|
32 |
|
33 |
// Define Debug Variables for developers
|
34 |
define( 'WPSC_DEBUG', false );
|
26 |
if(!defined('WPSC_URL'))
|
27 |
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
28 |
// Define Plugin version
|
29 |
+
define( 'WPSC_VERSION', '3.8.4' );
|
30 |
+
define( 'WPSC_MINOR_VERSION', '391083' );
|
31 |
+
define( 'WPSC_PRESENTABLE_VERSION', '3.8.4' );
|
32 |
|
33 |
// Define Debug Variables for developers
|
34 |
define( 'WPSC_DEBUG', false );
|
wpsc-core/wpsc-functions.php
CHANGED
@@ -397,18 +397,29 @@ function wpsc_serialize_shopping_cart() {
|
|
397 |
}
|
398 |
add_action( 'shutdown', 'wpsc_serialize_shopping_cart' );
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
/**
|
401 |
* wpsc_start_the_query
|
402 |
*/
|
403 |
function wpsc_start_the_query() {
|
404 |
global $wpsc_page_titles, $wp_query, $wpsc_query, $wpsc_query_vars;
|
405 |
$is_404 = false;
|
406 |
-
if(
|
407 |
-
$wp_query = new WP_Query( 'pagename='.$wpsc_page_titles['products'].'/'.$wp_query->query_vars['term'] );
|
408 |
-
global $post;
|
409 |
-
$post = $wp_query->post;
|
410 |
-
setup_postdata( $post );
|
411 |
-
}elseif ( null == $wpsc_query ) {
|
412 |
if( ( $wp_query->is_404 && !empty($wp_query->query_vars['paged']) ) || (isset( $wp_query->query['pagename']) && strpos( $wp_query->query['pagename'] , $wpsc_page_titles['products'] ) !== false ) && !isset($wp_query->post)){
|
413 |
//what was this for?
|
414 |
global $post;
|
@@ -435,14 +446,14 @@ function wpsc_start_the_query() {
|
|
435 |
|
436 |
if(isset($wp_query->query_vars['product_tag'])){
|
437 |
$wpsc_query_vars['product_tag'] = $wp_query->query_vars['product_tag'];
|
438 |
-
$wpsc_query_vars['taxonomy'] =
|
439 |
-
$wpsc_query_vars['term'] =
|
440 |
|
441 |
|
442 |
}elseif( isset($wp_query->query_vars['wpsc_product_category']) ){
|
443 |
$wpsc_query_vars['wpsc_product_category'] = $wp_query->query_vars['wpsc_product_category'];
|
444 |
-
$wpsc_query_vars['taxonomy'] =
|
445 |
-
$wpsc_query_vars['term'] =
|
446 |
}else{
|
447 |
$wpsc_query_vars['post_type'] = 'wpsc-product';
|
448 |
$wpsc_query_vars['pagename'] = 'products-page';
|
@@ -1006,15 +1017,14 @@ function wpsc_product_link( $permalink, $post, $leavename ) {
|
|
1006 |
$product_category_slugs[] = $product_category->slug;
|
1007 |
}
|
1008 |
// If the product is associated with multiple categories, determine which one to pick
|
1009 |
-
|
1010 |
if ( count( $product_categories ) == 0 ) {
|
1011 |
$category_slug = 'uncategorized';
|
1012 |
} elseif ( count( $product_categories ) > 1 ) {
|
1013 |
if ( (isset( $wp_query->query_vars['products'] ) && $wp_query->query_vars['products'] != null) && in_array( $wp_query->query_vars['products'], $product_category_slugs ) ) {
|
1014 |
$product_category = $wp_query->query_vars['products'];
|
1015 |
} else {
|
1016 |
-
if(
|
1017 |
-
$link = $
|
1018 |
else
|
1019 |
$link = $product_categories[0]->slug;
|
1020 |
|
397 |
}
|
398 |
add_action( 'shutdown', 'wpsc_serialize_shopping_cart' );
|
399 |
|
400 |
+
add_filter( 'query_string', 'wpsc_filter_query_string' );
|
401 |
+
|
402 |
+
/**
|
403 |
+
* Filter query string to make sure no 404 error is thrown for products-page's sub pages
|
404 |
+
*
|
405 |
+
* @param string $q Query String
|
406 |
+
*/
|
407 |
+
function wpsc_filter_query_string( $q ) {
|
408 |
+
global $wpsc_page_titles;
|
409 |
+
parse_str( $q, $args );
|
410 |
+
if ( ! empty( $args['wpsc_product_category'] ) && in_array( $args['wpsc_product_category'], $wpsc_page_titles ) ) {
|
411 |
+
$q = "pagename={$wpsc_page_titles['products']}/{$args['wpsc_product_category']}";
|
412 |
+
}
|
413 |
+
return $q;
|
414 |
+
}
|
415 |
+
|
416 |
/**
|
417 |
* wpsc_start_the_query
|
418 |
*/
|
419 |
function wpsc_start_the_query() {
|
420 |
global $wpsc_page_titles, $wp_query, $wpsc_query, $wpsc_query_vars;
|
421 |
$is_404 = false;
|
422 |
+
if ( null == $wpsc_query ) {
|
|
|
|
|
|
|
|
|
|
|
423 |
if( ( $wp_query->is_404 && !empty($wp_query->query_vars['paged']) ) || (isset( $wp_query->query['pagename']) && strpos( $wp_query->query['pagename'] , $wpsc_page_titles['products'] ) !== false ) && !isset($wp_query->post)){
|
424 |
//what was this for?
|
425 |
global $post;
|
446 |
|
447 |
if(isset($wp_query->query_vars['product_tag'])){
|
448 |
$wpsc_query_vars['product_tag'] = $wp_query->query_vars['product_tag'];
|
449 |
+
$wpsc_query_vars['taxonomy'] = get_query_var( 'taxonomy' );
|
450 |
+
$wpsc_query_vars['term'] = get_query_var( 'term' );
|
451 |
|
452 |
|
453 |
}elseif( isset($wp_query->query_vars['wpsc_product_category']) ){
|
454 |
$wpsc_query_vars['wpsc_product_category'] = $wp_query->query_vars['wpsc_product_category'];
|
455 |
+
$wpsc_query_vars['taxonomy'] = get_query_var( 'taxonomy' );
|
456 |
+
$wpsc_query_vars['term'] = get_query_var( 'term' );
|
457 |
}else{
|
458 |
$wpsc_query_vars['post_type'] = 'wpsc-product';
|
459 |
$wpsc_query_vars['pagename'] = 'products-page';
|
1017 |
$product_category_slugs[] = $product_category->slug;
|
1018 |
}
|
1019 |
// If the product is associated with multiple categories, determine which one to pick
|
|
|
1020 |
if ( count( $product_categories ) == 0 ) {
|
1021 |
$category_slug = 'uncategorized';
|
1022 |
} elseif ( count( $product_categories ) > 1 ) {
|
1023 |
if ( (isset( $wp_query->query_vars['products'] ) && $wp_query->query_vars['products'] != null) && in_array( $wp_query->query_vars['products'], $product_category_slugs ) ) {
|
1024 |
$product_category = $wp_query->query_vars['products'];
|
1025 |
} else {
|
1026 |
+
if( $current_cat = get_query_var( 'wpsc_product_category' ) && in_array( $current_cat, $product_category_slugs ) )
|
1027 |
+
$link = $current_cat;
|
1028 |
else
|
1029 |
$link = $product_categories[0]->slug;
|
1030 |
|
wpsc-includes/ajax.functions.php
CHANGED
@@ -639,7 +639,7 @@ function wpsc_submit_checkout() {
|
|
639 |
|
640 |
// submit to gateway
|
641 |
$current_gateway_data = &$wpsc_gateways[$submitted_gateway];
|
642 |
-
if ( $current_gateway_data['api_version'] >= 2.0 ) {
|
643 |
$merchant_instance = new $current_gateway_data['class_name']( $purchase_log_id );
|
644 |
$merchant_instance->construct_value_array();
|
645 |
$merchant_instance->submit();
|
@@ -647,13 +647,13 @@ function wpsc_submit_checkout() {
|
|
647 |
$gateway_used = $current_gateway_data['internalname'];
|
648 |
$wpdb->update( WPSC_TABLE_PURCHASE_LOGS, array(
|
649 |
'gateway' => $gateway_used
|
650 |
-
), array( 'id' => $
|
651 |
$current_gateway_data['function']( $separator, $sessionid );
|
652 |
} elseif ( ($current_gateway_data['internalname'] == 'google') && ($current_gateway_data['internalname'] == $submitted_gateway) ) {
|
653 |
$gateway_used = $current_gateway_data['internalname'];
|
654 |
$wpdb->update( WPSC_TABLE_PURCHASE_LOGS, array(
|
655 |
'gateway' => $gateway_used
|
656 |
-
), array( 'id' => $
|
657 |
$_SESSION['gateway'] = 'google';
|
658 |
wp_redirect(get_option( 'shopping_cart_url' ));
|
659 |
}
|
639 |
|
640 |
// submit to gateway
|
641 |
$current_gateway_data = &$wpsc_gateways[$submitted_gateway];
|
642 |
+
if ( isset( $current_gateway_data['api_version'] ) && $current_gateway_data['api_version'] >= 2.0 ) {
|
643 |
$merchant_instance = new $current_gateway_data['class_name']( $purchase_log_id );
|
644 |
$merchant_instance->construct_value_array();
|
645 |
$merchant_instance->submit();
|
647 |
$gateway_used = $current_gateway_data['internalname'];
|
648 |
$wpdb->update( WPSC_TABLE_PURCHASE_LOGS, array(
|
649 |
'gateway' => $gateway_used
|
650 |
+
), array( 'id' => $purchase_log_id ) );
|
651 |
$current_gateway_data['function']( $separator, $sessionid );
|
652 |
} elseif ( ($current_gateway_data['internalname'] == 'google') && ($current_gateway_data['internalname'] == $submitted_gateway) ) {
|
653 |
$gateway_used = $current_gateway_data['internalname'];
|
654 |
$wpdb->update( WPSC_TABLE_PURCHASE_LOGS, array(
|
655 |
'gateway' => $gateway_used
|
656 |
+
), array( 'id' => $purchase_log_id ) );
|
657 |
$_SESSION['gateway'] = 'google';
|
658 |
wp_redirect(get_option( 'shopping_cart_url' ));
|
659 |
}
|
wpsc-includes/checkout.class.php
CHANGED
@@ -791,11 +791,18 @@ class wpsc_checkout {
|
|
791 |
//Basic Form field validation for billing and shipping details
|
792 |
foreach ( $this->checkout_items as $form_data ) {
|
793 |
$value = '';
|
|
|
794 |
if( isset( $_POST['collected_data'][$form_data->id] ) )
|
795 |
$value = $_POST['collected_data'][$form_data->id];
|
796 |
$_SESSION['wpsc_checkout_saved_values'][$form_data->id] = $value;
|
797 |
$bad_input = false;
|
798 |
if ( ($form_data->mandatory == 1) || ($form_data->type == "coupon") ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
799 |
switch ( $form_data->type ) {
|
800 |
case "email":
|
801 |
if ( !preg_match( "/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-.]+\.[a-zA-Z]{2,5}$/", $value ) ) {
|
@@ -843,31 +850,52 @@ class wpsc_checkout {
|
|
843 |
function save_forms_to_db( $purchase_id ) {
|
844 |
global $wpdb;
|
845 |
|
|
|
|
|
|
|
|
|
|
|
846 |
foreach ( $this->checkout_items as $form_data ) {
|
|
|
|
|
|
|
847 |
$value = '';
|
848 |
if( isset( $_POST['collected_data'][$form_data->id] ) )
|
849 |
$value = $_POST['collected_data'][$form_data->id];
|
850 |
if ( empty( $value ) && isset( $form_data->value ) )
|
851 |
$value = $form_data->value;
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
|
|
|
|
|
|
865 |
$prepared_query = $wpdb->prepare( "INSERT INTO `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` ( `log_id` , `form_id` , `value` ) VALUES ( %d, %d, %s)", $purchase_id, $form_data->id, $value );
|
|
|
|
|
|
|
|
|
866 |
}
|
867 |
-
|
868 |
-
$wpdb->
|
869 |
}
|
|
|
|
|
870 |
}
|
|
|
|
|
|
|
|
|
871 |
}
|
872 |
|
873 |
/**
|
791 |
//Basic Form field validation for billing and shipping details
|
792 |
foreach ( $this->checkout_items as $form_data ) {
|
793 |
$value = '';
|
794 |
+
|
795 |
if( isset( $_POST['collected_data'][$form_data->id] ) )
|
796 |
$value = $_POST['collected_data'][$form_data->id];
|
797 |
$_SESSION['wpsc_checkout_saved_values'][$form_data->id] = $value;
|
798 |
$bad_input = false;
|
799 |
if ( ($form_data->mandatory == 1) || ($form_data->type == "coupon") ) {
|
800 |
+
// dirty hack
|
801 |
+
if ( $form_data->unique_name == 'billingstate' && empty( $value ) ) {
|
802 |
+
$billing_country_id = $wpdb->get_var( "SELECT `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `unique_name` = 'billingcountry' AND active = '1' " );
|
803 |
+
$value = $_POST['collected_data'][$billing_country_id][1];
|
804 |
+
}
|
805 |
+
|
806 |
switch ( $form_data->type ) {
|
807 |
case "email":
|
808 |
if ( !preg_match( "/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-.]+\.[a-zA-Z]{2,5}$/", $value ) ) {
|
850 |
function save_forms_to_db( $purchase_id ) {
|
851 |
global $wpdb;
|
852 |
|
853 |
+
// needs refactoring badly
|
854 |
+
$shipping_state_id = $wpdb->get_var( "SELECT `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `unique_name` = 'shippingstate' " );
|
855 |
+
$billing_state_id = $wpdb->get_var( "SELECT `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `unique_name` = 'billingstate' " );
|
856 |
+
$shipping_state = $billing_state = '';
|
857 |
+
|
858 |
foreach ( $this->checkout_items as $form_data ) {
|
859 |
+
if ( $form_data->type == 'heading' )
|
860 |
+
continue;
|
861 |
+
|
862 |
$value = '';
|
863 |
if( isset( $_POST['collected_data'][$form_data->id] ) )
|
864 |
$value = $_POST['collected_data'][$form_data->id];
|
865 |
if ( empty( $value ) && isset( $form_data->value ) )
|
866 |
$value = $form_data->value;
|
867 |
+
|
868 |
+
if ( $form_data->unique_name == 'billingstate' ) {
|
869 |
+
$billing_state = $value;
|
870 |
+
continue;
|
871 |
+
} elseif( $form_data->unique_name == 'shippingstate' ) {
|
872 |
+
$shipping_state = $value;
|
873 |
+
continue;
|
874 |
+
} elseif ( is_array( $value ) ) {
|
875 |
+
if ( in_array( $form_data->unique_name, array( 'billingcountry' , 'shippingcountry' ) ) ) {
|
876 |
+
if ( isset( $value[1] ) )
|
877 |
+
if ( $form_data->unique_name == 'billingcountry' )
|
878 |
+
$billing_state = $value[1];
|
879 |
+
else
|
880 |
+
$shipping_state = $value[1];
|
881 |
+
|
882 |
+
$value = $value[0];
|
883 |
$prepared_query = $wpdb->prepare( "INSERT INTO `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` ( `log_id` , `form_id` , `value` ) VALUES ( %d, %d, %s)", $purchase_id, $form_data->id, $value );
|
884 |
+
} else {
|
885 |
+
foreach ( (array)$value as $v ) {
|
886 |
+
$prepared_query = $wpdb->prepare( "INSERT INTO `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` ( `log_id` , `form_id` , `value` ) VALUES ( %d, %d, %s)", $purchase_id, $form_data->id, $v );
|
887 |
+
}
|
888 |
}
|
889 |
+
} else {
|
890 |
+
$prepared_query = $wpdb->prepare( "INSERT INTO `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` ( `log_id` , `form_id` , `value` ) VALUES ( %d, %d, %s)", $purchase_id, $form_data->id, $value );
|
891 |
}
|
892 |
+
|
893 |
+
$wpdb->query( $prepared_query );
|
894 |
}
|
895 |
+
|
896 |
+
// update the states
|
897 |
+
$wpdb->query( $wpdb->prepare( "INSERT INTO `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` ( `log_id` , `form_id` , `value` ) VALUES ( %d, %d, %s)", $purchase_id, $shipping_state_id, $shipping_state ) );
|
898 |
+
$wpdb->query( $wpdb->prepare( "INSERT INTO `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` ( `log_id` , `form_id` , `value` ) VALUES ( %d, %d, %s)", $purchase_id, $billing_state_id, $billing_state ) );
|
899 |
}
|
900 |
|
901 |
/**
|
wpsc-includes/currency_converter.inc.php
CHANGED
@@ -27,8 +27,21 @@
|
|
27 |
{
|
28 |
return $this->_error;
|
29 |
}
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
if ($amt == 0) {
|
33 |
return 0;
|
34 |
}
|
@@ -38,64 +51,22 @@
|
|
38 |
$this->_to=$to;
|
39 |
if(!empty($from))
|
40 |
$this->_from=$from;
|
41 |
-
|
42 |
-
$host="www.xe.com";
|
43 |
-
$fp = @fsockopen($host, 80, $errno, $errstr, 30);
|
44 |
-
if (!$fp)
|
45 |
-
{
|
46 |
-
$this->_error="$errstr ($errno)<br />\n";
|
47 |
-
return false;
|
48 |
-
}
|
49 |
-
else
|
50 |
-
{
|
51 |
-
$file="/ucc/convert.cgi";
|
52 |
-
$str = "?language=xe&Amount=".$this->_amt."&From=".$this->_from."&To=".$this->_to;
|
53 |
-
$out = "GET ".$file.$str." HTTP/1.0\r\n";
|
54 |
-
$out .= "Host: $host\r\n";
|
55 |
-
$out .= "Connection: Close\r\n\r\n";
|
56 |
-
|
57 |
-
@fputs($fp, $out);
|
58 |
-
while (!@feof($fp))
|
59 |
-
{
|
60 |
-
$data.= @fgets($fp, 128);
|
61 |
-
}
|
62 |
-
@fclose($fp);
|
63 |
|
64 |
-
|
65 |
-
$data =$match[2];
|
66 |
-
$search = array ("'<script[^>]*?>.*?</script>'si", // Strip out javascript
|
67 |
-
"'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags
|
68 |
-
"'([\r\n])[\s]+'", // Strip out white space
|
69 |
-
"'&(quot|#34);'i", // Replace HTML entities
|
70 |
-
"'&(amp|#38);'i",
|
71 |
-
"'&(lt|#60);'i",
|
72 |
-
"'&(gt|#62);'i",
|
73 |
-
"'&(nbsp|#160);'i",
|
74 |
-
"'&(iexcl|#161);'i",
|
75 |
-
"'&(cent|#162);'i",
|
76 |
-
"'&(pound|#163);'i",
|
77 |
-
"'&(copy|#169);'i",
|
78 |
-
"'&#(\d+);'e"); // evaluate as php
|
79 |
-
|
80 |
-
$replace = array ("",
|
81 |
-
"",
|
82 |
-
"\\1",
|
83 |
-
"\"",
|
84 |
-
"&",
|
85 |
-
"<",
|
86 |
-
">",
|
87 |
-
" ",
|
88 |
-
chr(161),
|
89 |
-
chr(162),
|
90 |
-
chr(163),
|
91 |
-
chr(169),
|
92 |
-
"chr(\\1)");
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
}
|
101 |
?>
|
27 |
{
|
28 |
return $this->_error;
|
29 |
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Given all details converts currency amount
|
33 |
+
*
|
34 |
+
* @param $amt double
|
35 |
+
* The amount to convert.
|
36 |
+
*
|
37 |
+
* @param $to string
|
38 |
+
* The currency you wish to convert to.
|
39 |
+
*
|
40 |
+
* @param $from string
|
41 |
+
* The currency you are converting from.
|
42 |
+
*/
|
43 |
+
function convert($amt = NULL, $to = "", $from = "")
|
44 |
+
{
|
45 |
if ($amt == 0) {
|
46 |
return 0;
|
47 |
}
|
51 |
$this->_to=$to;
|
52 |
if(!empty($from))
|
53 |
$this->_from=$from;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
$count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
$dom = new DOMDocument();
|
58 |
+
do {
|
59 |
+
@$dom->loadHTML(file_get_contents('http://www.exchange-rates.org/converter/' . $this->_to . '/' . $this->_from . '/' . $this->_amt));
|
60 |
+
$result = $dom->getElementById('ctl00_M_lblToAmount');
|
61 |
+
if ($result) {
|
62 |
+
return round($result->nodeValue, 2);
|
63 |
+
}
|
64 |
+
sleep(1);
|
65 |
+
$count++;
|
66 |
+
} while ($count < 10);
|
67 |
+
|
68 |
+
trigger_error('Unable to connect to currency conversion service', E_USER_ERROR);
|
69 |
+
return FALSE;
|
70 |
}
|
71 |
}
|
72 |
?>
|
wpsc-includes/merchant.class.php
CHANGED
@@ -141,31 +141,23 @@ class wpsc_merchant {
|
|
141 |
continue;
|
142 |
|
143 |
switch ( $collected_form_row['unique_name'] ) {
|
144 |
-
case 'billingcountry'
|
145 |
-
|
146 |
-
$address_data[$address_data_set][$address_key] = $country[0];
|
147 |
-
|
148 |
-
if ( is_array( $country ) && !empty( $country[1] ) )
|
149 |
-
$address_data['billing']['state'] = wpsc_get_state_by_id( $country[1], 'code' );
|
150 |
-
|
151 |
-
break;
|
152 |
-
|
153 |
-
case 'shippingcountry' :
|
154 |
$country = maybe_unserialize( $collected_form_row['value'] );
|
155 |
|
156 |
if ( is_array( $country ) ) {
|
157 |
-
$address_data[
|
158 |
$country = $country[0];
|
159 |
}
|
160 |
|
161 |
$address_data[$address_data_set][$address_key] = $country;
|
162 |
break;
|
163 |
-
|
164 |
-
case '
|
165 |
-
|
166 |
-
|
|
|
167 |
break;
|
168 |
-
|
169 |
default :
|
170 |
$address_data[$address_data_set][$address_key] = $collected_form_row['value'];
|
171 |
break;
|
141 |
continue;
|
142 |
|
143 |
switch ( $collected_form_row['unique_name'] ) {
|
144 |
+
case 'billingcountry':
|
145 |
+
case 'shippingcountry':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
$country = maybe_unserialize( $collected_form_row['value'] );
|
147 |
|
148 |
if ( is_array( $country ) ) {
|
149 |
+
$address_data[$address_data_set]['state'] = wpsc_get_state_by_id( $country[1], 'code' );
|
150 |
$country = $country[0];
|
151 |
}
|
152 |
|
153 |
$address_data[$address_data_set][$address_key] = $country;
|
154 |
break;
|
155 |
+
|
156 |
+
case 'billingstate':
|
157 |
+
case 'shippingstate':
|
158 |
+
if ( empty( $address_data[$address_data_set]['state'] ) )
|
159 |
+
$address_data[$address_data_set]['state'] = is_numeric( $collected_form_row['value'] ) ? wpsc_get_state_by_id( $collected_form_row['value'], 'code' ) : $collected_form_row['value'];
|
160 |
break;
|
|
|
161 |
default :
|
162 |
$address_data[$address_data_set][$address_key] = $collected_form_row['value'];
|
163 |
break;
|
wpsc-includes/theme.functions.php
CHANGED
@@ -625,14 +625,16 @@ function wpsc_enqueue_user_script_and_css() {
|
|
625 |
wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
|
626 |
wp_enqueue_script( 'jquery-rating', WPSC_CORE_JS_URL . '/jquery.rating.js', array( 'jquery' ), $version_identifier );
|
627 |
wp_enqueue_script( 'wp-e-commerce-legacy', WPSC_CORE_JS_URL . '/user.js', array( 'jquery' ), WPSC_VERSION . WPSC_MINOR_VERSION );
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
|
|
|
|
636 |
}
|
637 |
wp_enqueue_style( 'wpsc-theme-css', wpsc_get_template_file_url( 'wpsc-' . get_option( 'wpsc_selected_theme' ) . '.css' ), false, $version_identifier, 'all' );
|
638 |
wp_enqueue_style( 'wpsc-theme-css-compatibility', WPSC_CORE_THEME_URL . 'compatibility.css', false, $version_identifier, 'all' );
|
@@ -1090,10 +1092,12 @@ function wpsc_all_products_on_page(){
|
|
1090 |
do_action('wpsc_swap_the_template');
|
1091 |
$products_page_id = wpec_get_the_post_id_by_shortcode('[productspage]');
|
1092 |
$term = get_query_var( 'wpsc_product_category' );
|
1093 |
-
$
|
|
|
|
|
1094 |
$id = isset( $obj->ID ) ? $obj->ID : null;
|
1095 |
|
1096 |
-
if( get_query_var( 'post_type' ) == 'wpsc-product' || $term || ( $id == $products_page_id )){
|
1097 |
|
1098 |
$templates = array();
|
1099 |
|
@@ -1101,6 +1105,10 @@ function wpsc_all_products_on_page(){
|
|
1101 |
array_push( $templates, "taxonomy-wpsc_product_category-{$term}.php", 'taxonomy-wpsc_product_category.php' );
|
1102 |
}
|
1103 |
|
|
|
|
|
|
|
|
|
1104 |
array_push( $templates, 'page.php', 'single.php' );
|
1105 |
|
1106 |
if ( is_single() )
|
625 |
wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
|
626 |
wp_enqueue_script( 'jquery-rating', WPSC_CORE_JS_URL . '/jquery.rating.js', array( 'jquery' ), $version_identifier );
|
627 |
wp_enqueue_script( 'wp-e-commerce-legacy', WPSC_CORE_JS_URL . '/user.js', array( 'jquery' ), WPSC_VERSION . WPSC_MINOR_VERSION );
|
628 |
+
if ( get_option( 'show_thumbnails_thickbox' ) == 1 ){
|
629 |
+
$lightbox = get_option('wpsc_lightbox', 'thickbox');
|
630 |
+
if( $lightbox == 'thickbox' ) {
|
631 |
+
wp_enqueue_script( 'wpsc-thickbox', WPSC_CORE_JS_URL . '/thickbox.js', array( 'jquery' ), 'Instinct_e-commerce' );
|
632 |
+
wp_enqueue_style( 'wpsc-thickbox', WPSC_CORE_JS_URL . '/thickbox.css', false, $version_identifier, 'all' );
|
633 |
+
} elseif( $lightbox == 'colorbox' ) {
|
634 |
+
wp_enqueue_script( 'colorbox-min', WPSC_CORE_JS_URL . '/jquery.colorbox-min.js', array( 'jquery' ), 'Instinct_e-commerce' );
|
635 |
+
wp_enqueue_script( 'wpsc_colorbox', WPSC_CORE_JS_URL . '/wpsc_colorbox.js', array( 'jquery', 'colorbox-min' ), 'Instinct_e-commerce' );
|
636 |
+
wp_enqueue_style( 'wpsc-colorbox-css', WPSC_CORE_JS_URL . '/wpsc_colorbox.css', false, $version_identifier, 'all' );
|
637 |
+
}
|
638 |
}
|
639 |
wp_enqueue_style( 'wpsc-theme-css', wpsc_get_template_file_url( 'wpsc-' . get_option( 'wpsc_selected_theme' ) . '.css' ), false, $version_identifier, 'all' );
|
640 |
wp_enqueue_style( 'wpsc-theme-css-compatibility', WPSC_CORE_THEME_URL . 'compatibility.css', false, $version_identifier, 'all' );
|
1092 |
do_action('wpsc_swap_the_template');
|
1093 |
$products_page_id = wpec_get_the_post_id_by_shortcode('[productspage]');
|
1094 |
$term = get_query_var( 'wpsc_product_category' );
|
1095 |
+
$tax_term = get_query_var ('product_tag' );
|
1096 |
+
$obj = $wp_query->get_queried_object();
|
1097 |
+
|
1098 |
$id = isset( $obj->ID ) ? $obj->ID : null;
|
1099 |
|
1100 |
+
if( get_query_var( 'post_type' ) == 'wpsc-product' || $term || $tax_term || ( $id == $products_page_id )){
|
1101 |
|
1102 |
$templates = array();
|
1103 |
|
1105 |
array_push( $templates, "taxonomy-wpsc_product_category-{$term}.php", 'taxonomy-wpsc_product_category.php' );
|
1106 |
}
|
1107 |
|
1108 |
+
if ( $tax_term && ! is_single() ) {
|
1109 |
+
array_push( $templates, "taxonomy-product_tag-{$tax_term}.php", 'taxonomy-product_tag.php' );
|
1110 |
+
}
|
1111 |
+
|
1112 |
array_push( $templates, 'page.php', 'single.php' );
|
1113 |
|
1114 |
if ( is_single() )
|
wpsc-merchants/GoogleCheckout-XML.php
CHANGED
@@ -69,116 +69,102 @@ function gateway_google($fromcheckout = false){
|
|
69 |
}
|
70 |
}
|
71 |
|
72 |
-
|
73 |
-
global $wpdb, $wpsc_cart;
|
|
|
74 |
$purchase_log_sql = "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid`= ".$sessionid." LIMIT 1";
|
75 |
-
$purchase_log
|
76 |
|
77 |
-
$cart_sql
|
78 |
-
$wp_cart
|
79 |
-
|
80 |
-
$
|
81 |
-
$
|
82 |
-
$
|
83 |
-
$
|
84 |
-
$transact_url
|
85 |
-
$returnURL
|
|
|
|
|
86 |
$cart->SetContinueShoppingUrl($returnURL);
|
87 |
$cart->SetEditCartUrl(get_option('shopping_cart_url'));
|
88 |
-
|
89 |
-
$no = 0;
|
90 |
//google prohibited items not implemented
|
91 |
-
$
|
92 |
-
$currency_code
|
93 |
$local_currency_code = $currency_code[0]['code'];
|
94 |
-
$google_curr
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
while (wpsc_have_cart_items()) {
|
96 |
wpsc_the_cart_item();
|
97 |
-
|
98 |
-
|
99 |
-
$google_currency_shipping = $curr->convert( $wpsc_cart->selected_shipping_amount,$google_curr,$local_currency_code);
|
100 |
-
} else {
|
101 |
-
$google_currency_productprice = wpsc_cart_item_price(false)/wpsc_cart_item_quantity();
|
102 |
-
$google_currency_shipping = $wpsc_cart->selected_shipping_amount;
|
103 |
-
}
|
104 |
|
105 |
-
$
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
$cart->AddItem($
|
112 |
-
$no++;
|
113 |
}
|
|
|
114 |
//If there are coupons applied add coupon as a product with negative price
|
115 |
if($wpsc_cart->coupons_amount > 0){
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
);
|
127 |
-
$cart->AddItem($cartitem[$no]);
|
128 |
}
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
$Gfilter = new GoogleShippingFilters();
|
133 |
-
$google_checkout_shipping = get_option("google_shipping_country");
|
134 |
-
$googleshippingcountries = count($google_checkout_shipping);
|
135 |
-
if($googleshippingcountries == 242){
|
136 |
-
$Gfilter->SetAllowedWorldArea(true);
|
137 |
-
}else{
|
138 |
-
if(is_array($google_checkout_shipping)){
|
139 |
-
$google_shipping_country_ids = implode(",",$google_checkout_shipping);
|
140 |
-
}
|
141 |
-
$google_shipping_country = $wpdb->get_col("SELECT `isocode` FROM ".WPSC_TABLE_CURRENCY_LIST." WHERE id IN (".$google_shipping_country_ids.")");
|
142 |
-
foreach($google_shipping_country as $isocode){
|
143 |
-
$Gfilter->AddAllowedPostalArea($isocode);
|
144 |
-
if($isocode == 'US'){
|
145 |
-
$Gfilter->SetAllowedCountryArea('ALL');
|
146 |
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
|
|
|
|
149 |
}
|
150 |
|
151 |
-
$
|
152 |
-
$ship_1 = new GoogleFlatRateShipping($wpsc_cart->selected_shipping_method, $google_currency_shipping);
|
153 |
-
$ship_1->AddShippingRestrictions($Gfilter);
|
154 |
-
$cart->AddShipping($ship_1);
|
155 |
}
|
156 |
-
//wpsc_google_shipping_quotes();
|
157 |
|
158 |
// Add tax rules
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
$tax_rule = new GoogleDefaultTaxRule($defaultTax);
|
164 |
-
$sql = "SELECT `code` FROM ".WPSC_TABLE_REGION_TAX." WHERE `country_id`='136' AND `tax` = ".$state_name['tax'];
|
165 |
-
$states = $wpdb->get_col($sql);
|
166 |
-
$tax_rule->SetStateAreas((array)$states);
|
167 |
-
$cart->AddDefaultTaxRules($tax_rule);
|
168 |
-
//get alternative tax rates
|
169 |
-
$sql = "SELECT DISTINCT `tax` FROM ".WPSC_TABLE_REGION_TAX." WHERE `tax` != 0 AND `tax` !=".$state_name['tax']." AND `country_id`='136' ORDER BY `tax`";
|
170 |
-
$othertax = $wpdb->get_col($sql);
|
171 |
-
$i = 1;
|
172 |
-
foreach($othertax as $altTax){
|
173 |
-
$sql = "SELECT `code` FROM ".WPSC_TABLE_REGION_TAX." WHERE `country_id`='136' AND `tax`=".$altTax;
|
174 |
-
$alt = $wpdb->get_col($sql);
|
175 |
-
$altTax = $altTax/100;
|
176 |
-
$alt_google_tax = new GoogleDefaultTaxRule($altTax);
|
177 |
-
$alt_google_tax->SetStateAreas($alt);
|
178 |
-
$cart->AddDefaultTaxRules($alt_google_tax);
|
179 |
-
$i++;
|
180 |
}
|
181 |
|
|
|
182 |
if (get_option('google_button_size') == '0'){
|
183 |
$google_button_size = 'BIG';
|
184 |
} elseif(get_option('google_button_size') == '1') {
|
@@ -186,13 +172,12 @@ function gateway_google($fromcheckout = false){
|
|
186 |
} elseif(get_option('google_button_size') == '2') {
|
187 |
$google_button_size = 'SMALL';
|
188 |
}
|
189 |
-
// Display Google Checkout button
|
190 |
echo $cart->CheckoutButtonCode($google_button_size);
|
191 |
}
|
192 |
|
193 |
function wpsc_google_checkout_page(){
|
194 |
global $wpsc_gateway;
|
195 |
-
|
196 |
jQuery(document).ready(
|
197 |
function()
|
198 |
{
|
@@ -201,20 +186,20 @@ function wpsc_google_checkout_page(){
|
|
201 |
jQuery('.wpsc_checkout_forms').hide();
|
202 |
});
|
203 |
</script>";
|
204 |
-
|
205 |
if(in_array('google', (array)get_option('custom_gateway_options'))){
|
206 |
$options = 'google';
|
207 |
}
|
208 |
|
209 |
-
|
210 |
-
|
211 |
echo $script;
|
212 |
gateway_google(true);
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
}
|
|
|
217 |
add_action('wpsc_before_form_of_shopping_cart', 'wpsc_google_checkout_page');
|
|
|
218 |
function submit_google() {
|
219 |
if(isset($_POST['google_id'])) {
|
220 |
update_option('google_id', $_POST['google_id']);
|
@@ -241,8 +226,7 @@ function submit_google() {
|
|
241 |
return true;
|
242 |
}
|
243 |
|
244 |
-
function form_google()
|
245 |
-
{
|
246 |
if (get_option('google_button_size') == '0'){
|
247 |
$button_size1="checked='checked'";
|
248 |
} elseif(get_option('google_button_size') == '1') {
|
@@ -308,7 +292,7 @@ function form_google()
|
|
308 |
<td>Server Type
|
309 |
</td>
|
310 |
<td>
|
311 |
-
<input $google_server_type1 type='radio' name='google_server_type' value='sandbox' /> Sandbox
|
312 |
<input $google_server_type2 type='radio' name='google_server_type' value='production' /> Production
|
313 |
</td>
|
314 |
</tr>
|
@@ -359,9 +343,14 @@ function form_google()
|
|
359 |
</tr>
|
360 |
|
361 |
<tr>
|
362 |
-
<td
|
363 |
-
|
364 |
-
|
|
|
|
|
|
|
|
|
|
|
365 |
</tr>";
|
366 |
return $output;
|
367 |
}
|
@@ -373,11 +362,14 @@ function nzsc_googleResponse() {
|
|
373 |
$server_type = get_option('google_server_type');
|
374 |
$currency = get_option('google_cur');
|
375 |
|
|
|
|
|
376 |
define('RESPONSE_HANDLER_ERROR_LOG_FILE', 'library/googleerror.log');
|
377 |
define('RESPONSE_HANDLER_LOG_FILE', 'library/googlemessage.log');
|
378 |
if (stristr($_SERVER['HTTP_USER_AGENT'],"Google Checkout Notification Agent")) {
|
379 |
$Gresponse = new GoogleResponse($merchant_id, $merchant_key);
|
380 |
$xml_response = isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:file_get_contents("php://input");
|
|
|
381 |
if (get_magic_quotes_gpc()) {
|
382 |
$xml_response = stripslashes($xml_response);
|
383 |
}
|
@@ -507,6 +499,7 @@ function nzsc_googleResponse() {
|
|
507 |
$google_order_number = $data['order-state-change-notification']['google-order-number']['VALUE'];
|
508 |
$google_status=$wpdb->get_var("SELECT google_status FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE google_order_number='".$google_order_number."'");
|
509 |
$google_status = unserialize($google_status);
|
|
|
510 |
if (($google_status[0]!='Partially Charged') && ($google_status[0]!='Partially Refunded')) {
|
511 |
$google_status[0]=$data['order-state-change-notification']['new-financial-order-state']['VALUE'];
|
512 |
$google_status[1]=$data['order-state-change-notification']['new-fulfillment-order-state']['VALUE'];
|
@@ -514,13 +507,14 @@ function nzsc_googleResponse() {
|
|
514 |
$google_status = serialize($google_status);
|
515 |
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET google_status='".$google_status."' WHERE google_order_number='".$google_order_number."'";
|
516 |
$wpdb->query($sql) ;
|
|
|
517 |
if (($data['order-state-change-notification']['new-financial-order-state']['VALUE'] == 'CHARGEABLE') && (get_option('google_auto_charge') == '1')) {
|
518 |
$Grequest = new GoogleRequest($merchant_id, $merchant_key, $server_type,$currency);
|
519 |
$result = $Grequest->SendChargeOrder($google_order_number);
|
520 |
|
521 |
$_SESSION['nzshpcrt_cart'] = '';
|
522 |
unset($_SESSION['coupon_num'], $_SESSION['google_session']);
|
523 |
-
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET processed='
|
524 |
$wpdb->query($sql) ;
|
525 |
}
|
526 |
}
|
@@ -596,5 +590,6 @@ function nzsc_googleResponse() {
|
|
596 |
exit();
|
597 |
}
|
598 |
}
|
|
|
599 |
add_action('init', 'nzsc_googleResponse');
|
600 |
?>
|
69 |
}
|
70 |
}
|
71 |
|
72 |
+
function Usecase($separator, $sessionid, $fromcheckout) {
|
73 |
+
global $wpdb, $wpsc_cart ;
|
74 |
+
|
75 |
$purchase_log_sql = "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid`= ".$sessionid." LIMIT 1";
|
76 |
+
$purchase_log = $wpdb->get_results($purchase_log_sql,ARRAY_A) ;
|
77 |
|
78 |
+
$cart_sql = "SELECT * FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE `purchaseid`='".$purchase_log[0]['id']."'";
|
79 |
+
$wp_cart = $wpdb->get_results($cart_sql,ARRAY_A) ;
|
80 |
+
|
81 |
+
$merchant_id = get_option('google_id');
|
82 |
+
$merchant_key = get_option('google_key');
|
83 |
+
$server_type = get_option('google_server_type');
|
84 |
+
$currency = get_option('google_cur');
|
85 |
+
$transact_url = get_option('transact_url');
|
86 |
+
$returnURL = $transact_url.$separator."sessionid=".$sessionid."&gateway=google";
|
87 |
+
|
88 |
+
$cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
|
89 |
$cart->SetContinueShoppingUrl($returnURL);
|
90 |
$cart->SetEditCartUrl(get_option('shopping_cart_url'));
|
91 |
+
|
|
|
92 |
//google prohibited items not implemented
|
93 |
+
$currency_converter = new CURRENCYCONVERTER();
|
94 |
+
$currency_code = $wpdb->get_results("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
|
95 |
$local_currency_code = $currency_code[0]['code'];
|
96 |
+
$google_curr = get_option('google_cur');
|
97 |
+
$currentcy_rate = 1;
|
98 |
+
|
99 |
+
if($google_curr != $local_currency_code){
|
100 |
+
$currentcy_rate = $currency_converter->convert( 1, $local_currency_code, $google_curr);
|
101 |
+
}
|
102 |
+
|
103 |
while (wpsc_have_cart_items()) {
|
104 |
wpsc_the_cart_item();
|
105 |
+
|
106 |
+
$google_currency_productprice = $currentcy_rate * (wpsc_cart_item_price(false)/wpsc_cart_item_quantity());
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
+
$cart_item = new GoogleItem(wpsc_cart_item_name(), // Item name
|
109 |
+
'', // Item description
|
110 |
+
wpsc_cart_item_quantity(), // Quantity
|
111 |
+
($google_currency_productprice) // Unit price
|
112 |
+
);
|
113 |
+
|
114 |
+
$cart->AddItem($cart_item);
|
|
|
115 |
}
|
116 |
+
|
117 |
//If there are coupons applied add coupon as a product with negative price
|
118 |
if($wpsc_cart->coupons_amount > 0){
|
119 |
+
|
120 |
+
$google_currency_productprice = $currentcy_rate * $wpsc_cart->coupons_amount;
|
121 |
+
|
122 |
+
$coupon = new GoogleItem('Discount', // Item name
|
123 |
+
'Discount Price', // Item description
|
124 |
+
1, // Quantity
|
125 |
+
('-'.$google_currency_productprice) // Unit price
|
126 |
+
);
|
127 |
+
|
128 |
+
$cart->AddItem($coupon);
|
|
|
|
|
129 |
}
|
130 |
|
131 |
+
$shipping_country = $purchase_log[0]['shipping_country'];
|
132 |
+
$shipping_region = $purchase_log[0]['shipping_region'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
+
if ($shipping_country == "UK")
|
135 |
+
$shipping_country = "GB";
|
136 |
+
|
137 |
+
// Add shipping options
|
138 |
+
if(wpsc_uses_shipping()){
|
139 |
+
$shipping_name = ucfirst($wpsc_cart->selected_shipping_method)." - ".$wpsc_cart->selected_shipping_option;
|
140 |
+
if ($shipping_name == "") $shipping_name = "Calculated";
|
141 |
+
|
142 |
+
$shipping = new GoogleFlatRateShipping($shipping_name, $wpsc_cart->calculate_total_shipping() * $currentcy_rate);
|
143 |
+
|
144 |
+
if (!empty($shipping_country)){
|
145 |
+
$shipping_filter = new GoogleShippingFilters();
|
146 |
+
|
147 |
+
if (!empty($shipping_region) && is_numeric($shipping_region)){
|
148 |
+
$shipping_filter->AddAllowedPostalArea($shipping_country,wpsc_get_state_by_id($shipping_region,"code"));
|
149 |
+
$shipping_filter->AddAllowedStateArea(wpsc_get_state_by_id($shipping_region,"code"));
|
150 |
+
} else {
|
151 |
+
$shipping_filter->AddAllowedPostalArea($shipping_country);
|
152 |
}
|
153 |
+
|
154 |
+
$shipping->AddShippingRestrictions($shipping_filter);
|
155 |
}
|
156 |
|
157 |
+
$cart->AddShipping($shipping);
|
|
|
|
|
|
|
158 |
}
|
|
|
159 |
|
160 |
// Add tax rules
|
161 |
+
if (!empty($shipping_country)){
|
162 |
+
$tax_rule = new GoogleDefaultTaxRule( (wpsc_cart_tax(false)/$wpsc_cart->calculate_subtotal() ));
|
163 |
+
$tax_rule->AddPostalArea($shipping_country);
|
164 |
+
$cart->AddDefaultTaxRules($tax_rule);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
166 |
|
167 |
+
// Display Google Checkout button
|
168 |
if (get_option('google_button_size') == '0'){
|
169 |
$google_button_size = 'BIG';
|
170 |
} elseif(get_option('google_button_size') == '1') {
|
172 |
} elseif(get_option('google_button_size') == '2') {
|
173 |
$google_button_size = 'SMALL';
|
174 |
}
|
|
|
175 |
echo $cart->CheckoutButtonCode($google_button_size);
|
176 |
}
|
177 |
|
178 |
function wpsc_google_checkout_page(){
|
179 |
global $wpsc_gateway;
|
180 |
+
$script = "<script type='text/javascript'>
|
181 |
jQuery(document).ready(
|
182 |
function()
|
183 |
{
|
186 |
jQuery('.wpsc_checkout_forms').hide();
|
187 |
});
|
188 |
</script>";
|
189 |
+
$options = get_option('payment_gateway');
|
190 |
if(in_array('google', (array)get_option('custom_gateway_options'))){
|
191 |
$options = 'google';
|
192 |
}
|
193 |
|
194 |
+
if($options == 'google' && isset($_SESSION['gateway'])){
|
195 |
+
unset($_SESSION['gateway']);
|
196 |
echo $script;
|
197 |
gateway_google(true);
|
198 |
+
}
|
|
|
|
|
199 |
}
|
200 |
+
|
201 |
add_action('wpsc_before_form_of_shopping_cart', 'wpsc_google_checkout_page');
|
202 |
+
|
203 |
function submit_google() {
|
204 |
if(isset($_POST['google_id'])) {
|
205 |
update_option('google_id', $_POST['google_id']);
|
226 |
return true;
|
227 |
}
|
228 |
|
229 |
+
function form_google(){
|
|
|
230 |
if (get_option('google_button_size') == '0'){
|
231 |
$button_size1="checked='checked'";
|
232 |
} elseif(get_option('google_button_size') == '1') {
|
292 |
<td>Server Type
|
293 |
</td>
|
294 |
<td>
|
295 |
+
<input $google_server_type1 type='radio' name='google_server_type' value='sandbox' /> Sandbox
|
296 |
<input $google_server_type2 type='radio' name='google_server_type' value='production' /> Production
|
297 |
</td>
|
298 |
</tr>
|
343 |
</tr>
|
344 |
|
345 |
<tr>
|
346 |
+
<td>".__('API version','wpsc').":</td>
|
347 |
+
<td><strong>2.0</strong></td>
|
348 |
+
<td>
|
349 |
+
<tr>
|
350 |
+
<td>".__('API callback URL','wpsc').":</td>
|
351 |
+
</tr>
|
352 |
+
<tr>
|
353 |
+
<td colspan='2'><strong>".get_option('siteurl')."/index.php</strong></td>
|
354 |
</tr>";
|
355 |
return $output;
|
356 |
}
|
362 |
$server_type = get_option('google_server_type');
|
363 |
$currency = get_option('google_cur');
|
364 |
|
365 |
+
$xml_response = isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:file_get_contents("php://input");
|
366 |
+
|
367 |
define('RESPONSE_HANDLER_ERROR_LOG_FILE', 'library/googleerror.log');
|
368 |
define('RESPONSE_HANDLER_LOG_FILE', 'library/googlemessage.log');
|
369 |
if (stristr($_SERVER['HTTP_USER_AGENT'],"Google Checkout Notification Agent")) {
|
370 |
$Gresponse = new GoogleResponse($merchant_id, $merchant_key);
|
371 |
$xml_response = isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:file_get_contents("php://input");
|
372 |
+
|
373 |
if (get_magic_quotes_gpc()) {
|
374 |
$xml_response = stripslashes($xml_response);
|
375 |
}
|
499 |
$google_order_number = $data['order-state-change-notification']['google-order-number']['VALUE'];
|
500 |
$google_status=$wpdb->get_var("SELECT google_status FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE google_order_number='".$google_order_number."'");
|
501 |
$google_status = unserialize($google_status);
|
502 |
+
|
503 |
if (($google_status[0]!='Partially Charged') && ($google_status[0]!='Partially Refunded')) {
|
504 |
$google_status[0]=$data['order-state-change-notification']['new-financial-order-state']['VALUE'];
|
505 |
$google_status[1]=$data['order-state-change-notification']['new-fulfillment-order-state']['VALUE'];
|
507 |
$google_status = serialize($google_status);
|
508 |
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET google_status='".$google_status."' WHERE google_order_number='".$google_order_number."'";
|
509 |
$wpdb->query($sql) ;
|
510 |
+
|
511 |
if (($data['order-state-change-notification']['new-financial-order-state']['VALUE'] == 'CHARGEABLE') && (get_option('google_auto_charge') == '1')) {
|
512 |
$Grequest = new GoogleRequest($merchant_id, $merchant_key, $server_type,$currency);
|
513 |
$result = $Grequest->SendChargeOrder($google_order_number);
|
514 |
|
515 |
$_SESSION['nzshpcrt_cart'] = '';
|
516 |
unset($_SESSION['coupon_num'], $_SESSION['google_session']);
|
517 |
+
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET processed='3' WHERE google_order_number='".$google_order_number."'";
|
518 |
$wpdb->query($sql) ;
|
519 |
}
|
520 |
}
|
590 |
exit();
|
591 |
}
|
592 |
}
|
593 |
+
|
594 |
add_action('init', 'nzsc_googleResponse');
|
595 |
?>
|
wpsc-merchants/paypal-express.merchant.php
CHANGED
@@ -109,11 +109,10 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
109 |
|
110 |
// PayPal Express Checkout Module
|
111 |
$paymentAmount = $this->cart_data['total_price'];
|
112 |
-
$_SESSION['paypalAmount'] = $paymentAmount;
|
|
|
113 |
$_SESSION['paypalexpresssessionid'] = $this->cart_data['session_id'];
|
114 |
-
|
115 |
-
|
116 |
-
$currencyCodeType = get_option('paypal_curcode');
|
117 |
$paymentType = "Sale";
|
118 |
|
119 |
if(get_option('permalink_structure') != '')
|
@@ -124,7 +123,7 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
124 |
$transact_url = get_option('transact_url');
|
125 |
$returnURL = $transact_url.$separator."sessionid=".$this->cart_data['session_id']."&gateway=paypal";
|
126 |
$cancelURL = get_option('shopping_cart_url');
|
127 |
-
$resArray = $this->CallShortcutExpressCheckout ($
|
128 |
$ack = strtoupper($resArray["ACK"]);
|
129 |
|
130 |
if($ack=="SUCCESS") {
|
@@ -168,7 +167,7 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
168 |
function CallShortcutExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL) {
|
169 |
global $wpdb;
|
170 |
|
171 |
-
$nvpstr =
|
172 |
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
|
173 |
$nvpstr = $nvpstr . "&RETURNURL=" . $returnURL;
|
174 |
$nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
|
@@ -199,19 +198,29 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
199 |
$shipping_total = 0;
|
200 |
foreach ( $this->cart_items as $cart_item ) {
|
201 |
$data["L_PAYMENTREQUEST_0_NAME{$i}"] = $cart_item['name'];
|
202 |
-
$data["L_PAYMENTREQUEST_0_AMT{$i}"] = $cart_item['price'];
|
203 |
$data["L_PAYMENTREQUEST_0_NUMBER{$i}"] = $i;
|
204 |
$data["L_PAYMENTREQUEST_0_QTY{$i}"] = $cart_item['quantity'];
|
205 |
-
$item_total += $cart_item['price'] * $cart_item['quantity'];
|
206 |
$shipping_total += $cart_item['shipping'];
|
207 |
$i ++;
|
208 |
}
|
209 |
-
|
210 |
$data["PAYMENTREQUEST_0_ITEMAMT"] = $this->format_price( $item_total );
|
211 |
-
$data["PAYMENTREQUEST_0_SHIPPINGAMT"] = $this->
|
212 |
-
|
213 |
-
$data["PAYMENTREQUEST_0_TAXAMT"] = $this->cart_data['cart_tax'];
|
214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
if(count($data) >= 4) {
|
216 |
$temp_data = array();
|
217 |
foreach($data as $key => $value)
|
@@ -241,8 +250,40 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
241 |
// exit();
|
242 |
}
|
243 |
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
|
247 |
} // end of class
|
248 |
|
@@ -359,38 +400,15 @@ function form_paypal_express() {
|
|
359 |
return $output;
|
360 |
}
|
361 |
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
$paypal_currency_code = 'US';
|
370 |
-
|
371 |
-
$curr=new CURRENCYCONVERTER();
|
372 |
-
if($paypal_currency_code != $local_currency_code) {
|
373 |
-
$paypal_currency_productprice = $curr->convert($_SESSION['paypalAmount'],$paypal_currency_code,$local_currency_code);
|
374 |
-
} else {
|
375 |
-
$paypal_currency_productprice = $_SESSION['paypalAmount'];
|
376 |
-
}
|
377 |
-
switch($paypal_currency_code) {
|
378 |
-
case "JPY":
|
379 |
-
$decimal_places = 0;
|
380 |
-
break;
|
381 |
-
|
382 |
-
case "HUF":
|
383 |
-
$decimal_places = 0;
|
384 |
-
break;
|
385 |
-
|
386 |
-
default:
|
387 |
-
$decimal_places = 2;
|
388 |
-
break;
|
389 |
-
}
|
390 |
-
$_SESSION['paypalAmount'] = number_format(sprintf("%01.2f", $paypal_currency_productprice),$decimal_places,'.','');
|
391 |
}
|
392 |
|
393 |
-
|
394 |
/**
|
395 |
* prcessing functions, this is where the main logic of paypal express lives
|
396 |
* @access public
|
@@ -482,7 +500,7 @@ function paypal_processingfunctions(){
|
|
482 |
|
483 |
$paymentAmount =urlencode ($_SESSION['paypalAmount']);
|
484 |
$paymentType = urlencode($_SESSION['PaymentType']);
|
485 |
-
$currCodeType = urlencode(
|
486 |
$payerID = urlencode($_REQUEST['PayerID']);
|
487 |
$serverName = urlencode($_SERVER['SERVER_NAME']);
|
488 |
$BN='Instinct_e-commerce_wp-shopping-cart_NZ';
|
@@ -526,7 +544,7 @@ function paypal_processingfunctions(){
|
|
526 |
$token = $_REQUEST['token'];
|
527 |
if(!isset($token)) {
|
528 |
$paymentAmount=$_SESSION['paypalAmount'];
|
529 |
-
$currencyCodeType=
|
530 |
$paymentType='Sale';
|
531 |
if(get_option('permalink_structure') != '')
|
532 |
$separator ="?";
|
@@ -632,7 +650,7 @@ function paypal_processingfunctions(){
|
|
632 |
<table width='400' class='paypal_express_form'>
|
633 |
<tr>
|
634 |
<td align='left' class='firstcol'><b>Order Total:</b></td>
|
635 |
-
<td align='left'>" . wpsc_currency_display($_SESSION['
|
636 |
</tr>
|
637 |
<tr>
|
638 |
<td align='left' colspan='2'><b>" . __('Shipping Address:', 'wpsc' ) . " </b></td>
|
109 |
|
110 |
// PayPal Express Checkout Module
|
111 |
$paymentAmount = $this->cart_data['total_price'];
|
112 |
+
$_SESSION['paypalAmount'] = $this->convert( $paymentAmount );
|
113 |
+
$_SESSION['localPaypalAmount'] = $paymentAmount;
|
114 |
$_SESSION['paypalexpresssessionid'] = $this->cart_data['session_id'];
|
115 |
+
$currencyCodeType = $this->get_paypal_currency_code();
|
|
|
|
|
116 |
$paymentType = "Sale";
|
117 |
|
118 |
if(get_option('permalink_structure') != '')
|
123 |
$transact_url = get_option('transact_url');
|
124 |
$returnURL = $transact_url.$separator."sessionid=".$this->cart_data['session_id']."&gateway=paypal";
|
125 |
$cancelURL = get_option('shopping_cart_url');
|
126 |
+
$resArray = $this->CallShortcutExpressCheckout ($_SESSION['paypalAmount'], $currencyCodeType, $paymentType, $returnURL, $cancelURL);
|
127 |
$ack = strtoupper($resArray["ACK"]);
|
128 |
|
129 |
if($ack=="SUCCESS") {
|
167 |
function CallShortcutExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL) {
|
168 |
global $wpdb;
|
169 |
|
170 |
+
$nvpstr = '';
|
171 |
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
|
172 |
$nvpstr = $nvpstr . "&RETURNURL=" . $returnURL;
|
173 |
$nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
|
198 |
$shipping_total = 0;
|
199 |
foreach ( $this->cart_items as $cart_item ) {
|
200 |
$data["L_PAYMENTREQUEST_0_NAME{$i}"] = $cart_item['name'];
|
201 |
+
$data["L_PAYMENTREQUEST_0_AMT{$i}"] = $this->convert( $cart_item['price'] );
|
202 |
$data["L_PAYMENTREQUEST_0_NUMBER{$i}"] = $i;
|
203 |
$data["L_PAYMENTREQUEST_0_QTY{$i}"] = $cart_item['quantity'];
|
204 |
+
$item_total += $this->convert( $cart_item['price'] ) * $cart_item['quantity'];
|
205 |
$shipping_total += $cart_item['shipping'];
|
206 |
$i ++;
|
207 |
}
|
208 |
+
|
209 |
$data["PAYMENTREQUEST_0_ITEMAMT"] = $this->format_price( $item_total );
|
210 |
+
$data["PAYMENTREQUEST_0_SHIPPINGAMT"] = $this->convert( $this->cart_data['base_shipping'] + $shipping_total );
|
211 |
+
$total = $data["PAYMENTREQUEST_0_ITEMAMT"] + $data["PAYMENTREQUEST_0_SHIPPINGAMT"];
|
|
|
212 |
|
213 |
+
if ( ! wpsc_tax_isincluded() ) {
|
214 |
+
$data["PAYMENTREQUEST_0_TAXAMT"] = $this->convert( $this->cart_data['cart_tax'] );
|
215 |
+
$total += $data["PAYMENTREQUEST_0_TAXAMT"];
|
216 |
+
}
|
217 |
+
|
218 |
+
// adjust total amount in case we had to round up after converting currency
|
219 |
+
if ( $this->rate !== 1 && $total != $paymentAmount )
|
220 |
+
$paymentAmount = $total;
|
221 |
+
|
222 |
+
$data["PAYMENTREQUEST_0_AMT"] = $paymentAmount;
|
223 |
+
|
224 |
if(count($data) >= 4) {
|
225 |
$temp_data = array();
|
226 |
foreach($data as $key => $value)
|
250 |
// exit();
|
251 |
}
|
252 |
|
253 |
+
function convert( $amt ){
|
254 |
+
if ( empty( $this->rate ) ) {
|
255 |
+
$this->rate = 1;
|
256 |
+
$paypal_currency_code = $this->get_paypal_currency_code();
|
257 |
+
$local_currency_code = $this->get_local_currency_code();
|
258 |
+
if( $local_currency_code != $paypal_currency_code ) {
|
259 |
+
$curr=new CURRENCYCONVERTER();
|
260 |
+
$this->rate = $curr->convert( 1, $paypal_currency_code, $local_currency_code );
|
261 |
+
}
|
262 |
+
}
|
263 |
|
264 |
+
return $this->format_price( $amt / $this->rate );
|
265 |
+
}
|
266 |
+
|
267 |
+
function get_local_currency_code() {
|
268 |
+
if ( empty( $this->local_currency_code ) ) {
|
269 |
+
global $wpdb;
|
270 |
+
$this->local_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1");
|
271 |
+
}
|
272 |
+
|
273 |
+
return $this->local_currency_code;
|
274 |
+
}
|
275 |
+
|
276 |
+
function get_paypal_currency_code() {
|
277 |
+
if ( empty( $this->paypal_currency_code ) ) {
|
278 |
+
global $wpsc_gateways;
|
279 |
+
$this->paypal_currency_code = $this->get_local_currency_code();
|
280 |
+
|
281 |
+
if ( ! in_array( $this->paypal_currency_code, $wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'] ) )
|
282 |
+
$this->paypal_currency_code = get_option( 'paypal_curcode', 'USD' );
|
283 |
+
}
|
284 |
+
|
285 |
+
return $this->paypal_currency_code;
|
286 |
+
}
|
287 |
|
288 |
} // end of class
|
289 |
|
400 |
return $output;
|
401 |
}
|
402 |
|
403 |
+
function wpsc_get_paypal_currency_code() {
|
404 |
+
global $wpdb, $wpsc_gateways;
|
405 |
+
$paypal_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1");
|
406 |
+
if ( ! in_array( $paypal_currency_code, $wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'] ) )
|
407 |
+
$paypal_currency_code = get_option( 'paypal_curcode', 'USD' );
|
408 |
+
|
409 |
+
return $paypal_currency_code;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
}
|
411 |
|
|
|
412 |
/**
|
413 |
* prcessing functions, this is where the main logic of paypal express lives
|
414 |
* @access public
|
500 |
|
501 |
$paymentAmount =urlencode ($_SESSION['paypalAmount']);
|
502 |
$paymentType = urlencode($_SESSION['PaymentType']);
|
503 |
+
$currCodeType = urlencode(wpsc_get_paypal_currency_code());
|
504 |
$payerID = urlencode($_REQUEST['PayerID']);
|
505 |
$serverName = urlencode($_SERVER['SERVER_NAME']);
|
506 |
$BN='Instinct_e-commerce_wp-shopping-cart_NZ';
|
544 |
$token = $_REQUEST['token'];
|
545 |
if(!isset($token)) {
|
546 |
$paymentAmount=$_SESSION['paypalAmount'];
|
547 |
+
$currencyCodeType=wpsc_get_paypal_currency_code();
|
548 |
$paymentType='Sale';
|
549 |
if(get_option('permalink_structure') != '')
|
550 |
$separator ="?";
|
650 |
<table width='400' class='paypal_express_form'>
|
651 |
<tr>
|
652 |
<td align='left' class='firstcol'><b>Order Total:</b></td>
|
653 |
+
<td align='left'>" . wpsc_currency_display($_SESSION['localPaypalAmount']) . "</td>
|
654 |
</tr>
|
655 |
<tr>
|
656 |
<td align='left' colspan='2'><b>" . __('Shipping Address:', 'wpsc' ) . " </b></td>
|
wpsc-merchants/paypal-pro.merchant.php
CHANGED
@@ -38,12 +38,33 @@ class wpsc_merchant_paypal_pro extends wpsc_merchant {
|
|
38 |
|
39 |
var $name = 'PayPal Pro 2.0';
|
40 |
var $paypal_ipn_values = array( );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
/**
|
43 |
* construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
|
44 |
* @access public
|
45 |
*/
|
46 |
-
function construct_value_array() {
|
47 |
//$collected_gateway_data
|
48 |
$paypal_vars = array( );
|
49 |
// Store settings to be sent to paypal
|
@@ -57,6 +78,7 @@ class wpsc_merchant_paypal_pro extends wpsc_merchant {
|
|
57 |
$data['METHOD'] = "DoDirectPayment";
|
58 |
$data['PAYMENTACTION'] = "Sale";
|
59 |
$data['RETURNFMFDETAILS'] = "1"; // optional - return fraud management filter data
|
|
|
60 |
|
61 |
// Basic Cart Data
|
62 |
$data['INVNUM'] = $this->cart_data['session_id'];
|
@@ -95,30 +117,28 @@ class wpsc_merchant_paypal_pro extends wpsc_merchant {
|
|
95 |
// Ordered Items
|
96 |
|
97 |
// Cart Item Data
|
98 |
-
$i = $item_total =
|
|
|
99 |
|
100 |
$shipping_total = $this->cart_data['base_shipping'];
|
101 |
|
102 |
foreach ( $this->cart_items as $cart_row ) {
|
103 |
-
$
|
104 |
-
$
|
105 |
-
$
|
106 |
-
$
|
107 |
-
|
108 |
-
|
109 |
-
$item_total += $this->
|
110 |
-
|
111 |
-
|
112 |
}
|
113 |
|
114 |
-
$data = array_merge( $data, $cart_items );
|
115 |
// Cart totals
|
116 |
-
$data['ITEMAMT'] =
|
117 |
-
$data['SHIPPINGAMT'] =
|
118 |
-
$data['TAXAMT'] =
|
119 |
-
|
120 |
-
$data['AMT'] = number_format( $item_total + $tax_total + $shipping_total, 2 );
|
121 |
-
|
122 |
$this->collected_gateway_data = $data;
|
123 |
}
|
124 |
|
@@ -296,6 +316,20 @@ class wpsc_merchant_paypal_pro extends wpsc_merchant {
|
|
296 |
|
297 |
return $price;
|
298 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
}
|
301 |
|
@@ -305,6 +339,9 @@ function submit_paypal_pro() {
|
|
305 |
|
306 |
if ( isset( $_POST['PayPalPro']['password'] ) )
|
307 |
update_option( 'paypal_pro_password', $_POST['PayPalPro']['password'] );
|
|
|
|
|
|
|
308 |
|
309 |
if ( isset( $_POST['PayPalPro']['signature'] ) )
|
310 |
update_option( 'paypal_pro_signature', $_POST['PayPalPro']['signature'] );
|
@@ -316,7 +353,7 @@ function submit_paypal_pro() {
|
|
316 |
}
|
317 |
|
318 |
function form_paypal_pro() {
|
319 |
-
|
320 |
if ( get_option( 'paypal_pro_testmode' ) == "on" )
|
321 |
$selected = 'checked="checked"';
|
322 |
else
|
@@ -355,6 +392,40 @@ function form_paypal_pro() {
|
|
355 |
<input type="hidden" name="PayPalPro[testmode]" value="off" /><input type="checkbox" name="PayPalPro[testmode]" id="paypal_pro_testmode" value="on" ' . $selected . ' />
|
356 |
</td>
|
357 |
</tr>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
|
359 |
return $output;
|
360 |
}
|
@@ -418,5 +489,6 @@ if ( in_array( 'wpsc_merchant_paypal_pro', (array)get_option( 'custom_gateway_op
|
|
418 |
</td>
|
419 |
</tr>
|
420 |
";
|
|
|
421 |
}
|
422 |
?>
|
38 |
|
39 |
var $name = 'PayPal Pro 2.0';
|
40 |
var $paypal_ipn_values = array( );
|
41 |
+
|
42 |
+
function get_local_currency_code() {
|
43 |
+
if ( empty( $this->local_currency_code ) ) {
|
44 |
+
global $wpdb;
|
45 |
+
$this->local_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1");
|
46 |
+
}
|
47 |
+
|
48 |
+
return $this->local_currency_code;
|
49 |
+
}
|
50 |
+
|
51 |
+
function get_paypal_currency_code() {
|
52 |
+
if ( empty( $this->paypal_currency_code ) ) {
|
53 |
+
global $wpsc_gateways;
|
54 |
+
$this->paypal_currency_code = $this->get_local_currency_code();
|
55 |
+
|
56 |
+
if ( ! in_array( $this->paypal_currency_code, $wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list'] ) )
|
57 |
+
$this->paypal_currency_code = get_option( 'paypal_curcode', 'USD' );
|
58 |
+
}
|
59 |
+
|
60 |
+
return $this->paypal_currency_code;
|
61 |
+
}
|
62 |
|
63 |
/**
|
64 |
* construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
|
65 |
* @access public
|
66 |
*/
|
67 |
+
function construct_value_array() {
|
68 |
//$collected_gateway_data
|
69 |
$paypal_vars = array( );
|
70 |
// Store settings to be sent to paypal
|
78 |
$data['METHOD'] = "DoDirectPayment";
|
79 |
$data['PAYMENTACTION'] = "Sale";
|
80 |
$data['RETURNFMFDETAILS'] = "1"; // optional - return fraud management filter data
|
81 |
+
$data['CURRENCYCODE'] = $this->get_paypal_currency_code();
|
82 |
|
83 |
// Basic Cart Data
|
84 |
$data['INVNUM'] = $this->cart_data['session_id'];
|
117 |
// Ordered Items
|
118 |
|
119 |
// Cart Item Data
|
120 |
+
$i = $item_total = 0;
|
121 |
+
$tax_total = wpsc_tax_isincluded() ? 0 : $this->cart_data['cart_tax'];
|
122 |
|
123 |
$shipping_total = $this->cart_data['base_shipping'];
|
124 |
|
125 |
foreach ( $this->cart_items as $cart_row ) {
|
126 |
+
$data['L_NAME' . $i] = $cart_row['name'];
|
127 |
+
$data['L_AMT' . $i] = $this->convert( $cart_row['price'] );
|
128 |
+
$data['L_NUMBER' . $i] = $i;
|
129 |
+
$data['L_QTY' . $i] = $cart_row['quantity'];
|
130 |
+
|
131 |
+
$shipping_total += $cart_row['shipping'];
|
132 |
+
$item_total += $this->convert( $cart_row['price'] ) * $cart_row['quantity'];
|
133 |
+
|
134 |
+
$i++;
|
135 |
}
|
136 |
|
|
|
137 |
// Cart totals
|
138 |
+
$data['ITEMAMT'] = $item_total;
|
139 |
+
$data['SHIPPINGAMT'] = $this->convert( $shipping_total );
|
140 |
+
$data['TAXAMT'] = $this->convert( $tax_total );
|
141 |
+
$data['AMT'] = $data['ITEMAMT'] + $data['SHIPPINGAMT'] + $data['TAXAMT'];
|
|
|
|
|
142 |
$this->collected_gateway_data = $data;
|
143 |
}
|
144 |
|
316 |
|
317 |
return $price;
|
318 |
}
|
319 |
+
|
320 |
+
function convert( $amt ){
|
321 |
+
if ( empty( $this->rate ) ) {
|
322 |
+
$this->rate = 1;
|
323 |
+
$paypal_currency_code = $this->get_paypal_currency_code();
|
324 |
+
$local_currency_code = $this->get_local_currency_code();
|
325 |
+
if( $local_currency_code != $paypal_currency_code ) {
|
326 |
+
$curr=new CURRENCYCONVERTER();
|
327 |
+
$this->rate = $curr->convert( 1, $paypal_currency_code, $local_currency_code );
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
return $this->format_price( $amt / $this->rate );
|
332 |
+
}
|
333 |
|
334 |
}
|
335 |
|
339 |
|
340 |
if ( isset( $_POST['PayPalPro']['password'] ) )
|
341 |
update_option( 'paypal_pro_password', $_POST['PayPalPro']['password'] );
|
342 |
+
|
343 |
+
if(isset($_POST['paypal_curcode']))
|
344 |
+
update_option('paypal_curcode', $_POST['paypal_curcode']);
|
345 |
|
346 |
if ( isset( $_POST['PayPalPro']['signature'] ) )
|
347 |
update_option( 'paypal_pro_signature', $_POST['PayPalPro']['signature'] );
|
353 |
}
|
354 |
|
355 |
function form_paypal_pro() {
|
356 |
+
global $wpsc_gateways, $wpdb;
|
357 |
if ( get_option( 'paypal_pro_testmode' ) == "on" )
|
358 |
$selected = 'checked="checked"';
|
359 |
else
|
392 |
<input type="hidden" name="PayPalPro[testmode]" value="off" /><input type="checkbox" name="PayPalPro[testmode]" id="paypal_pro_testmode" value="on" ' . $selected . ' />
|
393 |
</td>
|
394 |
</tr>';
|
395 |
+
|
396 |
+
$store_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id` IN ('".absint(get_option('currency_type'))."')");
|
397 |
+
$current_currency = get_option('paypal_curcode');
|
398 |
+
|
399 |
+
if(($current_currency == '') && in_array($store_currency_code, $wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list'])) {
|
400 |
+
update_option('paypal_curcode', $store_currency_code);
|
401 |
+
$current_currency = $store_currency_code;
|
402 |
+
}
|
403 |
+
if($current_currency != $store_currency_code) {
|
404 |
+
$output .= "<tr> <td colspan='2'><strong class='form_group'>".__('Currency Converter')."</td> </tr>
|
405 |
+
<tr>
|
406 |
+
<td colspan='2'>".__('Your website is using a currency not accepted by PayPal, select an accepted currency using the drop down menu bellow. Buyers on your site will still pay in your local currency however we will convert the currency and send the order through to PayPal using the currency you choose below.', 'wpsc')."</td>
|
407 |
+
</tr>\n";
|
408 |
+
|
409 |
+
$output .= "<tr>\n <td>" . __('Convert to', 'wpsc' ) . " </td>\n ";
|
410 |
+
$output .= "<td>\n <select name='paypal_curcode'>\n";
|
411 |
+
|
412 |
+
if (!isset($wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list']))
|
413 |
+
$wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list'] = array();
|
414 |
+
|
415 |
+
$paypal_currency_list = $wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list'];
|
416 |
+
|
417 |
+
$currency_list = $wpdb->get_results("SELECT DISTINCT `code`, `currency` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `code` IN ('".implode("','",$paypal_currency_list)."')", ARRAY_A);
|
418 |
+
foreach($currency_list as $currency_item) {
|
419 |
+
$selected_currency = '';
|
420 |
+
if($current_currency == $currency_item['code']) {
|
421 |
+
$selected_currency = "selected='selected'";
|
422 |
+
}
|
423 |
+
$output .= "<option ".$selected_currency." value='{$currency_item['code']}'>{$currency_item['currency']}</option>";
|
424 |
+
}
|
425 |
+
$output .= " </select> \n";
|
426 |
+
$output .= " </td>\n";
|
427 |
+
$output .= " </tr>\n";
|
428 |
+
}
|
429 |
|
430 |
return $output;
|
431 |
}
|
489 |
</td>
|
490 |
</tr>
|
491 |
";
|
492 |
+
|
493 |
}
|
494 |
?>
|
wpsc-merchants/paypal-standard.merchant.php
CHANGED
@@ -58,6 +58,40 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
58 |
function construct_value_array() {
|
59 |
$this->collected_gateway_data = $this->_construct_value_array();
|
60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
/**
|
63 |
* construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
|
@@ -68,10 +102,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
68 |
function _construct_value_array($aggregate = false) {
|
69 |
global $wpdb;
|
70 |
$paypal_vars = array();
|
71 |
-
$add_tax =
|
72 |
-
if(get_option('wpec_taxes_inprice') == 'inclusive')
|
73 |
-
$add_tax = false;
|
74 |
-
|
75 |
|
76 |
// Store settings to be sent to paypal
|
77 |
$paypal_vars += array(
|
@@ -79,7 +110,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
79 |
'return' => add_query_arg('sessionid', $this->cart_data['session_id'], $this->cart_data['transaction_results_url']),
|
80 |
'cancel_return' => $this->cart_data['transaction_results_url'],
|
81 |
'rm' => '2',
|
82 |
-
'currency_code' => $this->
|
83 |
'lc' => $this->cart_data['store_currency'],
|
84 |
'bn' => $this->cart_data['software_name'],
|
85 |
|
@@ -117,16 +148,15 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
117 |
'state' => $this->cart_data['shipping_address']['state'],
|
118 |
);
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
// Order settings to be sent to paypal
|
126 |
$paypal_vars += array(
|
127 |
'invoice' => $this->cart_data['session_id']
|
128 |
);
|
129 |
-
|
130 |
// Two cases:
|
131 |
// - We're dealing with a subscription
|
132 |
// - We're dealing with a normal cart
|
@@ -154,7 +184,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
154 |
foreach ($this->cart_items as $cart_row) {
|
155 |
if ($cart_row['is_recurring']) {
|
156 |
$reprocessed_cart_data['subscription']['is_used'] = true;
|
157 |
-
$reprocessed_cart_data['subscription']['price'] = $cart_row['price'];
|
158 |
$reprocessed_cart_data['subscription']['length'] = $cart_row['recurring_data']['rebill_interval']['length'];
|
159 |
$reprocessed_cart_data['subscription']['unit'] = strtoupper($cart_row['recurring_data']['rebill_interval']['unit']);
|
160 |
$reprocessed_cart_data['subscription']['times_to_rebill'] = $cart_row['recurring_data']['times_to_rebill'];
|
@@ -177,7 +207,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
177 |
// This can be false, we don't need to have additional items in the cart/
|
178 |
if ($reprocessed_cart_data['shopping_cart']['is_used']) {
|
179 |
$paypal_vars += array(
|
180 |
-
"a1" => $this->
|
181 |
"p1" => $reprocessed_cart_data['shopping_cart']['length'],
|
182 |
"t1" => $reprocessed_cart_data['shopping_cart']['unit'],
|
183 |
);
|
@@ -187,7 +217,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
187 |
// If this is not true, something is rather wrong.
|
188 |
if ($reprocessed_cart_data['subscription']['is_used']) {
|
189 |
$paypal_vars += array(
|
190 |
-
"a3" => $this->
|
191 |
"p3" => $reprocessed_cart_data['subscription']['length'],
|
192 |
"t3" => $reprocessed_cart_data['subscription']['unit'],
|
193 |
);
|
@@ -209,11 +239,11 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
209 |
);
|
210 |
$handling = $this->cart_data['base_shipping'];
|
211 |
if($add_tax)
|
212 |
-
$
|
213 |
|
214 |
// Set base shipping
|
215 |
$paypal_vars += array(
|
216 |
-
'handling_cart' => $handling
|
217 |
);
|
218 |
|
219 |
// Stick the cart item values together here
|
@@ -223,45 +253,21 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
223 |
foreach ($this->cart_items as $cart_row) {
|
224 |
$paypal_vars += array(
|
225 |
"item_name_$i" => $cart_row['name'],
|
226 |
-
"amount_$i" => $this->
|
227 |
-
"tax_$i" => ($add_tax) ? $this->
|
228 |
"quantity_$i" => $cart_row['quantity'],
|
229 |
"item_number_$i" => $cart_row['product_id'],
|
230 |
// additional shipping for the the (first item / total of the items)
|
231 |
-
"shipping_$i" => $this->
|
232 |
// additional shipping beyond the first item
|
233 |
-
"shipping2_$i" => $this->
|
234 |
"handling_$i" => '',
|
235 |
);
|
236 |
++$i;
|
237 |
}
|
238 |
-
} else {
|
239 |
-
// Work out discounts where applicable
|
240 |
-
$currency_code = $wpdb->get_var("
|
241 |
-
SELECT `code`
|
242 |
-
FROM `".WPSC_TABLE_CURRENCY_LIST."`
|
243 |
-
WHERE `id`='".get_option('currency_type')."'
|
244 |
-
LIMIT 1
|
245 |
-
");
|
246 |
-
$local_currency_code = $currency_code;
|
247 |
-
$paypal_currency_code = get_option('paypal_curcode', 'USD');
|
248 |
-
|
249 |
-
if ($paypal_currency_code != $local_currency_code) {
|
250 |
-
$curr = new CURRENCYCONVERTER();
|
251 |
-
$paypal_currency_productprice = $curr->convert(
|
252 |
-
$this->cart_data['total_price'],
|
253 |
-
$paypal_currency_code,
|
254 |
-
$local_currency_code
|
255 |
-
);
|
256 |
-
} else {
|
257 |
-
$paypal_currency_productprice = $this->cart_data['total_price'];
|
258 |
-
}
|
259 |
-
|
260 |
$paypal_vars['item_name_'.$i] = "Your Shopping Cart";
|
261 |
-
$paypal_vars['amount_'.$i] = ($this->
|
262 |
-
$paypal_currency_productprice,
|
263 |
-
$local_currency_code
|
264 |
-
)-$paypal_vars['handling_cart']);
|
265 |
$paypal_vars['quantity_'.$i] = 1;
|
266 |
$paypal_vars['shipping_'.$i] = 0;
|
267 |
$paypal_vars['shipping2_'.$i] = 0;
|
@@ -296,6 +302,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
296 |
|
297 |
$redirect = get_option('paypal_multiple_url')."?".$gateway_values;
|
298 |
}
|
|
|
299 |
if (defined('WPSC_ADD_DEBUG_PAGE') && WPSC_ADD_DEBUG_PAGE) {
|
300 |
echo "<a href='".esc_url($redirect)."'>Test the URL here</a>";
|
301 |
echo "<pre>".print_r($this->collected_gateway_data,true)."</pre>";
|
58 |
function construct_value_array() {
|
59 |
$this->collected_gateway_data = $this->_construct_value_array();
|
60 |
}
|
61 |
+
|
62 |
+
function convert( $amt ){
|
63 |
+
if ( empty( $this->rate ) ) {
|
64 |
+
$this->rate = 1;
|
65 |
+
$paypal_currency_code = $this->get_paypal_currency_code();
|
66 |
+
$local_currency_code = $this->get_local_currency_code();
|
67 |
+
if( $local_currency_code != $paypal_currency_code ) {
|
68 |
+
$curr=new CURRENCYCONVERTER();
|
69 |
+
$this->rate = $curr->convert( 1, $paypal_currency_code, $local_currency_code );
|
70 |
+
}
|
71 |
+
}
|
72 |
+
return $this->format_price( $amt / $this->rate );
|
73 |
+
}
|
74 |
+
|
75 |
+
function get_local_currency_code() {
|
76 |
+
if ( empty( $this->local_currency_code ) ) {
|
77 |
+
global $wpdb;
|
78 |
+
$this->local_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1");
|
79 |
+
}
|
80 |
+
|
81 |
+
return $this->local_currency_code;
|
82 |
+
}
|
83 |
+
|
84 |
+
function get_paypal_currency_code() {
|
85 |
+
if ( empty( $this->paypal_currency_code ) ) {
|
86 |
+
global $wpsc_gateways;
|
87 |
+
$this->paypal_currency_code = $this->get_local_currency_code();
|
88 |
+
|
89 |
+
if ( ! in_array( $this->paypal_currency_code, $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list'] ) )
|
90 |
+
$this->paypal_currency_code = get_option( 'paypal_curcode', 'USD' );
|
91 |
+
}
|
92 |
+
|
93 |
+
return $this->paypal_currency_code;
|
94 |
+
}
|
95 |
|
96 |
/**
|
97 |
* construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
|
102 |
function _construct_value_array($aggregate = false) {
|
103 |
global $wpdb;
|
104 |
$paypal_vars = array();
|
105 |
+
$add_tax = ! wpsc_tax_isincluded();
|
|
|
|
|
|
|
106 |
|
107 |
// Store settings to be sent to paypal
|
108 |
$paypal_vars += array(
|
110 |
'return' => add_query_arg('sessionid', $this->cart_data['session_id'], $this->cart_data['transaction_results_url']),
|
111 |
'cancel_return' => $this->cart_data['transaction_results_url'],
|
112 |
'rm' => '2',
|
113 |
+
'currency_code' => $this->get_paypal_currency_code(),
|
114 |
'lc' => $this->cart_data['store_currency'],
|
115 |
'bn' => $this->cart_data['software_name'],
|
116 |
|
148 |
'state' => $this->cart_data['shipping_address']['state'],
|
149 |
);
|
150 |
|
151 |
+
if ( $paypal_vars['country'] == 'UK' ) {
|
152 |
+
$paypal_vars['country'] = 'GB';
|
153 |
+
}
|
154 |
+
|
|
|
155 |
// Order settings to be sent to paypal
|
156 |
$paypal_vars += array(
|
157 |
'invoice' => $this->cart_data['session_id']
|
158 |
);
|
159 |
+
|
160 |
// Two cases:
|
161 |
// - We're dealing with a subscription
|
162 |
// - We're dealing with a normal cart
|
184 |
foreach ($this->cart_items as $cart_row) {
|
185 |
if ($cart_row['is_recurring']) {
|
186 |
$reprocessed_cart_data['subscription']['is_used'] = true;
|
187 |
+
$reprocessed_cart_data['subscription']['price'] = $this->convert( $cart_row['price'] );
|
188 |
$reprocessed_cart_data['subscription']['length'] = $cart_row['recurring_data']['rebill_interval']['length'];
|
189 |
$reprocessed_cart_data['subscription']['unit'] = strtoupper($cart_row['recurring_data']['rebill_interval']['unit']);
|
190 |
$reprocessed_cart_data['subscription']['times_to_rebill'] = $cart_row['recurring_data']['times_to_rebill'];
|
207 |
// This can be false, we don't need to have additional items in the cart/
|
208 |
if ($reprocessed_cart_data['shopping_cart']['is_used']) {
|
209 |
$paypal_vars += array(
|
210 |
+
"a1" => $this->convert($reprocessed_cart_data['shopping_cart']['price']),
|
211 |
"p1" => $reprocessed_cart_data['shopping_cart']['length'],
|
212 |
"t1" => $reprocessed_cart_data['shopping_cart']['unit'],
|
213 |
);
|
217 |
// If this is not true, something is rather wrong.
|
218 |
if ($reprocessed_cart_data['subscription']['is_used']) {
|
219 |
$paypal_vars += array(
|
220 |
+
"a3" => $this->convert($reprocessed_cart_data['subscription']['price']),
|
221 |
"p3" => $reprocessed_cart_data['subscription']['length'],
|
222 |
"t3" => $reprocessed_cart_data['subscription']['unit'],
|
223 |
);
|
239 |
);
|
240 |
$handling = $this->cart_data['base_shipping'];
|
241 |
if($add_tax)
|
242 |
+
$paypal_vars['tax_cart'] = $this->convert( $this->cart_data['cart_tax'] );
|
243 |
|
244 |
// Set base shipping
|
245 |
$paypal_vars += array(
|
246 |
+
'handling_cart' => $this->convert( $handling )
|
247 |
);
|
248 |
|
249 |
// Stick the cart item values together here
|
253 |
foreach ($this->cart_items as $cart_row) {
|
254 |
$paypal_vars += array(
|
255 |
"item_name_$i" => $cart_row['name'],
|
256 |
+
"amount_$i" => $this->convert($cart_row['price']),
|
257 |
+
"tax_$i" => ($add_tax) ? $this->convert($cart_row['tax']) : 0,
|
258 |
"quantity_$i" => $cart_row['quantity'],
|
259 |
"item_number_$i" => $cart_row['product_id'],
|
260 |
// additional shipping for the the (first item / total of the items)
|
261 |
+
"shipping_$i" => $this->convert($cart_row['shipping']/ $cart_row['quantity'] ),
|
262 |
// additional shipping beyond the first item
|
263 |
+
"shipping2_$i" => $this->convert($cart_row['shipping']/ $cart_row['quantity'] ),
|
264 |
"handling_$i" => '',
|
265 |
);
|
266 |
++$i;
|
267 |
}
|
268 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
$paypal_vars['item_name_'.$i] = "Your Shopping Cart";
|
270 |
+
$paypal_vars['amount_'.$i] = $this->convert( $this->cart_data['total_price'] ) - $this->convert( $this->cart_data['base_shipping'] );
|
|
|
|
|
|
|
271 |
$paypal_vars['quantity_'.$i] = 1;
|
272 |
$paypal_vars['shipping_'.$i] = 0;
|
273 |
$paypal_vars['shipping2_'.$i] = 0;
|
302 |
|
303 |
$redirect = get_option('paypal_multiple_url')."?".$gateway_values;
|
304 |
}
|
305 |
+
|
306 |
if (defined('WPSC_ADD_DEBUG_PAGE') && WPSC_ADD_DEBUG_PAGE) {
|
307 |
echo "<a href='".esc_url($redirect)."'>Test the URL here</a>";
|
308 |
echo "<pre>".print_r($this->collected_gateway_data,true)."</pre>";
|
wpsc-theme/functions/wpsc-transaction_results_functions.php
CHANGED
@@ -53,6 +53,23 @@ function wpsc_transaction_theme() {
|
|
53 |
case 'dps':
|
54 |
$sessionid = decrypt_dps_response();
|
55 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
}
|
58 |
|
53 |
case 'dps':
|
54 |
$sessionid = decrypt_dps_response();
|
55 |
break;
|
56 |
+
//paystation was not updating the purchase logs for successful payment - this is ugly as need to have the databse update done in one place by all gatways on a sucsessful transaction hook not some within the gateway and some within here and some not at all??? This is getting a major overhaul but for here and now it just needs to work for the gold cart people!
|
57 |
+
case 'paystation':
|
58 |
+
$ec = $_GET['ec'];
|
59 |
+
$result= $_GET['em'];
|
60 |
+
|
61 |
+
if($result == 'Transaction successful' && $ec == 0)
|
62 |
+
$processed_id = '3';
|
63 |
+
|
64 |
+
if($result == 'Insufficient Funds' && $ec == 5){
|
65 |
+
$processed_id = '6';
|
66 |
+
|
67 |
+
$payment_instructions = printf( __( 'Sorry your transaction was not accepted due to insufficient funds <br /><a href="%1$s">Click here to go back to checkout page</a>.', 'wpsc' ), get_option( "shopping_cart_url" ) );
|
68 |
+
}
|
69 |
+
if($processed_id){
|
70 |
+
$wpdb->update( WPSC_TABLE_PURCHASE_LOGS, array('processed' => $processed_id),array('sessionid'=>$sessionid), array('%f') );
|
71 |
+
}
|
72 |
+
break;
|
73 |
}
|
74 |
}
|
75 |
|
wpsc-theme/functions/wpsc-user_log_functions.php
CHANGED
@@ -630,22 +630,27 @@ function wpsc_user_details() {
|
|
630 |
}
|
631 |
|
632 |
switch ($form_field['unique_name']){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
633 |
case 'shippingstate':
|
634 |
-
if(is_numeric($
|
635 |
-
|
636 |
else
|
637 |
$state = $form_field['value'];
|
638 |
|
639 |
echo " <tr><td>" . $form_field['name'] . ":</td><td>".$state ."</td></tr>";
|
640 |
break;
|
641 |
-
|
642 |
-
if(is_numeric($purchase['billing_region']))
|
643 |
-
$state = wpsc_get_region($purchase['billing_region']);
|
644 |
-
else
|
645 |
-
$state = $form_field['value'];
|
646 |
-
|
647 |
-
echo " <tr><td>" . $form_field['name'] . ":</td><td>".$state ."</td></tr>";
|
648 |
-
break;
|
649 |
default:
|
650 |
echo " <tr><td>" . $form_field['name'] . ":</td><td>" . esc_html( $form_field['value'] ) . "</td></tr>";
|
651 |
|
630 |
}
|
631 |
|
632 |
switch ($form_field['unique_name']){
|
633 |
+
case 'shippingcountry':
|
634 |
+
case 'billingcountry':
|
635 |
+
$country = unserialize($form_field['value']);
|
636 |
+
if(is_array($country))
|
637 |
+
$country = $country[0];
|
638 |
+
else
|
639 |
+
$country = $form_field['value'];
|
640 |
+
|
641 |
+
echo " <tr><td>" . $form_field['name'] . ":</td><td>".$country ."</td></tr>";
|
642 |
+
break;
|
643 |
+
|
644 |
+
case 'billingstate':
|
645 |
case 'shippingstate':
|
646 |
+
if(is_numeric($form_field['value']))
|
647 |
+
$state = wpsc_get_state_by_id($form_field['value'],'name');
|
648 |
else
|
649 |
$state = $form_field['value'];
|
650 |
|
651 |
echo " <tr><td>" . $form_field['name'] . ":</td><td>".$state ."</td></tr>";
|
652 |
break;
|
653 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
654 |
default:
|
655 |
echo " <tr><td>" . $form_field['name'] . ":</td><td>" . esc_html( $form_field['value'] ) . "</td></tr>";
|
656 |
|
wpsc-theme/wpsc-cart_widget.php
CHANGED
@@ -31,34 +31,15 @@
|
|
31 |
<?php endwhile; ?>
|
32 |
</tbody>
|
33 |
<tfoot>
|
34 |
-
<?php if( ( wpsc_cart_has_shipping() && !wpsc_cart_show_plus_postage() ) || ( (wpsc_cart_tax(false) >0) && !wpsc_cart_show_plus_postage() ) ) : ?>
|
35 |
-
<tr class="cart-widget-total cart-widget-shipping">
|
36 |
-
<td class="pricedisplay checkout-shipping" colspan='5'>
|
37 |
-
<?php if(wpsc_cart_has_shipping() && !wpsc_cart_show_plus_postage()) : ?>
|
38 |
-
<?php _e('Shipping', 'wpsc'); ?>: <?php echo wpsc_cart_shipping(); ?>
|
39 |
-
<?php endif; ?>
|
40 |
-
<?php if( (wpsc_cart_tax(false) >0) && !wpsc_cart_show_plus_postage()) : ?>
|
41 |
-
<br />
|
42 |
-
<span class="pricedisplay checkout-tax"><?php echo wpsc_display_tax_label(true); ?>: <?php echo wpsc_cart_tax(); ?></span>
|
43 |
-
<?php endif; ?>
|
44 |
-
</td>
|
45 |
-
</tr>
|
46 |
-
<?php endif; ?>
|
47 |
<tr class="cart-widget-total">
|
48 |
<td class="cart-widget-count">
|
49 |
<?php printf( _n('%d item', '%d items', wpsc_cart_item_count(), 'wpsc'), wpsc_cart_item_count() ); ?>
|
50 |
</td>
|
51 |
<td class="pricedisplay checkout-total" colspan='4'>
|
52 |
-
<?php _e('Total', 'wpsc'); ?>: <?php echo wpsc_cart_total_widget();
|
53 |
-
|
54 |
-
</tr>
|
55 |
-
<?php if(wpsc_cart_show_plus_postage()) : ?>
|
56 |
-
<tr>
|
57 |
-
<td class="pluspostagetax" colspan='5'>
|
58 |
-
+ <?php _e('Postage & Tax ', 'wpsc'); ?>
|
59 |
</td>
|
60 |
</tr>
|
61 |
-
<?php endif; ?>
|
62 |
<tr>
|
63 |
<td id='cart-widget-links' colspan="5">
|
64 |
<a target="_parent" href="<?php echo get_option('shopping_cart_url'); ?>" title="<?php _e('Checkout', 'wpsc'); ?>" class="gocheckout"><?php _e('Checkout', 'wpsc'); ?></a>
|
31 |
<?php endwhile; ?>
|
32 |
</tbody>
|
33 |
<tfoot>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
<tr class="cart-widget-total">
|
35 |
<td class="cart-widget-count">
|
36 |
<?php printf( _n('%d item', '%d items', wpsc_cart_item_count(), 'wpsc'), wpsc_cart_item_count() ); ?>
|
37 |
</td>
|
38 |
<td class="pricedisplay checkout-total" colspan='4'>
|
39 |
+
<?php _e('Total', 'wpsc'); ?>: <?php echo wpsc_cart_total_widget( false, false ,false ); ?><br />
|
40 |
+
<small><?php _e( 'excluding shipping and tax' ); ?></small>
|
|
|
|
|
|
|
|
|
|
|
41 |
</td>
|
42 |
</tr>
|
|
|
43 |
<tr>
|
44 |
<td id='cart-widget-links' colspan="5">
|
45 |
<a target="_parent" href="<?php echo get_option('shopping_cart_url'); ?>" title="<?php _e('Checkout', 'wpsc'); ?>" class="gocheckout"><?php _e('Checkout', 'wpsc'); ?></a>
|
wpsc-theme/wpsc-user-log.php
CHANGED
@@ -12,12 +12,14 @@
|
|
12 |
global $files, $separator, $purchase_log, $col_count, $products, $links; ?>
|
13 |
|
14 |
<div class="wrap">
|
15 |
-
|
16 |
-
<
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
|
22 |
<br />
|
23 |
<!-- START OF PROFILE PAGE -->
|
12 |
global $files, $separator, $purchase_log, $col_count, $products, $links; ?>
|
13 |
|
14 |
<div class="wrap">
|
15 |
+
<?php if ( is_user_logged_in() ) : ?>
|
16 |
+
<div class="user-profile-links">
|
17 |
+
<a href="<?php echo get_option( 'user_account_url' ); ?>"><?php _e('Purchase History','wpsc'); ?></a> |
|
18 |
+
<a href="<?php echo get_option( 'user_account_url' ) . $separator . "edit_profile=true"; ?>"><?php _e('Your Details','wpsc'); ?></a> |
|
19 |
+
<a href="<?php echo get_option( 'user_account_url' ) . $separator . "downloads=true"; ?>"><?php _e('Your Downloads','wpsc'); ?></a>
|
20 |
+
<?php do_action('wpsc_additional_user_profile_links', '|'); ?>
|
21 |
+
</div>
|
22 |
+
<?php endif; ?>
|
23 |
|
24 |
<br />
|
25 |
<!-- START OF PROFILE PAGE -->
|