Version Description
Download this release
Release Info
Developer | JustinSainton |
Plugin | WP eCommerce |
Version | 3.8beta3 |
Comparing to | |
See all releases |
Code changes from version 3.8beta2 to 3.8beta3
- .phptidy-config.php +5 -3
- extra_image_processing.php +5 -2
- homepage_products_functions.php +1 -1
- image_processing.php +3 -1
- image_resize.php +2 -1
- merchants/GoogleCheckout-XML.php +629 -623
- merchants/authorize.merchant.php +557 -411
- merchants/paypal-pro.merchant.php +451 -464
- merchants/testmode.merchant.php +55 -55
- shipping/flatrate.php +12 -5
- shipping/tablerate.php +66 -48
- shipping/weightrate.php +2 -2
- shopping_cart_functions.php +14 -8
- themes/default/checkout.php +1 -1
- themes/default/products_page.php +1 -1
- themes/default/shopping_cart_page.php +416 -412
- themes/default/single_product.php +1 -1
- themes/iShop/products_page.php +1 -1
- themes/iShop/shopping_cart_page.php +3 -1
- themes/iShop/single_product.php +1 -1
- themes/marketplace/products_page.php +1 -1
- themes/marketplace/single_product.php +1 -1
- themes/single-wpsc-product.php +5 -3
- transaction_result_functions.php +13 -7
- transaction_results.php +10 -8
- updates/database_template.php +2 -0
- widgets/category_widget.27.php +0 -205
- widgets/{category_widget.28.php → category_widget.php} +1 -1
- widgets/latest_product_widget.php +169 -109
- wp-shopping-cart.php +2 -6
- wpec-taxes/controllers/taxes_controller.class.php +3 -0
- wpsc-admin/admin.php +1 -1
- wpsc-admin/ajax-and-init.php +29 -12
- wpsc-admin/css/admin.css +1 -0
- wpsc-admin/display-items.page.php +4 -2
- wpsc-admin/display-options-settings.page.php +24 -0
- wpsc-admin/display-sales-logs.php +2 -2
- wpsc-admin/display-update.page.php +2 -0
- wpsc-admin/includes/product-functions.php +4 -2
- wpsc-admin/includes/products.php +2 -1
- wpsc-admin/includes/purchlogs_upgrade.php +1 -0
- wpsc-admin/includes/settings-pages/checkout.php +1 -1
- wpsc-admin/includes/settings-pages/gateway.php +40 -89
- wpsc-admin/includes/settings-pages/presentation.php +32 -0
- wpsc-admin/includes/updating-functions.php +17 -0
- wpsc-admin/js/admin.js +26 -0
- wpsc-includes/ajax.functions.php +7 -7
- wpsc-includes/cart.class.php +24 -12
- wpsc-includes/checkout.class.php +24 -11
- wpsc-includes/display.functions.php +5 -6
- wpsc-includes/install_and_update.functions.php +2 -0
- wpsc-includes/misc.functions.php +1 -1
- wpsc-includes/processing.functions.php +25 -0
- wpsc-includes/product-template.php +36 -8
- wpsc-includes/purchaselogs.class.php +8 -4
- wpsc-includes/theme.functions.php +4 -1
.phptidy-config.php
CHANGED
@@ -14,8 +14,10 @@
|
|
14 |
'wpsc-admin/includes/settings-pages/*.php');
|
15 |
|
16 |
$default_package = "WP e-Commerce";
|
17 |
-
$add_file_docblock =
|
18 |
-
$add_functions_docblock =
|
19 |
-
$add_doctags =
|
|
|
|
|
20 |
|
21 |
?>
|
14 |
'wpsc-admin/includes/settings-pages/*.php');
|
15 |
|
16 |
$default_package = "WP e-Commerce";
|
17 |
+
$add_file_docblock = TRUE;
|
18 |
+
$add_functions_docblock = TRUE;
|
19 |
+
$add_doctags = TRUE;
|
20 |
+
$fix_docblock_format = TRUE;
|
21 |
+
$fix_docblock_space = TRUE;
|
22 |
|
23 |
?>
|
extra_image_processing.php
CHANGED
@@ -44,14 +44,17 @@ if(is_numeric($height) && is_numeric($width) && function_exists('imagecreatefrom
|
|
44 |
}
|
45 |
ImageCopyResampled($dst_img,$src_img,0,0,0,0,$width,$height,$source_w,$source_h);
|
46 |
//exit($destdir);
|
|
|
|
|
|
|
47 |
switch($imagetype[2])
|
48 |
{
|
49 |
case IMAGETYPE_JPEG:
|
50 |
-
imagejpeg($dst_img, $destdir,
|
51 |
break;
|
52 |
|
53 |
case IMAGETYPE_GIF:
|
54 |
-
imagejpeg($dst_img, $destdir,
|
55 |
break;
|
56 |
|
57 |
case IMAGETYPE_PNG:
|
44 |
}
|
45 |
ImageCopyResampled($dst_img,$src_img,0,0,0,0,$width,$height,$source_w,$source_h);
|
46 |
//exit($destdir);
|
47 |
+
|
48 |
+
$image_quality = wpsc_image_quality();
|
49 |
+
|
50 |
switch($imagetype[2])
|
51 |
{
|
52 |
case IMAGETYPE_JPEG:
|
53 |
+
imagejpeg($dst_img, $destdir, $image_quality);
|
54 |
break;
|
55 |
|
56 |
case IMAGETYPE_GIF:
|
57 |
+
imagejpeg($dst_img, $destdir, $image_quality); //our server doesnt support saving gif, make it save gif images if you need gif images, otherwise, jpeg will do.
|
58 |
break;
|
59 |
|
60 |
case IMAGETYPE_PNG:
|
homepage_products_functions.php
CHANGED
@@ -123,7 +123,7 @@ function nszhpcrt_category_tag($content = '') {
|
|
123 |
$output .= "<tr>";
|
124 |
$output .= "<td class='imagecol'>";
|
125 |
}
|
126 |
-
$output .="<a href='".WPSC_IMAGE_URL.$product['image']."' class='
|
127 |
if($product['image'] != '') {
|
128 |
$output .= "<img class='product_image' src='".WPSC_THUMBNAIL_URL.$product['image']."' title='".$product['name']."' alt='".$product['name']."' />\n\r";
|
129 |
}
|
123 |
$output .= "<tr>";
|
124 |
$output .= "<td class='imagecol'>";
|
125 |
}
|
126 |
+
$output .="<a href='".WPSC_IMAGE_URL.$product['image']."' class='" . wpsc_the_product_image_link_classes() . " rel='".str_replace(" ", "_",$product['name'])."'>";
|
127 |
if($product['image'] != '') {
|
128 |
$output .= "<img class='product_image' src='".WPSC_THUMBNAIL_URL.$product['image']."' title='".$product['name']."' alt='".$product['name']."' />\n\r";
|
129 |
}
|
image_processing.php
CHANGED
@@ -104,9 +104,11 @@ global $wpdb;
|
|
104 |
ImageCopy( $dst_img, $temp_img, $w1, $h1, 0, 0, $temp_w, $temp_h );
|
105 |
//mail('thomas.howard@gmail.com','lolwut',"ImageCopy( $dst_img, $temp_img, $w1, $h1, 0, 0, $temp_w, $temp_h );");
|
106 |
|
|
|
|
|
107 |
switch($imagetype[2]) {
|
108 |
case IMAGETYPE_JPEG:
|
109 |
-
if(@ ImageJPEG($dst_img, $image_output,
|
110 |
break;
|
111 |
|
112 |
case IMAGETYPE_GIF:
|
104 |
ImageCopy( $dst_img, $temp_img, $w1, $h1, 0, 0, $temp_w, $temp_h );
|
105 |
//mail('thomas.howard@gmail.com','lolwut',"ImageCopy( $dst_img, $temp_img, $w1, $h1, 0, 0, $temp_w, $temp_h );");
|
106 |
|
107 |
+
$image_quality = wpsc_image_quality();
|
108 |
+
|
109 |
switch($imagetype[2]) {
|
110 |
case IMAGETYPE_JPEG:
|
111 |
+
if(@ ImageJPEG($dst_img, $image_output, $image_quality) == false) { return false; }
|
112 |
break;
|
113 |
|
114 |
case IMAGETYPE_GIF:
|
image_resize.php
CHANGED
@@ -70,11 +70,12 @@ if(file_exists($imagepath) && is_numeric($height) && is_numeric($width)) {
|
|
70 |
ImageAlphaBlending($dst_img, false);
|
71 |
}
|
72 |
|
|
|
73 |
|
74 |
//ImageCopyResampled($dst_img,$src_img,0,0,0,0,$width,$height,$source_w,$source_h);
|
75 |
switch($imagetype[2]) {
|
76 |
case IMAGETYPE_JPEG:
|
77 |
-
ImageJPEG($dst_img, $image_output,
|
78 |
break;
|
79 |
|
80 |
case IMAGETYPE_GIF:
|
70 |
ImageAlphaBlending($dst_img, false);
|
71 |
}
|
72 |
|
73 |
+
$image_quality = wpsc_image_quality();
|
74 |
|
75 |
//ImageCopyResampled($dst_img,$src_img,0,0,0,0,$width,$height,$source_w,$source_h);
|
76 |
switch($imagetype[2]) {
|
77 |
case IMAGETYPE_JPEG:
|
78 |
+
ImageJPEG($dst_img, $image_output, $image_quality);
|
79 |
break;
|
80 |
|
81 |
case IMAGETYPE_GIF:
|
merchants/GoogleCheckout-XML.php
CHANGED
@@ -1,624 +1,630 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once('library/googlecart.php');
|
4 |
-
require_once('library/googleitem.php');
|
5 |
-
require_once('library/googleshipping.php');
|
6 |
-
require_once('library/googletax.php');
|
7 |
-
require_once('library/googleresponse.php');
|
8 |
-
require_once('library/googlemerchantcalculations.php');
|
9 |
-
require_once('library/googleresult.php');
|
10 |
-
require_once('library/googlerequest.php');
|
11 |
-
|
12 |
-
|
13 |
-
$nzshpcrt_gateways[$num]['name'] = 'Google Checkout';
|
14 |
-
$nzshpcrt_gateways[$num]['internalname'] = 'google';
|
15 |
-
$nzshpcrt_gateways[$num]['function'] = 'gateway_google';
|
16 |
-
$nzshpcrt_gateways[$num]['form'] = "form_google";
|
17 |
-
$nzshpcrt_gateways[$num]['submit_function'] = "submit_google";
|
18 |
-
$nzshpcrt_gateways[$num]['is_exclusive'] = true;
|
19 |
-
$nzshpcrt_gateways[$num]['payment_type'] = "google_checkout";
|
20 |
-
|
21 |
-
function gateway_google($fromcheckout = false){
|
22 |
-
global $wpdb, $wpsc_cart, $wpsc_checkout,$current_user, $purchlogs;
|
23 |
-
//exit('<pre>'.print_r($fromcheckout, true).'</pre>');
|
24 |
-
if(!isset($wpsc_checkout)){
|
25 |
-
$wpsc_checkout = new wpsc_checkout();
|
26 |
-
}
|
27 |
-
if(!isset($_SESSION['wpsc_sessionid'])){
|
28 |
-
$sessionid = (mt_rand(100,999).time());
|
29 |
-
$_SESSION['wpsc_sessionid'] = $sessionid;
|
30 |
-
}
|
31 |
-
//exit('<pre>'.print_r($_SESSION,true).'</pre>');
|
32 |
-
if($_SESSION['wpsc_delivery_region'] == null && $_SESSION['wpsc_selected_region'] == null){
|
33 |
-
$_SESSION['wpsc_delivery_region'] = get_option('base_region');
|
34 |
-
$_SESSION['wpsc_selected_region'] = get_option('base_region');
|
35 |
-
}
|
36 |
-
|
37 |
-
$wpsc_cart->get_shipping_option();
|
38 |
-
$wpsc_cart->get_shipping_quotes();
|
39 |
-
$wpsc_cart->get_shipping_method();
|
40 |
-
$wpsc_cart->google_shipping_quotes();
|
41 |
-
$subtotal = $wpsc_cart->calculate_subtotal();
|
42 |
-
$base_shipping = $wpsc_cart->calculate_total_shipping();
|
43 |
-
$tax = $wpsc_cart->calculate_total_tax();
|
44 |
-
$total = $wpsc_cart->calculate_total_price();
|
45 |
-
// exit('<pre>'.print_r($wpsc_cart, true).'</pre>');
|
46 |
-
if($total > 0 ){
|
47 |
-
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `totalprice` = ".$total.", `statusno` = '0',`user_ID`=".(int)$user_ID.", `date`= UNIX_TIMESTAMP() , `gateway`='google', `billing_country`='".$wpsc_cart->delivery_country."', shipping_country='".$wpsc_cart->selected_country."', `base_shipping`= '".$base_shipping."', shipping_method = '".$wpsc_cart->selected_shipping_method."', shipping_option= '".$wpsc_cart->selected_shipping_option."', `plugin_version`= '".WPSC_VERSION."' , `discount_value` = '".$wpsc_cart->coupons_amount."', `discount_data`='".$wpsc_cart->coupons_name."' WHERE `sessionid`=".$_SESSION['wpsc_sessionid']."";
|
48 |
-
// exit($sql);
|
49 |
-
$update = $wpdb->query($sql);
|
50 |
-
$sql = "SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE sessionid=".$_SESSION['wpsc_sessionid'];
|
51 |
-
$purchase_log_id = $wpdb->get_var($sql);
|
52 |
-
$sql = "DELETE FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE purchaseid = ".$purchase_log_id;
|
53 |
-
$wpdb->query($sql);
|
54 |
-
$wpsc_cart->save_to_db($purchase_log_id);
|
55 |
-
if(! $update){
|
56 |
-
$sql = "INSERT INTO `".WPSC_TABLE_PURCHASE_LOGS."` (`totalprice`,`statusno`, `sessionid`, `user_ID`, `date`, `gateway`, `billing_country`,`shipping_country`, `base_shipping`,`shipping_method`, `shipping_option`, `plugin_version`, `discount_value`, `discount_data`) VALUES ('$total' ,'0', '".$_SESSION['wpsc_sessionid']."', '".(int)$user_ID."', UNIX_TIMESTAMP(), 'google', '{$wpsc_cart->delivery_country}', '{$wpsc_cart->selected_country}', '{$base_shipping}', '".$wpsc_cart->selected_shipping_method."', '".$wpsc_cart->selected_shipping_option."', '".WPSC_VERSION."', '{$wpsc_cart->coupons_amount}','{$wpsc_cart->coupons_name}')";
|
57 |
-
$wpdb->query($sql);
|
58 |
-
$sql = "SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE sessionid=".$_SESSION['wpsc_sessionid'];
|
59 |
-
$purchase_log_id = $wpdb->get_var($sql);
|
60 |
-
$wpsc_cart->save_to_db($purchase_log_id);
|
61 |
-
}
|
62 |
-
|
63 |
-
if(get_option('permalink_structure') != '') {
|
64 |
-
$seperator = "?";
|
65 |
-
} else {
|
66 |
-
$seperator = "&";
|
67 |
-
}
|
68 |
-
Usecase($seperator, $_SESSION['wpsc_sessionid'], $fromcheckout);
|
69 |
-
//exit();
|
70 |
-
|
71 |
-
}
|
72 |
-
|
73 |
-
|
74 |
-
}
|
75 |
-
|
76 |
-
function Usecase($seperator, $sessionid, $fromcheckout) {
|
77 |
-
global $wpdb, $wpsc_cart;
|
78 |
-
$purchase_log_sql = "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid`= ".$sessionid." LIMIT 1";
|
79 |
-
$purchase_log = $wpdb->get_results($purchase_log_sql,ARRAY_A) ;
|
80 |
-
|
81 |
-
$cart_sql = "SELECT * FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE `purchaseid`='".$purchase_log[0]['id']."'";
|
82 |
-
$wp_cart = $wpdb->get_results($cart_sql,ARRAY_A) ;
|
83 |
-
$merchant_id = get_option('google_id');
|
84 |
-
$merchant_key = get_option('google_key');
|
85 |
-
$server_type = get_option('google_server_type');
|
86 |
-
$currency = get_option('google_cur');
|
87 |
-
$cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
|
88 |
-
$transact_url = get_option('transact_url');
|
89 |
-
$returnURL = $transact_url.$seperator."sessionid=".$sessionid."&gateway=google";
|
90 |
-
$cart->SetContinueShoppingUrl($returnURL);
|
91 |
-
$cart->SetEditCartUrl(get_option('shopping_cart_url'));
|
92 |
-
$no=1;
|
93 |
-
//exit("<pre>".print_r($
|
94 |
-
|
95 |
-
//new item code
|
96 |
-
$no = 0;
|
97 |
-
// $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
|
98 |
-
// foreach($wpsc_cart->cart_items as $item){
|
99 |
-
//google prohibited items not implemented
|
100 |
-
$curr=new CURRENCYCONVERTER();
|
101 |
-
$currency_code = $wpdb->get_results("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
|
102 |
-
$local_currency_code = $currency_code[0]['code'];
|
103 |
-
|
104 |
-
$google_curr = get_option('google_cur');
|
105 |
-
while (wpsc_have_cart_items()) {
|
106 |
-
wpsc_the_cart_item();
|
107 |
-
if($google_curr != $local_currency_code) {
|
108 |
-
$google_currency_productprice = $curr->convert( wpsc_cart_item_price(false)/wpsc_cart_item_quantity(),$google_curr,$local_currency_code);
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
$
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
$google_currency_productprice = $wpsc_cart->coupons_amount;
|
129 |
-
}
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
$
|
146 |
-
|
147 |
-
|
148 |
-
$
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
$
|
158 |
-
|
159 |
-
$
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
$
|
179 |
-
$
|
180 |
-
//exit('<pre>'.print_r($
|
181 |
-
$
|
182 |
-
|
183 |
-
|
184 |
-
$
|
185 |
-
$
|
186 |
-
$
|
187 |
-
//exit('<pre>'.print_r($
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
$
|
198 |
-
|
199 |
-
$
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
$
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
//
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
if($_POST['
|
258 |
-
update_option('
|
259 |
-
}
|
260 |
-
if($_POST['
|
261 |
-
update_option('
|
262 |
-
}
|
263 |
-
if($_POST['
|
264 |
-
update_option('
|
265 |
-
}
|
266 |
-
if($_POST['
|
267 |
-
update_option('
|
268 |
-
}
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
$
|
284 |
-
} elseif(get_option('
|
285 |
-
$
|
286 |
-
}
|
287 |
-
|
288 |
-
if (get_option('
|
289 |
-
$
|
290 |
-
} elseif(get_option('
|
291 |
-
$
|
292 |
-
}
|
293 |
-
|
294 |
-
if (get_option('
|
295 |
-
$
|
296 |
-
}
|
297 |
-
$
|
298 |
-
}
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
<tr>
|
307 |
-
<td>Merchant
|
308 |
-
|
309 |
-
<
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
<td>
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
</tr>
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
$
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
$
|
412 |
-
$
|
413 |
-
$
|
414 |
-
$
|
415 |
-
$
|
416 |
-
$
|
417 |
-
$
|
418 |
-
$
|
419 |
-
$
|
420 |
-
$
|
421 |
-
$
|
422 |
-
$
|
423 |
-
$
|
424 |
-
$
|
425 |
-
$
|
426 |
-
$
|
427 |
-
$
|
428 |
-
$
|
429 |
-
$
|
430 |
-
$
|
431 |
-
$
|
432 |
-
$
|
433 |
-
$
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
$
|
449 |
-
$
|
450 |
-
$
|
451 |
-
$
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
$
|
457 |
-
$sql
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
$
|
463 |
-
$
|
464 |
-
$sql
|
465 |
-
$
|
466 |
-
$sql .= ", ('".$log_id."','".$
|
467 |
-
$
|
468 |
-
$sql .= ", ('".$log_id."','".$
|
469 |
-
$
|
470 |
-
$sql .= ", ('".$log_id."','".$
|
471 |
-
$
|
472 |
-
$sql .= ", ('".$log_id."','".$
|
473 |
-
$
|
474 |
-
$sql .= ", ('".$log_id."','".$
|
475 |
-
$
|
476 |
-
$sql .= ", ('".$log_id."','".$
|
477 |
-
$
|
478 |
-
$sql .= ", ('".$log_id."','".$
|
479 |
-
$
|
480 |
-
$sql .= ", ('".$log_id."','".$
|
481 |
-
$wpdb->
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
$
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
$
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
$google_status =
|
536 |
-
$
|
537 |
-
$
|
538 |
-
|
539 |
-
$
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
$
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
$
|
562 |
-
$
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
$
|
568 |
-
$
|
569 |
-
$
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
$
|
579 |
-
$
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
$
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
$
|
593 |
-
$google_status=$wpdb->
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
624 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once('library/googlecart.php');
|
4 |
+
require_once('library/googleitem.php');
|
5 |
+
require_once('library/googleshipping.php');
|
6 |
+
require_once('library/googletax.php');
|
7 |
+
require_once('library/googleresponse.php');
|
8 |
+
require_once('library/googlemerchantcalculations.php');
|
9 |
+
require_once('library/googleresult.php');
|
10 |
+
require_once('library/googlerequest.php');
|
11 |
+
|
12 |
+
|
13 |
+
$nzshpcrt_gateways[$num]['name'] = 'Google Checkout';
|
14 |
+
$nzshpcrt_gateways[$num]['internalname'] = 'google';
|
15 |
+
$nzshpcrt_gateways[$num]['function'] = 'gateway_google';
|
16 |
+
$nzshpcrt_gateways[$num]['form'] = "form_google";
|
17 |
+
$nzshpcrt_gateways[$num]['submit_function'] = "submit_google";
|
18 |
+
$nzshpcrt_gateways[$num]['is_exclusive'] = true;
|
19 |
+
$nzshpcrt_gateways[$num]['payment_type'] = "google_checkout";
|
20 |
+
|
21 |
+
function gateway_google($fromcheckout = false){
|
22 |
+
global $wpdb, $wpsc_cart, $wpsc_checkout,$current_user, $purchlogs;
|
23 |
+
//exit('<pre>'.print_r($fromcheckout, true).'</pre>');
|
24 |
+
if(!isset($wpsc_checkout)){
|
25 |
+
$wpsc_checkout = new wpsc_checkout();
|
26 |
+
}
|
27 |
+
if(!isset($_SESSION['wpsc_sessionid'])){
|
28 |
+
$sessionid = (mt_rand(100,999).time());
|
29 |
+
$_SESSION['wpsc_sessionid'] = $sessionid;
|
30 |
+
}
|
31 |
+
//exit('<pre>'.print_r($_SESSION,true).'</pre>');
|
32 |
+
if($_SESSION['wpsc_delivery_region'] == null && $_SESSION['wpsc_selected_region'] == null){
|
33 |
+
$_SESSION['wpsc_delivery_region'] = get_option('base_region');
|
34 |
+
$_SESSION['wpsc_selected_region'] = get_option('base_region');
|
35 |
+
}
|
36 |
+
|
37 |
+
$wpsc_cart->get_shipping_option();
|
38 |
+
$wpsc_cart->get_shipping_quotes();
|
39 |
+
$wpsc_cart->get_shipping_method();
|
40 |
+
$wpsc_cart->google_shipping_quotes();
|
41 |
+
$subtotal = $wpsc_cart->calculate_subtotal();
|
42 |
+
$base_shipping = $wpsc_cart->calculate_total_shipping();
|
43 |
+
$tax = $wpsc_cart->calculate_total_tax();
|
44 |
+
$total = $wpsc_cart->calculate_total_price();
|
45 |
+
// exit('<pre>'.print_r($wpsc_cart, true).'</pre>');
|
46 |
+
if($total > 0 ){
|
47 |
+
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `totalprice` = ".$total.", `statusno` = '0',`user_ID`=".(int)$user_ID.", `date`= UNIX_TIMESTAMP() , `gateway`='google', `billing_country`='".$wpsc_cart->delivery_country."', shipping_country='".$wpsc_cart->selected_country."', `base_shipping`= '".$base_shipping."', shipping_method = '".$wpsc_cart->selected_shipping_method."', shipping_option= '".$wpsc_cart->selected_shipping_option."', `plugin_version`= '".WPSC_VERSION."' , `discount_value` = '".$wpsc_cart->coupons_amount."', `discount_data`='".$wpsc_cart->coupons_name."' WHERE `sessionid`=".$_SESSION['wpsc_sessionid']."";
|
48 |
+
// exit($sql);
|
49 |
+
$update = $wpdb->query($sql);
|
50 |
+
$sql = "SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE sessionid=".$_SESSION['wpsc_sessionid'];
|
51 |
+
$purchase_log_id = $wpdb->get_var($sql);
|
52 |
+
$sql = "DELETE FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE purchaseid = ".$purchase_log_id;
|
53 |
+
$wpdb->query($sql);
|
54 |
+
$wpsc_cart->save_to_db($purchase_log_id);
|
55 |
+
if(! $update){
|
56 |
+
$sql = "INSERT INTO `".WPSC_TABLE_PURCHASE_LOGS."` (`totalprice`,`statusno`, `sessionid`, `user_ID`, `date`, `gateway`, `billing_country`,`shipping_country`, `base_shipping`,`shipping_method`, `shipping_option`, `plugin_version`, `discount_value`, `discount_data`) VALUES ('$total' ,'0', '".$_SESSION['wpsc_sessionid']."', '".(int)$user_ID."', UNIX_TIMESTAMP(), 'google', '{$wpsc_cart->delivery_country}', '{$wpsc_cart->selected_country}', '{$base_shipping}', '".$wpsc_cart->selected_shipping_method."', '".$wpsc_cart->selected_shipping_option."', '".WPSC_VERSION."', '{$wpsc_cart->coupons_amount}','{$wpsc_cart->coupons_name}')";
|
57 |
+
$wpdb->query($sql);
|
58 |
+
$sql = "SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE sessionid=".$_SESSION['wpsc_sessionid'];
|
59 |
+
$purchase_log_id = $wpdb->get_var($sql);
|
60 |
+
$wpsc_cart->save_to_db($purchase_log_id);
|
61 |
+
}
|
62 |
+
|
63 |
+
if(get_option('permalink_structure') != '') {
|
64 |
+
$seperator = "?";
|
65 |
+
} else {
|
66 |
+
$seperator = "&";
|
67 |
+
}
|
68 |
+
Usecase($seperator, $_SESSION['wpsc_sessionid'], $fromcheckout);
|
69 |
+
//exit();
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
function Usecase($seperator, $sessionid, $fromcheckout) {
|
77 |
+
global $wpdb, $wpsc_cart;
|
78 |
+
$purchase_log_sql = "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid`= ".$sessionid." LIMIT 1";
|
79 |
+
$purchase_log = $wpdb->get_results($purchase_log_sql,ARRAY_A) ;
|
80 |
+
|
81 |
+
$cart_sql = "SELECT * FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE `purchaseid`='".$purchase_log[0]['id']."'";
|
82 |
+
$wp_cart = $wpdb->get_results($cart_sql,ARRAY_A) ;
|
83 |
+
$merchant_id = get_option('google_id');
|
84 |
+
$merchant_key = get_option('google_key');
|
85 |
+
$server_type = get_option('google_server_type');
|
86 |
+
$currency = get_option('google_cur');
|
87 |
+
$cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
|
88 |
+
$transact_url = get_option('transact_url');
|
89 |
+
$returnURL = $transact_url.$seperator."sessionid=".$sessionid."&gateway=google";
|
90 |
+
$cart->SetContinueShoppingUrl($returnURL);
|
91 |
+
$cart->SetEditCartUrl(get_option('shopping_cart_url'));
|
92 |
+
$no=1;
|
93 |
+
//exit("<pre>".print_r($wpsc_cart,true)."</pre>");
|
94 |
+
|
95 |
+
//new item code
|
96 |
+
$no = 0;
|
97 |
+
// $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
|
98 |
+
// foreach($wpsc_cart->cart_items as $item){
|
99 |
+
//google prohibited items not implemented
|
100 |
+
$curr=new CURRENCYCONVERTER();
|
101 |
+
$currency_code = $wpdb->get_results("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
|
102 |
+
$local_currency_code = $currency_code[0]['code'];
|
103 |
+
// exit('<pre>'.print_r($_REQUEST,true).'</pre>');
|
104 |
+
$google_curr = get_option('google_cur');
|
105 |
+
while (wpsc_have_cart_items()) {
|
106 |
+
wpsc_the_cart_item();
|
107 |
+
if($google_curr != $local_currency_code) {
|
108 |
+
$google_currency_productprice = $curr->convert( wpsc_cart_item_price(false)/wpsc_cart_item_quantity(),$google_curr,$local_currency_code);
|
109 |
+
$google_currency_shipping = $curr->convert( $wpsc_cart->selected_shipping_amount,$google_curr,$local_currency_code);
|
110 |
+
|
111 |
+
|
112 |
+
} else {
|
113 |
+
$google_currency_productprice = wpsc_cart_item_price(false)/wpsc_cart_item_quantity();
|
114 |
+
$google_currency_shipping = $wpsc_cart->selected_shipping_amount;
|
115 |
+
}
|
116 |
+
|
117 |
+
// exit('<pre>'.print_r(wpsc_cart_item_name(),true).'</pre>');
|
118 |
+
$cartitem["$no"] = new GoogleItem(wpsc_cart_item_name(), // Item name
|
119 |
+
'', // Item description
|
120 |
+
wpsc_cart_item_quantity(), // Quantity
|
121 |
+
($google_currency_productprice)); // Unit price
|
122 |
+
$cart->AddItem($cartitem["$no"]);
|
123 |
+
$no++;
|
124 |
+
}
|
125 |
+
//If there are coupons applied add coupon as a product with negative price
|
126 |
+
if($wpsc_cart->coupons_amount > 0){
|
127 |
+
if($google_curr != $local_currency_code) {
|
128 |
+
$google_currency_productprice = $curr->convert( $wpsc_cart->coupons_amount,$google_curr,$local_currency_code);
|
129 |
+
} else {
|
130 |
+
$google_currency_productprice = $wpsc_cart->coupons_amount;
|
131 |
+
}
|
132 |
+
$cartitem[$no] = new GoogleItem('Discount', // Item name
|
133 |
+
'Discount Price', // Item description
|
134 |
+
1, // Quantity
|
135 |
+
('-'.$google_currency_productprice)); // Unit price
|
136 |
+
$cart->AddItem($cartitem[$no]);
|
137 |
+
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
// }
|
142 |
+
|
143 |
+
|
144 |
+
// Add shipping options
|
145 |
+
if(wpsc_uses_shipping() && $google_currency_shipping >0 ){
|
146 |
+
$Gfilter = new GoogleShippingFilters();
|
147 |
+
$google_checkout_shipping=get_option("google_shipping_country");
|
148 |
+
$googleshippingcountries = count($google_checkout_shipping);
|
149 |
+
//exit('<pre>'.print_r($googleshipping, true).'</pre>');
|
150 |
+
if($googleshippingcountries == 242){
|
151 |
+
$Gfilter->SetAllowedWorldArea(true);
|
152 |
+
|
153 |
+
}else{
|
154 |
+
if(is_array($google_checkout_shipping)){
|
155 |
+
$google_shipping_country_ids = implode(",",$google_checkout_shipping);
|
156 |
+
}
|
157 |
+
$google_shipping_country = $wpdb->get_col("SELECT `isocode` FROM ".WPSC_TABLE_CURRENCY_LIST." WHERE id IN (".$google_shipping_country_ids.")");
|
158 |
+
foreach($google_shipping_country as $isocode){
|
159 |
+
//exit($isocode);
|
160 |
+
$Gfilter->AddAllowedPostalArea($isocode);
|
161 |
+
if($isocode == 'US'){
|
162 |
+
$Gfilter->SetAllowedCountryArea('ALL');
|
163 |
+
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
$Gfilter->SetAllowUsPoBox(false);
|
169 |
+
$ship_1 = new GoogleFlatRateShipping('Flat Rate Shipping', $google_currency_shipping);
|
170 |
+
$ship_1->AddShippingRestrictions($Gfilter);
|
171 |
+
$cart->AddShipping($ship_1);
|
172 |
+
}
|
173 |
+
//wpsc_google_shipping_quotes();
|
174 |
+
|
175 |
+
// Add tax rules
|
176 |
+
//if ($_SESSION['wpsc_selected_country']=='US'){
|
177 |
+
//set default tax
|
178 |
+
//exit('<pre>'.print_r($_SESSION,true).'</pre>');
|
179 |
+
$sql = "SELECT `name`, `tax` FROM ".WPSC_TABLE_REGION_TAX." WHERE id='".$_SESSION['wpsc_selected_region']."'";
|
180 |
+
//exit('<pre>'.print_r($sql, true).'</pre>');
|
181 |
+
$state_name = $wpdb->get_row($sql, ARRAY_A);
|
182 |
+
//exit('<pre>'.print_r($state_name, true).'</pre>');
|
183 |
+
$defaultTax = $state_name['tax']/100;
|
184 |
+
$tax_rule = new GoogleDefaultTaxRule($defaultTax);
|
185 |
+
$sql = "SELECT `code` FROM ".WPSC_TABLE_REGION_TAX." WHERE `country_id`='136' AND `tax` = ".$state_name['tax'];
|
186 |
+
$states = $wpdb->get_col($sql);
|
187 |
+
//exit('<pre>'.print_r($states, true).'</pre>');
|
188 |
+
$tax_rule->SetStateAreas((array)$states);
|
189 |
+
$cart->AddDefaultTaxRules($tax_rule);
|
190 |
+
//get alternative tax rates
|
191 |
+
$sql = "SELECT DISTINCT `tax` FROM ".WPSC_TABLE_REGION_TAX." WHERE `tax` != 0 AND `tax` !=".$state_name['tax']." AND `country_id`='136' ORDER BY `tax`";
|
192 |
+
$othertax = $wpdb->get_col($sql);
|
193 |
+
$i = 1;
|
194 |
+
//exit('<pre>'.print_r($othertax, true).'</pre>');
|
195 |
+
foreach($othertax as $altTax){
|
196 |
+
$sql = "SELECT `code` FROM ".WPSC_TABLE_REGION_TAX." WHERE `country_id`='136' AND `tax`=".$altTax;
|
197 |
+
$alt = $wpdb->get_col($sql);
|
198 |
+
$altTax = $altTax/100;
|
199 |
+
$alt_google_tax = new GoogleDefaultTaxRule($altTax);
|
200 |
+
$alt_google_tax->SetStateAreas($alt);
|
201 |
+
//$g = new GoogleAlternateTaxTable('Alt Tax'.$i);
|
202 |
+
//$g->AddAlternateTaxRules($alt_google_tax);
|
203 |
+
$cart->AddDefaultTaxRules($alt_google_tax);
|
204 |
+
// exit(print_r($alt,true));
|
205 |
+
$i++;
|
206 |
+
}
|
207 |
+
|
208 |
+
//}
|
209 |
+
if (get_option('google_button_size') == '0'){
|
210 |
+
$google_button_size = 'BIG';
|
211 |
+
} elseif(get_option('google_button_size') == '1') {
|
212 |
+
$google_button_size = 'MEDIUM';
|
213 |
+
} elseif(get_option('google_button_size') == '2') {
|
214 |
+
$google_button_size = 'SMALL';
|
215 |
+
}
|
216 |
+
// Display Google Checkout button
|
217 |
+
//echo '<pre>'.print_r($cart, true).'</pre>';
|
218 |
+
//unset($_SESSION['wpsc_sessionid']);
|
219 |
+
//if($fromCheckout){
|
220 |
+
echo $cart->CheckoutButtonCode($google_button_size);
|
221 |
+
//}
|
222 |
+
}
|
223 |
+
|
224 |
+
function wpsc_google_checkout_page(){
|
225 |
+
global $wpsc_gateway;
|
226 |
+
$script = "<script type='text/javascript'>
|
227 |
+
jQuery(document).ready(
|
228 |
+
function()
|
229 |
+
{
|
230 |
+
jQuery('div#wpsc_shopping_cart_container h2').hide();
|
231 |
+
jQuery('div#wpsc_shopping_cart_container .wpsc_cart_shipping').hide();
|
232 |
+
jQuery('.wpsc_checkout_forms').hide();
|
233 |
+
});
|
234 |
+
</script>";
|
235 |
+
$options = get_option('payment_gateway');
|
236 |
+
// exit('HELLO<pre>'.print_r(get_option('custom_gateway_options'), true).'</pre>');
|
237 |
+
|
238 |
+
//foreach((array)get_option('custom_gateway_options') as $gateway){
|
239 |
+
if(in_array('google', (array)get_option('custom_gateway_options'))){
|
240 |
+
$options = 'google';
|
241 |
+
}
|
242 |
+
// }
|
243 |
+
if($options == 'google' && isset($_SESSION['gateway'])){
|
244 |
+
unset($_SESSION['gateway']);
|
245 |
+
echo $script;
|
246 |
+
gateway_google(true);
|
247 |
+
}
|
248 |
+
|
249 |
+
|
250 |
+
}
|
251 |
+
add_action('wpsc_before_form_of_shopping_cart', 'wpsc_google_checkout_page');
|
252 |
+
function submit_google() {
|
253 |
+
if($_POST['google_id'] != null) {
|
254 |
+
update_option('google_id', $_POST['google_id']);
|
255 |
+
}
|
256 |
+
|
257 |
+
if($_POST['google_key'] != null) {
|
258 |
+
update_option('google_key', $_POST['google_key']);
|
259 |
+
}
|
260 |
+
if($_POST['google_cur'] != null) {
|
261 |
+
update_option('google_cur', $_POST['google_cur']);
|
262 |
+
}
|
263 |
+
if($_POST['google_button_size'] != null) {
|
264 |
+
update_option('google_button_size', $_POST['google_button_size']);
|
265 |
+
}
|
266 |
+
if($_POST['google_button_bg'] != null) {
|
267 |
+
update_option('google_button_bg', $_POST['google_button_bg']);
|
268 |
+
}
|
269 |
+
if($_POST['google_server_type'] != null) {
|
270 |
+
update_option('google_server_type', $_POST['google_server_type']);
|
271 |
+
}
|
272 |
+
if($_POST['google_auto_charge'] != null) {
|
273 |
+
update_option('google_auto_charge', $_POST['google_auto_charge']);
|
274 |
+
}
|
275 |
+
return true;
|
276 |
+
}
|
277 |
+
|
278 |
+
function form_google()
|
279 |
+
{
|
280 |
+
if (get_option('google_button_size') == '0'){
|
281 |
+
$button_size1="checked='checked'";
|
282 |
+
} elseif(get_option('google_button_size') == '1') {
|
283 |
+
$button_size2="checked='checked'";
|
284 |
+
} elseif(get_option('google_button_size') == '2') {
|
285 |
+
$button_size3="checked='checked'";
|
286 |
+
}
|
287 |
+
|
288 |
+
if (get_option('google_server_type') == 'sandbox'){
|
289 |
+
$google_server_type1="checked='checked'";
|
290 |
+
} elseif(get_option('google_server_type') == 'production') {
|
291 |
+
$google_server_type2="checked='checked'";
|
292 |
+
}
|
293 |
+
|
294 |
+
if (get_option('google_auto_charge') == '1'){
|
295 |
+
$google_auto_charge1="checked='checked'";
|
296 |
+
} elseif(get_option('google_auto_charge') == '0') {
|
297 |
+
$google_auto_charge2="checked='checked'";
|
298 |
+
}
|
299 |
+
|
300 |
+
if (get_option('google_button_bg') == 'trans'){
|
301 |
+
$button_bg1="selected='selected'";
|
302 |
+
} else {
|
303 |
+
$button_bg2="selected='selected'";
|
304 |
+
}
|
305 |
+
$output = "
|
306 |
+
<tr>
|
307 |
+
<td>Merchant ID </td>
|
308 |
+
<td>
|
309 |
+
<input type='text' size='40' value='".get_option('google_id')."' name='google_id' />
|
310 |
+
</td>
|
311 |
+
</tr>
|
312 |
+
<tr>
|
313 |
+
<td>Merchant Key
|
314 |
+
</td>
|
315 |
+
<td>
|
316 |
+
<input type='text' size='40' value='".get_option('google_key')."' name='google_key' />
|
317 |
+
</td>
|
318 |
+
</tr>
|
319 |
+
<tr>
|
320 |
+
<td>
|
321 |
+
Turn on auto charging
|
322 |
+
</td>
|
323 |
+
<td>
|
324 |
+
<input $google_auto_charge1 type='radio' name='google_auto_charge' value='1' /> Yes
|
325 |
+
<input $google_auto_charge2 type='radio' name='google_auto_charge' value='0' /> No
|
326 |
+
</td>
|
327 |
+
</tr>
|
328 |
+
<tr>
|
329 |
+
<td>Server Type
|
330 |
+
</td>
|
331 |
+
<td>
|
332 |
+
<input $google_server_type1 type='radio' name='google_server_type' value='sandbox' /> Sandbox (For testing)
|
333 |
+
<input $google_server_type2 type='radio' name='google_server_type' value='production' /> Production
|
334 |
+
</td>
|
335 |
+
</tr>
|
336 |
+
<tr>
|
337 |
+
<td>
|
338 |
+
Select your currency
|
339 |
+
</td>
|
340 |
+
<td>
|
341 |
+
<select name='google_cur'>";
|
342 |
+
if (get_option('google_cur') == 'USD') {
|
343 |
+
$output.=
|
344 |
+
"<option selected='selected' value='USD'>USD</option>
|
345 |
+
<option value='GBP'>GBP</option>";
|
346 |
+
} else {
|
347 |
+
$output.=
|
348 |
+
"<option value='USD'>USD</option>
|
349 |
+
<option value='GBP' selected='selected'>GBP</option>";
|
350 |
+
}
|
351 |
+
$output.="</select>
|
352 |
+
</td>
|
353 |
+
</tr>
|
354 |
+
|
355 |
+
<tr>
|
356 |
+
<td>
|
357 |
+
Select Shipping Countries
|
358 |
+
</td>
|
359 |
+
<td>
|
360 |
+
<a href='".add_query_arg(array("googlecheckoutshipping" => 1, "page" =>
|
361 |
+
"wpsc-settings"))."' alt='Set Shipping Options'>Set Shipping countries</a> </td>
|
362 |
+
</tr>
|
363 |
+
|
364 |
+
<tr>
|
365 |
+
<td>Button Styles
|
366 |
+
</td>
|
367 |
+
<td><div>Size:
|
368 |
+
<input $button_size1 type='radio' name='google_button_size' value='0' /> 180×46
|
369 |
+
<input $button_size2 type='radio' name='google_button_size' value='1' /> 168×44
|
370 |
+
<input $button_size3 type='radio' name='google_button_size' value='2' /> 160×43
|
371 |
+
</div>
|
372 |
+
<div>
|
373 |
+
Background:
|
374 |
+
<select name='google_button_bg'>
|
375 |
+
<option $button_bg1 value='trans'>Transparent</option>
|
376 |
+
<option $button_bg2 value='white'>White</option>
|
377 |
+
</select>
|
378 |
+
</div>
|
379 |
+
</td>
|
380 |
+
</tr>
|
381 |
+
|
382 |
+
<tr>
|
383 |
+
<td colspan='2'>
|
384 |
+
Note: Please put this link to your Google API callback url field on your Google checkout account: <strong>".get_option('siteurl')."/index.php</strong>
|
385 |
+
</td>
|
386 |
+
</tr>";
|
387 |
+
return $output;
|
388 |
+
}
|
389 |
+
|
390 |
+
function nzsc_googleResponse() {
|
391 |
+
global $wpdb, $user_ID;
|
392 |
+
$merchant_id = get_option('google_id');
|
393 |
+
$merchant_key = get_option('google_key');
|
394 |
+
$server_type = get_option('google_server_type');
|
395 |
+
$currency = get_option('google_cur');
|
396 |
+
|
397 |
+
define('RESPONSE_HANDLER_ERROR_LOG_FILE', 'library/googleerror.log');
|
398 |
+
define('RESPONSE_HANDLER_LOG_FILE', 'library/googlemessage.log');
|
399 |
+
if (stristr($_SERVER['HTTP_USER_AGENT'],"Google Checkout Notification Agent")) {
|
400 |
+
$Gresponse = new GoogleResponse($merchant_id, $merchant_key);
|
401 |
+
$xml_response = isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:file_get_contents("php://input");
|
402 |
+
if (get_magic_quotes_gpc()) {
|
403 |
+
$xml_response = stripslashes($xml_response);
|
404 |
+
}
|
405 |
+
list($root, $data) = $Gresponse->GetParsedXML($xml_response);
|
406 |
+
|
407 |
+
$message = "<pre>".print_r($user_marketing_preference,1)."</pre>";
|
408 |
+
|
409 |
+
$sessionid = (mt_rand(100,999).time());
|
410 |
+
if ($root == "new-order-notification") {
|
411 |
+
$_SESSION['nzshpcrt_cart'] = '';
|
412 |
+
$cart_items = $data['new-order-notification']['shopping-cart']['items'];
|
413 |
+
$user_marketing_preference=$data['new-order-notification']['buyer-marketing-preferences']['email-allowed']['VALUE'];
|
414 |
+
$shipping_name = $data['new-order-notification']['buyer-shipping-address']['contact-name']['VALUE'];
|
415 |
+
$shipping_name = explode(" ",$shipping_name);
|
416 |
+
$shipping_firstname = $shipping_name[0];
|
417 |
+
$shipping_lastname = $shipping_name[count($shipping_name)-1];
|
418 |
+
$shipping_country = $data['new-order-notification']['buyer-shipping-address']['country-code']['VALUE'];
|
419 |
+
$shipping_address1 = $data['new-order-notification']['buyer-shipping-address']['address1']['VALUE'];
|
420 |
+
$shipping_address2 = $data['new-order-notification']['buyer-shipping-address']['address2']['VALUE'];
|
421 |
+
$shipping_city = $data['new-order-notification']['buyer-shipping-address']['city']['VALUE'];
|
422 |
+
$shipping_region = $data['new-order-notification']['buyer-shipping-address']['region']['VALUE'];
|
423 |
+
$billing_name = $data['new-order-notification']['buyer-billing-address']['contact-name']['VALUE'];
|
424 |
+
$billing_name = explode(" ",$shipping_name);
|
425 |
+
$billing_firstname = $shipping_name[0];
|
426 |
+
$billing_lastname = $shipping_name[count($shipping_name)-1];
|
427 |
+
$billing_region = $data['new-order-notification']['buyer-billing-address']['region']['VALUE'];
|
428 |
+
$billing_country = $data['new-order-notification']['buyer-billing-address']['country-code']['VALUE'];
|
429 |
+
$total_price = $data['new-order-notification']['order-total']['VALUE'];
|
430 |
+
$billing_email = $data['new-order-notification']['buyer-billing-address']['email']['VALUE'];
|
431 |
+
$billing_phone = $data['new-order-notification']['buyer-billing-address']['phone']['VALUE'];
|
432 |
+
$billing_address = $data['new-order-notification']['buyer-billing-address']['address1']['VALUE'];
|
433 |
+
$billing_address .= " ".$data['new-order-notification']['buyer-billing-address']['address2']['VALUE'];
|
434 |
+
$billing_address .= " ". $data['new-order-notification']['buyer-billing-address']['city']['VALUE'];
|
435 |
+
$billing_city = $data['new-order-notification']['buyer-billing-address']['city']['VALUE'];
|
436 |
+
$google_order_number = $data['new-order-notification']['google-order-number']['VALUE'];
|
437 |
+
$pnp = $data['new-order-notification']['order-adjustment']['shipping']['flat-rate-shipping-adjustment']['shipping-cost']['VALUE'];
|
438 |
+
$affiliate_id=$data['new-order-notification']['shopping-cart']['merchant-private-data'];
|
439 |
+
$affiliate_id=explode('=',$affiliate_id);
|
440 |
+
if ($affiliate_id[0]=='affiliate_id') {
|
441 |
+
if ($affiliate_id[1] == '') {
|
442 |
+
$affiliate_id = null;
|
443 |
+
} else {
|
444 |
+
$affiliate_id = $affiliate_id[1];
|
445 |
+
}
|
446 |
+
}
|
447 |
+
//$tax = $data['new-order-notification']['order-adjustment'][];
|
448 |
+
$Grequest = new GoogleRequest($merchant_id, $merchant_key, $server_type,$currency);
|
449 |
+
$result = $Grequest->SendProcessOrder($google_order_number);
|
450 |
+
$region_number = $wpdb->get_var("SELECT id FROM ".WPSC_TABLE_REGION_TAX."` WHERE code ='".$billing_region."'");
|
451 |
+
$sql = "INSERT INTO `".WPSC_TABLE_PURCHASE_LOGS."` ( `totalprice` , `sessionid` , `date`, `billing_country`, `shipping_country`,`base_shipping`,`shipping_region`, `user_ID`, `discount_value`,`gateway`, `google_order_number`, `google_user_marketing_preference`, `affiliate_id`) VALUES ( '".$total_price."', '".$sessionid."', '".time()."', '".$billing_country."', '".$shipping_country."', '".$pnp."','".$region_number."' , '".$user_ID."' , '".$_SESSION['wpsc_discount']."','".get_option('payment_gateway')."','".$google_order_number."','".$user_marketing_preference."', '".$affiliate_id."')";
|
452 |
+
// mail('hanzhimeng@gmail.com',"",$sql);
|
453 |
+
|
454 |
+
$wpdb->query($sql) ;
|
455 |
+
$log_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid` IN('".$sessionid."') LIMIT 1") ;
|
456 |
+
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET firstname='".$shipping_firstname."', lastname='".$shipping_lastname."', email='".$billing_email."', phone='".$billing_phone."' WHERE id='".$log_id."'";
|
457 |
+
$wpdb->query($sql) ;
|
458 |
+
if (array_key_exists(0,$cart_items['item'])) {
|
459 |
+
$cart_items = $cart_items['item'];
|
460 |
+
}
|
461 |
+
//logging to submited_form_data
|
462 |
+
$billing_fname_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='first_name' LIMIT 1") ;
|
463 |
+
$sql = "INSERT INTO `".WPSC_TABLE_SUBMITED_FORM_DATA."` (log_id, form_id, value) VALUES ('".$log_id."','".$billing_fname_id."','".$billing_firstname."')";
|
464 |
+
//$wpdb->query($sql) ;
|
465 |
+
$billing_lname_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='last_name' LIMIT 1") ;
|
466 |
+
$sql .= ", ('".$log_id."','".$billing_lname_id."','".$billing_lastname."')";
|
467 |
+
$billing_address_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='address' LIMIT 1") ;
|
468 |
+
$sql .= ", ('".$log_id."','".$billing_address_id."','".$billing_address."')";
|
469 |
+
$billing_city_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='city' LIMIT 1") ;
|
470 |
+
$sql .= ", ('".$log_id."','".$billing_city_id."','".$billing_city."')";
|
471 |
+
$billing_country_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='country' LIMIT 1") ;
|
472 |
+
$sql .= ", ('".$log_id."','".$billing_country_id."','".$billing_country."')";
|
473 |
+
$billing_state_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='state' LIMIT 1") ;
|
474 |
+
$sql .= ", ('".$log_id."','".$billing_state_id."','".$billing_region."')";
|
475 |
+
$shipping_fname_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='delivery_first_name' LIMIT 1") ;
|
476 |
+
$sql .= ", ('".$log_id."','".$shipping_fname_id."','".$shipping_firstname."')";
|
477 |
+
$shipping_lname_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='delivery_last_name' LIMIT 1") ;
|
478 |
+
$sql .= ", ('".$log_id."','".$shipping_lname_id."','".$shipping_lastname."')";
|
479 |
+
$shipping_address_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='delivery_address' LIMIT 1") ;
|
480 |
+
$sql .= ", ('".$log_id."','".$shipping_address_id."','".$shipping_address1." ".$shipping_address2."')";
|
481 |
+
$shipping_city_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='delivery_city' LIMIT 1") ;
|
482 |
+
$sql .= ", ('".$log_id."','".$shipping_city_id."','".$shipping_city."')";
|
483 |
+
$shipping_state_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='delivery_state' LIMIT 1") ;
|
484 |
+
$sql .= ", ('".$log_id."','".$shipping_state_id."','".$shipping_region."')";
|
485 |
+
$shipping_country_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type`='delivery_country' LIMIT 1") ;
|
486 |
+
$sql .= ", ('".$log_id."','".$shipping_country_id."','".$shipping_country."')";
|
487 |
+
$wpdb->query($sql) ;
|
488 |
+
//$variations = $cart_item->product_variations;
|
489 |
+
foreach($cart_items as $cart_item) {
|
490 |
+
$product_id = $cart_item['merchant-item-id']['VALUE'];
|
491 |
+
$item_name = $cart_item['item-name']['VALUE'];
|
492 |
+
$item_desc = $cart_item['item-description']['VALUE'];
|
493 |
+
$item_unit_price = $cart_item['unit-price']['VALUE'];
|
494 |
+
$item_quantity = $cart_item['quantity']['VALUE'];
|
495 |
+
$product_info = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE id='".$product_id."' LIMIT 1", ARRAY_A) ;
|
496 |
+
$product_info = $product_info[0];
|
497 |
+
//mail("hanzhimeng@gmail.com","",print_r($product_info,1));
|
498 |
+
if($product_info['notax'] != 1) {
|
499 |
+
//$price = nzshpcrt_calculate_tax($item_unit_price, $billing_country, $region_number);
|
500 |
+
if(get_option('base_country') == $billing_country) {
|
501 |
+
$country_data = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `isocode` IN('".get_option('base_country')."') LIMIT 1",ARRAY_A);
|
502 |
+
if(($country_data['has_regions'] == 1)) {
|
503 |
+
if(get_option('base_region') == $region_number) {
|
504 |
+
$region_data = $wpdb->get_row("SELECT `".WPSC_TABLE_REGION_TAX."`.* FROM `".WPSC_TABLE_REGION_TAX."` WHERE `".WPSC_TABLE_REGION_TAX."`.`country_id` IN('".$country_data['id']."') AND `".WPSC_TABLE_REGION_TAX."`.`id` IN('".get_option('base_region')."') ",ARRAY_A) ;
|
505 |
+
}
|
506 |
+
$gst = $region_data['tax'];
|
507 |
+
} else {
|
508 |
+
$gst = $country_data['tax'];
|
509 |
+
}
|
510 |
+
} else {
|
511 |
+
$gst = 0;
|
512 |
+
}
|
513 |
+
} else {
|
514 |
+
$gst = 0;
|
515 |
+
}
|
516 |
+
|
517 |
+
if ($product_info['no_shipping'] == '0') {
|
518 |
+
if ($shipping_country == get_option('base_country')) {
|
519 |
+
$pnp = $product_info['pnp'];
|
520 |
+
} else {
|
521 |
+
$pnp = $product_info['international_pnp'];
|
522 |
+
}
|
523 |
+
} else {
|
524 |
+
$pnp=0;
|
525 |
+
}
|
526 |
+
|
527 |
+
$cartsql = "INSERT INTO `".WPSC_TABLE_CART_CONTENTS."` ( `prodid` , `purchaseid`, `price`, `pnp`, `gst`, `quantity`, `donation`, `no_shipping` ) VALUES ('".$product_id."', '".$log_id."','".$item_unit_price."','".$pnp."', '".$gst."','".$item_quantity."', '".$product_info['donation']."', '".$product_info['no_shipping']."')";
|
528 |
+
|
529 |
+
$wpdb->query($cartsql) ;
|
530 |
+
}
|
531 |
+
}
|
532 |
+
|
533 |
+
if ($root == "order-state-change-notification") {
|
534 |
+
$google_order_number = $data['order-state-change-notification']['google-order-number']['VALUE'];
|
535 |
+
$google_status=$wpdb->get_var("SELECT google_status FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE google_order_number='".$google_order_number."'");
|
536 |
+
$google_status = unserialize($google_status);
|
537 |
+
if (($google_status[0]!='Partially Charged') && ($google_status[0]!='Partially Refunded')) {
|
538 |
+
$google_status[0]=$data['order-state-change-notification']['new-financial-order-state']['VALUE'];
|
539 |
+
$google_status[1]=$data['order-state-change-notification']['new-fulfillment-order-state']['VALUE'];
|
540 |
+
}
|
541 |
+
$google_status = serialize($google_status);
|
542 |
+
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET google_status='".$google_status."' WHERE google_order_number='".$google_order_number."'";
|
543 |
+
$wpdb->query($sql) ;
|
544 |
+
if (($data['order-state-change-notification']['new-financial-order-state']['VALUE'] == 'CHARGEABLE') && (get_option('google_auto_charge') == '1')) {
|
545 |
+
$Grequest = new GoogleRequest($merchant_id, $merchant_key, $server_type,$currency);
|
546 |
+
$result = $Grequest->SendChargeOrder($google_order_number);
|
547 |
+
|
548 |
+
$_SESSION['nzshpcrt_cart'] = '';
|
549 |
+
unset($_SESSION['coupon_num'], $_SESSION['google_session']);
|
550 |
+
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET processed='2' WHERE google_order_number='".$google_order_number."'";
|
551 |
+
$wpdb->query($sql) ;
|
552 |
+
}
|
553 |
+
}
|
554 |
+
|
555 |
+
if ($root == "charge-amount-notification") {
|
556 |
+
$google_order_number = $data['charge-amount-notification']['google-order-number']['VALUE'];
|
557 |
+
$google_status=$wpdb->get_var("SELECT google_status FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE google_order_number='".$google_order_number."'");
|
558 |
+
$google_status = unserialize($google_status);
|
559 |
+
$total_charged = $data['charge-amount-notification']['total-charge-amount']['VALUE'];
|
560 |
+
$google_status['partial_charge_amount'] = $total_charged;
|
561 |
+
$totalprice=$wpdb->get_var("SELECT totalprice FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE google_order_number='".$google_order_number."'");
|
562 |
+
if ($totalprice>$total_charged) {
|
563 |
+
$google_status[0] = 'Partially Charged';
|
564 |
+
} else if ($totalprice=$total_charged) {
|
565 |
+
$google_status[0] = 'CHARGED';
|
566 |
+
}
|
567 |
+
$google_status = serialize($google_status);
|
568 |
+
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET google_status='".$google_status."' WHERE google_order_number='".$google_order_number."'";
|
569 |
+
$wpdb->query($sql) ;
|
570 |
+
}
|
571 |
+
|
572 |
+
if ($root == "refund-amount-notification") {
|
573 |
+
$google_order_number = $data['refund-amount-notification']['google-order-number']['VALUE'];
|
574 |
+
$google_status=$wpdb->get_var("SELECT google_status FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE google_order_number='".$google_order_number."'");
|
575 |
+
$google_status = unserialize($google_status);
|
576 |
+
$total_charged = $data['refund-amount-notification']['total-refund-amount']['VALUE'];
|
577 |
+
$google_status['partial_refund_amount'] = $total_charged;
|
578 |
+
$totalprice=$wpdb->get_var("SELECT totalprice FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE google_order_number='".$google_order_number."'");
|
579 |
+
if ($totalprice>$total_charged) {
|
580 |
+
$google_status[0] = 'Partially refunded';
|
581 |
+
} else if ($totalprice=$total_charged) {
|
582 |
+
$google_status[0] = 'REFUNDED';
|
583 |
+
}
|
584 |
+
$google_status = serialize($google_status);
|
585 |
+
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET google_status='".$google_status."' WHERE google_order_number='".$google_order_number."'";
|
586 |
+
$wpdb->query($sql) ;
|
587 |
+
}
|
588 |
+
// <avs-response>Y</avs-response>
|
589 |
+
// <cvn-response>M</cvn-response>
|
590 |
+
|
591 |
+
if ($root == "risk-information-notification") {
|
592 |
+
$google_order_number = $data['risk-information-notification']['google-order-number']['VALUE'];
|
593 |
+
$google_status=$wpdb->get_var("SELECT google_status FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE google_order_number='".$google_order_number."'");
|
594 |
+
$google_status = unserialize($google_status);
|
595 |
+
$google_status['cvn']=$data['risk-information-notification']['risk-information']['cvn-response']['VALUE'];
|
596 |
+
$google_status['avs']=$data['risk-information-notification']['risk-information']['avs-response']['VALUE'];
|
597 |
+
$google_status['protection']=$data['risk-information-notification']['risk-information']['eligible-for-protection']['VALUE'];
|
598 |
+
$google_status = serialize($google_status);
|
599 |
+
$google_status=$wpdb->query("UPDATE ".WPSC_TABLE_PURCHASE_LOGS." SET google_status='".$google_status."' WHERE google_order_number='".$google_order_number."'");
|
600 |
+
if ($data['risk-information-notification']['risk-information']['cvn-response']['VALUE'] == 'E') {
|
601 |
+
$google_risk='cvn';
|
602 |
+
}
|
603 |
+
if (in_array($data['risk-information-notification']['risk-information']['avs-response']['VALUE'],array('N','U'))) {
|
604 |
+
if (isset($google_risk)) {
|
605 |
+
$google_risk = 'cvn+avs';
|
606 |
+
} else {
|
607 |
+
$google_risk='avs';
|
608 |
+
}
|
609 |
+
}
|
610 |
+
if (isset($google_risk)) {
|
611 |
+
$sql = "UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET google_risk='".$google_risk."' WHERE google_order_number='".$google_order_number."'";
|
612 |
+
$wpdb->query($sql);
|
613 |
+
}
|
614 |
+
}
|
615 |
+
|
616 |
+
if ($root == "order-state-change-notification") {
|
617 |
+
$google_order_number = $data['order-state-change-notification']['google-order-number']['VALUE'];
|
618 |
+
if ($data['order-state-change-notification']['new-financial-order-state']['VALUE'] == "CANCELLED_BY_GOOGLE") {
|
619 |
+
$google_status = $wpdb->get_var("SELECT google_status FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE google_order_number='".$google_order_number."'");
|
620 |
+
$google_status = unserialize($google_status);
|
621 |
+
$google_status[0] = "CANCELLED_BY_GOOGLE";
|
622 |
+
$wpdb->get_var("UPDATE ".WPSC_TABLE_PURCHASE_LOGS." SET google_status='".serialize($google_status)."' WHERE google_order_number='".$google_order_number."'");
|
623 |
+
}
|
624 |
+
}
|
625 |
+
// mail('hanzhimeng@gmail.com',"",$root . " <pre>". print_r($data,1)."</pre>");
|
626 |
+
exit();
|
627 |
+
}
|
628 |
+
}
|
629 |
+
add_action('init', 'nzsc_googleResponse');
|
630 |
?>
|
merchants/authorize.merchant.php
CHANGED
@@ -1,448 +1,594 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
* @since 3.7.6
|
9 |
-
* @subpackage wpsc-merchants
|
10 |
-
*/
|
11 |
-
$nzshpcrt_gateways[$num] = array(
|
12 |
-
'name' => 'Authorize.net 2.0',
|
13 |
-
'api_version' => 2.0,
|
14 |
-
'class_name' => 'wpsc_merchant_authorize',
|
15 |
-
'has_recurring_billing' => true,
|
16 |
-
'wp_admin_cannot_cancel' => false,
|
17 |
-
'requirements' => array(
|
18 |
-
/// so that you can restrict merchant modules to PHP 5, if you use PHP 5 features
|
19 |
-
'php_version' => 5.0,
|
20 |
-
/// for modules that may not be present, like curl
|
21 |
-
'extra_modules' => array('soap')
|
22 |
-
),
|
23 |
-
|
24 |
-
// this may be legacy, not yet decided
|
25 |
-
'internalname' => 'wpsc_merchant_authorize',
|
26 |
-
|
27 |
-
// All array members below here are legacy, and use the code in paypal_multiple.php
|
28 |
-
'form' => "form_authorize",
|
29 |
-
'submit_function' => "submit_authorize",
|
30 |
-
'payment_type' => "credit_card",
|
31 |
-
'supported_currencies' => array(
|
32 |
-
'currency_list' => array('USD')
|
33 |
-
//,'option_name' => 'paypal_curcode'
|
34 |
-
)
|
35 |
-
);
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
|
|
|
|
39 |
$gateway_checkout_form_fields[$nzshpcrt_gateways[$num]['internalname']] = "
|
40 |
-
<tr>
|
41 |
<td>Credit Card Number *</td>
|
42 |
<td>
|
43 |
<input type='text' value='' name='card_number' />
|
|
|
44 |
</td>
|
45 |
</tr>
|
46 |
-
<tr>
|
47 |
<td>Credit Card Expiry *</td>
|
48 |
<td>
|
49 |
<input type='text' size='2' value='' maxlength='2' name='expiry[month]' />/<input type='text' size='2' maxlength='2' value='' name='expiry[year]' />
|
|
|
50 |
</td>
|
51 |
</tr>
|
52 |
-
<tr>
|
53 |
<td>CVV </td>
|
54 |
-
<td><input type='text' size='4' value='' maxlength='4' name='card_code'
|
|
|
|
|
|
|
55 |
</tr>
|
56 |
";
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
-
/**
|
61 |
-
* WP eCommerce Authorize.net Standard Merchant Class
|
62 |
-
*
|
63 |
-
* This is the Authorize.net merchant class, it extends the base merchant class
|
64 |
-
*
|
65 |
-
* @package wp-e-commerce
|
66 |
-
* @since 3.7.6
|
67 |
-
* @subpackage wpsc-merchants
|
68 |
-
*/
|
69 |
-
class wpsc_merchant_authorize extends wpsc_merchant {
|
70 |
-
var $name = 'Authorize.net';
|
71 |
-
|
72 |
-
var $aim_response_keys = array(
|
73 |
-
'1' => 'response_code',
|
74 |
-
'2' => 'response_sub_code',
|
75 |
-
'3' => 'response_reason_code',
|
76 |
-
'4' => 'response_description',
|
77 |
-
'5' => 'authorization_code',
|
78 |
-
'6'=> 'avs_response',
|
79 |
-
'7' => 'transaction_id',
|
80 |
-
'8' => 'invoice_number',
|
81 |
-
'9' => 'description',
|
82 |
-
'10' => 'amount',
|
83 |
-
'11' => 'method',
|
84 |
-
'12' => 'transaction_type',
|
85 |
-
'13' => 'customer_id',
|
86 |
-
'37' => 'purchase_order_number',
|
87 |
-
'39' => 'card_code_response'
|
88 |
-
);
|
89 |
-
/*
|
90 |
-
var $credit_card_details = array(
|
91 |
-
'card_number' => '4111111111111111',
|
92 |
-
'expiry_date' => array('year' => '10', 'month' => '08'),
|
93 |
-
'card_code' => '123'
|
94 |
-
);
|
95 |
-
*/
|
96 |
-
var $credit_card_details = array(
|
97 |
-
'card_number' => null,
|
98 |
-
'expiry_date' => null,
|
99 |
-
'card_code' => null
|
100 |
-
);
|
101 |
-
|
102 |
-
|
103 |
-
var $arb_requests = array();
|
104 |
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
* construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
|
109 |
-
* @access public
|
110 |
-
*/
|
111 |
-
function construct_value_array() {
|
112 |
-
$this->credit_card_details = array(
|
113 |
-
'card_number' => $_POST['card_number'],
|
114 |
-
'expiry_date' => array('year' => $_POST['expiry']['year'], 'month' => $_POST['expiry']['month']),
|
115 |
-
'card_code' => $_POST['card_code']
|
116 |
-
);
|
117 |
-
|
118 |
-
$gateway_parameters = array();
|
119 |
-
|
120 |
-
|
121 |
-
$gateway_parameters += array(
|
122 |
-
/// Basic Authorize Settings
|
123 |
-
'x_version' => 3.1,
|
124 |
-
// 'x_test_request' => (int)(bool)get_option('authorize_testmode'),
|
125 |
-
'x_type' => 'AUTH_CAPTURE',
|
126 |
-
'x_method' => 'CC',
|
127 |
-
'x_recurring_billing' => (int)$this->cart_data['is_subscription'],
|
128 |
-
'x_duplicate_window' => '10', // Minimum time between duplicate transactions
|
129 |
-
'x_delim_data' => 1,
|
130 |
-
//'x_silent_post' => 'https://sandbox.boiling-pukeko.geek.nz',
|
131 |
-
|
132 |
-
/// Authorize access credentials
|
133 |
-
'x_login' => get_option('authorize_login'),
|
134 |
-
'x_tran_key' => get_option("authorize_password"),
|
135 |
-
|
136 |
-
/// Credit cart details start here
|
137 |
-
'x_card_num' => $this->credit_card_details['card_number'],
|
138 |
-
'x_exp_date' => $this->credit_card_details['expiry_date']['month']."-".$this->credit_card_details['expiry_date']['year'],
|
139 |
-
'x_card_code' => $this->credit_card_details['card_code'],
|
140 |
-
|
141 |
-
|
142 |
-
/// Transaction Details
|
143 |
-
'x_amount' => number_format($this->cart_data['total_price'],2,'.',''),
|
144 |
-
'x_trans_id' => $this->cart_data['session_id'],
|
145 |
-
'x_invoice_num' => $this->cart_data['session_id'],
|
146 |
-
//'x_description' => '',
|
147 |
-
|
148 |
-
/// Items in the cart go here, is currently unimplemented
|
149 |
-
//'x_line_item' => '',
|
150 |
-
|
151 |
-
/// Customer details start here
|
152 |
-
'x_email' => $this->cart_data['email_address'],
|
153 |
-
//'x_phone' => '',
|
154 |
-
//'x_cust_id' => '',
|
155 |
-
'x_customer_ip' => $_SERVER['REMOTE_ADDR'],
|
156 |
-
|
157 |
-
/// Customer billing details
|
158 |
-
'x_first_name' => $this->cart_data['billing_address']['first_name'],
|
159 |
-
'x_last_name' => $this->cart_data['billing_address']['last_name'],
|
160 |
-
'x_address' => $this->cart_data['billing_address']['address'],
|
161 |
-
'x_city' => $this->cart_data['billing_address']['city'],
|
162 |
-
//'x_state' => $this->cart_data['billing_address'][''],
|
163 |
-
'x_zip' => $this->cart_data['billing_address']['post_code'],
|
164 |
-
'x_country' => $this->cart_data['billing_address']['country'],
|
165 |
-
|
166 |
-
/// Customer shipping details
|
167 |
-
'x_ship_to_first_name' => $this->cart_data['shipping_address']['first_name'],
|
168 |
-
'x_ship_to_last_name' => $this->cart_data['shipping_address']['last_name'],
|
169 |
-
'x_ship_to_address' => $this->cart_data['shipping_address']['address'],
|
170 |
-
'x_ship_to_city' => $this->cart_data['shipping_address']['city'],
|
171 |
-
//'x_ship_to_state' => $this->cart_data['shipping_address'][''],
|
172 |
-
'x_ship_to_zip' => $this->cart_data['shipping_address']['post_code'],
|
173 |
-
'x_ship_to_country' => $this->cart_data['shipping_address']['country'],
|
174 |
-
|
175 |
-
//'x_po_num' => '',
|
176 |
-
);
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
}
|
182 |
-
}
|
183 |
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
* submit method, sends the received data to the payment gateway
|
190 |
-
* @access public
|
191 |
-
*/
|
192 |
-
function submit() {
|
193 |
-
$name_value_pairs = array();
|
194 |
-
foreach($this->collected_gateway_data as $key=>$value) {
|
195 |
-
//$output .= $key.'='.urlencode($value).$amp;
|
196 |
-
$name_value_pairs[]= $key.'='.urlencode($value);
|
197 |
-
}
|
198 |
-
$gateway_values = implode('&', $name_value_pairs);
|
199 |
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
// echo "<pre>".print_r($this,true)."</pre>";
|
205 |
-
// exit();
|
206 |
-
}
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
}
|
280 |
-
$this->set_error_message($parsed_response['response_description']);
|
281 |
-
$this->return_to_checkout();
|
282 |
-
break;
|
283 |
-
}
|
284 |
}
|
|
|
|
|
|
|
|
|
285 |
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
$
|
293 |
-
foreach($split_response as $key => $response_item) {
|
294 |
-
if(isset($this->aim_response_keys[($key+1)])) {
|
295 |
-
$parsed_response[$this->aim_response_keys[($key+1)]] = $response_item;
|
296 |
-
}
|
297 |
-
}
|
298 |
-
return $parsed_response;
|
299 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
case "w":
|
311 |
-
$arb_length = (int)$cart_item['recurring_data']['rebill_interval']['length'] * 7;
|
312 |
-
$arb_unit = 'days';
|
313 |
-
break;
|
314 |
-
|
315 |
-
case "y":
|
316 |
-
$arb_length = (int)$cart_item['recurring_data']['rebill_interval']['length'] / 12;
|
317 |
-
$arb_unit = 'months';
|
318 |
-
break;
|
319 |
-
|
320 |
-
|
321 |
-
case "m":
|
322 |
-
default:
|
323 |
-
$arb_length = $cart_item['recurring_data']['rebill_interval']['length'];
|
324 |
-
$arb_unit = 'months';
|
325 |
-
break;
|
326 |
-
}
|
327 |
-
if($cart_item['recurring_data']['charge_to_expiry'] !== true) {
|
328 |
-
$arb_times_to_rebill = $cart_item['recurring_data']['times_to_rebill'];
|
329 |
-
} else {
|
330 |
-
/// If subscription is permanent, rebill over 9000 times
|
331 |
-
$arb_times_to_rebill = 9999;
|
332 |
-
}
|
333 |
-
if($arb_times_to_rebill > 1) {
|
334 |
-
$arb_times_to_rebill--;
|
335 |
-
}
|
336 |
-
|
337 |
-
|
338 |
-
$arb_body = array(
|
339 |
-
/// Authentication Details go here
|
340 |
-
'merchantAuthentication'=>array(
|
341 |
-
'name'=>get_option('authorize_login'),
|
342 |
-
'transactionKey'=>get_option("authorize_password")
|
343 |
-
) ,
|
344 |
-
'subscription' => array(
|
345 |
-
/// Name goes here
|
346 |
-
'name' =>$cart_item['name'],
|
347 |
-
/// Amount goes here
|
348 |
-
'amount' => number_format($cart_item['price'],2,'.',''),
|
349 |
-
'trialAmount' => number_format(0,2,'.',''),
|
350 |
-
|
351 |
-
/// Payment Schedule goes here
|
352 |
-
'paymentSchedule' => array(
|
353 |
-
'interval' => array(
|
354 |
-
'length' => $arb_length,
|
355 |
-
'unit' => $arb_unit
|
356 |
-
),
|
357 |
-
'startDate' => gmdate("Y-m-d"),
|
358 |
-
'totalOccurrences' => $arb_times_to_rebill,
|
359 |
-
'trialOccurrences' => '1'
|
360 |
-
),
|
361 |
-
/// Payment Details go here
|
362 |
-
'payment' => array(
|
363 |
-
'creditCard' => array(
|
364 |
-
'cardNumber' => $this->credit_card_details['card_number'],
|
365 |
-
'expirationDate' => $this->credit_card_details['expiry_date']['month']."-".$this->credit_card_details['expiry_date']['year'],
|
366 |
-
'cardCode' => $this->credit_card_details['card_code']
|
367 |
-
)
|
368 |
-
),
|
369 |
-
/// Customer Details go Here
|
370 |
-
'order' => array(
|
371 |
-
//'invoiceNumber' => $this->cart_data['session_id']."123",
|
372 |
-
'description' => ''
|
373 |
-
),
|
374 |
-
/// Customer Details go Here
|
375 |
-
'customer' => array(
|
376 |
-
//'id' => 1,
|
377 |
-
'email' => $this->cart_data['email_address']
|
378 |
-
),
|
379 |
-
/// Billing Address Details go here
|
380 |
-
'billTo' => array(
|
381 |
-
'firstName' => $this->cart_data['billing_address']['first_name'],
|
382 |
-
'lastName' => $this->cart_data['billing_address']['last_name'],
|
383 |
-
'address' => $this->cart_data['billing_address']['address'],
|
384 |
-
'city' => $this->cart_data['billing_address']['city'],
|
385 |
-
//'state' => '',
|
386 |
-
'zip' => $this->cart_data['billing_address']['post_code'],
|
387 |
-
'country' => $this->cart_data['billing_address']['country']
|
388 |
-
)
|
389 |
-
)
|
390 |
-
);
|
391 |
-
return $arb_body;
|
392 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
|
410 |
-
|
411 |
-
|
412 |
-
|
|
|
|
|
413 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
$this->soap_client->__setLocation($service_url);
|
434 |
-
$returned_data = $this->soap_client->__soapCall($function, array($function => $arguments));
|
435 |
-
} else { // otherwise include and use nusoap
|
436 |
-
if(($this->soap_client == null) || !is_a($this->soap_client, 'soapclient')) {
|
437 |
-
include_once(WPSC_FILE_PATH.'/wpsc-includes/nusoap/nusoap.php');
|
438 |
-
$this->soap_client = new soapclient($wdsl_url, true);
|
439 |
-
}
|
440 |
-
$this->soap_client->setEndpoint($service_url);
|
441 |
-
$subscription_results = $this->soap_client->call($function, $arguments);
|
442 |
-
}
|
443 |
-
|
444 |
-
$returned_data = wpsc_object_to_array($returned_data);
|
445 |
-
return $returned_data;
|
446 |
}
|
447 |
}
|
448 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
if(!is_callable('get_option')) {
|
3 |
+
// This is here to stop error messages on servers with Zend Accelerator, it includes all files before get_option is declared
|
4 |
+
// then evidently includes them again, otherwise this code would break these modules
|
5 |
+
return;
|
6 |
+
exit("Something strange is happening, and \"return\" is not breaking out of a file.");
|
7 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
$nzshpcrt_gateways[$num]['name'] = 'Authorize.net';
|
10 |
+
$nzshpcrt_gateways[$num]['internalname'] = 'authorize';
|
11 |
+
$nzshpcrt_gateways[$num]['function'] = 'gateway_authorize';
|
12 |
+
$nzshpcrt_gateways[$num]['form'] = "form_authorize";
|
13 |
+
$nzshpcrt_gateways[$num]['submit_function'] = "submit_authorize";
|
14 |
+
$nzshpcrt_gateways[$num]['payment_type'] = "credit_card";
|
15 |
|
16 |
+
//include_once(ABSPATH.'wp-content/plugins/wp-shopping-cart/classes/authorize_class.php');
|
17 |
+
//if(get_option('payment_gateway') == 'authorize') {
|
18 |
+
if(in_array('authorize',(array)get_option('custom_gateway_options'))) {
|
19 |
$gateway_checkout_form_fields[$nzshpcrt_gateways[$num]['internalname']] = "
|
20 |
+
<tr %s>
|
21 |
<td>Credit Card Number *</td>
|
22 |
<td>
|
23 |
<input type='text' value='' name='card_number' />
|
24 |
+
<p class='validation-error'>%s</p>
|
25 |
</td>
|
26 |
</tr>
|
27 |
+
<tr %s>
|
28 |
<td>Credit Card Expiry *</td>
|
29 |
<td>
|
30 |
<input type='text' size='2' value='' maxlength='2' name='expiry[month]' />/<input type='text' size='2' maxlength='2' value='' name='expiry[year]' />
|
31 |
+
<p class='validation-error'>%s</p>
|
32 |
</td>
|
33 |
</tr>
|
34 |
+
<tr %s>
|
35 |
<td>CVV </td>
|
36 |
+
<td><input type='text' size='4' value='' maxlength='4' name='card_code' />
|
37 |
+
<p class='validation-error'>%s</p>
|
38 |
+
</td>
|
39 |
+
|
40 |
</tr>
|
41 |
";
|
42 |
}
|
43 |
|
44 |
+
function gateway_authorize($seperator, $sessionid) {
|
45 |
+
global $wpdb,$wpsc_cart;
|
46 |
+
$purchase_log_sql = "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid`= ".$sessionid." LIMIT 1";
|
47 |
+
$purchase_log = $wpdb->get_row($purchase_log_sql,ARRAY_A);
|
48 |
+
$cart_sql = "SELECT * FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE `purchaseid`='".$purchase_log['id']."'";
|
49 |
+
$cart = $wpdb->get_results($cart_sql,ARRAY_A);
|
50 |
+
$prodid=$cart[0]['prodid'];
|
51 |
+
$product_sql = "SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='".$prodid."'";
|
52 |
+
$product_data = $wpdb->get_results($product_sql,ARRAY_A);
|
53 |
+
$status = get_product_meta($prodid,'is_membership',true);
|
54 |
+
$free_trial = get_product_meta($prodid,'free_trial',true);
|
55 |
+
if (($status[0] == 1) && function_exists('wpsc_members_init')) {
|
56 |
+
$membership_length = get_product_meta($prodid,'membership_length',true);
|
57 |
+
$membership_length = $membership_length[0];
|
58 |
+
$length = $membership_length['length'];
|
59 |
+
$unit = $membership_length['unit'];
|
60 |
+
if ($unit == 'd') {
|
61 |
+
$unit='days';
|
62 |
+
} elseif ($unit == 'm') {
|
63 |
+
$unit='months';
|
64 |
+
}
|
65 |
+
$amount = nzshpcrt_overall_total_price($_SESSION['selected_country']);
|
66 |
+
$loginname = get_option('authorize_login');
|
67 |
+
$transactionkey = get_option("authorize_password");
|
68 |
+
$firstName = $_POST['collected_data'][get_option('authorize_form_first_name')];
|
69 |
+
$lastName = $_POST['collected_data'][get_option('authorize_form_last_name')];
|
70 |
+
$cardNumber = $_POST['card_number'];
|
71 |
+
$expirationDate ="20" . $_POST['expiry']['year']."-".$_POST['expiry']['month'] ;
|
72 |
+
$cardCode = $_POST['card_code'];
|
73 |
+
$startDate=date('Y-m-d');
|
74 |
+
$totalOccurrences = 99;
|
75 |
+
$trialOccurrences =1;
|
76 |
+
$amount = $product_data[0]['price'];
|
77 |
+
$trialAmount = 0;
|
78 |
+
|
79 |
+
$xml = "<?xml version='1.0' encoding='utf-8' ?>".
|
80 |
+
"<ARBCreateSubscriptionRequest xmlns='AnetApi/xml/v1/schema/AnetApiSchema.xsd'>".
|
81 |
+
"<merchantAuthentication>".
|
82 |
+
"<name>" . $loginname . "</name>".
|
83 |
+
"<transactionKey>" . $transactionkey . "</transactionKey>".
|
84 |
+
"</merchantAuthentication>".
|
85 |
+
"<refId>Instinct</refId>".
|
86 |
+
"<subscription>".
|
87 |
+
"<name>Samplesubscription</name>".
|
88 |
+
"<paymentSchedule>".
|
89 |
+
"<interval>".
|
90 |
+
"<length>". $length ."</length>".
|
91 |
+
"<unit>". $unit ."</unit>".
|
92 |
+
"</interval>".
|
93 |
+
"<startDate>" . $startDate . "</startDate>".
|
94 |
+
"<totalOccurrences>". $totalOccurrences . "</totalOccurrences>".
|
95 |
+
"<trialOccurrences>". $trialOccurrences . "</trialOccurrences>".
|
96 |
+
"</paymentSchedule>".
|
97 |
+
"<amount>". $amount ."</amount>".
|
98 |
+
"<trialAmount>" . $trialAmount . "</trialAmount>".
|
99 |
+
"<payment>".
|
100 |
+
"<creditCard>".
|
101 |
+
"<cardNumber>" . $cardNumber . "</cardNumber>".
|
102 |
+
"<expirationDate>" . $expirationDate . "</expirationDate>".
|
103 |
+
"<cardCode>" . $cardCode . "</cardCode>".
|
104 |
+
"</creditCard>".
|
105 |
+
"</payment>".
|
106 |
+
"<billTo>".
|
107 |
+
"<firstName>". $firstName . "</firstName>".
|
108 |
+
"<lastName>" . $lastName . "</lastName>".
|
109 |
+
"</billTo>".
|
110 |
+
"</subscription>".
|
111 |
+
"</ARBCreateSubscriptionRequest>";
|
112 |
+
// exit("<pre>".print_r($xml,1)."</pre>");
|
113 |
+
|
114 |
+
//Send the XML via curl
|
115 |
+
$response = send_request_via_curl($host,$path,$xml);
|
116 |
+
//If curl is unavilable you can try using fsockopen
|
117 |
+
/*
|
118 |
+
$response = send_request_via_fsockopen($host,$path,$content);
|
119 |
+
*/
|
120 |
+
//If the connection and send worked $response holds the return from Authorize.Net
|
121 |
+
if ($response) {
|
122 |
+
list ($refId, $resultCode, $code, $text, $subscriptionId) =parse_return($response);
|
123 |
+
if ($code == 'I00001') {
|
124 |
+
$wpdb->query("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `processed` = '2' WHERE `sessionid` = ".$sessionid." LIMIT 1");
|
125 |
+
$results=$wpdb->get_results("select * from `".WPSC_TABLE_LOGGED_SUBSCRIPTIONS."` where cart_id=".$cart[0]['id']."",ARRAY_A);
|
126 |
+
$sub_id=$results[0]['id'];
|
127 |
+
wpsc_member_activate_subscriptions($sub_id);
|
128 |
+
header("Location: ".get_option('transact_url').$seperator."sessionid=".$sessionid);
|
129 |
+
} else {
|
130 |
+
echo " refId: $refId<br>";
|
131 |
+
echo " resultCode: $resultCode <br>";
|
132 |
+
echo " code: $code<br>";
|
133 |
+
echo " text: $text<br>";
|
134 |
+
echo " subscriptionId: $subscriptionId <br><br>";
|
135 |
+
}
|
136 |
+
} else {
|
137 |
+
echo "send failed <br>";
|
138 |
+
}
|
139 |
+
|
140 |
+
//Dump the response to the screen for debugging
|
141 |
+
//echo "<xmp>$response</xmp>"; //Display response SOAP
|
142 |
+
exit('');
|
143 |
+
}
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
|
147 |
+
if($purchase_log['shipping_country'] != null) {
|
148 |
+
$shipping_country = $purchase_log['shipping_country'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
|
150 |
+
}
|
151 |
+
if($purchase_log['shipping_region'] != null) {
|
152 |
+
$shipping_region = $purchase_log['shipping_region'];
|
|
|
|
|
153 |
|
154 |
+
}else{
|
155 |
+
$shipping_region = 0;
|
156 |
+
}
|
157 |
+
if($purchase_log['billing_country'] != null) {
|
158 |
+
$billing_country = $purchase_log['billing_country'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
+
}
|
161 |
+
if($purchase_log['billing_region'] != null) {
|
162 |
+
$billing_region = $purchase_log['billing_region'];
|
163 |
+
$billing_region=$wpdb->get_var("SELECT code FROM `".WPSC_TABLE_REGION_TAX."` WHERE id='".$billing_region."'");
|
|
|
|
|
|
|
164 |
|
165 |
+
|
166 |
+
}else{
|
167 |
+
$billing_region = 0;
|
168 |
+
}
|
169 |
+
|
170 |
+
$authorize_data = array();
|
171 |
+
$authorize_data['x_Version'] = "3.1";
|
172 |
+
$authorize_data['x_Login'] = urlencode(get_option('authorize_login'));
|
173 |
+
$authorize_data['x_Password'] = urlencode(get_option("authorize_password"));
|
174 |
+
$authorize_data['x_Delim_Data'] = urlencode("TRUE");
|
175 |
+
$authorize_data['x_Delim_Char'] = urlencode(",");
|
176 |
+
$authorize_data['x_Encap_Char'] = urlencode("");
|
177 |
+
$authorize_data['x_Type'] = urlencode("AUTH_CAPTURE");
|
178 |
+
|
179 |
+
$authorize_data['x_ADC_Relay_Response'] = urlencode("FALSE");
|
180 |
+
if(get_option('authorize_testmode') == 1) {
|
181 |
+
$authorize_data['x_Test_Request'] = urlencode("TRUE");
|
182 |
+
}
|
183 |
+
$authorize_data['x_Method'] = urlencode("CC");
|
184 |
+
$authorize_data['x_Amount'] = number_format(nzshpcrt_overall_total_price($_SESSION['delivery_country'],false,false),2);
|
185 |
+
$authorize_data['x_First_Name'] = urlencode($_POST['collected_data'][get_option('authorize_form_first_name')]);
|
186 |
+
$authorize_data['x_Last_Name'] = urlencode($_POST['collected_data'][get_option('authorize_form_last_name')]);
|
187 |
+
$authorize_data['x_Card_Num'] = urlencode($_POST['card_number']);
|
188 |
+
$authorize_data['x_Exp_Date'] = urlencode(($_POST['expiry']['month'] . $_POST['expiry']['year']));
|
189 |
+
$authorize_data['x_Card_Code'] = urlencode($_POST['card_code']);
|
190 |
+
$authorize_data['x_Address'] = urlencode($_POST['collected_data'][get_option('authorize_form_address')]);
|
191 |
+
$authorize_data['x_City'] = urlencode($_POST['collected_data'][get_option('authorize_form_city')]);
|
192 |
+
$authorize_data['x_Zip'] = urlencode($_POST['collected_data'][get_option('authorize_form_post_code')]);
|
193 |
+
$authorize_data['x_State'] = urlencode($billing_region);
|
194 |
+
$authorize_data['x_Country'] = urlencode($billing_country);
|
195 |
+
$authorize_data['x_Phone'] = urlencode($_POST['collected_data'][get_option('authorize_form_phone')]);
|
196 |
+
|
197 |
+
|
198 |
+
|
199 |
+
|
200 |
+
|
201 |
+
$authorize_data['x_Email'] = urlencode($_POST['collected_data'][get_option('authorize_form_email')]);
|
202 |
+
$authorize_data['x_Email_Customer'] = urlencode("TRUE");
|
203 |
+
$authorize_data['x_Merchant_Email'] = urlencode(get_option('purch_log_email'));
|
204 |
+
|
205 |
+
|
206 |
+
// MY ADDITIONS HERE
|
207 |
+
$authorize_data['x_Description'] = urlencode(get_option('authorize_form_description'));
|
208 |
+
$authorize_data['x_invoice_num'] = $cart[0]['purchaseid'];
|
209 |
+
$authorize_data['x_cust_id'] = $cart[0]['purchaseid'];
|
210 |
+
$setstate=$_POST['collected_data'][get_option('authorize_form_country')][1];
|
211 |
+
$setstate=$wpdb->get_var("SELECT code FROM `".WPSC_TABLE_REGION_TAX."` WHERE id='".$setstate."'");
|
212 |
+
// $authorize_data['x_State'] = urlencode($setstate);
|
213 |
+
$setcountry=$_POST['collected_data'][get_option('authorize_form_country')][0];
|
214 |
+
// $authorize_data['x_Country'] = urlencode($setcountry);
|
215 |
+
$authorize_data['x_ship_to_First_Name'] = urlencode($_POST['collected_data'][get_option('authorize_form_ship_first_name')]);
|
216 |
+
$authorize_data['x_ship_to_Last_Name'] = urlencode($_POST['collected_data'][get_option('authorize_form_ship_last_name')]);
|
217 |
+
$authorize_data['x_ship_to_Address'] = urlencode($_POST['collected_data'][get_option('authorize_form_ship_address')]);
|
218 |
+
$authorize_data['x_ship_to_City'] = urlencode($_POST['collected_data'][get_option('authorize_form_ship_city')]);
|
219 |
+
$authorize_data['x_ship_to_Zip'] = urlencode($_POST['collected_data'][get_option('authorize_form_ship_post_code')]);
|
220 |
+
$setstate=$_POST['collected_data'][get_option('authorize_form_ship_state')];
|
221 |
+
$shipping_region=$wpdb->get_var("SELECT code FROM `".WPSC_TABLE_REGION_TAX."` WHERE id='".$shipping_region."'");
|
222 |
+
$authorize_data['x_ship_to_State'] = urlencode($shipping_region);
|
223 |
+
// $setcountry=$_POST['collected_data'][get_option('authorize_form_ship_country')];
|
224 |
+
$authorize_data['x_ship_to_Country'] = urlencode($shipping_country);
|
225 |
+
$authorize_data['x_tax'] = urlencode($wpsc_cart->total_tax);
|
226 |
+
if(wpsc_uses_shipping()){
|
227 |
+
$authorize_data['x_freight'] = urlencode($wpsc_cart->selected_shipping_method . '<|>' . $wpsc_cart->selected_shipping_option . '<|>' . $wpsc_cart->base_shipping);
|
228 |
+
}
|
229 |
+
// Extra shopping cart data for credit card receipt
|
230 |
+
if (isset($cart[0])) {
|
231 |
+
foreach ($cart as $k=>$v) {
|
232 |
+
$authorize_data['item_' . $k . '_name'] = $v['name'];
|
233 |
+
$authorize_data['item_' . $k . '_qty'] = $v['quantity'];
|
234 |
+
$authorize_data['item_' . $k . '_price'] = $v['price'];
|
235 |
+
}
|
|
|
|
|
|
|
|
|
|
|
236 |
}
|
237 |
+
|
238 |
+
if($x_Password!='') {
|
239 |
+
$authorize_data['x_Password']=$x_Password;
|
240 |
+
}
|
241 |
|
242 |
+
#
|
243 |
+
# Build fields string to post, nicer than the old code
|
244 |
+
#
|
245 |
+
$num = 0;
|
246 |
+
foreach($authorize_data as $key => $value) {
|
247 |
+
if($num > 0) {
|
248 |
+
$fields .= "&";
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
}
|
250 |
+
$fields .= $key."=".$value;
|
251 |
+
$num++;
|
252 |
+
}
|
253 |
+
|
254 |
+
#
|
255 |
+
# Start CURL session
|
256 |
+
#
|
257 |
+
$user_agent = "WP eCommerce plugin for Wordpress";
|
258 |
+
$referrer = get_option('transact_url');
|
259 |
+
|
260 |
+
$ch=curl_init();
|
261 |
+
curl_setopt($ch, CURLOPT_URL, "https://secure.authorize.net/gateway/transact.dll");
|
262 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
263 |
+
curl_setopt($ch, CURLOPT_NOPROGRESS, 1);
|
264 |
+
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
265 |
+
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,0);
|
266 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
267 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
|
268 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
|
269 |
+
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
|
270 |
+
curl_setopt($ch, CURLOPT_REFERER, $referrer);
|
271 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
272 |
+
|
273 |
+
$buffer = curl_exec($ch);
|
274 |
+
curl_close($ch);
|
275 |
+
|
276 |
+
// This section of the code is the change from Version 1.
|
277 |
+
// This allows this script to process all information provided by Authorize.net...
|
278 |
+
// and not just whether if the transaction was successful or not
|
279 |
+
|
280 |
+
// Provided in the true spirit of giving by Chuck Carpenter (Chuck@MLSphotos.com)
|
281 |
+
// Be sure to email him and tell him how much you appreciate his efforts for PHP coders everywhere
|
282 |
+
|
283 |
+
$return = preg_split("/[,]+/", "$buffer"); // Splits out the buffer return into an array so . . .
|
284 |
+
$details = $return[0]; // This can grab the Transaction ID at position 1 in the array
|
285 |
+
|
286 |
+
|
287 |
+
$wpdb->query("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `transactid` = '".$wpdb->escape($return[18])."' WHERE `sessionid` = ".$sessionid." LIMIT 1");
|
288 |
+
|
289 |
+
// echo "Location: ".$transact_url.$seperator."sessionid=".$sessionid;
|
290 |
+
// exit("<pre>".print_r($return,true)."</pre>");
|
291 |
+
// Change the number to grab additional information. Consult the AIM guidelines to see what information is provided in each position.
|
292 |
+
|
293 |
+
// For instance, to get the Transaction ID from the returned information (in position 7)..
|
294 |
+
// Simply add the following:
|
295 |
+
// $x_trans_id = $return[6];
|
296 |
+
|
297 |
+
// You may then use the switch statement (or other process) to process the information provided
|
298 |
+
// Example below is to see if the transaction was charged successfully
|
299 |
+
|
300 |
+
if(get_option('permalink_structure') != '')
|
301 |
+
{
|
302 |
+
$seperator ="?";
|
303 |
+
}
|
304 |
+
else
|
305 |
+
{
|
306 |
+
$seperator ="&";
|
307 |
+
}
|
308 |
+
switch ($details)
|
309 |
+
{
|
310 |
+
case 1: // Credit Card Successfully Charged
|
311 |
+
$processing_stage = $wpdb->get_var("SELECT `processed` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid` = ".$sessionid." LIMIT 1");
|
312 |
+
if($processing_stage < 2) {
|
313 |
+
$wpdb->query("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `processed` = '2' WHERE `sessionid` = ".$sessionid." LIMIT 1");
|
314 |
+
}
|
315 |
+
header("Location: ".get_option('transact_url').$seperator."sessionid=".$sessionid);
|
316 |
+
exit();
|
317 |
+
break;
|
318 |
+
|
319 |
+
default: // Credit Card Not Successfully Charged
|
320 |
+
$_SESSION['wpsc_checkout_misc_error_messages'][] = "Credit Card Processing Error: ".$return[3];//. " ". print_r($return,true)
|
321 |
+
header("Location: ".get_option('shopping_cart_url').$seperator."total=".nzshpcrt_overall_total_price($_POST['collected_data'][get_option('country_form_field')]));
|
322 |
+
exit();
|
323 |
+
break;
|
324 |
+
}
|
325 |
+
}
|
326 |
|
327 |
+
function submit_authorize()
|
328 |
+
{
|
329 |
+
//exit("<pre>".print_r($_POST,true)."</pre>");
|
330 |
+
update_option('authorize_login', $_POST['authorize_login']);
|
331 |
+
update_option('authorize_password', $_POST['authorize_password']);
|
332 |
+
if($_POST['authorize_testmode'] == 1) {
|
333 |
+
update_option('authorize_testmode', 1);
|
334 |
+
} else {
|
335 |
+
update_option('authorize_testmode', 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
}
|
337 |
+
|
338 |
+
foreach((array)$_POST['authorize_form'] as $form => $value) {
|
339 |
+
update_option(('authorize_form_'.$form), $value);
|
340 |
+
}
|
341 |
+
return true;
|
342 |
+
}
|
343 |
|
344 |
+
function form_authorize()
|
345 |
+
{
|
346 |
+
$output = '';
|
347 |
+
$output .= "
|
348 |
+
<tr>
|
349 |
+
<td>
|
350 |
+
Authorize API Login ID
|
351 |
+
</td>
|
352 |
+
<td>
|
353 |
+
<input type='text' size='40' value='".get_option('authorize_login')."' name='authorize_login' />
|
354 |
+
</td>
|
355 |
+
</tr>
|
356 |
+
<tr>
|
357 |
+
<td>
|
358 |
+
Authorize Transaction Key
|
359 |
+
</td>
|
360 |
+
<td>
|
361 |
+
<input type='text' size='40' value='".get_option('authorize_password')."' name='authorize_password' />
|
362 |
+
</td>
|
363 |
+
</tr>
|
364 |
+
<tr>
|
365 |
+
<td>
|
366 |
+
Test Mode
|
367 |
+
</td>
|
368 |
+
<td>\n";
|
369 |
+
if(get_option('authorize_testmode') == 1)
|
370 |
+
{
|
371 |
+
$output .= "<input type='checkbox' size='40' value='1' checked='true' name='authorize_testmode' />\n";
|
372 |
+
}
|
373 |
+
else
|
374 |
+
{
|
375 |
+
$output .= "<input type='checkbox' size='40' value='1' name='authorize_testmode' />\n";
|
376 |
+
}
|
377 |
+
$output .= " </td>
|
378 |
+
</tr>
|
379 |
+
|
380 |
+
|
381 |
+
|
382 |
+
<tr class='update_gateway' >
|
383 |
+
<td colspan='2'>
|
384 |
+
<div class='submit'>
|
385 |
+
<input type='submit' value='Update »' name='updateoption'/>
|
386 |
+
</div>
|
387 |
+
</td>
|
388 |
+
</tr>
|
389 |
+
<tr>
|
390 |
+
<td>
|
391 |
+
Please note that country and state fields are generated automatically.
|
392 |
+
</td>
|
393 |
+
</tr>
|
394 |
+
<tr class='firstrowth'>
|
395 |
+
<td style='border-bottom: medium none;' colspan='2'>
|
396 |
+
<strong class='form_group'>Forms Sent to Gateway</strong>
|
397 |
+
</td>
|
398 |
+
</tr>
|
399 |
+
|
400 |
+
<tr>
|
401 |
+
<td>
|
402 |
+
Description
|
403 |
+
</td>
|
404 |
+
<td>
|
405 |
+
<input name='authorize_form[description]' value='".get_option('authorize_form_description')."'>
|
406 |
+
</select>
|
407 |
+
</td>
|
408 |
+
</tr>
|
409 |
+
|
410 |
+
<tr>
|
411 |
+
<td colspan='2'>
|
412 |
+
<u>Bill To Info:</u>
|
413 |
+
</td>
|
414 |
+
</tr>
|
415 |
+
|
416 |
+
<tr>
|
417 |
+
<td>
|
418 |
+
|
419 |
+
First Name Field
|
420 |
+
</td>
|
421 |
+
<td>
|
422 |
+
<select name='authorize_form[first_name]'>
|
423 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_first_name'))."
|
424 |
+
</select>
|
425 |
+
</td>
|
426 |
+
</tr>
|
427 |
+
<tr>
|
428 |
+
<td>
|
429 |
+
Last Name Field
|
430 |
+
</td>
|
431 |
+
<td>
|
432 |
+
<select name='authorize_form[last_name]'>
|
433 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_last_name'))."
|
434 |
+
</select>
|
435 |
+
</td>
|
436 |
+
</tr>
|
437 |
+
<tr>
|
438 |
+
<td>
|
439 |
+
Address Field
|
440 |
+
</td>
|
441 |
+
<td>
|
442 |
+
<select name='authorize_form[address]'>
|
443 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_address'))."
|
444 |
+
</select>
|
445 |
+
</td>
|
446 |
+
</tr>
|
447 |
+
<tr>
|
448 |
+
<td>
|
449 |
+
City Field
|
450 |
+
</td>
|
451 |
+
<td>
|
452 |
+
<select name='authorize_form[city]'>
|
453 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_city'))."
|
454 |
+
</select>
|
455 |
+
</td>
|
456 |
+
</tr>
|
457 |
+
<tr>
|
458 |
+
<td>
|
459 |
+
Postal code/Zip code Field
|
460 |
+
</td>
|
461 |
+
<td>
|
462 |
+
<select name='authorize_form[post_code]'>
|
463 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_post_code'))."
|
464 |
+
</select>
|
465 |
+
</td>
|
466 |
+
</tr>
|
467 |
+
<tr>
|
468 |
+
<td>
|
469 |
+
Email Field
|
470 |
+
</td>
|
471 |
+
<td>
|
472 |
+
<select name='authorize_form[email]'>
|
473 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_email'))."
|
474 |
+
</select>
|
475 |
+
</td>
|
476 |
+
</tr>
|
477 |
+
<tr>
|
478 |
+
<td>
|
479 |
+
Phone Number Field
|
480 |
+
</td>
|
481 |
+
<td>
|
482 |
+
<select name='authorize_form[phone]'>
|
483 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_phone'))."
|
484 |
+
</select>
|
485 |
+
</td>
|
486 |
+
</tr>
|
487 |
+
<tr>
|
488 |
+
<td colspan='2'>
|
489 |
+
<u>Ship To Info:</u>
|
490 |
+
</td>
|
491 |
+
</tr>
|
492 |
+
<tr>
|
493 |
+
<td>
|
494 |
+
First Name Field
|
495 |
+
</td>
|
496 |
+
<td>
|
497 |
+
<select name='authorize_form[ship_first_name]'>
|
498 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_ship_first_name'))."
|
499 |
+
</select>
|
500 |
+
</td>
|
501 |
+
</tr>
|
502 |
+
<tr>
|
503 |
+
<td>
|
504 |
+
Last Name Field
|
505 |
+
</td>
|
506 |
+
<td>
|
507 |
+
<select name='authorize_form[ship_last_name]'>
|
508 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_ship_last_name'))."
|
509 |
+
</select>
|
510 |
+
</td>
|
511 |
+
</tr>
|
512 |
+
<tr>
|
513 |
+
<td>
|
514 |
+
Address Field
|
515 |
+
</td>
|
516 |
+
<td>
|
517 |
+
<select name='authorize_form[ship_address]'>
|
518 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_ship_address'))."
|
519 |
+
</select>
|
520 |
+
</td>
|
521 |
+
</tr>
|
522 |
+
<tr>
|
523 |
+
<td>
|
524 |
+
City Field
|
525 |
+
</td>
|
526 |
+
<td>
|
527 |
+
<select name='authorize_form[ship_city]'>
|
528 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_ship_city'))."
|
529 |
+
</select>
|
530 |
+
</td>
|
531 |
+
</tr>
|
532 |
+
<tr>
|
533 |
+
<td>
|
534 |
+
Postal code/Zip code Field
|
535 |
+
</td>
|
536 |
+
<td>
|
537 |
+
<select name='authorize_form[ship_post_code]'>
|
538 |
+
".nzshpcrt_form_field_list(get_option('authorize_form_ship_post_code'))."
|
539 |
+
</select>
|
540 |
+
</td>
|
541 |
+
</tr>
|
542 |
+
|
543 |
+
";
|
544 |
+
return $output;
|
545 |
+
}
|
546 |
|
547 |
+
function send_request_via_curl($host,$path,$content) {
|
548 |
+
if (get_option('authorize_testmode')=='1'){
|
549 |
+
$host = "apitest.authorize.net";
|
550 |
+
} else {
|
551 |
+
$host = "api.authorize.net";
|
552 |
}
|
553 |
+
$path = "/xml/v1/request.api";
|
554 |
+
$posturl = "https://" . $host . $path;
|
555 |
+
$ch = curl_init();
|
556 |
+
curl_setopt($ch, CURLOPT_URL, $posturl);
|
557 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
558 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
|
559 |
+
curl_setopt($ch, CURLOPT_HEADER, 1);
|
560 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
|
561 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
562 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
563 |
+
$response = curl_exec($ch);
|
564 |
+
return $response;
|
565 |
+
}
|
566 |
|
567 |
+
//Function to parse Authorize.net response
|
568 |
+
function parse_return($content)
|
569 |
+
{
|
570 |
+
$refId = substring_between($content,'<refId>','</refId>');
|
571 |
+
$resultCode = substring_between($content,'<resultCode>','</resultCode>');
|
572 |
+
$code = substring_between($content,'<code>','</code>');
|
573 |
+
$text = substring_between($content,'<text>','</text>');
|
574 |
+
$subscriptionId = substring_between($content,'<subscriptionId>','</subscriptionId>');
|
575 |
+
return array ($refId, $resultCode, $code, $text, $subscriptionId);
|
576 |
+
}
|
577 |
+
//Helper function for parsing response
|
578 |
+
function substring_between($haystack,$start,$end) {
|
579 |
+
if (strpos($haystack,$start) === false || strpos($haystack,$end) === false) {
|
580 |
+
return false;
|
581 |
+
} else{
|
582 |
+
$start_position = strpos($haystack,$start)+strlen($start);
|
583 |
+
$end_position = strpos($haystack,$end);
|
584 |
+
return substr($haystack,$start_position,$end_position-$start_position);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
}
|
586 |
}
|
587 |
+
|
588 |
+
function authorize_response(){
|
589 |
+
global $wpdb;
|
590 |
+
// mail('hanzhimeng@gmail.com','',print_r($_SERVER,1));
|
591 |
+
}
|
592 |
+
|
593 |
+
add_action('init', 'authorize_response');
|
594 |
+
?>
|
merchants/paypal-pro.merchant.php
CHANGED
@@ -1,465 +1,452 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
|
4 |
-
*/
|
5 |
-
$nzshpcrt_gateways[$num] = array(
|
6 |
-
'name' => 'Paypal Pro 2.0',
|
7 |
-
'api_version' => 2.0,
|
8 |
-
'class_name' => 'wpsc_merchant_paypal_pro',
|
9 |
-
'has_recurring_billing' => true,
|
10 |
-
'wp_admin_cannot_cancel' => true,
|
11 |
-
'requirements' => array(
|
12 |
-
/// so that you can restrict merchant modules to PHP 5, if you use PHP 5 features
|
13 |
-
'php_version' => 4.3,
|
14 |
-
/// for modules that may not be present, like curl
|
15 |
-
'extra_modules' => array()
|
16 |
-
),
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
//
|
22 |
-
'
|
23 |
-
|
24 |
-
|
25 |
-
'
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
)
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
*
|
38 |
-
*
|
39 |
-
*
|
40 |
-
*
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
$
|
56 |
-
|
57 |
-
|
58 |
-
$data
|
59 |
-
|
60 |
-
$data['
|
61 |
-
$data['
|
62 |
-
|
63 |
-
$data['
|
64 |
-
|
65 |
-
|
66 |
-
//
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
//$data['
|
71 |
-
|
72 |
-
$data['
|
73 |
-
|
74 |
-
|
75 |
-
$data['
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
$data['
|
80 |
-
$data['
|
81 |
-
$data['
|
82 |
-
$data['
|
83 |
-
$data['
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
$data['
|
93 |
-
$data['
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
$data['
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
$
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
$cart_items['
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
$
|
126 |
-
$
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
$data
|
135 |
-
|
136 |
-
$data['
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
//
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
$
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
case '
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
$
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
$decimal_places =
|
322 |
-
break;
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
if($_POST['PayPalPro']['
|
343 |
-
update_option('
|
344 |
-
}
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
}
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
<
|
415 |
-
<
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
<
|
422 |
-
|
423 |
-
<option value='
|
424 |
-
<option value='
|
425 |
-
|
426 |
-
<
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
<option value='Visa'>Visa</option>
|
453 |
-
<option value='Mastercard'>MasterCard</option>
|
454 |
-
<option value='Discover'>Discover</option>
|
455 |
-
<option value='Amex'>Amex</option>
|
456 |
-
</select>
|
457 |
-
<p class='validation-error'>%s</p>
|
458 |
-
</td>
|
459 |
-
</tr>
|
460 |
-
";
|
461 |
-
}
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
|
4 |
+
*/
|
5 |
+
$nzshpcrt_gateways[$num] = array(
|
6 |
+
'name' => 'Paypal Pro 2.0',
|
7 |
+
'api_version' => 2.0,
|
8 |
+
'class_name' => 'wpsc_merchant_paypal_pro',
|
9 |
+
'has_recurring_billing' => true,
|
10 |
+
'wp_admin_cannot_cancel' => true,
|
11 |
+
'requirements' => array(
|
12 |
+
/// so that you can restrict merchant modules to PHP 5, if you use PHP 5 features
|
13 |
+
'php_version' => 4.3,
|
14 |
+
/// for modules that may not be present, like curl
|
15 |
+
'extra_modules' => array()
|
16 |
+
),
|
17 |
+
'form' => 'form_paypal_pro',
|
18 |
+
'submit_function' => 'submit_paypal_pro',
|
19 |
+
|
20 |
+
|
21 |
+
// this may be legacy, not yet decided
|
22 |
+
'internalname' => 'wpsc_merchant_paypal_pro',
|
23 |
+
|
24 |
+
// All array members below here are legacy, and use the code in paypal_multiple.php
|
25 |
+
// 'form' => 'form_paypal_multiple',
|
26 |
+
// 'submit_function' => 'submit_paypal_multiple',
|
27 |
+
'payment_type' => 'paypal',
|
28 |
+
'supported_currencies' => array(
|
29 |
+
'currency_list' => array('AUD', 'BRL', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN', 'MYR', 'NOK', 'NZD', 'PHP', 'PLN', 'SEK', 'SGD', 'THB', 'TWD', 'USD'),
|
30 |
+
'option_name' => 'paypal_curcode'
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
/**
|
37 |
+
* WP eCommerce Paypal Standard Merchant Class
|
38 |
+
*
|
39 |
+
* This is the paypal standard merchant class, it extends the base merchant class
|
40 |
+
*
|
41 |
+
* @package wp-e-commerce
|
42 |
+
* @since 3.7.6
|
43 |
+
* @subpackage wpsc-merchants
|
44 |
+
*/
|
45 |
+
class wpsc_merchant_paypal_pro extends wpsc_merchant {
|
46 |
+
var $name = 'Paypal Payments Standard';
|
47 |
+
var $paypal_ipn_values = array();
|
48 |
+
|
49 |
+
/**
|
50 |
+
* construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
|
51 |
+
* @access public
|
52 |
+
*/
|
53 |
+
function construct_value_array() {
|
54 |
+
//$collected_gateway_data
|
55 |
+
$paypal_vars = array();
|
56 |
+
// Store settings to be sent to paypal
|
57 |
+
|
58 |
+
$data = array();
|
59 |
+
$data['USER'] = get_option('paypal_pro_username');
|
60 |
+
$data['PWD'] = get_option('paypal_pro_password');
|
61 |
+
$data['SIGNATURE'] = get_option('paypal_pro_signature');
|
62 |
+
|
63 |
+
$data['VERSION'] = "52.0";
|
64 |
+
$data['METHOD'] = "DoDirectPayment";
|
65 |
+
$data['PAYMENTACTION'] = "Sale";
|
66 |
+
$data['RETURNFMFDETAILS'] = "1"; // optional - return fraud management filter data
|
67 |
+
|
68 |
+
|
69 |
+
// Basic Cart Data
|
70 |
+
//$data['TRANSACTIONID'] = $this->cart_data['session_id'];
|
71 |
+
//$data['CURRENCYCODE'] = $this->cart_data['store_currency'];
|
72 |
+
$data['INVNUM'] = $this->cart_data['session_id'];
|
73 |
+
//$data['CUSTOM'] = $this->cart_data['session_id'];
|
74 |
+
$data['NOTIFYURL'] = add_query_arg('gateway', 'wpsc_merchant_paypal_pro', $this->cart_data['notification_url']);
|
75 |
+
$data['IPADDRESS'] = $_SERVER["REMOTE_ADDR"];
|
76 |
+
|
77 |
+
// Billing Data
|
78 |
+
$data['FIRSTNAME'] = $this->cart_data['billing_address']['first_name'];
|
79 |
+
$data['LASTNAME'] = $this->cart_data['billing_address']['last_name'];
|
80 |
+
$data['EMAIL'] = $this->cart_data['email_address'];
|
81 |
+
// $data['PHONENUM'] = $this->cart_data['billing_address'];
|
82 |
+
$data['STREET'] = $this->cart_data['billing_address']['address'];
|
83 |
+
$data['CITY'] = $this->cart_data['billing_address']['city'];
|
84 |
+
$data['STATE'] = $this->cart_data['billing_address']['state'];
|
85 |
+
$data['COUNTRYCODE'] = $this->cart_data['billing_address']['country'];
|
86 |
+
$data['ZIP'] = $this->cart_data['billing_address']['post_code'];
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
// Shipping Data
|
91 |
+
$data['SHIPTONAME'] = $this->cart_data['shipping_address']['first_name']." ".$this->cart_data['shipping_address']['last_name'];
|
92 |
+
$data['SHIPTOSTREET'] = $this->cart_data['shipping_address']['address'];
|
93 |
+
$data['SHIPTOCITY'] = $this->cart_data['shipping_address']['city'];
|
94 |
+
|
95 |
+
$data['SHIPTOSTATE'] = $this->cart_data['shipping_address']['state'];
|
96 |
+
$data['SHIPTOCOUNTRY'] = $this->cart_data['shipping_address']['country'];
|
97 |
+
$data['SHIPTOZIP'] = $this->cart_data['shipping_address']['post_code'];
|
98 |
+
|
99 |
+
|
100 |
+
// Credit Card Data
|
101 |
+
$data['CREDITCARDTYPE'] = $_POST['cctype'];
|
102 |
+
$data['ACCT'] = $_POST['card_number'];
|
103 |
+
$data['EXPDATE'] = $_POST['expiry']['month'].$_POST['expiry']['year'];
|
104 |
+
$data['CVV2'] = $_POST['card_code'];
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
// Ordered Items
|
109 |
+
//$discount = $wpsc_cart->coupons_amount;
|
110 |
+
|
111 |
+
|
112 |
+
// Cart Item Data
|
113 |
+
$i = 0;
|
114 |
+
$item_total = 0;
|
115 |
+
$tax_total = 0;
|
116 |
+
// $shipping_total = $this->cart_data['shipping_price'];
|
117 |
+
$shipping_total = $this->cart_data['base_shipping'];
|
118 |
+
foreach($this->cart_items as $cart_row) {
|
119 |
+
$cart_items['L_NAME'.$i] = $cart_row['name'];
|
120 |
+
$cart_items['L_AMT'.$i] = $this->format_price($cart_row['price']);
|
121 |
+
$cart_items['L_NUMBER'.$i] = $i;
|
122 |
+
$cart_items['L_QTY'.$i] = $cart_row['quantity'];
|
123 |
+
$cart_items['L_TAXAMT'.$i] = $this->format_price(0);
|
124 |
+
|
125 |
+
//"item_number_$i" => $cart_row['product_id'],
|
126 |
+
//"shipping_$i" => $this->format_price($cart_row['shipping']), // additional shipping for the the (first item / total of the items)
|
127 |
+
//"shipping2_$i" => $this->format_price($cart_row['shipping']), // additional shipping beyond the first item
|
128 |
+
|
129 |
+
$item_total += $this->format_price($cart_row['price'] * $cart_row['quantity']);
|
130 |
+
$tax_total += $this->format_price($cart_row['tax']);
|
131 |
+
++$i;
|
132 |
+
}
|
133 |
+
|
134 |
+
$data = array_merge($data, $cart_items);
|
135 |
+
// Cart totals
|
136 |
+
$data['ITEMAMT'] = number_format($item_total,2);
|
137 |
+
$data['SHIPPINGAMT'] = number_format($shipping_total,2);
|
138 |
+
$data['TAXAMT'] = number_format($tax_total, 2);
|
139 |
+
|
140 |
+
$data['AMT'] = number_format($item_total + $tax_total + $shipping_total,2);
|
141 |
+
|
142 |
+
|
143 |
+
|
144 |
+
// exit("<pre>".print_r($data, true)."</pre><br /><br /><pre>".print_r($this->cart_data, true)."</pre>");
|
145 |
+
|
146 |
+
$this->collected_gateway_data = $data;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* submit method, sends the received data to the payment gateway
|
151 |
+
* @access public
|
152 |
+
*/
|
153 |
+
function submit() {
|
154 |
+
|
155 |
+
if (get_option('paypal_pro_testmode') == "on"){
|
156 |
+
$paypal_url = "https://api-3t.beta-sandbox.paypal.com/nvp"; // Sandbox testing
|
157 |
+
}else{
|
158 |
+
$paypal_url = "https://api-3t.paypal.com/nvp"; // Live
|
159 |
+
}
|
160 |
+
|
161 |
+
|
162 |
+
$options = array(
|
163 |
+
'timeout' => 5,
|
164 |
+
'body' => $this->collected_gateway_data,
|
165 |
+
'user-agent' => $this->cart_data['software_name'] ." " . get_bloginfo( 'url' )
|
166 |
+
);
|
167 |
+
|
168 |
+
$response = wp_remote_post($paypal_url, $options);
|
169 |
+
|
170 |
+
// parse the response body
|
171 |
+
parse_str($response['body'], $parsed_response);
|
172 |
+
|
173 |
+
$error_data = array();
|
174 |
+
if( is_wp_error( $response ) ) {
|
175 |
+
$error_data[0]['error_code'] = null;
|
176 |
+
$error_data[0]['error_message'] = __('There was a problem connecting to the payment gateway.', 'wpsc');
|
177 |
+
}
|
178 |
+
|
179 |
+
// List of error codes that we need to convert to something more human readable
|
180 |
+
$paypal_error_codes = array('10500','10501','10507','10548','10549','10550','10552','10758','10760','15003');
|
181 |
+
|
182 |
+
// Extract the error messages from the array
|
183 |
+
foreach((array)$parsed_response as $response_key => $response_value) {
|
184 |
+
if(preg_match("/L_([A-Z]+){1}(\d+){1}()/", $response_key ,$matches)) {
|
185 |
+
$error_number = $matches[2];
|
186 |
+
switch($matches[1]) {
|
187 |
+
case 'ERRORCODE':
|
188 |
+
$error_data[$error_number]['error_code'] = $response_value;
|
189 |
+
if(in_array($response_value, $paypal_error_codes)) {
|
190 |
+
$error_data[$error_number]['error_message'] = __('There is a problem with your PayPal account configuration, please contact PayPal for further information.', 'wpsc').$response_value;
|
191 |
+
|
192 |
+
break 2;
|
193 |
+
}
|
194 |
+
break;
|
195 |
+
|
196 |
+
case 'LONGMESSAGE':
|
197 |
+
// Oddly, this comes with two levels of slashes, so strip them twice
|
198 |
+
$error_data[$error_number]['error_message'] = htmlentities(stripslashes(stripslashes($response_value)));
|
199 |
+
break;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
//exit("<pre>".print_r($parsed_response,true)."</pre>");
|
205 |
+
|
206 |
+
switch($parsed_response['ACK']) {
|
207 |
+
case 'Success':
|
208 |
+
case 'SuccessWithWarning':
|
209 |
+
$this->set_transaction_details($parsed_response['TRANSACTIONID'], 3);
|
210 |
+
//transaction_results($this->cart_data['session_id'], false);
|
211 |
+
$this->go_to_transaction_results($this->cart_data['session_id']);
|
212 |
+
break;
|
213 |
+
|
214 |
+
case 'Failure': /// case 2 is order denied
|
215 |
+
default: /// default is http or unknown error state
|
216 |
+
foreach((array)$error_data as $error_row) {
|
217 |
+
$this->set_error_message($error_row['error_message']);
|
218 |
+
}
|
219 |
+
$this->return_to_checkout();
|
220 |
+
exit();
|
221 |
+
break;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
|
226 |
+
/**
|
227 |
+
* parse_gateway_notification method, receives data from the payment gateway
|
228 |
+
* @access private
|
229 |
+
*/
|
230 |
+
function parse_gateway_notification() {
|
231 |
+
/// PayPal first expects the IPN variables to be returned to it within 30 seconds, so we do this first.
|
232 |
+
$paypal_url = get_option('paypal_multiple_url');
|
233 |
+
|
234 |
+
$received_values = array();
|
235 |
+
$received_values['cmd'] = '_notify-validate';
|
236 |
+
$received_values += $_POST;
|
237 |
+
$options = array(
|
238 |
+
'timeout' => 5,
|
239 |
+
'body' => $received_values,
|
240 |
+
'user-agent' => ('WP e-Commerce/'.WPSC_PRESENTABLE_VERSION)
|
241 |
+
);
|
242 |
+
|
243 |
+
$response = wp_remote_post($paypal_url, $options);
|
244 |
+
if(strpos($response['body'], 'VERIFIED') !== false) {
|
245 |
+
$this->paypal_ipn_values = $received_values;
|
246 |
+
$this->session_id = $received_values['invoice'];
|
247 |
+
} else {
|
248 |
+
exit("IPN Request Failure");
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* process_gateway_notification method, receives data from the payment gateway
|
254 |
+
* @access public
|
255 |
+
*/
|
256 |
+
function process_gateway_notification() {
|
257 |
+
// Compare the received store owner email address to the set one
|
258 |
+
if(strtolower($this->paypal_ipn_values['receiver_email']) == strtolower(get_option('paypal_multiple_business'))) {
|
259 |
+
switch($this->paypal_ipn_values['txn_type']) {
|
260 |
+
case 'cart':
|
261 |
+
case 'express_checkout':
|
262 |
+
if((float)$this->paypal_ipn_values['mc_gross'] == (float)$this->cart_data['total_price']) {
|
263 |
+
$this->set_transaction_details($this->paypal_ipn_values['txn_id'], 3);
|
264 |
+
transaction_results($this->cart_data['session_id'],false);
|
265 |
+
}
|
266 |
+
break;
|
267 |
+
|
268 |
+
case 'subscr_signup':
|
269 |
+
case 'subscr_payment':
|
270 |
+
$this->set_transaction_details($this->paypal_ipn_values['subscr_id'], 3);
|
271 |
+
foreach($this->cart_items as $cart_row) {
|
272 |
+
if($cart_row['is_recurring'] == true) {
|
273 |
+
do_action('wpsc_activate_subscription', $cart_row['cart_item_id'], $this->paypal_ipn_values['subscr_id']);
|
274 |
+
}
|
275 |
+
}
|
276 |
+
transaction_results($this->cart_data['session_id'],false);
|
277 |
+
break;
|
278 |
+
|
279 |
+
case 'subscr_cancel':
|
280 |
+
case 'subscr_eot':
|
281 |
+
case 'subscr_failed':
|
282 |
+
foreach($this->cart_items as $cart_row) {
|
283 |
+
$altered_count = 0;
|
284 |
+
if((bool)$cart_row['is_recurring'] == true) {
|
285 |
+
$altered_count++;
|
286 |
+
wpsc_update_cartmeta($cart_row['cart_item_id'], 'is_subscribed', 0);
|
287 |
+
}
|
288 |
+
}
|
289 |
+
break;
|
290 |
+
|
291 |
+
default:
|
292 |
+
break;
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
$message = "
|
297 |
+
{$this->paypal_ipn_values['receiver_email']} => ".get_option('paypal_multiple_business')."
|
298 |
+
{$this->paypal_ipn_values['txn_type']}
|
299 |
+
{$this->paypal_ipn_values['mc_gross']} => {$this->cart_data['total_price']}
|
300 |
+
{$this->paypal_ipn_values['txn_id']}
|
301 |
+
|
302 |
+
".print_r($this->cart_items, true)."
|
303 |
+
{$altered_count}
|
304 |
+
";
|
305 |
+
//mail('thomas.howard@gmail.com', "IPN Debugging", $message);
|
306 |
+
}
|
307 |
+
|
308 |
+
|
309 |
+
|
310 |
+
function format_price($price) {
|
311 |
+
$paypal_currency_code = get_option('paypal_curcode');
|
312 |
+
switch($paypal_currency_code) {
|
313 |
+
case "JPY":
|
314 |
+
$decimal_places = 0;
|
315 |
+
break;
|
316 |
+
|
317 |
+
case "HUF":
|
318 |
+
$decimal_places = 0;
|
319 |
+
|
320 |
+
default:
|
321 |
+
$decimal_places = 2;
|
322 |
+
break;
|
323 |
+
}
|
324 |
+
$price = number_format(sprintf("%01.2f",$price),$decimal_places,'.','');
|
325 |
+
return $price;
|
326 |
+
}
|
327 |
+
|
328 |
+
}
|
329 |
+
|
330 |
+
|
331 |
+
function submit_paypal_pro(){
|
332 |
+
//exit('<pre>'.print_r($_POST, true).'</pre>');
|
333 |
+
if($_POST['PayPalPro']['username'] != null) {
|
334 |
+
update_option('paypal_pro_username', $_POST['PayPalPro']['username']);
|
335 |
+
}
|
336 |
+
if($_POST['PayPalPro']['password'] != null) {
|
337 |
+
update_option('paypal_pro_password', $_POST['PayPalPro']['password']);
|
338 |
+
}
|
339 |
+
if($_POST['PayPalPro']['signature'] != null) {
|
340 |
+
update_option('paypal_pro_signature', $_POST['PayPalPro']['signature']);
|
341 |
+
}
|
342 |
+
if($_POST['PayPalPro']['testmode'] != null) {
|
343 |
+
update_option('paypal_pro_testmode', $_POST['PayPalPro']['testmode']);
|
344 |
+
}
|
345 |
+
return true;
|
346 |
+
}
|
347 |
+
|
348 |
+
function form_paypal_pro(){
|
349 |
+
if(get_option('paypal_pro_testmode') == "on"){
|
350 |
+
$selected = 'checked="checked"';
|
351 |
+
}else{
|
352 |
+
$selected = '';
|
353 |
+
}
|
354 |
+
$output = '
|
355 |
+
<tr>
|
356 |
+
<td>
|
357 |
+
<label for="paypal_pro_username">'.__('API Username:').'</label>
|
358 |
+
</td>
|
359 |
+
<td>
|
360 |
+
<input type="text" name="PayPalPro[username]" id="paypal_pro_username" value="'.get_option("paypal_pro_username").'" size="30" />
|
361 |
+
</td>
|
362 |
+
</tr>
|
363 |
+
<tr>
|
364 |
+
<td>
|
365 |
+
<label for="paypal_pro_password">'.__('API Password:').'</label>
|
366 |
+
</td>
|
367 |
+
<td>
|
368 |
+
<input type="password" name="PayPalPro[password]" id="paypal_pro_password" value="'.get_option('paypal_pro_password').'" size="16" />
|
369 |
+
</td>
|
370 |
+
</tr>
|
371 |
+
<tr>
|
372 |
+
<td>
|
373 |
+
<label for="paypal_pro_signature">'.__('API Signature:').'</label>
|
374 |
+
</td>
|
375 |
+
<td>
|
376 |
+
<input type="text" name="PayPalPro[signature]" id="paypal_pro_signature" value="'.get_option('paypal_pro_signature').'" size="48" />
|
377 |
+
</td>
|
378 |
+
</tr>
|
379 |
+
<tr>
|
380 |
+
<td>
|
381 |
+
<label for="paypal_pro_testmode">'.__('Test Mode Enabled:').'</label>
|
382 |
+
</td>
|
383 |
+
<td>
|
384 |
+
<input type="hidden" name="PayPalPro[testmode]" value="off" /><input type="checkbox" name="PayPalPro[testmode]" id="paypal_pro_testmode" value="on" '.$selected.' />
|
385 |
+
</td>
|
386 |
+
</tr>';
|
387 |
+
return $output;
|
388 |
+
}
|
389 |
+
|
390 |
+
$years = '';
|
391 |
+
$months = '';
|
392 |
+
if(in_array('wpsc_merchant_paypal_pro',(array)get_option('custom_gateway_options'))) {
|
393 |
+
$curryear = date('Y');
|
394 |
+
|
395 |
+
//generate year options
|
396 |
+
for($i=0; $i < 7; $i++){
|
397 |
+
$years .= "<option value='".$curryear."'>".$curryear."</option>\r\n";
|
398 |
+
$curryear++;
|
399 |
+
}
|
400 |
+
|
401 |
+
$gateway_checkout_form_fields[$nzshpcrt_gateways[$num]['internalname']] = "
|
402 |
+
<tr>
|
403 |
+
<td class='wpsc_CC_details'>Credit Card Number *</td>
|
404 |
+
<td>
|
405 |
+
<input type='text' value='' name='card_number' />
|
406 |
+
</td>
|
407 |
+
</tr>
|
408 |
+
<tr>
|
409 |
+
<td class='wpsc_CC_details'>Credit Card Expiry *</td>
|
410 |
+
<td>
|
411 |
+
<select class='wpsc_ccBox' name='expiry[month]'>
|
412 |
+
".$months."
|
413 |
+
<option value='01'>01</option>
|
414 |
+
<option value='02'>02</option>
|
415 |
+
<option value='03'>03</option>
|
416 |
+
<option value='04'>04</option>
|
417 |
+
<option value='05'>05</option>
|
418 |
+
<option value='06'>06</option>
|
419 |
+
<option value='07'>07</option>
|
420 |
+
<option value='08'>08</option>
|
421 |
+
<option value='09'>09</option>
|
422 |
+
<option value='10'>10</option>
|
423 |
+
<option value='11'>11</option>
|
424 |
+
<option value='12'>12</option>
|
425 |
+
</select>
|
426 |
+
<select class='wpsc_ccBox' name='expiry[year]'>
|
427 |
+
".$years."
|
428 |
+
</select>
|
429 |
+
</td>
|
430 |
+
</tr>
|
431 |
+
<tr>
|
432 |
+
<td class='wpsc_CC_details'>CVV *</td>
|
433 |
+
<td><input type='text' size='4' value='' maxlength='4' name='card_code' />
|
434 |
+
</td>
|
435 |
+
</tr>
|
436 |
+
<tr>
|
437 |
+
<td>Card Type *</td>
|
438 |
+
<td>
|
439 |
+
<select class='wpsc_ccBox' name='cctype'>
|
440 |
+
<option value='Visa'>Visa</option>
|
441 |
+
<option value='Mastercard'>MasterCard</option>
|
442 |
+
<option value='Discover'>Discover</option>
|
443 |
+
<option value='Amex'>Amex</option>
|
444 |
+
</select>
|
445 |
+
</td>
|
446 |
+
</tr>
|
447 |
+
";
|
448 |
+
}
|
449 |
+
|
450 |
+
|
451 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
?>
|
merchants/testmode.merchant.php
CHANGED
@@ -1,56 +1,56 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* WP eCommerce Test Merchant Gateway
|
5 |
-
* This is the file for the test merchant gateway
|
6 |
-
*
|
7 |
-
* @package wp-e-comemrce
|
8 |
-
* @since 3.7.6
|
9 |
-
* @subpackage wpsc-merchants
|
10 |
-
*/
|
11 |
-
|
12 |
-
$nzshpcrt_gateways[$num] = array(
|
13 |
-
'name' => 'Test Gateway',
|
14 |
-
'api_version' => 2.0,
|
15 |
-
'class_name' => 'wpsc_merchant_testmode',
|
16 |
-
'has_recurring_billing' => true,
|
17 |
-
'wp_admin_cannot_cancel' => false,
|
18 |
-
'requirements' => array(
|
19 |
-
/// so that you can restrict merchant modules to PHP 5, if you use PHP 5 features
|
20 |
-
///'php_version' => 5.0,
|
21 |
-
),
|
22 |
-
|
23 |
-
'form' => 'form_testmode',
|
24 |
-
|
25 |
-
// this may be legacy, not yet decided
|
26 |
-
'internalname' => 'wpsc_merchant_testmode',
|
27 |
-
);
|
28 |
-
|
29 |
-
class wpsc_merchant_testmode extends wpsc_merchant {
|
30 |
-
|
31 |
-
var $name = 'Test Gateway';
|
32 |
-
|
33 |
-
function submit() {
|
34 |
-
$this->set_purchase_processed_by_purchid(2);
|
35 |
-
|
36 |
-
$this->go_to_transaction_results($this->cart_data['session_id']);
|
37 |
-
|
38 |
-
exit();
|
39 |
-
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
function form_testmode() {
|
44 |
-
$output = "<tr>\n\r";
|
45 |
-
$output .= " <td colspan='2'>\n\r";
|
46 |
-
// $output = " </td>\n\r";
|
47 |
-
// $output = " <td>\n\r";
|
48 |
-
|
49 |
-
$output .= "<strong>".__('Enter the payment instructions that you wish to display to your customers when they make a purchase', 'wpsc').":</strong><br />\n\r";
|
50 |
-
$output .= "<textarea cols='40' rows='9' name='wpsc_options[payment_instructions]'>".get_option('payment_instructions')."</textarea><br />\n\r";
|
51 |
-
$output .= "<em>".__('For example, this is where you the Shop Owner might enter your bank account details or address so that your customer can make their manual payment.', 'wpsc')."</em>\n\r";
|
52 |
-
$output .= " </td>\n\r";
|
53 |
-
$output .= "</tr>\n\r";
|
54 |
-
|
55 |
-
return $output;
|
56 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WP eCommerce Test Merchant Gateway
|
5 |
+
* This is the file for the test merchant gateway
|
6 |
+
*
|
7 |
+
* @package wp-e-comemrce
|
8 |
+
* @since 3.7.6
|
9 |
+
* @subpackage wpsc-merchants
|
10 |
+
*/
|
11 |
+
|
12 |
+
$nzshpcrt_gateways[$num] = array(
|
13 |
+
'name' => 'Test Gateway',
|
14 |
+
'api_version' => 2.0,
|
15 |
+
'class_name' => 'wpsc_merchant_testmode',
|
16 |
+
'has_recurring_billing' => true,
|
17 |
+
'wp_admin_cannot_cancel' => false,
|
18 |
+
'requirements' => array(
|
19 |
+
/// so that you can restrict merchant modules to PHP 5, if you use PHP 5 features
|
20 |
+
///'php_version' => 5.0,
|
21 |
+
),
|
22 |
+
|
23 |
+
'form' => 'form_testmode',
|
24 |
+
|
25 |
+
// this may be legacy, not yet decided
|
26 |
+
'internalname' => 'wpsc_merchant_testmode',
|
27 |
+
);
|
28 |
+
|
29 |
+
class wpsc_merchant_testmode extends wpsc_merchant {
|
30 |
+
|
31 |
+
var $name = 'Test Gateway';
|
32 |
+
|
33 |
+
function submit() {
|
34 |
+
$this->set_purchase_processed_by_purchid(2);
|
35 |
+
$this->set_transaction_details();
|
36 |
+
$this->go_to_transaction_results($this->cart_data['session_id']);
|
37 |
+
|
38 |
+
exit();
|
39 |
+
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
function form_testmode() {
|
44 |
+
$output = "<tr>\n\r";
|
45 |
+
$output .= " <td colspan='2'>\n\r";
|
46 |
+
// $output = " </td>\n\r";
|
47 |
+
// $output = " <td>\n\r";
|
48 |
+
|
49 |
+
$output .= "<strong>".__('Enter the payment instructions that you wish to display to your customers when they make a purchase', 'wpsc').":</strong><br />\n\r";
|
50 |
+
$output .= "<textarea cols='40' rows='9' name='wpsc_options[payment_instructions]'>".stripslashes(get_option('payment_instructions'))."</textarea><br />\n\r";
|
51 |
+
$output .= "<em>".__('For example, this is where you the Shop Owner might enter your bank account details or address so that your customer can make their manual payment.', 'wpsc')."</em>\n\r";
|
52 |
+
$output .= " </td>\n\r";
|
53 |
+
$output .= "</tr>\n\r";
|
54 |
+
|
55 |
+
return $output;
|
56 |
}
|
shipping/flatrate.php
CHANGED
@@ -109,7 +109,7 @@ class flatrate {
|
|
109 |
if (strlen($flatrates['local']) > 0) $shipping_quotes["Local Shipping"] = (float)$flatrates['local'];
|
110 |
break;
|
111 |
}
|
112 |
-
if($_SESSION['quote_shipping_method'] == $this->internal_name) {
|
113 |
$shipping_options = array_keys($shipping_quotes);
|
114 |
if(array_search($_SESSION['quote_shipping_option'], $shipping_options) === false) {
|
115 |
$_SESSION['quote_shipping_option'] = null;
|
@@ -122,7 +122,9 @@ class flatrate {
|
|
122 |
|
123 |
|
124 |
function get_item_shipping(&$cart_item) {
|
|
|
125 |
global $wpdb, $wpsc_cart;
|
|
|
126 |
$unit_price = $cart_item->unit_price;
|
127 |
$quantity = $cart_item->quantity;
|
128 |
$weight = $cart_item->weight;
|
@@ -148,11 +150,16 @@ class flatrate {
|
|
148 |
//$product_list = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='{$product_id}' LIMIT 1",ARRAY_A);
|
149 |
if($cart_item->uses_shipping == true) {
|
150 |
//if the item has shipping
|
151 |
-
$
|
152 |
-
if($
|
|
|
|
|
|
|
153 |
$additional_shipping = $shipping_values['local'];
|
154 |
} else {
|
155 |
-
$
|
|
|
|
|
156 |
}
|
157 |
$shipping = $quantity * $additional_shipping;
|
158 |
} else {
|
@@ -171,4 +178,4 @@ class flatrate {
|
|
171 |
}
|
172 |
}
|
173 |
$flatrate = new flatrate();
|
174 |
-
$wpsc_shipping_modules[$flatrate->getInternalName()] = $flatrate;
|
109 |
if (strlen($flatrates['local']) > 0) $shipping_quotes["Local Shipping"] = (float)$flatrates['local'];
|
110 |
break;
|
111 |
}
|
112 |
+
if(isset($_SESSION['quote_shipping_method']) && $_SESSION['quote_shipping_method'] == $this->internal_name) {
|
113 |
$shipping_options = array_keys($shipping_quotes);
|
114 |
if(array_search($_SESSION['quote_shipping_option'], $shipping_options) === false) {
|
115 |
$_SESSION['quote_shipping_option'] = null;
|
122 |
|
123 |
|
124 |
function get_item_shipping(&$cart_item) {
|
125 |
+
|
126 |
global $wpdb, $wpsc_cart;
|
127 |
+
|
128 |
$unit_price = $cart_item->unit_price;
|
129 |
$quantity = $cart_item->quantity;
|
130 |
$weight = $cart_item->weight;
|
150 |
//$product_list = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='{$product_id}' LIMIT 1",ARRAY_A);
|
151 |
if($cart_item->uses_shipping == true) {
|
152 |
//if the item has shipping
|
153 |
+
$additional_shipping = '';
|
154 |
+
if(isset($cart_item->meta[0]['shipping'])) {
|
155 |
+
$shipping_values = $cart_item->meta[0]['shipping'];
|
156 |
+
}
|
157 |
+
if(isset($shipping_values['local']) && $country_code == get_option('base_country')) {
|
158 |
$additional_shipping = $shipping_values['local'];
|
159 |
} else {
|
160 |
+
if(isset($shipping_values['international'])) {
|
161 |
+
$additional_shipping = $shipping_values['international'];
|
162 |
+
}
|
163 |
}
|
164 |
$shipping = $quantity * $additional_shipping;
|
165 |
} else {
|
178 |
}
|
179 |
}
|
180 |
$flatrate = new flatrate();
|
181 |
+
$wpsc_shipping_modules[$flatrate->getInternalName()] = $flatrate;
|
shipping/tablerate.php
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<?php
|
2 |
class tablerate {
|
|
|
3 |
var $internal_name, $name;
|
|
|
4 |
function tablerate () {
|
5 |
$this->internal_name = "tablerate";
|
6 |
$this->name="Table Rate";
|
@@ -8,15 +10,6 @@ class tablerate {
|
|
8 |
return true;
|
9 |
}
|
10 |
|
11 |
-
function getId() {
|
12 |
-
// return $this->usps_id;
|
13 |
-
}
|
14 |
-
|
15 |
-
function setId($id) {
|
16 |
-
// $usps_id = $id;
|
17 |
-
// return true;
|
18 |
-
}
|
19 |
-
|
20 |
function getName() {
|
21 |
return $this->name;
|
22 |
}
|
@@ -26,14 +19,16 @@ class tablerate {
|
|
26 |
}
|
27 |
|
28 |
function getForm() {
|
29 |
-
|
30 |
$output.="<tr><th>".__('Total Price', 'wpsc')."</th><th>".__('Shipping Price', 'wpsc')."</th></tr>";
|
31 |
$layers = get_option("table_rate_layers");
|
|
|
32 |
if ($layers != '') {
|
33 |
-
|
|
|
|
|
34 |
$output.="<tr class='rate_row'>
|
35 |
<td>
|
36 |
-
|
37 |
<i style='color: grey;'>".__('If price is ', 'wpsc')."</i>
|
38 |
<input type='text' name='layer[]' value='$key' size='4' />
|
39 |
<i style='color: grey;'> ".__(' and above', 'wpsc')."</i>
|
@@ -42,14 +37,12 @@ class tablerate {
|
|
42 |
".wpsc_get_currency_symbol()."
|
43 |
<input type='text' value='{$shipping}' name='shipping[]' size='4'>
|
44 |
<a href='#' class='delete_button' >".__('Delete', 'wpsc')."</a>
|
45 |
-
|
46 |
</td>
|
47 |
</tr>";
|
48 |
}
|
49 |
}
|
50 |
$output.="<input type='hidden' name='checkpage' value='table'>";
|
51 |
$output.="<tr class='addlayer'><td colspan='2'>Layers: <a href='' style='cursor:pointer;' id='addlayer' >Add Layer</a></td></tr>";
|
52 |
-
// $output.="</table>";
|
53 |
return $output;
|
54 |
}
|
55 |
|
@@ -59,7 +52,7 @@ class tablerate {
|
|
59 |
$layers = (array)$_POST['layer'];
|
60 |
$shippings = (array)$_POST['shipping'];
|
61 |
if ($shippings != '') {
|
62 |
-
foreach($shippings as $key => $price) {
|
63 |
if ($price == '') {
|
64 |
unset($shippings[$key]);
|
65 |
unset($layers[$key]);
|
@@ -68,46 +61,85 @@ class tablerate {
|
|
68 |
}
|
69 |
}
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
71 |
if (!isset($_POST['checkpage'])) $_POST['checkpage'] = '';
|
72 |
if ($_POST['checkpage'] == 'table') {
|
73 |
-
update_option('table_rate_layers'
|
74 |
}
|
75 |
return true;
|
76 |
}
|
77 |
|
78 |
-
function
|
79 |
-
global $wpdb, $wpsc_cart;
|
80 |
-
$shopping_cart = $_SESSION['nzshpcrt_cart'];
|
81 |
|
|
|
|
|
|
|
|
|
82 |
if(is_object($wpsc_cart)) {
|
83 |
$price = $wpsc_cart->calculate_subtotal(true);
|
84 |
}
|
85 |
-
|
86 |
$layers = get_option('table_rate_layers');
|
87 |
|
88 |
-
//echo "<pre>".print_r($layers,true)."</pre>";
|
89 |
-
|
90 |
if ($layers != '') {
|
|
|
|
|
|
|
|
|
91 |
krsort($layers);
|
|
|
92 |
foreach ($layers as $key => $shipping) {
|
|
|
93 |
if ($price >= (float)$key) {
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
|
|
98 |
}
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
}
|
102 |
|
103 |
-
function getQuote() {
|
104 |
-
return $this->getQuotes();
|
105 |
-
}
|
106 |
-
|
107 |
|
108 |
-
function get_item_shipping(
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
if($cart_item->uses_shipping == true) {
|
112 |
//if the item has shipping
|
113 |
$shipping_values = $cart_item->meta[0]['shipping'];
|
@@ -127,21 +159,7 @@ class tablerate {
|
|
127 |
}
|
128 |
}
|
129 |
|
130 |
-
function get_cart_shipping($total_price, $weight) {
|
131 |
-
$layers = get_option('table_rate_layers');
|
132 |
-
if ($layers != '') {
|
133 |
-
krsort($layers);
|
134 |
-
foreach ($layers as $key => $shipping) {
|
135 |
-
if ($total_price >= (float)$key) {
|
136 |
-
$output = $shipping;
|
137 |
-
}
|
138 |
-
}
|
139 |
-
}
|
140 |
-
return $output;
|
141 |
-
}
|
142 |
-
|
143 |
-
|
144 |
}
|
145 |
$tablerate = new tablerate();
|
146 |
$wpsc_shipping_modules[$tablerate->getInternalName()] = $tablerate;
|
147 |
-
?>
|
1 |
<?php
|
2 |
class tablerate {
|
3 |
+
|
4 |
var $internal_name, $name;
|
5 |
+
|
6 |
function tablerate () {
|
7 |
$this->internal_name = "tablerate";
|
8 |
$this->name="Table Rate";
|
10 |
return true;
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
function getName() {
|
14 |
return $this->name;
|
15 |
}
|
19 |
}
|
20 |
|
21 |
function getForm() {
|
22 |
+
|
23 |
$output.="<tr><th>".__('Total Price', 'wpsc')."</th><th>".__('Shipping Price', 'wpsc')."</th></tr>";
|
24 |
$layers = get_option("table_rate_layers");
|
25 |
+
|
26 |
if ($layers != '') {
|
27 |
+
|
28 |
+
foreach ($layers as $key => $shipping) {
|
29 |
+
|
30 |
$output.="<tr class='rate_row'>
|
31 |
<td>
|
|
|
32 |
<i style='color: grey;'>".__('If price is ', 'wpsc')."</i>
|
33 |
<input type='text' name='layer[]' value='$key' size='4' />
|
34 |
<i style='color: grey;'> ".__(' and above', 'wpsc')."</i>
|
37 |
".wpsc_get_currency_symbol()."
|
38 |
<input type='text' value='{$shipping}' name='shipping[]' size='4'>
|
39 |
<a href='#' class='delete_button' >".__('Delete', 'wpsc')."</a>
|
|
|
40 |
</td>
|
41 |
</tr>";
|
42 |
}
|
43 |
}
|
44 |
$output.="<input type='hidden' name='checkpage' value='table'>";
|
45 |
$output.="<tr class='addlayer'><td colspan='2'>Layers: <a href='' style='cursor:pointer;' id='addlayer' >Add Layer</a></td></tr>";
|
|
|
46 |
return $output;
|
47 |
}
|
48 |
|
52 |
$layers = (array)$_POST['layer'];
|
53 |
$shippings = (array)$_POST['shipping'];
|
54 |
if ($shippings != '') {
|
55 |
+
foreach ($shippings as $key => $price) {
|
56 |
if ($price == '') {
|
57 |
unset($shippings[$key]);
|
58 |
unset($layers[$key]);
|
61 |
}
|
62 |
}
|
63 |
}
|
64 |
+
// Sort the data before it goes into the database. Makes the UI make more sense
|
65 |
+
if (isset($new_layer)) {
|
66 |
+
krsort($new_layer);
|
67 |
+
}
|
68 |
+
|
69 |
if (!isset($_POST['checkpage'])) $_POST['checkpage'] = '';
|
70 |
if ($_POST['checkpage'] == 'table') {
|
71 |
+
update_option('table_rate_layers', $new_layer);
|
72 |
}
|
73 |
return true;
|
74 |
}
|
75 |
|
76 |
+
function getQuote() {
|
|
|
|
|
77 |
|
78 |
+
global $wpdb, $wpsc_cart;
|
79 |
+
if(isset($_SESSION['nzshpcrt_cart'])) {
|
80 |
+
$shopping_cart = $_SESSION['nzshpcrt_cart'];
|
81 |
+
}
|
82 |
if(is_object($wpsc_cart)) {
|
83 |
$price = $wpsc_cart->calculate_subtotal(true);
|
84 |
}
|
85 |
+
|
86 |
$layers = get_option('table_rate_layers');
|
87 |
|
|
|
|
|
88 |
if ($layers != '') {
|
89 |
+
|
90 |
+
// At some point we should probably remove this as the sorting should be
|
91 |
+
// done when we save the data to the database. But need to leave it here
|
92 |
+
// for people who have non-sorted settings in their database
|
93 |
krsort($layers);
|
94 |
+
|
95 |
foreach ($layers as $key => $shipping) {
|
96 |
+
|
97 |
if ($price >= (float)$key) {
|
98 |
+
|
99 |
+
if (stristr($shipping, '%')) {
|
100 |
+
|
101 |
+
// Shipping should be a % of the cart total
|
102 |
+
$shipping = str_replace('%','',$shipping);
|
103 |
+
$shipping_amount = $price * ( $shipping / 100 );
|
104 |
+
|
105 |
+
} else {
|
106 |
+
|
107 |
+
// Shipping is an absolute value
|
108 |
+
$shipping_amount = $shipping;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
return array("Table Rate"=>$shipping_amount);
|
113 |
+
|
114 |
}
|
115 |
+
|
116 |
}
|
117 |
+
|
118 |
+
$shipping = array_shift($layers);
|
119 |
+
|
120 |
+
if (stristr($shipping, '%')) {
|
121 |
+
$shipping = str_replace('%','',$shipping);
|
122 |
+
$shipping_amount = $price * ( $shipping / 100 );
|
123 |
+
} else {
|
124 |
+
$shipping_amount = $shipping;
|
125 |
+
}
|
126 |
+
|
127 |
+
return array("Table Rate"=>$shipping_amount);
|
128 |
+
|
129 |
}
|
130 |
}
|
131 |
|
|
|
|
|
|
|
|
|
132 |
|
133 |
+
function get_item_shipping(&$cart_item) {
|
134 |
+
|
135 |
+
global $wpdb, $wpsc_cart;
|
136 |
+
|
137 |
+
$unit_price = $cart_item->unit_price;
|
138 |
+
$quantity = $cart_item->quantity;
|
139 |
+
$weight = $cart_item->weight;
|
140 |
+
$product_id = $cart_item->product_id;
|
141 |
+
|
142 |
+
if(is_numeric($product_id) && (get_option('do_not_use_shipping') != 1) && (isset($_SESSION['quote_shipping_method']) && $_SESSION['quote_shipping_method'] == 'flatrate')) {
|
143 |
if($cart_item->uses_shipping == true) {
|
144 |
//if the item has shipping
|
145 |
$shipping_values = $cart_item->meta[0]['shipping'];
|
159 |
}
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
}
|
163 |
$tablerate = new tablerate();
|
164 |
$wpsc_shipping_modules[$tablerate->getInternalName()] = $tablerate;
|
165 |
+
?>
|
shipping/weightrate.php
CHANGED
@@ -78,7 +78,7 @@ class weightrate {
|
|
78 |
}
|
79 |
}
|
80 |
|
81 |
-
function get_item_shipping(
|
82 |
return 0;
|
83 |
}
|
84 |
|
@@ -96,4 +96,4 @@ class weightrate {
|
|
96 |
}
|
97 |
}
|
98 |
$weightrate = new weightrate();
|
99 |
-
$wpsc_shipping_modules[$weightrate->getInternalName()] = $weightrate;
|
78 |
}
|
79 |
}
|
80 |
|
81 |
+
function get_item_shipping(&$cart_item) {
|
82 |
return 0;
|
83 |
}
|
84 |
|
96 |
}
|
97 |
}
|
98 |
$weightrate = new weightrate();
|
99 |
+
$wpsc_shipping_modules[$weightrate->getInternalName()] = $weightrate;
|
shopping_cart_functions.php
CHANGED
@@ -9,11 +9,11 @@ function wpsc_shopping_cart($input = null, $override_state = null) {
|
|
9 |
|
10 |
|
11 |
if(get_option('show_sliding_cart') == 1) {
|
12 |
-
if(is_numeric($_SESSION['slider_state'])) {
|
13 |
if($_SESSION['slider_state'] == 0) { $collapser_image = 'plus.png'; } else { $collapser_image = 'minus.png'; }
|
14 |
$fancy_collapser = "<a href='#' onclick='return shopping_cart_collapser()' id='fancy_collapser_link'><img src='".WPSC_URL."/images/$collapser_image' title='' alt='' id='fancy_collapser' /></a>";
|
15 |
} else {
|
16 |
-
if($_SESSION['nzshpcrt_cart']
|
17 |
$fancy_collapser = "<a href='#' onclick='return shopping_cart_collapser()' id='fancy_collapser_link'><img src='".WPSC_URL."/images/$collapser_image' title='' alt='' id='fancy_collapser' /></a>";
|
18 |
}
|
19 |
} else {
|
@@ -37,9 +37,7 @@ function wpsc_shopping_cart($input = null, $override_state = null) {
|
|
37 |
echo "<div id='widgetshoppingcart'>";
|
38 |
echo "<h3>".__('Shopping Cart')."$fancy_collapser</h3>";
|
39 |
echo " <div id='shoppingcartcontents'>";
|
40 |
-
if (isset($cart)) {
|
41 |
echo wpsc_shopping_basket_internals($cart,false,true);
|
42 |
-
}
|
43 |
echo " </div>";
|
44 |
echo "</div>";
|
45 |
$dont_add_input = true;
|
@@ -47,13 +45,20 @@ function wpsc_shopping_cart($input = null, $override_state = null) {
|
|
47 |
echo "<div id='sideshoppingcart'>";
|
48 |
echo "<h3>".__('Shopping Cart')."$fancy_collapser</h3>";
|
49 |
echo " <div id='shoppingcartcontents'>";
|
50 |
-
|
|
|
|
|
51 |
echo " </div>";
|
52 |
echo "</div>";
|
53 |
}
|
54 |
} else {
|
55 |
-
if(($GLOBALS['nzshpcrt_activateshpcrt'] === true)) {
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
57 |
echo "<div id='shoppingcart'>";
|
58 |
echo "<h3>".__('Shopping Cart')."$fancy_collapser</h3>";
|
59 |
echo " <div id='shoppingcartcontents'>";
|
@@ -80,11 +85,12 @@ function wpsc_shopping_basket_internals($cart,$quantity_limit = false, $no_title
|
|
80 |
$cur_wpsc_theme_folder = apply_filters('wpsc_theme_folder',$wpsc_theme_path.WPSC_THEME_DIR);
|
81 |
include_once($cur_wpsc_theme_folder."/cart_widget.php");
|
82 |
echo " </div>";
|
83 |
-
|
84 |
}
|
85 |
|
86 |
function wpsc_country_region_list($form_id = null, $ajax = false , $selected_country = null, $selected_region = null, $supplied_form_id = null, $checkoutfields = false) {
|
87 |
global $wpdb;
|
|
|
88 |
if($selected_country == null) {
|
89 |
$selected_country = get_option('base_country');
|
90 |
}
|
9 |
|
10 |
|
11 |
if(get_option('show_sliding_cart') == 1) {
|
12 |
+
if(isset($_SESSION['slider_state']) && is_numeric($_SESSION['slider_state'])) {
|
13 |
if($_SESSION['slider_state'] == 0) { $collapser_image = 'plus.png'; } else { $collapser_image = 'minus.png'; }
|
14 |
$fancy_collapser = "<a href='#' onclick='return shopping_cart_collapser()' id='fancy_collapser_link'><img src='".WPSC_URL."/images/$collapser_image' title='' alt='' id='fancy_collapser' /></a>";
|
15 |
} else {
|
16 |
+
if(isset($_SESSION['nzshpcrt_cart'])) { $collapser_image = 'minus.png';} else { $collapser_image = 'plus.png'; }
|
17 |
$fancy_collapser = "<a href='#' onclick='return shopping_cart_collapser()' id='fancy_collapser_link'><img src='".WPSC_URL."/images/$collapser_image' title='' alt='' id='fancy_collapser' /></a>";
|
18 |
}
|
19 |
} else {
|
37 |
echo "<div id='widgetshoppingcart'>";
|
38 |
echo "<h3>".__('Shopping Cart')."$fancy_collapser</h3>";
|
39 |
echo " <div id='shoppingcartcontents'>";
|
|
|
40 |
echo wpsc_shopping_basket_internals($cart,false,true);
|
|
|
41 |
echo " </div>";
|
42 |
echo "</div>";
|
43 |
$dont_add_input = true;
|
45 |
echo "<div id='sideshoppingcart'>";
|
46 |
echo "<h3>".__('Shopping Cart')."$fancy_collapser</h3>";
|
47 |
echo " <div id='shoppingcartcontents'>";
|
48 |
+
if (isset($cart)) {
|
49 |
+
echo wpsc_shopping_basket_internals($cart,false,true);
|
50 |
+
}
|
51 |
echo " </div>";
|
52 |
echo "</div>";
|
53 |
}
|
54 |
} else {
|
55 |
+
if((isset($GLOBALS['nzshpcrt_activateshpcrt']) && $GLOBALS['nzshpcrt_activateshpcrt'] === true)) {
|
56 |
+
|
57 |
+
$cart = $GLOBALS['nzshpcrt_activateshpcrt'];
|
58 |
+
|
59 |
+
if(isset($_SESSION['nzshpcrt_cart'])) {
|
60 |
+
$cart = $_SESSION['nzshpcrt_cart'];
|
61 |
+
}
|
62 |
echo "<div id='shoppingcart'>";
|
63 |
echo "<h3>".__('Shopping Cart')."$fancy_collapser</h3>";
|
64 |
echo " <div id='shoppingcartcontents'>";
|
85 |
$cur_wpsc_theme_folder = apply_filters('wpsc_theme_folder',$wpsc_theme_path.WPSC_THEME_DIR);
|
86 |
include_once($cur_wpsc_theme_folder."/cart_widget.php");
|
87 |
echo " </div>";
|
88 |
+
return $output;
|
89 |
}
|
90 |
|
91 |
function wpsc_country_region_list($form_id = null, $ajax = false , $selected_country = null, $selected_region = null, $supplied_form_id = null, $checkoutfields = false) {
|
92 |
global $wpdb;
|
93 |
+
$output = '';
|
94 |
if($selected_country == null) {
|
95 |
$selected_country = get_option('base_country');
|
96 |
}
|
themes/default/checkout.php
CHANGED
@@ -108,7 +108,7 @@ get_header(); ?>
|
|
108 |
<?php do_action('wpsc_before_shipping_of_shopping_cart'); ?>
|
109 |
<div id='wpsc_shopping_cart_container'>
|
110 |
<?php if(wpsc_uses_shipping()) : ?>
|
111 |
-
<h2><?php
|
112 |
<table class="productcart">
|
113 |
<tr>
|
114 |
<td colspan='5'>
|
108 |
<?php do_action('wpsc_before_shipping_of_shopping_cart'); ?>
|
109 |
<div id='wpsc_shopping_cart_container'>
|
110 |
<?php if(wpsc_uses_shipping()) : ?>
|
111 |
+
<h2><?php _e('Calculate Shipping Price', 'wpsc'); ?></h2>
|
112 |
<table class="productcart">
|
113 |
<tr>
|
114 |
<td colspan='5'>
|
themes/default/products_page.php
CHANGED
@@ -91,7 +91,7 @@ global $wpsc_query, $wpdb;
|
|
91 |
<?php if(get_option('show_thumbnails')) :?>
|
92 |
<div class="imagecol">
|
93 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
94 |
-
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="
|
95 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>"/>
|
96 |
</a>
|
97 |
<?php else: ?>
|
91 |
<?php if(get_option('show_thumbnails')) :?>
|
92 |
<div class="imagecol">
|
93 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
94 |
+
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="<?php echo wpsc_the_product_image_link_classes(); ?>" href="<?php echo wpsc_the_product_image(); ?>">
|
95 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>"/>
|
96 |
</a>
|
97 |
<?php else: ?>
|
themes/default/shopping_cart_page.php
CHANGED
@@ -2,436 +2,440 @@
|
|
2 |
global $wpsc_cart, $wpdb, $wpsc_checkout, $wpsc_gateway, $wpsc_coupons;
|
3 |
$wpsc_checkout = new wpsc_checkout();
|
4 |
$wpsc_gateway = new wpsc_gateways();
|
5 |
-
|
|
|
|
|
6 |
//echo "<pre>".print_r($wpsc_cart, true)."</pre>";
|
7 |
// //echo "<pre>".print_r($wpsc_checkout, true)."</pre>";
|
8 |
if(wpsc_cart_item_count() > 0) :
|
9 |
?>
|
10 |
<p><?php echo __('Please review your order', 'wpsc'); ?></p>
|
11 |
<table class="productcart">
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
|
59 |
if(wpsc_uses_coupons()): ?>
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
|
|
|
|
210 |
|
211 |
<!--
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-->
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
//
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
echo get_option('siteurl')."?termsandconds=true&width=360&height=400'"; ?>' class='termsandconds'><?php echo __('Terms and Conditions', 'wpsc');?></a>
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
|
410 |
<!-- div for make purchase button -->
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
|
422 |
-
|
423 |
-
<?php echo __('If you have just registered, please check your email and login before you make your purchase', 'wpsc');?>
|
424 |
-
</td>
|
425 |
-
<?php endif; */?>
|
426 |
-
</span>
|
427 |
-
</div>
|
428 |
</form>
|
429 |
</div>
|
430 |
-
|
431 |
-
<div class='clear'></div>
|
432 |
<?php
|
433 |
else:
|
434 |
-
|
435 |
endif;
|
436 |
do_action('wpsc_bottom_of_shopping_cart');
|
437 |
-
?>
|
2 |
global $wpsc_cart, $wpdb, $wpsc_checkout, $wpsc_gateway, $wpsc_coupons;
|
3 |
$wpsc_checkout = new wpsc_checkout();
|
4 |
$wpsc_gateway = new wpsc_gateways();
|
5 |
+
if(isset($_SESSION['coupon_numbers'])){
|
6 |
+
$wpsc_coupons = new wpsc_coupons($_SESSION['coupon_numbers']);
|
7 |
+
}
|
8 |
//echo "<pre>".print_r($wpsc_cart, true)."</pre>";
|
9 |
// //echo "<pre>".print_r($wpsc_checkout, true)."</pre>";
|
10 |
if(wpsc_cart_item_count() > 0) :
|
11 |
?>
|
12 |
<p><?php echo __('Please review your order', 'wpsc'); ?></p>
|
13 |
<table class="productcart">
|
14 |
+
<tr class="firstrow">
|
15 |
+
<td class='firstcol'></td>
|
16 |
+
<td><?php echo __('Product', 'wpsc'); ?>:</td>
|
17 |
+
<td><?php echo __('Quantity', 'wpsc'); ?>:</td>
|
18 |
+
<?php if(wpsc_uses_shipping()): ?>
|
19 |
+
<!-- <td><?php //echo __('Shipping', 'wpsc'); ?>:</td> -->
|
20 |
+
<?php endif; ?>
|
21 |
+
<td><?php echo __('Price', 'wpsc'); ?>:</td>
|
22 |
+
|
23 |
+
<td></td>
|
24 |
+
</tr>
|
25 |
+
<?php while (wpsc_have_cart_items()) : wpsc_the_cart_item(); ?>
|
26 |
+
|
27 |
+
<?php //this displays the confirm your order html ?>
|
28 |
+
|
29 |
+
<tr class="product_row product_row_<?php echo wpsc_the_cart_item_key(); ?>">
|
30 |
+
<td class="firstcol wpsc_product_image wpsc_product_image_<?php echo wpsc_the_cart_item_key(); ?>"><img src='<?php echo wpsc_cart_item_image(48,48); ?>' alt='<?php echo wpsc_cart_item_name(); ?>' title='<?php echo wpsc_cart_item_name(); ?>' /></td>
|
31 |
+
<td class="firstcol wpsc_product_name wpsc_product_name_<?php echo wpsc_the_cart_item_key(); ?>">
|
32 |
+
<a href='<?php echo wpsc_cart_item_url();?>'><?php echo wpsc_cart_item_name(); ?></a>
|
33 |
+
</td>
|
34 |
+
<td class='wpsc_product_quantity wpsc_product_quantity_<?php echo wpsc_the_cart_item_key(); ?>'>
|
35 |
+
<form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform">
|
36 |
+
<input type="text" name="quantity" size="2" value="<?php echo wpsc_cart_item_quantity(); ?>" />
|
37 |
+
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
|
38 |
+
<input type="hidden" name="wpsc_update_quantity" value="true" />
|
39 |
+
<input type="submit" value="<?php echo __('Update', 'wpsc'); ?>" name="submit" />
|
40 |
+
</form>
|
41 |
+
</td>
|
42 |
+
<?php if(wpsc_uses_shipping()): ?>
|
43 |
+
|
44 |
+
<?php endif; ?>
|
45 |
+
<td class='wpsc_product_price wpsc_product_price_<?php echo wpsc_the_cart_item_key(); ?>'><span class="pricedisplay"><?php echo wpsc_cart_item_price(); ?></span></td>
|
46 |
+
|
47 |
+
<td class='wpsc_product_remove wpsc_product_remove_<?php echo wpsc_the_cart_item_key(); ?>'>
|
48 |
+
<form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform">
|
49 |
+
<input type="hidden" name="quantity" value="0" />
|
50 |
+
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
|
51 |
+
<input type="hidden" name="wpsc_update_quantity" value="true" />
|
52 |
+
<button class='remove_button' type="submit"><span><?php echo __('Remove', 'wpsc'); ?></span></button>
|
53 |
+
</form>
|
54 |
+
</td>
|
55 |
+
</tr>
|
56 |
+
<?php endwhile; ?>
|
57 |
+
<?php //this HTML displays coupons if there are any active coupons to use ?>
|
58 |
+
|
59 |
+
<?php //echo "<pre>"; print_r($wpsc_cart); echo "</pre>"; echo "total cart weight: ".wpsc_cart_weight_total();
|
60 |
|
61 |
if(wpsc_uses_coupons()): ?>
|
62 |
+
|
63 |
+
<?php if(wpsc_coupons_error()): ?>
|
64 |
+
<tr class='wpsc_coupon_error_row'><td><?php echo __('Coupon is not valid.', 'wpsc'); ?></td></tr>
|
65 |
+
<?php endif; ?>
|
66 |
+
<tr class='wpsc_coupon_row'>
|
67 |
+
<td colspan="2"><?php _e('Enter your coupon number'); ?> :</td>
|
68 |
+
<td colspan="3" align='left'>
|
69 |
+
<form method='post' action="<?php echo get_option('shopping_cart_url'); ?>">
|
70 |
+
<input type='text' name='coupon_num' id='coupon_num' value='<?php echo $wpsc_cart->coupons_name; ?>' />
|
71 |
+
<input type='submit' value='<?php echo __('Update', 'wpsc') ?>' />
|
72 |
+
</form>
|
73 |
+
</td>
|
74 |
+
</tr>
|
75 |
+
<?php endif; ?>
|
76 |
+
</table>
|
77 |
+
<p class='wpsc_cost_before'><?php _e('Cost before shipping = ','wpsc'); ?> <?php echo wpsc_cart_total_widget(false,false,false);?></p>
|
78 |
+
<?php //this HTML dispalys the calculate your order HTML ?>
|
79 |
+
|
80 |
+
<?php if(isset($_SESSION['nocamsg']) && isset($_GET['noca']) && $_GET['noca'] == 'confirm'): ?>
|
81 |
+
<p class='validation-error'><?php echo $_SESSION['nocamsg']; ?></p>
|
82 |
+
<?php endif; ?>
|
83 |
+
<?php if(isset($_SESSION['categoryAndShippingCountryConflict']) && $_SESSION['categoryAndShippingCountryConflict'] != '') : ?>
|
84 |
+
<p class='validation-error'><?php echo $_SESSION['categoryAndShippingCountryConflict']; ?></p>
|
85 |
+
<?php
|
86 |
+
endif;
|
87 |
+
|
88 |
+
if(isset($_SESSION['WpscGatewayErrorMessage']) && $_SESSION['WpscGatewayErrorMessage'] != '') :
|
89 |
+
?>
|
90 |
+
<p class='validation-error'><?php echo $_SESSION['WpscGatewayErrorMessage']; ?></p>
|
91 |
+
<?php
|
92 |
+
endif;
|
93 |
+
?>
|
94 |
+
<?php do_action('wpsc_before_shipping_of_shopping_cart'); ?>
|
95 |
+
<div id='wpsc_shopping_cart_container'>
|
96 |
+
<?php if(wpsc_uses_shipping()) : ?>
|
97 |
+
<h2><?php _e('Calculate Shipping Price', 'wpsc'); ?></h2>
|
98 |
+
<table class="productcart">
|
99 |
+
<tr class='wpsc_shipping_info'>
|
100 |
+
<td colspan='5'>
|
101 |
+
<?php echo __('Please choose a country below to calculate your shipping costs', 'wpsc'); ?>
|
102 |
+
</td>
|
103 |
+
</tr>
|
104 |
+
|
105 |
+
<?php if (!wpsc_have_shipping_quote()) : // No valid shipping quotes ?>
|
106 |
+
<?php if (($_SESSION['wpsc_zipcode'] == '') || ($_SESSION['wpsc_zipcode'] == 'Your Zipcode')) : // No valid shipping quotes ?>
|
107 |
+
<?php if ($_SESSION['wpsc_update_location'] == true) :?>
|
108 |
+
<tr class='wpsc_update_location'>
|
109 |
+
<td colspan='5' class='shipping_error' >
|
110 |
+
<?php echo __('Please provide a Zipcode and click Calculate in order to continue.', 'wpsc'); ?>
|
111 |
+
</td>
|
112 |
+
</tr>
|
113 |
+
<?php endif; ?>
|
114 |
+
<?php else: ?>
|
115 |
+
<tr class='wpsc_update_location_error'>
|
116 |
+
<td colspan='5' class='shipping_error' >
|
117 |
+
<?php echo __('Sorry, online ordering is unavailable to this destination and/or weight. Please double check your destination details.', 'wpsc'); ?>
|
118 |
+
</td>
|
119 |
+
</tr>
|
120 |
+
<?php endif; ?>
|
121 |
+
<?php endif; ?>
|
122 |
+
<tr class='wpsc_change_country'>
|
123 |
+
<td colspan='5'>
|
124 |
+
<form name='change_country' id='change_country' action='' method='post'>
|
125 |
+
<?php echo wpsc_shipping_country_list();?>
|
126 |
+
<input type='hidden' name='wpsc_update_location' value='true' />
|
127 |
+
<input type='submit' name='wpsc_submit_zipcode' value='Calculate' />
|
128 |
+
</form>
|
129 |
+
</td>
|
130 |
+
</tr>
|
131 |
+
|
132 |
+
<?php if (wpsc_have_morethanone_shipping_quote()) :?>
|
133 |
+
<?php while (wpsc_have_shipping_methods()) : wpsc_the_shipping_method(); ?>
|
134 |
+
<?php if (!wpsc_have_shipping_quotes()) { continue; } // Don't display shipping method if it doesn't have at least one quote ?>
|
135 |
+
<tr class='wpsc_shipping_header'><td class='shipping_header' colspan='5'><?php echo wpsc_shipping_method_name().__('- Choose a Shipping Rate', 'wpsc'); ?> </td></tr>
|
136 |
+
<?php while (wpsc_have_shipping_quotes()) : wpsc_the_shipping_quote(); ?>
|
137 |
+
<tr class='<?php echo wpsc_shipping_quote_html_id(); ?>'>
|
138 |
+
<td class='wpsc_shipping_quote_name wpsc_shipping_quote_name_<?php echo wpsc_shipping_quote_html_id(); ?>' colspan='3'>
|
139 |
+
<label for='<?php echo wpsc_shipping_quote_html_id(); ?>'><?php echo wpsc_shipping_quote_name(); ?></label>
|
140 |
+
</td>
|
141 |
+
<td class='wpsc_shipping_quote_price wpsc_shipping_quote_price_<?php echo wpsc_shipping_quote_html_id(); ?>' style='text-align:center;'>
|
142 |
+
<label for='<?php echo wpsc_shipping_quote_html_id(); ?>'><?php echo wpsc_shipping_quote_value(); ?></label>
|
143 |
+
</td>
|
144 |
+
<td class='wpsc_shipping_quote_radio wpsc_shipping_quote_radio_<?php echo wpsc_shipping_quote_html_id(); ?>' style='text-align:center;'>
|
145 |
+
<?php if(wpsc_have_morethanone_shipping_methods_and_quotes()): ?>
|
146 |
+
<input type='radio' id='<?php echo wpsc_shipping_quote_html_id(); ?>' <?php echo wpsc_shipping_quote_selected_state(); ?> onclick='switchmethod("<?php echo wpsc_shipping_quote_name(); ?>", "<?php echo wpsc_shipping_method_internal_name(); ?>")' value='<?php echo wpsc_shipping_quote_value(true); ?>' name='shipping_method' />
|
147 |
+
<?php else: ?>
|
148 |
+
<input <?php echo wpsc_shipping_quote_selected_state(); ?> disabled='disabled' type='radio' id='<?php echo wpsc_shipping_quote_html_id(); ?>' value='<?php echo wpsc_shipping_quote_value(true); ?>' name='shipping_method' />
|
149 |
+
<?php wpsc_update_shipping_single_method(); ?>
|
150 |
+
<?php endif; ?>
|
151 |
+
</td>
|
152 |
+
</tr>
|
153 |
+
<?php endwhile; ?>
|
154 |
+
<?php endwhile; ?>
|
155 |
+
<?php endif; ?>
|
156 |
+
|
157 |
+
<?php wpsc_update_shipping_multiple_methods(); ?>
|
158 |
+
|
159 |
+
|
160 |
+
<?php if (!wpsc_have_shipping_quote()) : // No valid shipping quotes ?>
|
161 |
+
</table>
|
162 |
+
</div>
|
163 |
+
<?php return; ?>
|
164 |
+
<?php endif; ?>
|
165 |
+
</table>
|
166 |
+
<?php endif; ?>
|
167 |
+
|
168 |
+
<table class="productcart">
|
169 |
+
<?php if(wpsc_cart_tax(false) > 0) : ?>
|
170 |
+
<tr class="total_price total_tax">
|
171 |
+
<td colspan="3">
|
172 |
+
<?php echo wpsc_display_tax_label(true); ?>
|
173 |
+
|
174 |
+
</td>
|
175 |
+
<td colspan="2">
|
176 |
+
<span id="checkout_tax" class="pricedisplay checkout-tax"><?php echo wpsc_cart_tax(); ?></span>
|
177 |
+
</td>
|
178 |
+
</tr>
|
179 |
+
<?php endif; ?>
|
180 |
+
</table>
|
181 |
+
<?php do_action('wpsc_before_form_of_shopping_cart'); ?>
|
182 |
+
|
183 |
+
<form class='wpsc_checkout_forms' action='' method='post' enctype="multipart/form-data">
|
184 |
+
|
185 |
+
<?php
|
186 |
+
/**
|
187 |
+
* Both the registration forms and the checkout details forms must be in the same form element as they are submitted together, you cannot have two form elements submit together without the use of JavaScript.
|
188 |
+
*/
|
189 |
+
?>
|
190 |
+
|
191 |
+
<?php if(!is_user_logged_in() && get_option('users_can_register') && get_option('require_register')) :
|
192 |
+
global $current_user;
|
193 |
+
get_currentuserinfo(); ?>
|
194 |
+
<h2><?php _e('Not yet a member?');?></h2>
|
195 |
+
<p><?php _e('In order to buy from us, you\'ll need an account. Joining is free and easy. All you need is a username, password and valid email address.');?></p>
|
196 |
+
<?php if(count($_SESSION['wpsc_checkout_user_error_messages']) > 0) : ?>
|
197 |
+
<div class="login_error">
|
198 |
+
<?php
|
199 |
+
foreach($_SESSION['wpsc_checkout_user_error_messages'] as $user_error ) {
|
200 |
+
echo $user_error."<br />\n";
|
201 |
+
}
|
202 |
+
$_SESSION['wpsc_checkout_user_error_messages'] = array();
|
203 |
+
?>
|
204 |
+
</div>
|
205 |
+
<?php endif; ?>
|
206 |
+
|
207 |
+
|
208 |
+
<fieldset class='wpsc_registration_form'>
|
209 |
+
<label><?php _e('Username'); ?>:</label><input type="text" name="log" id="log" value="" size="20"/>
|
210 |
+
<label><?php _e('Password'); ?>:</label><input type="password" name="pwd" id="pwd" value="" size="20" />
|
211 |
+
<label><?php _e('E-mail'); ?>:</label><input type="text" name="user_email" id="user_email" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="20" />
|
212 |
+
</fieldset>
|
213 |
+
<?php endif; ?>
|
214 |
|
215 |
<!--
|
216 |
+
<h2><?php //exit('<pre>'.print_r($_SESSION,true).'</pre>');//echo __('Please enter your contact details:', 'wpsc'); ?></h2>
|
217 |
+
<?php/* echo __('Note, Once you press submit, you will need to have your Credit card handy.', 'wpsc'); <br /> */?>
|
218 |
+
<p><?php //echo __('Fields marked with an asterisk must be filled in.', 'wpsc'); ?></p>
|
219 |
-->
|
220 |
+
<?php
|
221 |
+
if(count($_SESSION['wpsc_checkout_misc_error_messages']) > 0) {
|
222 |
+
echo "<div class='login_error'>\n\r";
|
223 |
+
foreach((array)$_SESSION['wpsc_checkout_misc_error_messages'] as $user_error ) {
|
224 |
+
echo $user_error."<br />\n";
|
225 |
+
}
|
226 |
+
echo "</div>\n\r";
|
227 |
+
}
|
228 |
+
$_SESSION['wpsc_checkout_misc_error_messages'] =array();
|
229 |
+
// wpsc_has_correct_region($_SESSION['wpsc_delivery_country'],$_SESSION['wpsc_delivery_region']);
|
230 |
+
?>
|
231 |
+
<table class='wpsc_checkout_table table-1'>
|
232 |
+
<?php $i = 0; while (wpsc_have_checkout_items()) : wpsc_the_checkout_item(); ?>
|
233 |
+
<?php if(wpsc_checkout_form_is_header() == true) : $i++;?>
|
234 |
+
<?php if($i > 1):?>
|
235 |
+
</table>
|
236 |
+
<table class='wpsc_checkout_table table-<?php echo $i; ?>'>
|
237 |
+
<?php endif; ?>
|
238 |
+
<tr <?php echo wpsc_the_checkout_item_error_class();?>>
|
239 |
+
<td <?php if(wpsc_is_shipping_details()){ echo "class='wpsc_shipping_forms'";}else{echo "class='wpsc_billing_forms'";} ?> colspan='2'>
|
240 |
+
<h4><?php echo wpsc_checkout_form_name();?></h4>
|
241 |
+
</td>
|
242 |
+
</tr>
|
243 |
+
<?php if(!wpsc_is_shipping_details() && $i <= 1){?>
|
244 |
+
<tr class='same_as_shipping_row'>
|
245 |
+
<td colspan ='2'>
|
246 |
+
<input type='checkbox' value='true' name='billing_same_as_shipping' id='billing_same_as_shipping' />
|
247 |
+
<label for='billing_same_as_shipping'><?php _e('Same as shipping address?','wpsc'); ?></label>
|
248 |
+
</td>
|
249 |
+
</tr>
|
250 |
+
<?php } ?>
|
251 |
+
<?php else: ?>
|
252 |
+
<?php if((!wpsc_uses_shipping()) && $wpsc_checkout->checkout_item->unique_name == 'shippingstate'): ?>
|
253 |
+
|
254 |
+
<?php elseif(wpsc_checkout_form_element_id() =='wpsc_checkout_form_8'): ?>
|
255 |
+
<div class='wpsc_email_address'>
|
256 |
+
<p class='<?php echo wpsc_checkout_form_element_id(); ?>'>
|
257 |
+
<label class='wpsc_email_address' for='<?php echo wpsc_checkout_form_element_id(); ?>'>
|
258 |
+
<?php echo wpsc_checkout_form_name();?>
|
259 |
+
|
260 |
+
</label>
|
261 |
+
</span>
|
262 |
+
<p>
|
263 |
+
<?php echo wpsc_checkout_form_field();?>
|
264 |
+
|
265 |
+
<?php if(wpsc_the_checkout_item_error() != ''): ?>
|
266 |
+
<p class='validation-error'><?php echo wpsc_the_checkout_item_error(); ?></span>
|
267 |
+
|
268 |
+
<?php endif; ?>
|
269 |
+
</p>
|
270 |
+
</div>
|
271 |
+
<?php else : ?>
|
272 |
+
<tr <?php echo wpsc_the_checkout_item_error_class();?>>
|
273 |
+
<?php // to get rid of shipping state label
|
274 |
+
if (wpsc_checkout_form_name() == 'State: '){ ?>
|
275 |
+
<td class='shippingstate' colspan='2'>
|
276 |
+
<?php if($wpsc_checkout->checkout_item->unique_name != 'shippingstate' || (wpsc_has_regions($_SESSION['wpsc_delivery_country']))){
|
277 |
+
echo wpsc_checkout_form_field();
|
278 |
+
}else{
|
279 |
+
// exit('<pre>'.print_r($_SESSION,true).'</pre>');
|
280 |
+
echo ' ';
|
281 |
+
}
|
282 |
+
?>
|
283 |
+
|
284 |
+
<?php if(wpsc_the_checkout_item_error() != ''): ?>
|
285 |
+
<p class='validation-error'><?php echo wpsc_the_checkout_item_error(); ?></p>
|
286 |
+
|
287 |
+
<?php endif; ?>
|
288 |
+
</td>
|
289 |
+
<?php }else{?>
|
290 |
+
<td class='<?php echo wpsc_checkout_form_element_id(); ?>'>
|
291 |
+
<label for='<?php echo wpsc_checkout_form_element_id(); ?>'>
|
292 |
+
<?php echo wpsc_checkout_form_name();?>
|
293 |
+
|
294 |
+
</label>
|
295 |
+
</td>
|
296 |
+
<td>
|
297 |
+
<?php echo wpsc_checkout_form_field();?>
|
298 |
+
|
299 |
+
<?php if(wpsc_the_checkout_item_error() != ''): ?>
|
300 |
+
<p class='validation-error'><?php echo wpsc_the_checkout_item_error(); ?></p>
|
301 |
+
|
302 |
+
<?php endif; ?>
|
303 |
+
</td>
|
304 |
+
<?php
|
305 |
+
} ?>
|
306 |
+
</tr>
|
307 |
+
<?php endif; ?>
|
308 |
+
|
309 |
+
<?php endif; ?>
|
310 |
+
|
311 |
+
<?php endwhile; ?>
|
312 |
+
|
313 |
+
<?php if (get_option('display_find_us') == '1') : ?>
|
314 |
+
<tr>
|
315 |
+
<td>How did you find us:</td>
|
316 |
+
<td>
|
317 |
+
<select name='how_find_us'>
|
318 |
+
<option value='Word of Mouth'>Word of mouth</option>
|
319 |
+
<option value='Advertisement'>Advertising</option>
|
320 |
+
<option value='Internet'>Internet</option>
|
321 |
+
<option value='Customer'>Existing Customer</option>
|
322 |
+
</select>
|
323 |
+
</td>
|
324 |
+
</tr>
|
325 |
+
<?php endif; ?>
|
326 |
+
<tr>
|
327 |
+
<td colspan='2' class='wpsc_gateway_container'>
|
328 |
+
|
329 |
+
<?php //this HTML displays activated payment gateways?>
|
330 |
+
|
331 |
+
<?php if(wpsc_gateway_count() > 1): // if we have more than one gateway enabled, offer the user a choice ?>
|
332 |
+
<h3><?php echo __('Select a payment gateway', 'wpsc');?></h3>
|
333 |
+
<?php while (wpsc_have_gateways()) : wpsc_the_gateway(); ?>
|
334 |
+
<div class="custom_gateway">
|
335 |
+
<?php if(wpsc_gateway_internal_name() == 'noca'){ ?>
|
336 |
+
<label><input type="radio" id='noca_gateway' value="<?php echo wpsc_gateway_internal_name();?>" <?php echo wpsc_gateway_is_checked(); ?> name="custom_gateway" class="custom_gateway"/><?php echo wpsc_gateway_name();?></label>
|
337 |
+
<?php }else{ ?>
|
338 |
+
<label><input type="radio" value="<?php echo wpsc_gateway_internal_name();?>" <?php echo wpsc_gateway_is_checked(); ?> name="custom_gateway" class="custom_gateway"/><?php echo wpsc_gateway_name();?></label>
|
339 |
+
<?php } ?>
|
340 |
+
|
341 |
+
|
342 |
+
<?php if(wpsc_gateway_form_fields()): ?>
|
343 |
+
<table class='<?php echo wpsc_gateway_form_field_style();?>'>
|
344 |
+
<?php echo wpsc_gateway_form_fields();?>
|
345 |
+
</table>
|
346 |
+
<?php endif; ?>
|
347 |
+
</div>
|
348 |
+
<?php endwhile; ?>
|
349 |
+
<?php else: // otherwise, there is no choice, stick in a hidden form ?>
|
350 |
+
<?php while (wpsc_have_gateways()) : wpsc_the_gateway(); ?>
|
351 |
+
<input name='custom_gateway' value='<?php echo wpsc_gateway_internal_name();?>' type='hidden' />
|
352 |
+
|
353 |
+
<?php if(wpsc_gateway_form_fields()): ?>
|
354 |
+
<table>
|
355 |
+
<?php echo wpsc_gateway_form_fields();?>
|
356 |
+
</table>
|
357 |
+
<?php endif; ?>
|
358 |
+
<?php endwhile; ?>
|
359 |
+
<?php endif; ?>
|
360 |
+
|
361 |
+
</td>
|
362 |
+
</tr>
|
363 |
+
|
364 |
+
<?php if(get_option('terms_and_conditions') != '') : ?>
|
365 |
+
<tr>
|
366 |
+
<td colspan='2'>
|
367 |
+
<input type='checkbox' value='yes' name='agree' /> <?php echo __('I agree to The ', 'wpsc');?><a class='thickbox' target='_blank' href='<?php
|
368 |
echo get_option('siteurl')."?termsandconds=true&width=360&height=400'"; ?>' class='termsandconds'><?php echo __('Terms and Conditions', 'wpsc');?></a>
|
369 |
+
</td>
|
370 |
+
</tr>
|
371 |
+
<?php endif; ?>
|
372 |
+
</table>
|
373 |
+
|
374 |
+
<table class='wpsc_checkout_table table-4'>
|
375 |
+
<tr>
|
376 |
+
<td class='wpsc_total_price_and_shipping'colspan='2'>
|
377 |
+
<h4><?php echo __('Total Price with Shipping','wpsc'); ?></h4>
|
378 |
+
</td>
|
379 |
+
</tr>
|
380 |
+
<?php if(wpsc_uses_shipping()) : ?>
|
381 |
+
<tr class="total_price total_shipping">
|
382 |
+
<td class='wpsc_totals'>
|
383 |
+
<?php echo __('Total Shipping', 'wpsc'); ?>
|
384 |
+
</td>
|
385 |
+
<td class='wpsc_totals'>
|
386 |
+
<span id="checkout_shipping" class="pricedisplay checkout-shipping"><?php echo wpsc_cart_shipping(); ?></span>
|
387 |
+
</td>
|
388 |
+
</tr>
|
389 |
+
<?php endif; ?>
|
390 |
+
|
391 |
+
<?php if(wpsc_uses_coupons() && (wpsc_coupon_amount(false) > 0)): ?>
|
392 |
+
<tr class="total_price">
|
393 |
+
<td class='wpsc_totals'>
|
394 |
+
<?php echo __('Discount', 'wpsc'); ?>
|
395 |
+
</td>
|
396 |
+
<td class='wpsc_totals'>
|
397 |
+
<span id="coupons_amount" class="pricedisplay"><?php echo wpsc_coupon_amount(); ?></span>
|
398 |
+
</td>
|
399 |
+
</tr>
|
400 |
+
<?php endif ?>
|
401 |
+
|
402 |
+
|
403 |
+
|
404 |
+
<tr class='total_price'>
|
405 |
+
<td class='wpsc_totals'>
|
406 |
+
<?php echo __('Total Price', 'wpsc'); ?>
|
407 |
+
</td>
|
408 |
+
<td class='wpsc_totals'>
|
409 |
+
<span id='checkout_total' class="pricedisplay checkout-total"><?php echo wpsc_cart_total(); ?></span>
|
410 |
+
</td>
|
411 |
+
</tr>
|
412 |
+
</table>
|
413 |
|
414 |
<!-- div for make purchase button -->
|
415 |
+
<div class='wpsc_make_purchase'>
|
416 |
+
<span>
|
417 |
+
<?php if(get_option('terms_and_conditions') == '') : ?>
|
418 |
+
<input type='hidden' value='yes' name='agree' />
|
419 |
+
<?php endif; ?>
|
420 |
+
<?php //exit('<pre>'.print_r($wpsc_gateway->wpsc_gateways[0]['name'], true).'</pre>');
|
421 |
+
if(count($wpsc_gateway->wpsc_gateways) == 1 && $wpsc_gateway->wpsc_gateways[0]['name'] == 'Noca'){}else{?>
|
422 |
+
<input type='hidden' value='submit_checkout' name='wpsc_action' />
|
423 |
+
<input type='submit' value='<?php echo __('Make Purchase', 'wpsc');?>' name='submit' class='make_purchase wpsc_buy_button' />
|
424 |
+
<?php }/* else: ?>
|
425 |
+
|
426 |
+
<br /><strong><?php echo __('Please login or signup above to make your purchase', 'wpsc');?></strong><br />
|
427 |
+
<?php echo __('If you have just registered, please check your email and login before you make your purchase', 'wpsc');?>
|
428 |
+
</td>
|
429 |
+
<?php endif; */?>
|
430 |
+
</span>
|
431 |
+
</div>
|
432 |
|
433 |
+
<div class='clear'></div>
|
|
|
|
|
|
|
|
|
|
|
434 |
</form>
|
435 |
</div>
|
|
|
|
|
436 |
<?php
|
437 |
else:
|
438 |
+
echo __('Oops, there is nothing in your cart.', 'wpsc') . "<a href=".get_option("product_list_url").">" . __('Please visit our shop', 'wpsc') . "</a>";
|
439 |
endif;
|
440 |
do_action('wpsc_bottom_of_shopping_cart');
|
441 |
+
?>
|
themes/default/single_product.php
CHANGED
@@ -27,7 +27,7 @@ $image_height = get_option('single_view_image_height');
|
|
27 |
<div class="textcol">
|
28 |
<div class="imagecol">
|
29 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
30 |
-
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="
|
31 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_image($image_width, $image_height); ?>" />
|
32 |
</a>
|
33 |
<?php else: ?>
|
27 |
<div class="textcol">
|
28 |
<div class="imagecol">
|
29 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
30 |
+
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="<?php echo wpsc_the_product_image_link_classes(); ?>" href="<?php echo wpsc_the_product_image(); ?>">
|
31 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_image($image_width, $image_height); ?>" />
|
32 |
</a>
|
33 |
<?php else: ?>
|
themes/iShop/products_page.php
CHANGED
@@ -83,7 +83,7 @@ global $wpsc_query, $wpdb;
|
|
83 |
<?php if(get_option('show_thumbnails')) :?>
|
84 |
<div class="imagecol">
|
85 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
86 |
-
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="
|
87 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>"/>
|
88 |
</a>
|
89 |
<?php else: ?>
|
83 |
<?php if(get_option('show_thumbnails')) :?>
|
84 |
<div class="imagecol">
|
85 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
86 |
+
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="<?php echo wpsc_the_product_image_link_classes(); ?>" href="<?php echo wpsc_the_product_image(); ?>">
|
87 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>"/>
|
88 |
</a>
|
89 |
<?php else: ?>
|
themes/iShop/shopping_cart_page.php
CHANGED
@@ -2,7 +2,9 @@
|
|
2 |
global $wpsc_cart, $wpdb, $wpsc_checkout, $wpsc_gateway, $wpsc_coupons;
|
3 |
$wpsc_checkout = new wpsc_checkout();
|
4 |
$wpsc_gateway = new wpsc_gateways();
|
5 |
-
|
|
|
|
|
6 |
//echo "<pre>".print_r($wpsc_cart,true)."</pre>";
|
7 |
if(wpsc_cart_item_count() > 0) :
|
8 |
?>
|
2 |
global $wpsc_cart, $wpdb, $wpsc_checkout, $wpsc_gateway, $wpsc_coupons;
|
3 |
$wpsc_checkout = new wpsc_checkout();
|
4 |
$wpsc_gateway = new wpsc_gateways();
|
5 |
+
if(isset($_SESSION['coupon_numbers'])){
|
6 |
+
$wpsc_coupons = new wpsc_coupons($_SESSION['coupon_numbers']);
|
7 |
+
}
|
8 |
//echo "<pre>".print_r($wpsc_cart,true)."</pre>";
|
9 |
if(wpsc_cart_item_count() > 0) :
|
10 |
?>
|
themes/iShop/single_product.php
CHANGED
@@ -28,7 +28,7 @@ $image_height = get_option('single_view_image_height');
|
|
28 |
<div class="textcol">
|
29 |
<div class="imagecol">
|
30 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
31 |
-
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="
|
32 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_image($image_width, $image_height); ?>"/>
|
33 |
</a>
|
34 |
<?php else: ?>
|
28 |
<div class="textcol">
|
29 |
<div class="imagecol">
|
30 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
31 |
+
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="<?php echo wpsc_the_product_image_link_classes(); ?>" href="<?php echo wpsc_the_product_image(); ?>">
|
32 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_image($image_width, $image_height); ?>"/>
|
33 |
</a>
|
34 |
<?php else: ?>
|
themes/marketplace/products_page.php
CHANGED
@@ -86,7 +86,7 @@ global $wpsc_query, $wpdb;
|
|
86 |
<?php if(get_option('show_thumbnails')) :?>
|
87 |
<div class="imagecol">
|
88 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
89 |
-
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="
|
90 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>" />
|
91 |
</a>
|
92 |
<?php else: ?>
|
86 |
<?php if(get_option('show_thumbnails')) :?>
|
87 |
<div class="imagecol">
|
88 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
89 |
+
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="<?php echo wpsc_the_product_image_link_classes(); ?>" href="<?php echo wpsc_the_product_image(); ?>">
|
90 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>" />
|
91 |
</a>
|
92 |
<?php else: ?>
|
themes/marketplace/single_product.php
CHANGED
@@ -28,7 +28,7 @@ $image_height = get_option('single_view_image_height');
|
|
28 |
<div class="textcol">
|
29 |
<div class="imagecol">
|
30 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
31 |
-
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="
|
32 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_image($image_width, $image_height); ?>"/>
|
33 |
</a>
|
34 |
<?php else: ?>
|
28 |
<div class="textcol">
|
29 |
<div class="imagecol">
|
30 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
31 |
+
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="<?php echo wpsc_the_product_image_link_classes(); ?>" href="<?php echo wpsc_the_product_image(); ?>">
|
32 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_image($image_width, $image_height); ?>"/>
|
33 |
</a>
|
34 |
<?php else: ?>
|
themes/single-wpsc-product.php
CHANGED
@@ -34,7 +34,7 @@ get_header();
|
|
34 |
<div class="imagecol">
|
35 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
36 |
<?php //echo('<pre>'.print_r($wpsc_query,true).'</pre>'); ?>
|
37 |
-
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="
|
38 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_image($image_width, $image_height); ?>" />
|
39 |
</a>
|
40 |
<?php else: ?>
|
@@ -50,7 +50,9 @@ get_header();
|
|
50 |
<div class="producttext">
|
51 |
<h2 class="prodtitles">Purchase</h2>
|
52 |
<?php
|
|
|
53 |
do_action('wpsc_product_before_description', wpsc_the_product_id(), $wpsc_query->product);
|
|
|
54 |
?>
|
55 |
|
56 |
<?php
|
@@ -134,9 +136,9 @@ get_header();
|
|
134 |
<option value="<?php echo wpsc_the_variation_id(); ?>" <?php if (wpsc_the_variation_stock() < 1 ) { echo "disabled"; } ?>>
|
135 |
<?php echo wpsc_the_variation_name(); ?>
|
136 |
|
137 |
-
<?php/* if(wpsc_the_variation_price() != false) : ?>
|
138 |
- <?php echo wpsc_the_variation_price(); ?>
|
139 |
-
<?php endif ;
|
140 |
</option>
|
141 |
<?php endwhile; ?>
|
142 |
</select>
|
34 |
<div class="imagecol">
|
35 |
<?php if(wpsc_the_product_thumbnail()) :?>
|
36 |
<?php //echo('<pre>'.print_r($wpsc_query,true).'</pre>'); ?>
|
37 |
+
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="<?php echo wpsc_the_product_image_link_classes(); ?>" href="<?php echo wpsc_the_product_image(); ?>">
|
38 |
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_image($image_width, $image_height); ?>" />
|
39 |
</a>
|
40 |
<?php else: ?>
|
50 |
<div class="producttext">
|
51 |
<h2 class="prodtitles">Purchase</h2>
|
52 |
<?php
|
53 |
+
if(isset($wpsc_query->product)) {
|
54 |
do_action('wpsc_product_before_description', wpsc_the_product_id(), $wpsc_query->product);
|
55 |
+
}
|
56 |
?>
|
57 |
|
58 |
<?php
|
136 |
<option value="<?php echo wpsc_the_variation_id(); ?>" <?php if (wpsc_the_variation_stock() < 1 ) { echo "disabled"; } ?>>
|
137 |
<?php echo wpsc_the_variation_name(); ?>
|
138 |
|
139 |
+
<?php /* if(wpsc_the_variation_price() != false) : ?>
|
140 |
- <?php echo wpsc_the_variation_price(); ?>
|
141 |
+
<?php endif ; */ ?>
|
142 |
</option>
|
143 |
<?php endwhile; ?>
|
144 |
</select>
|
transaction_result_functions.php
CHANGED
@@ -29,7 +29,7 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
|
|
29 |
}
|
30 |
$order_url = $siteurl."/wp-admin/admin.php?page=".WPSC_DIR_NAME."/display-log.php&purchcaseid=".$purchase_log['id'];
|
31 |
|
32 |
-
if(($_GET['ipn_request'] != 'true')
|
33 |
if($purchase_log == null) {
|
34 |
echo __('We're Sorry, your order has not been accepted, the most likely reason is that you have insufficient funds.', 'wpsc');
|
35 |
if((get_option('purch_log_email') != null) && ($purchase_log['email_sent'] != 1)) {
|
@@ -37,7 +37,7 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
|
|
37 |
}
|
38 |
return false;
|
39 |
} else if ($purchase_log['processed'] < 3) { //added by Thomas on 20/6/2007
|
40 |
-
echo __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "<p style='margin: 1em 0px 0px 0px;' >".nl2br(get_option('payment_instructions'))."</p>";
|
41 |
/*if($purchase_log['gateway'] != 'testmode') {
|
42 |
if((get_option('purch_log_email') != null) && ($purchase_log['email_sent'] != 1)) {
|
43 |
mail(get_option('purch_log_email'), __('New pending order', 'wpsc'), __('There is a new order awaiting processing:', 'wpsc').$order_url, "From: ".get_option('return_email')."");
|
@@ -103,17 +103,17 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
|
|
103 |
|
104 |
}
|
105 |
do_action('wpsc_confirm_checkout', $purchase_log['id']);
|
106 |
-
|
|
|
107 |
$shipping = $row['pnp']*$row['quantity'];
|
108 |
$total_shipping += $shipping;
|
109 |
|
110 |
-
|
111 |
$total += ($row['price'] * $row['quantity']);
|
112 |
$message_price = nzshpcrt_currency_display(($row['price']*$row['quantity']), true);
|
113 |
|
114 |
$shipping_price = nzshpcrt_currency_display($shipping, 1, true);
|
115 |
|
116 |
-
if($purchase['gateway'] != 'testmode') {
|
117 |
if($gateway['internalname'] == $purch_data[0]['gateway'] ) {
|
118 |
$gateway_name = $gateway['name'];
|
119 |
}
|
@@ -128,7 +128,6 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
|
|
128 |
if(!is_string($additional_content)) {
|
129 |
$additional_content = '';
|
130 |
}
|
131 |
-
|
132 |
$product_list .= " - ". $row['name'] ." ".$message_price ." ".__('Click to download', 'wpsc').":";
|
133 |
$product_list_html .= " - ". $row['name'] ." ".$message_price ." ".__('Click to download', 'wpsc').":\n\r";
|
134 |
foreach($link as $single_link){
|
@@ -138,6 +137,8 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
|
|
138 |
$product_list .= $additional_content;
|
139 |
$product_list_html .= $additional_content;
|
140 |
} else {
|
|
|
|
|
141 |
$plural = '';
|
142 |
if($row['quantity'] > 1) {
|
143 |
$plural = "s";
|
@@ -149,6 +150,7 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
|
|
149 |
|
150 |
}
|
151 |
$report = get_option('wpsc_email_admin');
|
|
|
152 |
$report_product_list.= " - ". $row['name']." ".$message_price ."\n\r";
|
153 |
}
|
154 |
|
@@ -174,6 +176,10 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
|
|
174 |
$discount_email.= __('Discount', 'wpsc')."\n\r: ";
|
175 |
$discount_email .=$purchase_log['discount_data'].' : '.nzshpcrt_currency_display($purchase_log['discount_value'], 1, true)."\n\r";
|
176 |
}
|
|
|
|
|
|
|
|
|
177 |
$total_shipping_email.= __('Total Shipping', 'wpsc').": ".nzshpcrt_currency_display($total_shipping,1,true)."\n\r";
|
178 |
$total_price_email.= __('Total', 'wpsc').": ".nzshpcrt_currency_display($total,1,true)."\n\r";
|
179 |
$product_list_html.= "Your Purchase No.: ".$purchase_log['id']."\n\n\r";
|
@@ -212,7 +218,7 @@ function transaction_results($sessionid, $echo_to_screen = true, $transaction_id
|
|
212 |
add_filter('wp_mail_from_name', 'wpsc_replace_reply_name', 0);
|
213 |
|
214 |
if($purchase_log['processed'] < 3) {
|
215 |
-
$payment_instructions = strip_tags(get_option('payment_instructions'));
|
216 |
$message = __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "\n\r" . $payment_instructions ."\n\r". $message;
|
217 |
wp_mail($email, __('Order Pending: Payment Required', 'wpsc'), $message);
|
218 |
} else {
|
29 |
}
|
30 |
$order_url = $siteurl."/wp-admin/admin.php?page=".WPSC_DIR_NAME."/display-log.php&purchcaseid=".$purchase_log['id'];
|
31 |
|
32 |
+
if((!isset($_GET['ipn_request']) || $_GET['ipn_request'] != 'true') && (get_option('paypal_ipn') == 1)) {
|
33 |
if($purchase_log == null) {
|
34 |
echo __('We're Sorry, your order has not been accepted, the most likely reason is that you have insufficient funds.', 'wpsc');
|
35 |
if((get_option('purch_log_email') != null) && ($purchase_log['email_sent'] != 1)) {
|
37 |
}
|
38 |
return false;
|
39 |
} else if ($purchase_log['processed'] < 3) { //added by Thomas on 20/6/2007
|
40 |
+
echo __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "<p style='margin: 1em 0px 0px 0px;' >".nl2br(stripslashes(get_option('payment_instructions')))."</p>";
|
41 |
/*if($purchase_log['gateway'] != 'testmode') {
|
42 |
if((get_option('purch_log_email') != null) && ($purchase_log['email_sent'] != 1)) {
|
43 |
mail(get_option('purch_log_email'), __('New pending order', 'wpsc'), __('There is a new order awaiting processing:', 'wpsc').$order_url, "From: ".get_option('return_email')."");
|
103 |
|
104 |
}
|
105 |
do_action('wpsc_confirm_checkout', $purchase_log['id']);
|
106 |
+
$total_shipping = '';
|
107 |
+
$total = '';
|
108 |
$shipping = $row['pnp']*$row['quantity'];
|
109 |
$total_shipping += $shipping;
|
110 |
|
|
|
111 |
$total += ($row['price'] * $row['quantity']);
|
112 |
$message_price = nzshpcrt_currency_display(($row['price']*$row['quantity']), true);
|
113 |
|
114 |
$shipping_price = nzshpcrt_currency_display($shipping, 1, true);
|
115 |
|
116 |
+
if(isset($purchase['gateway']) && $purchase['gateway'] != 'testmode') {
|
117 |
if($gateway['internalname'] == $purch_data[0]['gateway'] ) {
|
118 |
$gateway_name = $gateway['name'];
|
119 |
}
|
128 |
if(!is_string($additional_content)) {
|
129 |
$additional_content = '';
|
130 |
}
|
|
|
131 |
$product_list .= " - ". $row['name'] ." ".$message_price ." ".__('Click to download', 'wpsc').":";
|
132 |
$product_list_html .= " - ". $row['name'] ." ".$message_price ." ".__('Click to download', 'wpsc').":\n\r";
|
133 |
foreach($link as $single_link){
|
137 |
$product_list .= $additional_content;
|
138 |
$product_list_html .= $additional_content;
|
139 |
} else {
|
140 |
+
|
141 |
+
$product_list_html = '';
|
142 |
$plural = '';
|
143 |
if($row['quantity'] > 1) {
|
144 |
$plural = "s";
|
150 |
|
151 |
}
|
152 |
$report = get_option('wpsc_email_admin');
|
153 |
+
$report_product_list = '';
|
154 |
$report_product_list.= " - ". $row['name']." ".$message_price ."\n\r";
|
155 |
}
|
156 |
|
176 |
$discount_email.= __('Discount', 'wpsc')."\n\r: ";
|
177 |
$discount_email .=$purchase_log['discount_data'].' : '.nzshpcrt_currency_display($purchase_log['discount_value'], 1, true)."\n\r";
|
178 |
}
|
179 |
+
$total_price_email = '';
|
180 |
+
$total_price_html = '';
|
181 |
+
$total_shipping_html = '';
|
182 |
+
$total_shipping_email = '';
|
183 |
$total_shipping_email.= __('Total Shipping', 'wpsc').": ".nzshpcrt_currency_display($total_shipping,1,true)."\n\r";
|
184 |
$total_price_email.= __('Total', 'wpsc').": ".nzshpcrt_currency_display($total,1,true)."\n\r";
|
185 |
$product_list_html.= "Your Purchase No.: ".$purchase_log['id']."\n\n\r";
|
218 |
add_filter('wp_mail_from_name', 'wpsc_replace_reply_name', 0);
|
219 |
|
220 |
if($purchase_log['processed'] < 3) {
|
221 |
+
$payment_instructions = strip_tags(stripslashes(get_option('payment_instructions')));
|
222 |
$message = __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "\n\r" . $payment_instructions ."\n\r". $message;
|
223 |
wp_mail($email, __('Order Pending: Payment Required', 'wpsc'), $message);
|
224 |
} else {
|
transaction_results.php
CHANGED
@@ -2,14 +2,16 @@
|
|
2 |
global $wpdb, $user_ID, $nzshpcrt_gateways;
|
3 |
//$curgateway = get_option('payment_gateway');
|
4 |
|
5 |
-
$
|
|
|
|
|
6 |
if(!isset($_GET['sessionid']) && isset($_GET['ms']) ){
|
7 |
$sessionid = $_GET['ms'];
|
8 |
}
|
9 |
-
if($_GET['gateway'] == 'google'){
|
10 |
wpsc_google_checkout_submit();
|
11 |
unset($_SESSION['wpsc_sessionid']);
|
12 |
-
}elseif($_GET['gateway'] == 'noca'){
|
13 |
wpsc_submit_checkout();
|
14 |
}
|
15 |
if($_SESSION['wpsc_previous_selected_gateway'] == 'paypal_certified'){
|
@@ -19,15 +21,15 @@ if($_SESSION['wpsc_previous_selected_gateway'] == 'paypal_certified'){
|
|
19 |
//exit("test!");
|
20 |
$errorcode = '';
|
21 |
$transactid = '';
|
22 |
-
if($_REQUEST['eway']=='1') {
|
23 |
$sessionid = $_GET['result'];
|
24 |
-
}elseif($_REQUEST['eway']=='0'){
|
25 |
echo $_SESSION['eway_message'];
|
26 |
-
}elseif ($_REQUEST['payflow']=='1') {
|
27 |
echo $_SESSION['payflow_message'];
|
28 |
$_SESSION['payflow_message']='';
|
29 |
}
|
30 |
-
//exit('getting here?<pre>'.print_r($_SESSION[
|
31 |
if($_SESSION['wpsc_previous_selected_gateway'] == 'paypal_certified'){
|
32 |
echo $_SESSION['paypalExpressMessage'];
|
33 |
|
@@ -42,7 +44,7 @@ if($_SESSION['wpsc_previous_selected_gateway'] == 'paypal_certified'){
|
|
42 |
_e('Sorry your transaction was not accepted.<br /><a href='.get_option("shopping_cart_url").'>Click here to go back to checkout page.</a>');
|
43 |
}
|
44 |
} else {
|
45 |
-
|
46 |
echo transaction_results($sessionid, true);
|
47 |
}
|
48 |
}
|
2 |
global $wpdb, $user_ID, $nzshpcrt_gateways;
|
3 |
//$curgateway = get_option('payment_gateway');
|
4 |
|
5 |
+
if(isset($_GET['sessionid'])) {
|
6 |
+
$sessionid = $_GET['sessionid'];
|
7 |
+
}
|
8 |
if(!isset($_GET['sessionid']) && isset($_GET['ms']) ){
|
9 |
$sessionid = $_GET['ms'];
|
10 |
}
|
11 |
+
if(isset($_GET['gateway']) && $_GET['gateway'] == 'google'){
|
12 |
wpsc_google_checkout_submit();
|
13 |
unset($_SESSION['wpsc_sessionid']);
|
14 |
+
}elseif(isset($_GET['gateway']) && $_GET['gateway'] == 'noca'){
|
15 |
wpsc_submit_checkout();
|
16 |
}
|
17 |
if($_SESSION['wpsc_previous_selected_gateway'] == 'paypal_certified'){
|
21 |
//exit("test!");
|
22 |
$errorcode = '';
|
23 |
$transactid = '';
|
24 |
+
if(isset($_REQUEST['eway']) && $_REQUEST['eway']=='1') {
|
25 |
$sessionid = $_GET['result'];
|
26 |
+
}elseif(isset($_REQUEST['eway']) && $_REQUEST['eway']=='0'){
|
27 |
echo $_SESSION['eway_message'];
|
28 |
+
}elseif (isset($_REQUEST['payflow'])&& $_REQUEST['payflow']=='1') {
|
29 |
echo $_SESSION['payflow_message'];
|
30 |
$_SESSION['payflow_message']='';
|
31 |
}
|
32 |
+
//exit('getting here?<pre>'.print_r($_SESSION['wpsc_previous_selected_gateway'], true).'</pre>'.get_option('payment_gateway'));
|
33 |
if($_SESSION['wpsc_previous_selected_gateway'] == 'paypal_certified'){
|
34 |
echo $_SESSION['paypalExpressMessage'];
|
35 |
|
44 |
_e('Sorry your transaction was not accepted.<br /><a href='.get_option("shopping_cart_url").'>Click here to go back to checkout page.</a>');
|
45 |
}
|
46 |
} else {
|
47 |
+
//exit('<pre>sess - '.print_r($_SESSION, true).'</pre>');
|
48 |
echo transaction_results($sessionid, true);
|
49 |
}
|
50 |
}
|
updates/database_template.php
CHANGED
@@ -289,6 +289,8 @@ $wpsc_database_template[$table_name]['columns']['shipping_option'] = "VARCHAR(12
|
|
289 |
$wpsc_database_template[$table_name]['columns']['affiliate_id'] = "VARCHAR(32) NULL ";
|
290 |
$wpsc_database_template[$table_name]['columns']['plugin_version'] = "VARCHAR(32) NULL ";
|
291 |
$wpsc_database_template[$table_name]['columns']['notes'] = "text NULL";
|
|
|
|
|
292 |
$wpsc_database_template[$table_name]['indexes']['PRIMARY'] = "PRIMARY KEY ( `id` )";
|
293 |
$wpsc_database_template[$table_name]['indexes']['sessionid'] = "UNIQUE KEY `sessionid` ( `sessionid` )";
|
294 |
$wpsc_database_template[$table_name]['indexes']['gateway'] = " KEY `gateway` ( `gateway` )";
|
289 |
$wpsc_database_template[$table_name]['columns']['affiliate_id'] = "VARCHAR(32) NULL ";
|
290 |
$wpsc_database_template[$table_name]['columns']['plugin_version'] = "VARCHAR(32) NULL ";
|
291 |
$wpsc_database_template[$table_name]['columns']['notes'] = "text NULL";
|
292 |
+
$wpsc_database_template[$table_name]['columns']['wpec_taxes_total'] = "decimal(11,2)";
|
293 |
+
$wpsc_database_template[$table_name]['columns']['wpec_taxes_rate'] = "decimal(11,2)";
|
294 |
$wpsc_database_template[$table_name]['indexes']['PRIMARY'] = "PRIMARY KEY ( `id` )";
|
295 |
$wpsc_database_template[$table_name]['indexes']['sessionid'] = "UNIQUE KEY `sessionid` ( `sessionid` )";
|
296 |
$wpsc_database_template[$table_name]['indexes']['gateway'] = " KEY `gateway` ( `gateway` )";
|
widgets/category_widget.27.php
DELETED
@@ -1,205 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
function widget_wpsc_categorisation( $args, $widget_args = 1 ) {
|
3 |
-
global $wpdb;
|
4 |
-
extract( $args, EXTR_SKIP );
|
5 |
-
if ( is_numeric($widget_args) )
|
6 |
-
$widget_args = array( 'number' => $widget_args );
|
7 |
-
$widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
|
8 |
-
extract( $widget_args, EXTR_SKIP );
|
9 |
-
|
10 |
-
// Data should be stored as array: array( number => data for that instance of the widget, ... )
|
11 |
-
$option_name = 'widget_wpsc_categorisation';
|
12 |
-
$options = get_option($option_name);
|
13 |
-
if ( !isset($options[$number]) )
|
14 |
-
return;
|
15 |
-
|
16 |
-
$my_options = $options[$number];
|
17 |
-
|
18 |
-
|
19 |
-
$title = empty($my_options['title']) ? __('Categories', 'wpsc') : $my_options['title'];
|
20 |
-
|
21 |
-
echo $before_widget;
|
22 |
-
$full_title = $before_title . $title . $after_title;
|
23 |
-
echo $full_title;
|
24 |
-
$selected_categorisations = array_keys($my_options['categorisation'], true);
|
25 |
-
if($selected_categorisations != null) {
|
26 |
-
foreach($selected_categorisations as $key => $selected_categorisation) {
|
27 |
-
$selected_categorisations[$key] = (int)$selected_categorisation;
|
28 |
-
}
|
29 |
-
$selected_values = implode(',',$selected_categorisations);
|
30 |
-
|
31 |
-
$categorisation_groups = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CATEGORISATION_GROUPS."` WHERE `id` IN ({$selected_values}) AND `active` IN ('1')", ARRAY_A);
|
32 |
-
foreach($categorisation_groups as $categorisation_group) {
|
33 |
-
echo "<div id='categorisation_group_".$categorisation_group['id']."'>\n\r";
|
34 |
-
if(count($categorisation_groups) > 1) { // no title unless multiple category groups
|
35 |
-
echo "<h2 class='categorytitle'>{$categorisation_group['name']}</h2>\n\r";
|
36 |
-
}
|
37 |
-
show_cats_brands($categorisation_group['id'], 'sidebar', 'name', $my_options['image']);
|
38 |
-
echo "\n\r";
|
39 |
-
echo "</div>\n\r";
|
40 |
-
}
|
41 |
-
//echo("<pre>".print_r($selected_categorisations,true)."</pre>");
|
42 |
-
} else {
|
43 |
-
show_cats_brands(null, 'sidebar');
|
44 |
-
}
|
45 |
-
|
46 |
-
echo $after_widget;
|
47 |
-
}
|
48 |
-
|
49 |
-
// Displays form for a particular instance of the widget. Also updates the data after a POST submit
|
50 |
-
// $widget_args: number
|
51 |
-
// number: which of the several widgets of this type do we mean
|
52 |
-
function widget_wpsc_categorisation_control( $widget_args = 1 ) {
|
53 |
-
global $wp_registered_widgets, $wpdb;
|
54 |
-
static $updated = false; // Whether or not we have already updated the data after a POST submit
|
55 |
-
$option_name = 'widget_wpsc_categorisation';
|
56 |
-
|
57 |
-
if ( is_numeric($widget_args) )
|
58 |
-
$widget_args = array( 'number' => $widget_args );
|
59 |
-
$widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
|
60 |
-
extract( $widget_args, EXTR_SKIP );
|
61 |
-
|
62 |
-
// Data should be stored as array: array( number => data for that instance of the widget, ... )
|
63 |
-
$options = get_option($option_name);
|
64 |
-
if ( !is_array($options) )
|
65 |
-
$options = array();
|
66 |
-
|
67 |
-
// We need to update the data
|
68 |
-
if ( !$updated && !empty($_POST['sidebar']) ) {
|
69 |
-
// Tells us what sidebar to put the data in
|
70 |
-
$sidebar = (string) $_POST['sidebar'];
|
71 |
-
|
72 |
-
$sidebars_widgets = wp_get_sidebars_widgets();
|
73 |
-
if ( isset($sidebars_widgets[$sidebar]) )
|
74 |
-
$this_sidebar =& $sidebars_widgets[$sidebar];
|
75 |
-
else
|
76 |
-
$this_sidebar = array();
|
77 |
-
|
78 |
-
foreach ( $this_sidebar as $_widget_id ) {
|
79 |
-
// Remove all widgets of this type from the sidebar. We'll add the new data in a second. This makes sure we don't get any duplicate data
|
80 |
-
// since widget ids aren't necessarily persistent across multiple updates
|
81 |
-
if ( $option_name == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
|
82 |
-
$widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
|
83 |
-
if ( !in_array( "categorisation-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed. "categorisation-$widget_number" is "{id_base}-{widget_number}
|
84 |
-
unset($options[$widget_number]);
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
foreach ( (array) $_POST[$option_name] as $widget_number => $widget_wpsc_categorisation_instance ) {
|
89 |
-
// compile data from $widget_wpsc_categorisation_instance
|
90 |
-
if ((!isset($widget_wpsc_categorisation_instance['title']) && isset($options[$widget_number])) || ($options[$widget_number]['check'] == 1)) {// user clicked cancel or no changes made
|
91 |
-
continue;
|
92 |
-
}
|
93 |
-
$options[$widget_number]['title'] = esc_html($widget_wpsc_categorisation_instance['title']);
|
94 |
-
$categorisation_groups = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CATEGORISATION_GROUPS."` WHERE `active` IN ('1')", ARRAY_A);
|
95 |
-
|
96 |
-
|
97 |
-
foreach($categorisation_groups as $cat_group){
|
98 |
-
if($widget_wpsc_categorisation_instance['categorisation'][$cat_group['id']] == "true") {
|
99 |
-
$options[$widget_number]['categorisation'][$cat_group['id']] = true;
|
100 |
-
} else {
|
101 |
-
$options[$widget_number]['categorisation'][$cat_group['id']] = false;
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
if ($widget_wpsc_categorisation_instance['image'] == "true") {
|
106 |
-
$options[$widget_number]['image'] = true;
|
107 |
-
} else {
|
108 |
-
$options[$widget_number]['image'] = false;
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
update_option($option_name, $options);
|
113 |
-
$updated = true; // So that we don't go through this more than once
|
114 |
-
}
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
// Here we echo out the form
|
121 |
-
if ( -1 == $number ) { // We echo out a template for a form which can be converted to a specific form later via JS
|
122 |
-
$something = '';
|
123 |
-
$number = '%i%';
|
124 |
-
} else {
|
125 |
-
$title = esc_attr($options[$number]['title']);
|
126 |
-
}
|
127 |
-
|
128 |
-
|
129 |
-
//echo "<pre>".print_r($_POST,true)."</pre>";
|
130 |
-
//echo "<pre>".print_r($options,true)."</pre>";
|
131 |
-
|
132 |
-
|
133 |
-
echo "<p>\n\r";
|
134 |
-
echo " <label for='{$option_name}-{$number}-title'>".__('Title:')."<input class='widefat' id='{$option_name}-{$number}-title' name='{$option_name}[{$number}][title]' type='text' value='{$title}' /></label>\n\r";
|
135 |
-
echo " <input type='hidden' id='widget-categorisation-submit-$number' name='{$option_name}[$number][submit]' value='1' />\n\r";
|
136 |
-
echo "</p>\n\r";
|
137 |
-
|
138 |
-
echo "<p>\n\r";
|
139 |
-
|
140 |
-
$categorisation_groups = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CATEGORISATION_GROUPS."` WHERE `active` IN ('1')", ARRAY_A);
|
141 |
-
|
142 |
-
foreach($categorisation_groups as $cat_group){
|
143 |
-
$checked = '';
|
144 |
-
//$checked = "checked='checked'";
|
145 |
-
$category_count = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `group_id` IN ('{$cat_group['id']}')");
|
146 |
-
//$category_group_name = str_replace("[categorisation]", , __('Display "[categorisation]"', 'wpsc'));
|
147 |
-
|
148 |
-
if($options[$number]['categorisation'][$cat_group['id']] == true) {
|
149 |
-
$checked = "checked='checked'";
|
150 |
-
}
|
151 |
-
|
152 |
-
if($category_count <1) {
|
153 |
-
// if count of items is less than 1, disable it, but do it later, not a vital feture
|
154 |
-
//$checked = "disabled='true' ";
|
155 |
-
}
|
156 |
-
$form_id = "{$option_name}-{$number}-group{$cat_group['id']}";
|
157 |
-
echo " <label for='{$form_id}'>\n\r";
|
158 |
-
echo " <input type='checkbox' name='{$option_name}[$number][categorisation][{$cat_group['id']}]' id='{$form_id}' value='true' class='checkbox' {$checked} />\n\r";
|
159 |
-
echo " ".str_replace(":category:",$cat_group['name'],__('Display the :category: Group', 'wpsc'))."</label>\n\r";
|
160 |
-
echo " <br/>\n\r";
|
161 |
-
}
|
162 |
-
if ($options[$number]['image'] == true) {
|
163 |
-
$checked = "checked='checked'";
|
164 |
-
}
|
165 |
-
echo "<br />\n\r";
|
166 |
-
echo " <label for='sidebar_category_image'>\n\r";
|
167 |
-
echo " <input type='checkbox' name='{$option_name}[$number][image]' id='sidebar_category_image' value='true' class='checkbox' {$checked} />\n\r";
|
168 |
-
echo " ".__('Display the Group thumbnails in the sidebar', 'wpsc')."</label>\n\r";
|
169 |
-
echo " <br/>\n\r";
|
170 |
-
echo " <input type='hidden' name='{$option_name}[$number][check]' value='1' />\n\r";
|
171 |
-
}
|
172 |
-
|
173 |
-
|
174 |
-
// Registers each instance of our widget on startup
|
175 |
-
function widget_wpsc_categorisation_register() {
|
176 |
-
$option_name = 'widget_wpsc_categorisation';
|
177 |
-
if ( !$options = get_option($option_name))
|
178 |
-
$options = array();
|
179 |
-
$widget_ops = array('classname' => 'widget_wpsc_categorisation', 'description' => __(__('Product Grouping Widget', 'wpsc')));
|
180 |
-
$control_ops = array('width' => 232, 'height' => 350, 'id_base' => 'wpsc_categorisation');
|
181 |
-
$name = __("Product Categories", 'wpsc');
|
182 |
-
|
183 |
-
$registered = false;
|
184 |
-
foreach ( array_keys($options) as $o ) {
|
185 |
-
// Old widgets can have null values for some reason
|
186 |
-
if ( !isset($options[$o]['title']) ) // we used 'something' above in our example. Replace with with whatever your real data are.
|
187 |
-
continue;
|
188 |
-
|
189 |
-
// $id should look like {$id_base}-{$o}
|
190 |
-
$id = "wpsc_categorisation-$o"; // Never never never translate an id
|
191 |
-
$registered = true;
|
192 |
-
wp_register_sidebar_widget( $id, $name, 'widget_wpsc_categorisation', $widget_ops, array( 'number' => $o ) );
|
193 |
-
wp_register_widget_control( $id, $name, 'widget_wpsc_categorisation_control', $control_ops, array( 'number' => $o ) );
|
194 |
-
}
|
195 |
-
|
196 |
-
// If there are none, we register the widget's existance with a generic template
|
197 |
-
if ( !$registered ) {
|
198 |
-
wp_register_sidebar_widget( 'wpsc_categorisation-1', $name, 'widget_wpsc_categorisation', $widget_ops, array( 'number' => -1 ) );
|
199 |
-
wp_register_widget_control( 'wpsc_categorisation-1', $name, 'widget_wpsc_categorisation_control', $control_ops, array( 'number' => -1 ) );
|
200 |
-
}
|
201 |
-
}
|
202 |
-
|
203 |
-
// This is important
|
204 |
-
add_action( 'widgets_init', 'widget_wpsc_categorisation_register' );
|
205 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/{category_widget.28.php → category_widget.php}
RENAMED
@@ -58,4 +58,4 @@ class WP_Widget_Product_Categories extends WP_Widget {
|
|
58 |
}
|
59 |
|
60 |
add_action('widgets_init', create_function('', 'return register_widget("WP_Widget_Product_Categories");'));
|
61 |
-
?>
|
58 |
}
|
59 |
|
60 |
add_action('widgets_init', create_function('', 'return register_widget("WP_Widget_Product_Categories");'));
|
61 |
+
?>
|
widgets/latest_product_widget.php
CHANGED
@@ -1,126 +1,186 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
6 |
*/
|
7 |
-
|
8 |
-
global $wpdb, $table_prefix;
|
9 |
-
extract($args);
|
10 |
-
$options = get_option('wpsc-widget_latest_products');
|
11 |
-
$title = empty($options['title']) ?__('Latest Product', 'wpsc') : $options['title'];
|
12 |
-
echo $before_widget."<br />";
|
13 |
-
$full_title = $before_title . $title . $after_title;
|
14 |
-
echo $full_title."<br />";
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
function nzshpcrt_latest_product($input = null) {
|
26 |
-
global $wpdb;
|
27 |
-
$siteurl = get_option('siteurl');
|
28 |
-
$options = get_option("wpsc-widget_latest_products");
|
29 |
-
$number = ($options["number"]==0)?5:$options["number"];
|
30 |
-
//$latest_product = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `active` IN ('1') ORDER BY `id` DESC LIMIT ".$number, ARRAY_A);
|
31 |
-
$latest_products = get_posts(array(
|
32 |
-
'post_type' => 'wpsc-product',
|
33 |
-
'posts_per_page' => 1,
|
34 |
-
'orderby' => 'post_date',
|
35 |
-
'post_parent' => 0,
|
36 |
-
'post_status' => 'all',
|
37 |
-
'order' => "DESC"
|
38 |
-
));
|
39 |
-
$latest_product = $latest_products[0];
|
40 |
-
//exit( "<pre>".print_r($latest_product,true)."</pre>");
|
41 |
-
if($latest_product != null) {
|
42 |
-
$output = "<div>";
|
43 |
-
$output.="<div>";
|
44 |
-
$output .= " <div class='item_image'>";
|
45 |
-
$output.=" <a href='".wpsc_product_url($latest_product->ID, null)."'>";
|
46 |
-
$attached_images = (array)get_posts(array(
|
47 |
-
'post_type' => 'attachment',
|
48 |
-
'numberposts' => 1,
|
49 |
-
'post_status' => null,
|
50 |
-
'post_parent' => $latest_product->ID,
|
51 |
-
'orderby' => 'menu_order',
|
52 |
-
'order' => 'ASC'
|
53 |
-
));
|
54 |
-
$attached_image = $attached_images[0];
|
55 |
-
if(($attached_image->ID > 0)) {
|
56 |
-
if(get_option('wpsc_selected_theme') == 'marketplace') {
|
57 |
-
$src = WPSC_IMAGE_URL.$special['image'];
|
58 |
-
|
59 |
-
$output .= " <img src='". wpsc_product_image($attached_image->ID, 100, 75)."' title='".$latest_product->post_title."' alt='".$latest_product->post_title."' />";
|
60 |
-
|
61 |
-
} else {
|
62 |
-
$output .= " <img src='". wpsc_product_image($attached_image->ID, 45, 25)."' title='".$latest_product->post_title."' alt='".$latest_product->post_title."' /><br />";
|
63 |
-
}
|
64 |
-
} else {
|
65 |
-
//$output .= "<img src='$siteurl/wp-content/plugins/wp-shopping-cart/no-image-uploaded.gif' title='".$special['name']."' alt='".$special['name']."' /><br />";
|
66 |
-
}
|
67 |
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
$
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
-
$output .= "</div>";
|
77 |
-
} else {
|
78 |
-
$output = '';
|
79 |
}
|
80 |
-
echo $input.$output;
|
81 |
-
}
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
93 |
|
|
|
|
|
94 |
}
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
-
$title = htmlspecialchars($options['title'], ENT_QUOTES);
|
100 |
-
|
101 |
-
echo "<p>\n\r";
|
102 |
-
echo " <label for='{$option_name}'>"._e('Title:')."<input class='widefat' id='{$option_name}' name='{$option_name}' type='text' value='{$title}' /></label>\n\r";
|
103 |
-
echo " <label for='wpsc_lpwn'>"._e('Number of products to show:')."
|
104 |
-
<select id='wpsc_lpwn' name='wpsc_lpwn'>";
|
105 |
-
for($i = 1; $i <= 30; $i++){
|
106 |
-
$selected=''; if ($i==$options["number"]) $selected=" SELECTED "; echo "<option".$selected." value='".$i."'>".$i."</option>";
|
107 |
-
}
|
108 |
-
echo " </select>
|
109 |
-
</label>\n\r";
|
110 |
|
111 |
-
echo "</p>\n\r";
|
112 |
}
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
*/
|
118 |
-
function
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
}
|
123 |
-
|
|
|
|
|
124 |
}
|
125 |
-
|
126 |
-
|
1 |
<?php
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Latest Product widget class
|
7 |
+
*
|
8 |
+
* Takes the settings, works out if there is anything to display, if so, displays it.
|
9 |
+
*
|
10 |
+
* @since 3.8
|
11 |
*/
|
12 |
+
class WP_Widget_Latest_Products extends WP_Widget {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
/**
|
15 |
+
* Widget Constuctor
|
16 |
+
*/
|
17 |
+
function WP_Widget_Latest_Products() {
|
18 |
+
|
19 |
+
$widget_ops = array(
|
20 |
+
'classname' => 'widget_wpsc_latest_products',
|
21 |
+
'description' => __( 'Latest Products Widget', 'wpsc' )
|
22 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
$this->WP_Widget( 'wpsc_latest_products', __( 'Latest Products', 'wpsc' ), $widget_ops );
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Widget Output
|
30 |
+
*
|
31 |
+
* @param $args (array)
|
32 |
+
* @param $instance (array) Widget values.
|
33 |
+
*/
|
34 |
+
function widget( $args, $instance ) {
|
35 |
|
36 |
+
global $wpdb, $table_prefix;
|
37 |
+
|
38 |
+
extract( $args );
|
39 |
+
|
40 |
+
echo $before_widget;
|
41 |
+
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Latest Products' ) : $instance['title'] );
|
42 |
+
if ( $title ) {
|
43 |
+
echo $before_title . $title . $after_title;
|
44 |
+
}
|
45 |
+
nzshpcrt_latest_product();
|
46 |
+
echo $after_widget;
|
47 |
|
|
|
|
|
|
|
48 |
}
|
|
|
|
|
49 |
|
50 |
+
/**
|
51 |
+
* Update Widget
|
52 |
+
*
|
53 |
+
* @param $new_instance (array) New widget values.
|
54 |
+
* @param $old_instance (array) Old widget values.
|
55 |
+
*
|
56 |
+
* @return (array) New values.
|
57 |
+
*/
|
58 |
+
function update( $new_instance, $old_instance ) {
|
59 |
+
|
60 |
+
$instance = $old_instance;
|
61 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
62 |
+
$instance['number'] = (int)$new_instance['number'];
|
63 |
|
64 |
+
return $instance;
|
65 |
+
|
66 |
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Widget Options Form
|
70 |
+
*
|
71 |
+
* @param $instance (array) Widget values.
|
72 |
+
*/
|
73 |
+
function form( $instance ) {
|
74 |
+
|
75 |
+
global $wpdb;
|
76 |
+
|
77 |
+
// Defaults
|
78 |
+
$instance = wp_parse_args( (array)$instance, array( 'title' => '', 'number' => 5 ) );
|
79 |
+
|
80 |
+
// Values
|
81 |
+
$title = esc_attr( $instance['title'] );
|
82 |
+
$number = (int)$instance['number'];
|
83 |
+
|
84 |
+
?>
|
85 |
+
<p>
|
86 |
+
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
|
87 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" />
|
88 |
+
</p>
|
89 |
+
<p>
|
90 |
+
<label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of products to show', 'wpsc' ); ?></label>
|
91 |
+
<select id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>">
|
92 |
+
<?php
|
93 |
+
for ( $i = 1; $i <= 30; $i++ ) {
|
94 |
+
$selected = '';
|
95 |
+
if ( $i == $number ) $selected = ' selected="selected"';
|
96 |
+
echo '<option' . $selected . ' value="' . $i . '">' . $i . '</option>';
|
97 |
+
}
|
98 |
+
?>
|
99 |
+
</select>
|
100 |
+
</p>
|
101 |
+
<?php
|
102 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
|
|
104 |
}
|
105 |
|
106 |
+
add_action( 'widgets_init', create_function( '', 'return register_widget("WP_Widget_Latest_Products");' ) );
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Latest Product Widget content function
|
110 |
+
*
|
111 |
+
* Displays the latest products.
|
112 |
+
*
|
113 |
+
* @todo Options need to be passed as a paramter from the widget - is the $input paramter is needed? Would be better if expect an array of arguments.
|
114 |
+
* @todo Make this use wp_query and a theme file (if no theme file present there should be a default output).
|
115 |
+
* @todo Remove marketplace theme specific code and maybe replce with a filter for the image output?
|
116 |
+
* @todo Should this latest products function live in a different file, seperate to the widget logic?
|
117 |
+
*
|
118 |
+
* Changes made in 3.8 that may affect users:
|
119 |
+
*
|
120 |
+
* 1. The product title link text does now not have a bold tag, it should be styled via css.
|
121 |
+
* 2. <br /> tags have been ommitted. Padding and margins should be applied via css.
|
122 |
+
* 3. Each product is enclosed in a <div> with a 'wpec-latest-product' class.
|
123 |
+
* 4. The product list is enclosed in a <div> with a 'wpec-latest-products' class.
|
124 |
*/
|
125 |
+
function nzshpcrt_latest_product( $input = null ) {
|
126 |
+
|
127 |
+
global $wpdb;
|
128 |
+
|
129 |
+
$siteurl = get_option( 'siteurl' );
|
130 |
+
$options = get_option( 'wpsc-widget_latest_products' );
|
131 |
+
$number = ( $options['number'] == 0 ) ? 5 : $options['number'];
|
132 |
+
|
133 |
+
$latest_products = get_posts( array(
|
134 |
+
'post_type' => 'wpsc-product',
|
135 |
+
'numberposts' => $number,
|
136 |
+
'orderby' => 'post_date',
|
137 |
+
'post_parent' => 0,
|
138 |
+
'post_status' => 'all',
|
139 |
+
'order' => 'DESC'
|
140 |
+
) );
|
141 |
+
|
142 |
+
$output = '';
|
143 |
+
|
144 |
+
if ( count( $latest_products ) > 0 ) {
|
145 |
+
$output .= '<div class="wpec-latest-products">';
|
146 |
+
foreach ( $latest_products as $latest_product ) {
|
147 |
+
$output .= '<div class="wpec-latest-product">';
|
148 |
+
|
149 |
+
// Image
|
150 |
+
$output .= '<div class="item_image">';
|
151 |
+
$output .= '<a href="' . wpsc_product_url( $latest_product->ID, null ) . '">';
|
152 |
+
$attached_images = (array)get_posts( array(
|
153 |
+
'post_type' => 'attachment',
|
154 |
+
'numberposts' => 1,
|
155 |
+
'post_status' => null,
|
156 |
+
'post_parent' => $latest_product->ID,
|
157 |
+
'orderby' => 'menu_order',
|
158 |
+
'order' => 'ASC'
|
159 |
+
) );
|
160 |
+
$attached_image = $attached_images[0];
|
161 |
+
if ( $attached_image->ID > 0 ) {
|
162 |
+
if ( get_option( 'wpsc_selected_theme' ) == 'marketplace' ) {
|
163 |
+
$src = WPSC_IMAGE_URL . $special['image'];
|
164 |
+
$output .= '<img src="' . wpsc_product_image( $attached_image->ID, 100, 75 ) . '" title="' . $latest_product->post_title . '" alt="' . $latest_product->post_title . '" />';
|
165 |
+
} else {
|
166 |
+
$output .= '<img src="' . wpsc_product_image( $attached_image->ID, 45, 25 ) . '" title="' . $latest_product->post_title . '" alt="' . $latest_product->post_title . '" />';
|
167 |
+
}
|
168 |
+
}
|
169 |
+
$output .= '</a>';
|
170 |
+
$output .= '</div>';
|
171 |
+
|
172 |
+
// Link
|
173 |
+
$output .= '<a href="' . wpsc_product_url( $latest_product->ID, null ) . '" class="wpec-product-title">';
|
174 |
+
$output .= stripslashes( $latest_product->post_title );
|
175 |
+
$output .= '</a>';
|
176 |
+
$output .= '</div>';
|
177 |
+
|
178 |
+
}
|
179 |
+
$output .= "</div>";
|
180 |
}
|
181 |
+
|
182 |
+
echo $input . $output;
|
183 |
+
|
184 |
}
|
185 |
+
|
186 |
+
?>
|
wp-shopping-cart.php
CHANGED
@@ -199,11 +199,7 @@ include_once(WPSC_FILE_PATH.'/widgets/latest_product_widget.php');
|
|
199 |
include_once(WPSC_FILE_PATH.'/widgets/price_range_widget.php');
|
200 |
include_once(WPSC_FILE_PATH.'/widgets/admin_menu_widget.php');
|
201 |
//include_once(WPSC_FILE_PATH.'/widgets/api_key_widget.php');
|
202 |
-
|
203 |
-
include_once(WPSC_FILE_PATH.'/widgets/category_widget.28.php');
|
204 |
-
} else {
|
205 |
-
include_once(WPSC_FILE_PATH.'/widgets/category_widget.27.php');
|
206 |
-
}
|
207 |
|
208 |
|
209 |
include_once(WPSC_FILE_PATH.'/image_processing.php');
|
@@ -592,7 +588,7 @@ $labels = array(
|
|
592 |
|
593 |
function wpsc_check_for_theme() {
|
594 |
|
595 |
-
$file =
|
596 |
$wpsc_file = WPSC_FILE_PATH."/themes/single-wpsc-product.php";
|
597 |
|
598 |
//Check for single-wpsc-product.php in currently active theme dir
|
199 |
include_once(WPSC_FILE_PATH.'/widgets/price_range_widget.php');
|
200 |
include_once(WPSC_FILE_PATH.'/widgets/admin_menu_widget.php');
|
201 |
//include_once(WPSC_FILE_PATH.'/widgets/api_key_widget.php');
|
202 |
+
include_once(WPSC_FILE_PATH.'/widgets/category_widget.php');
|
|
|
|
|
|
|
|
|
203 |
|
204 |
|
205 |
include_once(WPSC_FILE_PATH.'/image_processing.php');
|
588 |
|
589 |
function wpsc_check_for_theme() {
|
590 |
|
591 |
+
$file = get_stylesheet_directory()."/single-wpsc-product.php";
|
592 |
$wpsc_file = WPSC_FILE_PATH."/themes/single-wpsc-product.php";
|
593 |
|
594 |
//Check for single-wpsc-product.php in currently active theme dir
|
wpec-taxes/controllers/taxes_controller.class.php
CHANGED
@@ -137,6 +137,9 @@ class wpec_taxes_controller
|
|
137 |
**/
|
138 |
function wpec_taxes_retrieve_region()
|
139 |
{
|
|
|
|
|
|
|
140 |
switch($this->wpec_taxes->wpec_taxes_get_logic())
|
141 |
{
|
142 |
case 'billing_shipping':
|
137 |
**/
|
138 |
function wpec_taxes_retrieve_region()
|
139 |
{
|
140 |
+
|
141 |
+
global $wpsc_cart;
|
142 |
+
|
143 |
switch($this->wpec_taxes->wpec_taxes_get_logic())
|
144 |
{
|
145 |
case 'billing_shipping':
|
wpsc-admin/admin.php
CHANGED
@@ -332,7 +332,7 @@ function wpsc_admin_dynamic_js() {
|
|
332 |
$hidden_boxes = get_option('wpsc_hidden_box');
|
333 |
|
334 |
$form_types1 = get_option('wpsc_checkout_form_fields');
|
335 |
-
$unique_names1 = Array('billingfirstname', 'billinglastname', 'billingaddress', 'billingcity',
|
336 |
'billingcountry', 'billingemail', 'billingphone', 'billingpostcode',
|
337 |
'delivertoafriend', 'shippingfirstname', 'shippinglastname', 'shippingaddress',
|
338 |
'shippingcity', 'shippingstate', 'shippingcountry', 'shippingpostcode');
|
332 |
$hidden_boxes = get_option('wpsc_hidden_box');
|
333 |
|
334 |
$form_types1 = get_option('wpsc_checkout_form_fields');
|
335 |
+
$unique_names1 = Array('billingfirstname', 'billinglastname', 'billingaddress', 'billingcity', 'billingstate',
|
336 |
'billingcountry', 'billingemail', 'billingphone', 'billingpostcode',
|
337 |
'delivertoafriend', 'shippingfirstname', 'shippinglastname', 'shippingaddress',
|
338 |
'shippingcity', 'shippingstate', 'shippingcountry', 'shippingpostcode');
|
wpsc-admin/ajax-and-init.php
CHANGED
@@ -1302,7 +1302,7 @@ function wpsc_purchlog_resend_email(){
|
|
1302 |
add_filter('wp_mail_from', 'wpsc_replace_reply_address', 0);
|
1303 |
add_filter('wp_mail_from_name', 'wpsc_replace_reply_name', 0);
|
1304 |
if($purchase_log['processed'] < 2) {
|
1305 |
-
$payment_instructions = strip_tags(get_option('payment_instructions'));
|
1306 |
$message = __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "\n\r" . $payment_instructions ."\n\r". $message;
|
1307 |
$resent = (bool)wp_mail($email, __('Order Pending: Payment Required', 'wpsc'), $message);
|
1308 |
$sent = 1;
|
@@ -1565,11 +1565,6 @@ if(isset($_REQUEST['wpsc_admin_action']) && ($_REQUEST['wpsc_admin_action'] == '
|
|
1565 |
add_action('admin_init', 'wpsc_delete_purchlog');
|
1566 |
}
|
1567 |
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
/*
|
1574 |
* Get Shipping Form ajax call
|
1575 |
*/
|
@@ -1587,6 +1582,20 @@ function wpsc_ajax_get_shipping_form() {
|
|
1587 |
exit();
|
1588 |
}
|
1589 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1590 |
function wpsc_crop_thumbnail_html() {
|
1591 |
include(WPSC_FILE_PATH."/wpsc-admin/includes/crop.php");
|
1592 |
exit();
|
@@ -1604,6 +1613,10 @@ if(isset($_REQUEST['wpsc_admin_action']) && ($_REQUEST['wpsc_admin_action'] == '
|
|
1604 |
add_action('admin_init', 'wpsc_ajax_get_shipping_form');
|
1605 |
}
|
1606 |
|
|
|
|
|
|
|
|
|
1607 |
|
1608 |
|
1609 |
/*
|
@@ -2041,7 +2054,7 @@ function wpsc_gateway_settings(){
|
|
2041 |
|
2042 |
|
2043 |
|
2044 |
-
if(is_array($_POST['user_defined_name'])) {
|
2045 |
$payment_gateway_names = get_option('payment_gateway_names');
|
2046 |
if(!is_array($payment_gateway_names)) {
|
2047 |
$payment_gateway_names = array();
|
@@ -2049,19 +2062,21 @@ function wpsc_gateway_settings(){
|
|
2049 |
$payment_gateway_names = array_merge($payment_gateway_names, (array)$_POST['user_defined_name']);
|
2050 |
update_option('payment_gateway_names', $payment_gateway_names);
|
2051 |
}
|
2052 |
-
|
2053 |
-
|
2054 |
|
2055 |
foreach($GLOBALS['nzshpcrt_gateways'] as $gateway) {
|
2056 |
-
|
|
|
2057 |
{
|
|
|
2058 |
if(isset($gateway['submit_function'])) {
|
2059 |
call_user_func_array($gateway['submit_function'], array());
|
2060 |
$changes_made = true;
|
2061 |
}
|
2062 |
}
|
2063 |
}
|
2064 |
-
if(($_POST['payment_gw'] != null)) {
|
2065 |
update_option('payment_gateway', $_POST['payment_gw']);
|
2066 |
}
|
2067 |
$sendback = wp_get_referer();
|
@@ -2074,8 +2089,10 @@ function wpsc_gateway_settings(){
|
|
2074 |
$sendback = add_query_arg('tab', $_SESSION['wpsc_settings_curr_page'], $sendback);
|
2075 |
}
|
2076 |
//sexit($sendback);
|
|
|
|
|
2077 |
wp_redirect($sendback);
|
2078 |
-
|
2079 |
|
2080 |
}
|
2081 |
if(isset($_REQUEST['wpsc_gateway_settings']) && ($_REQUEST['wpsc_gateway_settings'] == 'gateway_settings')) {
|
1302 |
add_filter('wp_mail_from', 'wpsc_replace_reply_address', 0);
|
1303 |
add_filter('wp_mail_from_name', 'wpsc_replace_reply_name', 0);
|
1304 |
if($purchase_log['processed'] < 2) {
|
1305 |
+
$payment_instructions = strip_tags(stripslashes(get_option('payment_instructions')));
|
1306 |
$message = __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "\n\r" . $payment_instructions ."\n\r". $message;
|
1307 |
$resent = (bool)wp_mail($email, __('Order Pending: Payment Required', 'wpsc'), $message);
|
1308 |
$sent = 1;
|
1565 |
add_action('admin_init', 'wpsc_delete_purchlog');
|
1566 |
}
|
1567 |
|
|
|
|
|
|
|
|
|
|
|
1568 |
/*
|
1569 |
* Get Shipping Form ajax call
|
1570 |
*/
|
1582 |
exit();
|
1583 |
}
|
1584 |
|
1585 |
+
function wpsc_ajax_get_payment_form() {
|
1586 |
+
global $wpdb, $nzshpcrt_gateways;
|
1587 |
+
$paymentname = $_REQUEST['paymentname'];
|
1588 |
+
$_SESSION['previous_payment_name'] = $paymentname;
|
1589 |
+
$payment_data = wpsc_get_payment_form($paymentname);
|
1590 |
+
$html_payment_name = str_replace(Array("\n","\r") , Array("\\n","\\r"),addslashes($payment_data['name']));
|
1591 |
+
$payment_form = str_replace(Array("\n","\r") , Array("\\n","\\r"),addslashes($payment_data['form_fields']));
|
1592 |
+
echo "payment_name_html = '$html_payment_name'; \n\r";
|
1593 |
+
echo "payment_form_html = '$payment_form'; \n\r";
|
1594 |
+
echo "has_submit_button = '{$payment_data['has_submit_button']}'; \n\r";
|
1595 |
+
//echo "<script type='text/javascript'>jQuery('.gateway_settings h3.hndle').livequery(function(){ jQuery(this).html('".$wpsc_shipping_modules[$shippingname]->name."')})</script>";
|
1596 |
+
exit();
|
1597 |
+
}
|
1598 |
+
|
1599 |
function wpsc_crop_thumbnail_html() {
|
1600 |
include(WPSC_FILE_PATH."/wpsc-admin/includes/crop.php");
|
1601 |
exit();
|
1613 |
add_action('admin_init', 'wpsc_ajax_get_shipping_form');
|
1614 |
}
|
1615 |
|
1616 |
+
if(isset($_REQUEST['wpsc_admin_action']) && ($_REQUEST['wpsc_admin_action'] == 'get_payment_form')) {
|
1617 |
+
add_action('admin_init', 'wpsc_ajax_get_payment_form');
|
1618 |
+
}
|
1619 |
+
|
1620 |
|
1621 |
|
1622 |
/*
|
2054 |
|
2055 |
|
2056 |
|
2057 |
+
if(isset($_POST['user_defined_name']) && is_array($_POST['user_defined_name'])) {
|
2058 |
$payment_gateway_names = get_option('payment_gateway_names');
|
2059 |
if(!is_array($payment_gateway_names)) {
|
2060 |
$payment_gateway_names = array();
|
2062 |
$payment_gateway_names = array_merge($payment_gateway_names, (array)$_POST['user_defined_name']);
|
2063 |
update_option('payment_gateway_names', $payment_gateway_names);
|
2064 |
}
|
2065 |
+
$custom_gateways = get_option('custom_gateway_options');
|
2066 |
+
// exit('<pre>'.print_r($GLOBALS['nzshpcrt_gateways'],true).'</pre>');
|
2067 |
|
2068 |
foreach($GLOBALS['nzshpcrt_gateways'] as $gateway) {
|
2069 |
+
//if($gateway['internalname'] == get_option('payment_gateway'))
|
2070 |
+
if(in_array($gateway['internalname'], $custom_gateways))
|
2071 |
{
|
2072 |
+
print_r($gateway);
|
2073 |
if(isset($gateway['submit_function'])) {
|
2074 |
call_user_func_array($gateway['submit_function'], array());
|
2075 |
$changes_made = true;
|
2076 |
}
|
2077 |
}
|
2078 |
}
|
2079 |
+
if((isset($_POST['payment_gw'] ) && $_POST['payment_gw'] != null)) {
|
2080 |
update_option('payment_gateway', $_POST['payment_gw']);
|
2081 |
}
|
2082 |
$sendback = wp_get_referer();
|
2089 |
$sendback = add_query_arg('tab', $_SESSION['wpsc_settings_curr_page'], $sendback);
|
2090 |
}
|
2091 |
//sexit($sendback);
|
2092 |
+
|
2093 |
+
// exit('<pre>'.print_r($_POST).'</pre>');
|
2094 |
wp_redirect($sendback);
|
2095 |
+
exit();
|
2096 |
|
2097 |
}
|
2098 |
if(isset($_REQUEST['wpsc_gateway_settings']) && ($_REQUEST['wpsc_gateway_settings'] == 'gateway_settings')) {
|
wpsc-admin/css/admin.css
CHANGED
@@ -1012,6 +1012,7 @@ float: left;
|
|
1012 |
/* shipping options start here */
|
1013 |
div.wpsc_shipping_options{
|
1014 |
width:100%;
|
|
|
1015 |
}
|
1016 |
.wpsc-shipping-actions{
|
1017 |
visibility:hidden;
|
1012 |
/* shipping options start here */
|
1013 |
div.wpsc_shipping_options{
|
1014 |
width:100%;
|
1015 |
+
padding:3px 0;
|
1016 |
}
|
1017 |
.wpsc-shipping-actions{
|
1018 |
visibility:hidden;
|
wpsc-admin/display-items.page.php
CHANGED
@@ -44,6 +44,8 @@ function wpsc_display_edit_products_page() {
|
|
44 |
if(isset($_GET["product"]) && $_GET["product"] != '') {
|
45 |
unset($columns["categories"]);
|
46 |
}
|
|
|
|
|
47 |
register_column_headers('display-product-list', $columns);
|
48 |
|
49 |
$baseurl = includes_url('js/tinymce');
|
@@ -74,8 +76,8 @@ function wpsc_display_edit_products_page() {
|
|
74 |
<div id="message" class="updated fade">
|
75 |
<p>
|
76 |
<?php
|
77 |
-
|
78 |
-
if(!isset($_GET['deleted'])) $_GET['deleted'] = 0.00;
|
79 |
|
80 |
if ( isset($_GET['updated'])) {
|
81 |
printf( _n( '%s product updated.', '%s products updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
|
44 |
if(isset($_GET["product"]) && $_GET["product"] != '') {
|
45 |
unset($columns["categories"]);
|
46 |
}
|
47 |
+
$columns = apply_filters( 'manage_display-product-list_columns', $columns );
|
48 |
+
|
49 |
register_column_headers('display-product-list', $columns);
|
50 |
|
51 |
$baseurl = includes_url('js/tinymce');
|
76 |
<div id="message" class="updated fade">
|
77 |
<p>
|
78 |
<?php
|
79 |
+
//Not sure when or why this was added...seems to be the culprit for the constant deletion notice. Just commenting out in case it's actually necessary.
|
80 |
+
// if(!isset($_GET['deleted'])) $_GET['deleted'] = 0.00;
|
81 |
|
82 |
if ( isset($_GET['updated'])) {
|
83 |
printf( _n( '%s product updated.', '%s products updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
|
wpsc-admin/display-options-settings.page.php
CHANGED
@@ -183,6 +183,30 @@ function wpsc_get_shipping_form($shippingname) {
|
|
183 |
return $output;
|
184 |
}
|
185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
function wpsc_settings_page_update_notification(){
|
188 |
if (isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['shipadd']) ) { ?>
|
183 |
return $output;
|
184 |
}
|
185 |
|
186 |
+
/*
|
187 |
+
* Get Payment Form for wp-admin
|
188 |
+
*/
|
189 |
+
function wpsc_get_payment_form($paymentname) {
|
190 |
+
global $wpdb, $nzshpcrt_gateways;
|
191 |
+
$form = array();
|
192 |
+
foreach($nzshpcrt_gateways as $gateway) {
|
193 |
+
if($gateway["internalname"] != $paymentname) {
|
194 |
+
continue;
|
195 |
+
} else {
|
196 |
+
$form = $gateway;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
if($form) {
|
200 |
+
$payment_forms = $form["form"]();
|
201 |
+
$payment_module_name = $form["name"];
|
202 |
+
|
203 |
+
$output = array('name' => $payment_module_name, 'form_fields' => $payment_forms, 'has_submit_button' => 1);
|
204 |
+
} else {
|
205 |
+
$output = array('name' => ' ', 'form_fields' => __('To configure a payment module select one on the left.', 'wpsc'), 'has_submit_button' => 0);
|
206 |
+
}
|
207 |
+
return $output;
|
208 |
+
}
|
209 |
+
|
210 |
|
211 |
function wpsc_settings_page_update_notification(){
|
212 |
if (isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['shipadd']) ) { ?>
|
wpsc-admin/display-sales-logs.php
CHANGED
@@ -258,7 +258,7 @@ if(!isset($purchlogs)){
|
|
258 |
|
259 |
<br /><br class='small' /><img src='<?php echo WPSC_URL; ?>/images/email_go.png' alt='email icon' /> <a href='<?php echo add_query_arg('email_buyer_id',$_GET['purchaselog_id']); ?>'><?php echo __('Resend Receipt to Buyer', 'wpsc'); ?></a>
|
260 |
|
261 |
-
<br /><br class='small' /><a class='submitdelete' title='<?php echo esc_attr(__('Delete this log')); ?>' href='<?php echo wp_nonce_url("
|
262 |
|
263 |
<br /><br class='small' />   <a href='<?php echo $page_back ?>'><?php echo __('Go Back', 'wpsc'); ?></a>
|
264 |
<br /><br />
|
@@ -515,7 +515,7 @@ if(!isset($purchlogs)){
|
|
515 |
<a href='http://checkout.google.com/' rel=''><img class='google_checkout_logo' src='<?php echo WPSC_URL."/images/checkout_logo.jpg"; ?>' alt='google checkout' /></a>
|
516 |
<?php } ?>
|
517 |
</td><!-- Status -->
|
518 |
-
<td><a class='submitdelete' title='<?php echo esc_attr(__('Delete this log')); ?>' href='<?php echo wp_nonce_url("
|
519 |
<td>
|
520 |
<a class='wpsc_show_trackingid' title='<?php echo wpsc_the_purch_item_id(); ?>' href=''>+ tracking id</a>
|
521 |
</td>
|
258 |
|
259 |
<br /><br class='small' /><img src='<?php echo WPSC_URL; ?>/images/email_go.png' alt='email icon' /> <a href='<?php echo add_query_arg('email_buyer_id',$_GET['purchaselog_id']); ?>'><?php echo __('Resend Receipt to Buyer', 'wpsc'); ?></a>
|
260 |
|
261 |
+
<br /><br class='small' /><a class='submitdelete' title='<?php echo esc_attr(__('Delete this log')); ?>' href='<?php echo wp_nonce_url("admin.php?wpsc_admin_action=delete_purchlog&purchlog_id=".$_GET['purchaselog_id'], 'delete_purchlog_' .$_GET['purchaselog_id']); ?>' onclick="if ( confirm(' <?php echo esc_js(sprintf( __("You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete.",'wpsc'), wpsc_purchaselog_details_date() )) ?>') ) { return true;}return false;"><img src='<?php echo WPSC_URL."/images/cross.png"; ?>' alt='delete icon' /> <?php echo __('Remove this record', 'wpsc') ?></a>
|
262 |
|
263 |
<br /><br class='small' />   <a href='<?php echo $page_back ?>'><?php echo __('Go Back', 'wpsc'); ?></a>
|
264 |
<br /><br />
|
515 |
<a href='http://checkout.google.com/' rel=''><img class='google_checkout_logo' src='<?php echo WPSC_URL."/images/checkout_logo.jpg"; ?>' alt='google checkout' /></a>
|
516 |
<?php } ?>
|
517 |
</td><!-- Status -->
|
518 |
+
<td><a class='submitdelete' title='<?php echo esc_attr(__('Delete this log')); ?>' href='<?php echo wp_nonce_url("admin.php?wpsc_admin_action=delete_purchlog&purchlog_id=".wpsc_the_purch_item_id(), 'delete_purchlog_' . wpsc_the_purch_item_id()); ?>' onclick="if ( confirm(' <?php echo esc_js(sprintf( __("You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete."), wpsc_the_purch_item_date() )) ?>') ) { return true;}return false;"><img class='wpsc_pushdown_img' src='<?php echo WPSC_URL."/images/cross.png"; ?>' alt='delete icon' /><?php _e('Delete') ?></a></td><!-- Delete -->
|
519 |
<td>
|
520 |
<a class='wpsc_show_trackingid' title='<?php echo wpsc_the_purch_item_id(); ?>' href=''>+ tracking id</a>
|
521 |
</td>
|
wpsc-admin/display-update.page.php
CHANGED
@@ -57,6 +57,8 @@ function wpsc_display_update_page() {
|
|
57 |
wpsc_convert_variation_combinations();
|
58 |
echo '<br />Updating Product Files...';
|
59 |
wpsc_update_files();
|
|
|
|
|
60 |
echo '<br /><br /><strong>WP e-Commerce updated successfully!</strong>';
|
61 |
update_option('wpsc_version', 3.8);
|
62 |
else:
|
57 |
wpsc_convert_variation_combinations();
|
58 |
echo '<br />Updating Product Files...';
|
59 |
wpsc_update_files();
|
60 |
+
echo '<br />Updating Database...';
|
61 |
+
wpsc_update_database();
|
62 |
echo '<br /><br /><strong>WP e-Commerce updated successfully!</strong>';
|
63 |
update_option('wpsc_version', 3.8);
|
64 |
else:
|
wpsc-admin/includes/product-functions.php
CHANGED
@@ -596,8 +596,10 @@ function wpsc_edit_product_variations($product_id, $post_data) {
|
|
596 |
|
597 |
foreach ($posted_term as $term=>$val) {
|
598 |
$posted_terms[] = $term;
|
599 |
-
|
600 |
-
$
|
|
|
|
|
601 |
}
|
602 |
}
|
603 |
|
596 |
|
597 |
foreach ($posted_term as $term=>$val) {
|
598 |
$posted_terms[] = $term;
|
599 |
+
if(is_array($val)) {
|
600 |
+
foreach($val as $term2=>$val2) {
|
601 |
+
$posted_terms[] = $term2;
|
602 |
+
}
|
603 |
}
|
604 |
}
|
605 |
|
wpsc-admin/includes/products.php
CHANGED
@@ -56,6 +56,7 @@ function wpsc_product_row(&$product, $parent_product = null) {
|
|
56 |
<tr id='post-<?php echo $product->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $product->post_status ); ?> iedit <?php if ( get_option ( 'wpsc_sort_by' ) == 'dragndrop') { echo 'product-edit'; } ?>' valign="top">
|
57 |
<?php
|
58 |
$posts_columns = get_column_headers('display-product-list');
|
|
|
59 |
$hidden = get_hidden_columns('display-product-list');
|
60 |
//exit('<pre>'.print_r($product,true).'</pre>');
|
61 |
|
@@ -164,7 +165,7 @@ function wpsc_product_row(&$product, $parent_product = null) {
|
|
164 |
if ( current_user_can('edit_product', $product->ID) ) {
|
165 |
$actions['view'] = '<a href="'.get_permalink($product->ID).'" title="'.esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">'.__('Preview').'</a>';
|
166 |
}
|
167 |
-
} else if ( 'trash' != $product->post_status
|
168 |
$actions['view'] = '<a href="'.get_permalink($product->ID).'" title="'.esc_attr(sprintf(__('View “%s”'), $title)).'" rel="permalink">'.__('View').'</a>';
|
169 |
}
|
170 |
if(!isset($_GET["product"]) || $_GET["product"] == '' ) {
|
56 |
<tr id='post-<?php echo $product->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $product->post_status ); ?> iedit <?php if ( get_option ( 'wpsc_sort_by' ) == 'dragndrop') { echo 'product-edit'; } ?>' valign="top">
|
57 |
<?php
|
58 |
$posts_columns = get_column_headers('display-product-list');
|
59 |
+
$posts_columns = apply_filters( 'manage_display-product-list_columns', $posts_columns );
|
60 |
$hidden = get_hidden_columns('display-product-list');
|
61 |
//exit('<pre>'.print_r($product,true).'</pre>');
|
62 |
|
165 |
if ( current_user_can('edit_product', $product->ID) ) {
|
166 |
$actions['view'] = '<a href="'.get_permalink($product->ID).'" title="'.esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">'.__('Preview').'</a>';
|
167 |
}
|
168 |
+
} else if ( 'trash' != $product->post_status ) {
|
169 |
$actions['view'] = '<a href="'.get_permalink($product->ID).'" title="'.esc_attr(sprintf(__('View “%s”'), $title)).'" rel="permalink">'.__('View').'</a>';
|
170 |
}
|
171 |
if(!isset($_GET["product"]) || $_GET["product"] == '' ) {
|
wpsc-admin/includes/purchlogs_upgrade.php
CHANGED
@@ -43,6 +43,7 @@ function wpsc_select_options_purchlogs_fix($id){
|
|
43 |
<option value='billinglastname'>Billing Last Name</option>
|
44 |
<option value='billingaddress'>Billing Address</option>
|
45 |
<option value='billingcity'>Billing City</option>
|
|
|
46 |
<option value='billingcountry'>Billing Country</option>
|
47 |
<option value='billingemail'>Billing Email</option>
|
48 |
<option value='billingphone'>Billing Phone</option>
|
43 |
<option value='billinglastname'>Billing Last Name</option>
|
44 |
<option value='billingaddress'>Billing Address</option>
|
45 |
<option value='billingcity'>Billing City</option>
|
46 |
+
<option value='billingstate'>Billing State</option>
|
47 |
<option value='billingcountry'>Billing Country</option>
|
48 |
<option value='billingemail'>Billing Email</option>
|
49 |
<option value='billingphone'>Billing Phone</option>
|
wpsc-admin/includes/settings-pages/checkout.php
CHANGED
@@ -16,7 +16,7 @@ $form_types = Array("Text" => "text",
|
|
16 |
"Checkbox" => "checkbox"
|
17 |
);
|
18 |
|
19 |
-
$unique_names = Array('billingfirstname','billinglastname','billingaddress','billingcity','billingcountry','billingemail','billingphone','billingpostcode','delivertoafriend','shippingfirstname','shippinglastname','shippingaddress','shippingcity','shippingstate','shippingcountry','shippingpostcode');
|
20 |
|
21 |
update_option('wpsc_checkout_form_fields', $form_types);
|
22 |
if(get_option('wpsc_checkout_form_fields') == ''){
|
16 |
"Checkbox" => "checkbox"
|
17 |
);
|
18 |
|
19 |
+
$unique_names = Array('billingfirstname','billinglastname','billingaddress','billingcity','billingstate','billingcountry','billingemail','billingphone','billingpostcode','delivertoafriend','shippingfirstname','shippinglastname','shippingaddress','shippingcity','shippingstate','shippingcountry','shippingpostcode');
|
20 |
|
21 |
update_option('wpsc_checkout_form_fields', $form_types);
|
22 |
if(get_option('wpsc_checkout_form_fields') == ''){
|
wpsc-admin/includes/settings-pages/gateway.php
CHANGED
@@ -42,6 +42,7 @@ function selectgateway() {
|
|
42 |
|
43 |
</script>
|
44 |
<div class="wrap">
|
|
|
45 |
<div class='metabox-holder'>
|
46 |
<form name='gatewayopt' method='post' id='gateway_opt' action='' >
|
47 |
<input type='hidden' name='gateway_submits' value='true' />
|
@@ -83,10 +84,25 @@ function selectgateway() {
|
|
83 |
}
|
84 |
if (in_array($gateway['internalname'], (array)$selected_gateways)) {
|
85 |
?>
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
<?php } else { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
<p><input name='wpsc_options[custom_gateway_options][]' type='checkbox' value='<?php echo $gateway['internalname']; ?>' id='<?php echo $gateway['internalname']; ?>_id' />
|
89 |
-
<label for='<?php echo $gateway['internalname']; ?>_id'><?php echo $gateway['name']; ?></label></p>
|
90 |
<?php }
|
91 |
}
|
92 |
?>
|
@@ -105,103 +121,38 @@ function selectgateway() {
|
|
105 |
</td>
|
106 |
|
107 |
<td class='gateway_settings' rowspan='2'>
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
<table class='form-table'>
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
<tr>
|
124 |
-
<td class='wpsc_gateway_table'>
|
125 |
-
<h4><?php echo __('Payment Gateway', 'wpsc');?></h4>
|
126 |
-
</td>
|
127 |
-
<td style='border-top: none;'>
|
128 |
-
<select name='payment_gw' onchange='selectgateway();'>
|
129 |
-
<?php echo $gatewaylist; ?>
|
130 |
-
</select>
|
131 |
-
</td>
|
132 |
-
</tr>
|
133 |
-
|
134 |
-
|
135 |
-
<tr>
|
136 |
-
<td style='border-top: none;'>
|
137 |
-
<?php _e("Display Name");?>
|
138 |
-
</td>
|
139 |
-
<td style='border-top: none;'>
|
140 |
-
<?php
|
141 |
-
if (!isset($selected_gateway_data['internalname'])) $selected_gateway_data['internalname'] = '';
|
142 |
-
if(isset($payment_gateway_names[$selected_gateway_data['internalname']]) && $payment_gateway_names[$selected_gateway_data['internalname']] != '') {
|
143 |
-
$display_name = $payment_gateway_names[$selected_gateway_data['internalname']];
|
144 |
-
} else {
|
145 |
-
if (!isset($selected_gateway_data['payment_type'])) $selected_gateway_data['payment_type'] = '';
|
146 |
-
switch($selected_gateway_data['payment_type']) {
|
147 |
-
case "paypal";
|
148 |
-
$display_name = "PayPal";
|
149 |
-
break;
|
150 |
-
|
151 |
-
case "manual_payment":
|
152 |
-
$display_name = "Manual Payment";
|
153 |
-
break;
|
154 |
-
|
155 |
-
case "google_checkout":
|
156 |
-
$display_name = "Google Checkout";
|
157 |
-
break;
|
158 |
-
|
159 |
-
case "credit_card":
|
160 |
-
default:
|
161 |
-
$display_name = "Credit Card";
|
162 |
-
break;
|
163 |
-
}
|
164 |
-
}
|
165 |
-
?>
|
166 |
-
<input type='text' name='user_defined_name[<?php echo $selected_gateway_data['internalname']; ?>]' value='<?php echo $display_name; ?>' /><br />
|
167 |
-
<span class='small description'><?php __('The text that people see when making a purchase'); ?></span>
|
168 |
-
</td>
|
169 |
-
</tr>
|
170 |
-
|
171 |
-
<?php
|
172 |
-
if (!isset($form)) $form = '';
|
173 |
-
|
174 |
-
echo $form;
|
175 |
-
?>
|
176 |
-
|
177 |
-
<tr class='update_gateway' >
|
178 |
-
<td colspan='2'>
|
179 |
-
<div class='submit'>
|
180 |
<?php wp_nonce_field('update-options', 'wpsc-update-options'); ?>
|
181 |
<input type='submit' value='<?php echo __('Update »', 'wpsc')?>' name='updateoption' />
|
182 |
</div>
|
183 |
-
</td>
|
184 |
-
</tr>
|
185 |
-
</table>
|
186 |
-
<?php if (IS_WP27){ ?>
|
187 |
</div>
|
188 |
-
</div>
|
189 |
-
<?php } ?>
|
190 |
</td>
|
191 |
</tr>
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
</table>
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
</form>
|
202 |
</div>
|
203 |
</div>
|
204 |
|
205 |
<?php
|
206 |
-
}
|
207 |
?>
|
42 |
|
43 |
</script>
|
44 |
<div class="wrap">
|
45 |
+
<?php // global $nzshpcrt_gateways; print_r($nzshpcrt_gateways);?>
|
46 |
<div class='metabox-holder'>
|
47 |
<form name='gatewayopt' method='post' id='gateway_opt' action='' >
|
48 |
<input type='hidden' name='gateway_submits' value='true' />
|
84 |
}
|
85 |
if (in_array($gateway['internalname'], (array)$selected_gateways)) {
|
86 |
?>
|
87 |
+
|
88 |
+
<div class="wpsc_shipping_options">
|
89 |
+
<div class='wpsc-shipping-actions wpsc-payment-actions'>
|
90 |
+
| <span class="edit">
|
91 |
+
<a class='edit-payment-module' rel="<?php echo $gateway['internalname']; ?>" onclick="event.preventDefault();" title="Edit this Payment Module" href='<?php echo htmlspecialchars(add_query_arg('payment_module', $gateway['internalname'])); ?>' style="cursor:pointer;">Edit</a>
|
92 |
+
</span> |
|
93 |
+
</div>
|
94 |
+
<p><input name='wpsc_options[custom_gateway_options][]' checked='checked' type='checkbox' value='<?php echo $gateway['internalname']; ?>' id='<?php echo $gateway['internalname']; ?>_id' />
|
95 |
+
<label for='<?php echo $gateway['internalname']; ?>_id'><?php echo $gateway['name']; ?></label></p>
|
96 |
+
</div>
|
97 |
<?php } else { ?>
|
98 |
+
<div class="wpsc_shipping_options">
|
99 |
+
<div class='wpsc-shipping-actions wpsc-payment-actions'>
|
100 |
+
| <span class="edit">
|
101 |
+
<a class='edit-payment-module' rel="<?php echo $gateway['internalname']; ?>" onclick="event.preventDefault();" title="Edit this Payment Module" href='<?php echo htmlspecialchars(add_query_arg('payment_module', $gateway['internalname'])); ?>' style="cursor:pointer;">Edit</a>
|
102 |
+
</span> |
|
103 |
+
</div>
|
104 |
<p><input name='wpsc_options[custom_gateway_options][]' type='checkbox' value='<?php echo $gateway['internalname']; ?>' id='<?php echo $gateway['internalname']; ?>_id' />
|
105 |
+
<label for='<?php echo $gateway['internalname']; ?>_id'><?php echo $gateway['name']; ?></label></p></div>
|
106 |
<?php }
|
107 |
}
|
108 |
?>
|
121 |
</td>
|
122 |
|
123 |
<td class='gateway_settings' rowspan='2'>
|
124 |
+
<div class='postbox'>
|
125 |
+
<?php
|
126 |
+
|
127 |
+
if(!isset($_SESSION['previous_payment_name']))
|
128 |
+
$_SESSION['previous_payment_name'] = "";
|
129 |
+
|
130 |
+
$payment_data = wpsc_get_payment_form($_SESSION['previous_payment_name']);
|
131 |
+
?>
|
132 |
+
<h3 class='hndle'><?php echo $payment_data['name']; ?></h3>
|
133 |
+
<div class='inside'>
|
134 |
<table class='form-table'>
|
135 |
+
<?php echo $payment_data['form_fields']; ?>
|
136 |
+
</table>
|
137 |
+
<?php
|
138 |
+
if ( $payment_data['has_submit_button'] == 0) {
|
139 |
+
$update_button_css = 'style= "display: none;"';
|
140 |
+
} else {
|
141 |
+
$update_button_css = '';
|
142 |
+
}
|
143 |
+
?>
|
144 |
+
<div class='submit' <?php echo $update_button_css; ?>>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
<?php wp_nonce_field('update-options', 'wpsc-update-options'); ?>
|
146 |
<input type='submit' value='<?php echo __('Update »', 'wpsc')?>' name='updateoption' />
|
147 |
</div>
|
|
|
|
|
|
|
|
|
148 |
</div>
|
|
|
|
|
149 |
</td>
|
150 |
</tr>
|
151 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
</form>
|
153 |
</div>
|
154 |
</div>
|
155 |
|
156 |
<?php
|
157 |
+
}
|
158 |
?>
|
wpsc-admin/includes/settings-pages/presentation.php
CHANGED
@@ -542,11 +542,17 @@ global $wpdb;
|
|
542 |
$display_live_search = get_option('show_live_search');
|
543 |
if($display_live_search == 1) {
|
544 |
$show_live_search = "checked ='checked'";
|
|
|
|
|
545 |
}
|
546 |
|
547 |
if ($show_search1 != "checked ='checked'") {
|
548 |
$dis = "style='display:none;'";
|
|
|
|
|
549 |
}
|
|
|
|
|
550 |
?>
|
551 |
<input type='radio' onclick='jQuery("#wpsc_advanced_search").show()' value='1' name='wpsc_options[show_search]' id='show_search1' <?php echo $show_search1; ?> /> <label for='show_search1'><?php echo __('Yes', 'wpsc');?></label>
|
552 |
<input type='radio' onclick='jQuery("#wpsc_advanced_search").hide()' value='0' name='wpsc_options[show_search]' id='show_search2' <?php echo $show_search2; ?> /> <label for='show_search2'><?php echo __('No', 'wpsc');?></label>
|
@@ -599,6 +605,9 @@ global $wpdb;
|
|
599 |
$cart_location = get_option('cart_location');
|
600 |
$cart1 = "";
|
601 |
$cart2 = "";
|
|
|
|
|
|
|
602 |
switch($cart_location) {
|
603 |
case 1:
|
604 |
$cart1 = "checked ='checked'";
|
@@ -886,6 +895,29 @@ global $wpdb;
|
|
886 |
<input type='radio' value='0' name='wpsc_options[show_thumbnails]' id='show_thumbnails2' <?php echo $show_thumbnails2; ?> /> <label for='show_thumbnails2'><?php echo __('No', 'wpsc');?></label>
|
887 |
</td>
|
888 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
889 |
<?php
|
890 |
if(function_exists('gold_shpcrt_display_gallery')) {
|
891 |
?>
|
542 |
$display_live_search = get_option('show_live_search');
|
543 |
if($display_live_search == 1) {
|
544 |
$show_live_search = "checked ='checked'";
|
545 |
+
} else {
|
546 |
+
$show_live_search = "";
|
547 |
}
|
548 |
|
549 |
if ($show_search1 != "checked ='checked'") {
|
550 |
$dis = "style='display:none;'";
|
551 |
+
} else {
|
552 |
+
$dis = "";
|
553 |
}
|
554 |
+
|
555 |
+
|
556 |
?>
|
557 |
<input type='radio' onclick='jQuery("#wpsc_advanced_search").show()' value='1' name='wpsc_options[show_search]' id='show_search1' <?php echo $show_search1; ?> /> <label for='show_search1'><?php echo __('Yes', 'wpsc');?></label>
|
558 |
<input type='radio' onclick='jQuery("#wpsc_advanced_search").hide()' value='0' name='wpsc_options[show_search]' id='show_search2' <?php echo $show_search2; ?> /> <label for='show_search2'><?php echo __('No', 'wpsc');?></label>
|
605 |
$cart_location = get_option('cart_location');
|
606 |
$cart1 = "";
|
607 |
$cart2 = "";
|
608 |
+
$cart3 = "";
|
609 |
+
$cart4 = "";
|
610 |
+
$cart5 = "";
|
611 |
switch($cart_location) {
|
612 |
case 1:
|
613 |
$cart1 = "checked ='checked'";
|
895 |
<input type='radio' value='0' name='wpsc_options[show_thumbnails]' id='show_thumbnails2' <?php echo $show_thumbnails2; ?> /> <label for='show_thumbnails2'><?php echo __('No', 'wpsc');?></label>
|
896 |
</td>
|
897 |
</tr>
|
898 |
+
<tr>
|
899 |
+
<th scope="row"><?php echo __('Use Thickbox Effect for product images', 'wpsc');?>:</th>
|
900 |
+
<td>
|
901 |
+
<?php
|
902 |
+
$show_thumbnails_thickbox = get_option('show_thumbnails_thickbox');
|
903 |
+
$show_thumbnails_thickbox1 = "";
|
904 |
+
$show_thumbnails_thickbox2 = "";
|
905 |
+
switch($show_thumbnails_thickbox) {
|
906 |
+
case 0:
|
907 |
+
$show_thumbnails_thickbox2 = "checked ='checked'";
|
908 |
+
break;
|
909 |
+
|
910 |
+
case 1:
|
911 |
+
$show_thumbnails_thickbox1 = "checked ='checked'";
|
912 |
+
break;
|
913 |
+
}
|
914 |
+
|
915 |
+
?>
|
916 |
+
<input type='radio' value='1' name='wpsc_options[show_thumbnails_thickbox]' id='show_thumbnails_thickbox1' <?php echo $show_thumbnails_thickbox1; ?> /> <label for='show_thumbnails_thickbox1'><?php echo __('Yes', 'wpsc');?></label>
|
917 |
+
<input type='radio' value='0' name='wpsc_options[show_thumbnails_thickbox]' id='show_thumbnails_thickbox2' <?php echo $show_thumbnails_thickbox2; ?> /> <label for='show_thumbnails_thickbox2'><?php echo __('No', 'wpsc');?></label><br />
|
918 |
+
<?php _e('Using thickbox means that when clicking on a product image, a larger version will be displayed in a "thickbox" style window. If you are using a plugin such as Shutter Reloaded, you may want to disable thickbox.', 'wpsc'); ?>
|
919 |
+
</td>
|
920 |
+
</tr>
|
921 |
<?php
|
922 |
if(function_exists('gold_shpcrt_display_gallery')) {
|
923 |
?>
|
wpsc-admin/includes/updating-functions.php
CHANGED
@@ -548,4 +548,21 @@ function wpsc_update_files() {
|
|
548 |
}
|
549 |
}
|
550 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
?>
|
548 |
}
|
549 |
}
|
550 |
|
551 |
+
function wpsc_update_database() {
|
552 |
+
global $wpdb;
|
553 |
+
|
554 |
+
$result = $wpdb->get_results("SHOW COLUMNS FROM ". WPSC_TABLE_PURCHASE_LOGS."", ARRAY_A);
|
555 |
+
if (!$result) {
|
556 |
+
echo 'Could not run query: ' . mysql_error();
|
557 |
+
exit;
|
558 |
+
}
|
559 |
+
foreach($result as $row_key=>$value) {
|
560 |
+
$has_taxes = ($value["Field"] == "wpec_taxes_total" || $value["Field"] == "wpec_taxes_rate") ? true: false;
|
561 |
+
}
|
562 |
+
if (!$has_taxes) {
|
563 |
+
$add_fields = $wpdb->query($wpdb->prepare("ALTER TABLE ".WPSC_TABLE_PURCHASE_LOGS." ADD wpec_taxes_total decimal(11,2)"));
|
564 |
+
$add_fields = $wpdb->query($wpdb->prepare("ALTER TABLE ".WPSC_TABLE_PURCHASE_LOGS." ADD wpec_taxes_rate decimal(11,2)"));
|
565 |
+
}
|
566 |
+
}
|
567 |
+
|
568 |
?>
|
wpsc-admin/js/admin.js
CHANGED
@@ -994,6 +994,32 @@ jQuery(".wpsc-shipping-actions a").livequery(function(){
|
|
994 |
});
|
995 |
});
|
996 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
997 |
jQuery('#addweightlayer').livequery(function(){
|
998 |
jQuery(this).click(function(){
|
999 |
jQuery(this).parent().append("<div class='wpsc_newlayer'><tr class='rate_row'><td><i style='color:grey'>"+TXT_WPSC_IF_WEIGHT_IS+"</i><input type='text' name='weight_layer[]' size='10'> <i style='color:grey'>"+TXT_WPSC_AND_ABOVE+"</i></td><td><input type='text' name='weight_shipping[]' size='10'> <a href='' class='delete_button nosubmit' >"+TXT_WPSC_DELETE+"</a></td></tr></div>");
|
994 |
});
|
995 |
});
|
996 |
|
997 |
+
jQuery(".wpsc-payment-actions a").livequery(function(){
|
998 |
+
jQuery(this).click( function () {
|
999 |
+
var module = jQuery(this).attr('rel');
|
1000 |
+
console.log(module);
|
1001 |
+
jQuery.ajax({
|
1002 |
+
method: "post",
|
1003 |
+
url: "index.php",
|
1004 |
+
data: "wpsc_admin_action=get_payment_form&paymentname="+module,
|
1005 |
+
success: function(returned_data){
|
1006 |
+
console.log(returned_data);
|
1007 |
+
eval(returned_data);
|
1008 |
+
//jQuery(".gateway_settings").children(".form-table").html(html)
|
1009 |
+
jQuery('.gateway_settings h3.hndle').html(payment_name_html);
|
1010 |
+
jQuery("td.gateway_settings table.form-table").html('<tr><td><input type="hidden" name="paymentname" value="'+module+'" /></td></tr>'+payment_form_html);
|
1011 |
+
if(has_submit_button != '') {
|
1012 |
+
jQuery('.gateway_settings div.submit').css('display', 'block');
|
1013 |
+
} else {
|
1014 |
+
jQuery('.gateway_settings div.submit').css('display', 'none');
|
1015 |
+
}
|
1016 |
+
}
|
1017 |
+
});
|
1018 |
+
return false;
|
1019 |
+
|
1020 |
+
});
|
1021 |
+
});
|
1022 |
+
|
1023 |
jQuery('#addweightlayer').livequery(function(){
|
1024 |
jQuery(this).click(function(){
|
1025 |
jQuery(this).parent().append("<div class='wpsc_newlayer'><tr class='rate_row'><td><i style='color:grey'>"+TXT_WPSC_IF_WEIGHT_IS+"</i><input type='text' name='weight_layer[]' size='10'> <i style='color:grey'>"+TXT_WPSC_AND_ABOVE+"</i></td><td><input type='text' name='weight_shipping[]' size='10'> <a href='' class='delete_button nosubmit' >"+TXT_WPSC_DELETE+"</a></td></tr></div>");
|
wpsc-includes/ajax.functions.php
CHANGED
@@ -258,7 +258,7 @@ function wpsc_coupon_price($currCoupon = '') {
|
|
258 |
$wpsc_cart->coupons_name = '';
|
259 |
}
|
260 |
|
261 |
-
} else if ($_POST['coupon_num'] == '' && $currCoupon == ''){
|
262 |
$wpsc_cart->coupons_amount = 0;
|
263 |
$wpsc_cart->coupons_name = '';
|
264 |
} else if ($currCoupon != '') {
|
@@ -299,10 +299,12 @@ function wpsc_update_item_quantity() {
|
|
299 |
// if the quantity is 0, remove the item.
|
300 |
$wpsc_cart->remove_item($key);
|
301 |
}
|
302 |
-
|
|
|
|
|
303 |
}
|
304 |
|
305 |
-
if($_REQUEST['ajax'] == 'true') {
|
306 |
ob_start();
|
307 |
$cur_wpsc_theme_folder = apply_filters('wpsc_theme_folder',$wpsc_theme_path.WPSC_THEME_DIR);
|
308 |
include_once($cur_wpsc_theme_folder."/cart_widget.php");
|
@@ -474,7 +476,7 @@ function wpsc_update_location() {
|
|
474 |
//echo "<pre>".print_r($wpsc_cart, true)."</pre>";
|
475 |
//exit();
|
476 |
|
477 |
-
if($_GET['ajax'] == 'true') {
|
478 |
exit();
|
479 |
}
|
480 |
}
|
@@ -636,7 +638,7 @@ function wpsc_submit_checkout() {
|
|
636 |
$wpdb->query($sql);
|
637 |
|
638 |
$purchase_log_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid` IN('{$sessionid}') LIMIT 1") ;
|
639 |
-
|
640 |
$wpsc_checkout->save_forms_to_db($purchase_log_id);
|
641 |
$wpsc_cart->save_to_db($purchase_log_id);
|
642 |
$wpsc_cart->submit_stock_claims($purchase_log_id);
|
@@ -653,8 +655,6 @@ function wpsc_submit_checkout() {
|
|
653 |
$seperator = "&";
|
654 |
}
|
655 |
|
656 |
-
|
657 |
-
|
658 |
/// submit to gateway
|
659 |
print_r($current_gateway_data);
|
660 |
$current_gateway_data = &$wpsc_gateways[$submitted_gateway];
|
258 |
$wpsc_cart->coupons_name = '';
|
259 |
}
|
260 |
|
261 |
+
} else if ((!isset($_POST['coupon_num']) || $_POST['coupon_num'] == '') && $currCoupon == ''){
|
262 |
$wpsc_cart->coupons_amount = 0;
|
263 |
$wpsc_cart->coupons_name = '';
|
264 |
} else if ($currCoupon != '') {
|
299 |
// if the quantity is 0, remove the item.
|
300 |
$wpsc_cart->remove_item($key);
|
301 |
}
|
302 |
+
if(isset($_SESSION['coupon_numbers'])) {
|
303 |
+
wpsc_coupon_price($_SESSION['coupon_numbers']);
|
304 |
+
}
|
305 |
}
|
306 |
|
307 |
+
if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 'true') {
|
308 |
ob_start();
|
309 |
$cur_wpsc_theme_folder = apply_filters('wpsc_theme_folder',$wpsc_theme_path.WPSC_THEME_DIR);
|
310 |
include_once($cur_wpsc_theme_folder."/cart_widget.php");
|
476 |
//echo "<pre>".print_r($wpsc_cart, true)."</pre>";
|
477 |
//exit();
|
478 |
|
479 |
+
if(isset($_GET['ajax']) && $_GET['ajax'] == 'true') {
|
480 |
exit();
|
481 |
}
|
482 |
}
|
638 |
$wpdb->query($sql);
|
639 |
|
640 |
$purchase_log_id = $wpdb->get_var("SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid` IN('{$sessionid}') LIMIT 1") ;
|
641 |
+
// exit('PurchLog id'.$purchase_log_id);
|
642 |
$wpsc_checkout->save_forms_to_db($purchase_log_id);
|
643 |
$wpsc_cart->save_to_db($purchase_log_id);
|
644 |
$wpsc_cart->submit_stock_claims($purchase_log_id);
|
655 |
$seperator = "&";
|
656 |
}
|
657 |
|
|
|
|
|
658 |
/// submit to gateway
|
659 |
print_r($current_gateway_data);
|
660 |
$current_gateway_data = &$wpsc_gateways[$submitted_gateway];
|
wpsc-includes/cart.class.php
CHANGED
@@ -181,10 +181,12 @@ function wpsc_cart_show_plus_postage() {
|
|
181 |
* @return boolean if true, all items in the cart do use shipping
|
182 |
*/
|
183 |
function wpsc_uses_shipping() {
|
|
|
184 |
global $wpsc_cart;
|
185 |
$shippingoptions = get_option('custom_shipping_options');
|
186 |
-
if( (!((get_option('shipping_discount')== 1) && (get_option('shipping_discount_value') <= $wpsc_cart->calculate_subtotal())))
|
187 |
-
|
|
|
188 |
} else {
|
189 |
$status = false;
|
190 |
}
|
@@ -661,7 +663,7 @@ class wpsc_cart {
|
|
661 |
{
|
662 |
global $wpsc_cart;
|
663 |
|
664 |
-
if(
|
665 |
{
|
666 |
foreach($wpsc_cart->cart_items as &$cart_item)
|
667 |
{
|
@@ -711,7 +713,7 @@ class wpsc_cart {
|
|
711 |
if(is_callable(array(& $wpsc_shipping_modules[$this->selected_shipping_method], "getQuote" ))) {
|
712 |
$this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
|
713 |
}
|
714 |
-
if(count($this->shipping_quotes) > $shipping_quote_count) { // if we have any shipping quotes, break the loop.
|
715 |
break;
|
716 |
}
|
717 |
}
|
@@ -1192,6 +1194,7 @@ class wpsc_cart {
|
|
1192 |
*/
|
1193 |
function calculate_total_weight($for_shipping = false) {
|
1194 |
global $wpdb;
|
|
|
1195 |
if($for_shipping == true ) {
|
1196 |
foreach($this->cart_items as $key => $cart_item) {
|
1197 |
if($cart_item->uses_shipping == 1) {
|
@@ -1294,6 +1297,7 @@ class wpsc_cart {
|
|
1294 |
*/
|
1295 |
function calculate_per_item_shipping($method = null) {
|
1296 |
global $wpdb, $wpsc_shipping_modules;
|
|
|
1297 |
if($method == null) {
|
1298 |
$method = $this->selected_shipping_method;
|
1299 |
}
|
@@ -1321,10 +1325,12 @@ class wpsc_cart {
|
|
1321 |
foreach($this->cart_items as $key => $cart_item) {
|
1322 |
$uses_shipping += (int)$cart_item->uses_shipping;
|
1323 |
}
|
1324 |
-
$uses_shipping = (bool)$uses_shipping;
|
1325 |
} else {
|
1326 |
$uses_shipping = $this->uses_shipping;
|
1327 |
}
|
|
|
|
|
|
|
1328 |
return $uses_shipping;
|
1329 |
}
|
1330 |
|
@@ -1345,10 +1351,10 @@ class wpsc_cart {
|
|
1345 |
$price = number_format($price, 2, '.', ',');
|
1346 |
|
1347 |
if($wpsc_currency_data['symbol'] != '') {
|
1348 |
-
if($nohtml ==
|
1349 |
-
$currency_sign = $wpsc_currency_data['symbol_html'];
|
1350 |
-
} else {
|
1351 |
$currency_sign = $wpsc_currency_data['symbol'];
|
|
|
|
|
1352 |
}
|
1353 |
} else {
|
1354 |
$currency_sign = $wpsc_currency_data['code'];
|
@@ -1704,7 +1710,7 @@ class wpsc_cart_item {
|
|
1704 |
|
1705 |
// if we are using table rate price
|
1706 |
$levels = get_product_meta($this->product_id, 'table_rate_price');
|
1707 |
-
if ($levels != '') {
|
1708 |
foreach((array)$levels['quantity'] as $key => $qty) {
|
1709 |
if ($this->quantity >= $qty) {
|
1710 |
$unit_price = $levels['table_price'][$key];
|
@@ -1730,9 +1736,15 @@ class wpsc_cart_item {
|
|
1730 |
*/
|
1731 |
|
1732 |
// change no_shipping to boolean and invert it
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1736 |
|
1737 |
if($this->is_donation == 1) {
|
1738 |
$this->unit_price = $this->provided_price;
|
181 |
* @return boolean if true, all items in the cart do use shipping
|
182 |
*/
|
183 |
function wpsc_uses_shipping() {
|
184 |
+
//This currently requires
|
185 |
global $wpsc_cart;
|
186 |
$shippingoptions = get_option('custom_shipping_options');
|
187 |
+
if( (!((get_option('shipping_discount')== 1) && (get_option('shipping_discount_value') <= $wpsc_cart->calculate_subtotal()))) || ( count($shippingoptions) >= 1 && $shippingoptions[0] != '' && get_option('do_not_use_shipping') == 0) ) {
|
188 |
+
$status = (bool) $wpsc_cart->uses_shipping();
|
189 |
+
// $status = true;
|
190 |
} else {
|
191 |
$status = false;
|
192 |
}
|
663 |
{
|
664 |
global $wpsc_cart;
|
665 |
|
666 |
+
if(is_object($wpsc_cart->cart_items))
|
667 |
{
|
668 |
foreach($wpsc_cart->cart_items as &$cart_item)
|
669 |
{
|
713 |
if(is_callable(array(& $wpsc_shipping_modules[$this->selected_shipping_method], "getQuote" ))) {
|
714 |
$this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
|
715 |
}
|
716 |
+
if(isset($shipping_quote_count) && count($this->shipping_quotes) > $shipping_quote_count) { // if we have any shipping quotes, break the loop.
|
717 |
break;
|
718 |
}
|
719 |
}
|
1194 |
*/
|
1195 |
function calculate_total_weight($for_shipping = false) {
|
1196 |
global $wpdb;
|
1197 |
+
$total = '';
|
1198 |
if($for_shipping == true ) {
|
1199 |
foreach($this->cart_items as $key => $cart_item) {
|
1200 |
if($cart_item->uses_shipping == 1) {
|
1297 |
*/
|
1298 |
function calculate_per_item_shipping($method = null) {
|
1299 |
global $wpdb, $wpsc_shipping_modules;
|
1300 |
+
$total ='';
|
1301 |
if($method == null) {
|
1302 |
$method = $this->selected_shipping_method;
|
1303 |
}
|
1325 |
foreach($this->cart_items as $key => $cart_item) {
|
1326 |
$uses_shipping += (int)$cart_item->uses_shipping;
|
1327 |
}
|
|
|
1328 |
} else {
|
1329 |
$uses_shipping = $this->uses_shipping;
|
1330 |
}
|
1331 |
+
|
1332 |
+
$this->uses_shipping = $uses_shipping;
|
1333 |
+
|
1334 |
return $uses_shipping;
|
1335 |
}
|
1336 |
|
1351 |
$price = number_format($price, 2, '.', ',');
|
1352 |
|
1353 |
if($wpsc_currency_data['symbol'] != '') {
|
1354 |
+
if(isset($nohtml) && $nohtml == true) {
|
|
|
|
|
1355 |
$currency_sign = $wpsc_currency_data['symbol'];
|
1356 |
+
} else {
|
1357 |
+
$currency_sign = $wpsc_currency_data['symbol_html'];
|
1358 |
}
|
1359 |
} else {
|
1360 |
$currency_sign = $wpsc_currency_data['code'];
|
1710 |
|
1711 |
// if we are using table rate price
|
1712 |
$levels = get_product_meta($this->product_id, 'table_rate_price');
|
1713 |
+
if (isset($levels["quantity"]) && $levels["quantity"] != '') {
|
1714 |
foreach((array)$levels['quantity'] as $key => $qty) {
|
1715 |
if ($this->quantity >= $qty) {
|
1716 |
$unit_price = $levels['table_price'][$key];
|
1736 |
*/
|
1737 |
|
1738 |
// change no_shipping to boolean and invert it
|
1739 |
+
if(isset($product_meta[0]['no_shipping']) && $product_meta[0]['no_shipping'] == 1) {
|
1740 |
+
$this->uses_shipping = 0 ;
|
1741 |
+
} else {
|
1742 |
+
$this->uses_shipping = 1;
|
1743 |
+
}
|
1744 |
+
|
1745 |
+
if(isset($product_meta[0]['quantity_limited'])) {
|
1746 |
+
$this->has_limited_stock = (bool)(int)$product_meta['quantity_limited'];
|
1747 |
+
}
|
1748 |
|
1749 |
if($this->is_donation == 1) {
|
1750 |
$this->unit_price = $this->provided_price;
|
wpsc-includes/checkout.class.php
CHANGED
@@ -122,7 +122,10 @@ function wpsc_shipping_details(){
|
|
122 |
}
|
123 |
function wpsc_the_checkout_item_error_class($as_attribute = true) {
|
124 |
global $wpsc_checkout;
|
125 |
-
|
|
|
|
|
|
|
126 |
$class_name = 'validation-error';
|
127 |
}
|
128 |
if(($as_attribute == true)){
|
@@ -136,7 +139,7 @@ function wpsc_the_checkout_item_error_class($as_attribute = true) {
|
|
136 |
function wpsc_the_checkout_item_error() {
|
137 |
global $wpsc_checkout;
|
138 |
$output = false;
|
139 |
-
if($_SESSION['wpsc_checkout_error_messages'][$wpsc_checkout->checkout_item->id] != '') {
|
140 |
$output = $_SESSION['wpsc_checkout_error_messages'][$wpsc_checkout->checkout_item->id];
|
141 |
}
|
142 |
|
@@ -153,7 +156,7 @@ function wpsc_the_checkout_CC_validation(){
|
|
153 |
}
|
154 |
function wpsc_the_checkout_CC_validation_class(){
|
155 |
$output = '';
|
156 |
-
if ($_SESSION['wpsc_gateway_error_messages']['card_number'] != ''){
|
157 |
$output = 'class="validation-error"';
|
158 |
}
|
159 |
return $output;
|
@@ -237,7 +240,7 @@ function wpsc_checkout_form_field() {
|
|
237 |
|
238 |
function wpsc_shipping_region_list($selected_country, $selected_region, $shippingdetails = false){
|
239 |
global $wpdb;
|
240 |
-
|
241 |
//$region_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_REGION_TAX."` WHERE country_id='136'",ARRAY_A);
|
242 |
$region_data = $wpdb->get_results("SELECT `regions`.* FROM `".WPSC_TABLE_REGION_TAX."` AS `regions` INNER JOIN `".WPSC_TABLE_CURRENCY_LIST."` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('".$wpdb->escape($selected_country)."')",ARRAY_A);
|
243 |
$js = '';
|
@@ -295,7 +298,7 @@ function wpsc_shipping_country_list($shippingdetails = false) {
|
|
295 |
|
296 |
$output .= wpsc_shipping_region_list($selected_country, $selected_region, $shippingdetails);
|
297 |
|
298 |
-
if($_POST['wpsc_update_location'] == 'true') {
|
299 |
$_SESSION['wpsc_update_location'] = true;
|
300 |
} else {
|
301 |
$_SESSION['wpsc_update_location'] = false;
|
@@ -326,7 +329,7 @@ function wpsc_shipping_country_list($shippingdetails = false) {
|
|
326 |
$uses_zipcode = false;
|
327 |
$custom_shipping = get_option('custom_shipping_options');
|
328 |
foreach((array)$custom_shipping as $shipping) {
|
329 |
-
if($wpsc_shipping_modules[$shipping]->needs_zipcode == true) {
|
330 |
$uses_zipcode = true;
|
331 |
}
|
332 |
}
|
@@ -450,7 +453,8 @@ class wpsc_checkout {
|
|
450 |
if((count($_SESSION['wpsc_checkout_saved_values']) <= 0) && ($user_ID > 0)) {
|
451 |
$_SESSION['wpsc_checkout_saved_values'] = get_user_meta($user_ID, 'wpshpcrt_usr_profile');
|
452 |
}
|
453 |
-
|
|
|
454 |
//exit('<pre>'.print_r($this, true).'</pre>');
|
455 |
$an_array = '';
|
456 |
if(function_exists('wpsc_get_ticket_checkout_set')){
|
@@ -624,6 +628,7 @@ class wpsc_checkout {
|
|
624 |
$our_user_id = $results->ID;
|
625 |
} else {
|
626 |
$any_bad_inputs = true;
|
|
|
627 |
}
|
628 |
}
|
629 |
if($our_user_id < 1) {
|
@@ -815,12 +820,17 @@ function wpsc_the_gateway() {
|
|
815 |
|
816 |
function wpsc_gateway_name() {
|
817 |
global $wpsc_gateway;
|
|
|
|
|
818 |
$payment_gateway_names = get_option('payment_gateway_names');
|
819 |
-
|
|
|
820 |
$display_name = $payment_gateway_names[$wpsc_gateway->gateway['internalname']];
|
821 |
-
}
|
822 |
switch($selected_gateway_data['payment_type']) {
|
823 |
-
case "paypal"
|
|
|
|
|
824 |
$display_name = "PayPal";
|
825 |
break;
|
826 |
|
@@ -838,6 +848,9 @@ function wpsc_gateway_name() {
|
|
838 |
break;
|
839 |
}
|
840 |
}
|
|
|
|
|
|
|
841 |
return $display_name;
|
842 |
}
|
843 |
|
@@ -881,7 +894,7 @@ function wpsc_gateway_form_fields() {
|
|
881 |
return $output;
|
882 |
}
|
883 |
if($wpsc_gateway->gateway['internalname'] == 'authorize' || $wpsc_gateway->gateway['internalname'] == 'paypal_payflow'){
|
884 |
-
$output = sprintf($gateway_checkout_form_fields[$wpsc_gateway->gateway['internalname']] ,wpsc_the_checkout_CC_validation_class(), $_SESSION['wpsc_gateway_error_messages']['card_number'],
|
885 |
wpsc_the_checkout_CCexpiry_validation_class(), $_SESSION['wpsc_gateway_error_messages']['expdate'],
|
886 |
wpsc_the_checkout_CCcvv_validation_class(), $_SESSION['wpsc_gateway_error_messages']['card_code']
|
887 |
);
|
122 |
}
|
123 |
function wpsc_the_checkout_item_error_class($as_attribute = true) {
|
124 |
global $wpsc_checkout;
|
125 |
+
|
126 |
+
$class_name = '';
|
127 |
+
|
128 |
+
if(isset($_SESSION['wpsc_checkout_error_messages'][$wpsc_checkout->checkout_item->id]) && $_SESSION['wpsc_checkout_error_messages'][$wpsc_checkout->checkout_item->id] != '') {
|
129 |
$class_name = 'validation-error';
|
130 |
}
|
131 |
if(($as_attribute == true)){
|
139 |
function wpsc_the_checkout_item_error() {
|
140 |
global $wpsc_checkout;
|
141 |
$output = false;
|
142 |
+
if(isset($_SESSION['wpsc_checkout_error_messages'][$wpsc_checkout->checkout_item->id]) && $_SESSION['wpsc_checkout_error_messages'][$wpsc_checkout->checkout_item->id] != '') {
|
143 |
$output = $_SESSION['wpsc_checkout_error_messages'][$wpsc_checkout->checkout_item->id];
|
144 |
}
|
145 |
|
156 |
}
|
157 |
function wpsc_the_checkout_CC_validation_class(){
|
158 |
$output = '';
|
159 |
+
if (isset($_SESSION['wpsc_gateway_error_messages']) && $_SESSION['wpsc_gateway_error_messages']['card_number'] != ''){
|
160 |
$output = 'class="validation-error"';
|
161 |
}
|
162 |
return $output;
|
240 |
|
241 |
function wpsc_shipping_region_list($selected_country, $selected_region, $shippingdetails = false){
|
242 |
global $wpdb;
|
243 |
+
$output = '';
|
244 |
//$region_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_REGION_TAX."` WHERE country_id='136'",ARRAY_A);
|
245 |
$region_data = $wpdb->get_results("SELECT `regions`.* FROM `".WPSC_TABLE_REGION_TAX."` AS `regions` INNER JOIN `".WPSC_TABLE_CURRENCY_LIST."` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('".$wpdb->escape($selected_country)."')",ARRAY_A);
|
246 |
$js = '';
|
298 |
|
299 |
$output .= wpsc_shipping_region_list($selected_country, $selected_region, $shippingdetails);
|
300 |
|
301 |
+
if(isset($_POST['wpsc_update_location']) && $_POST['wpsc_update_location'] == 'true') {
|
302 |
$_SESSION['wpsc_update_location'] = true;
|
303 |
} else {
|
304 |
$_SESSION['wpsc_update_location'] = false;
|
329 |
$uses_zipcode = false;
|
330 |
$custom_shipping = get_option('custom_shipping_options');
|
331 |
foreach((array)$custom_shipping as $shipping) {
|
332 |
+
if(isset($wpsc_shipping_modules[$shipping]->needs_zipcode) && $wpsc_shipping_modules[$shipping]->needs_zipcode == true) {
|
333 |
$uses_zipcode = true;
|
334 |
}
|
335 |
}
|
453 |
if((count($_SESSION['wpsc_checkout_saved_values']) <= 0) && ($user_ID > 0)) {
|
454 |
$_SESSION['wpsc_checkout_saved_values'] = get_user_meta($user_ID, 'wpshpcrt_usr_profile');
|
455 |
}
|
456 |
+
|
457 |
+
$saved_form_data = @htmlentities(stripslashes((string)$_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id]), ENT_QUOTES);
|
458 |
//exit('<pre>'.print_r($this, true).'</pre>');
|
459 |
$an_array = '';
|
460 |
if(function_exists('wpsc_get_ticket_checkout_set')){
|
628 |
$our_user_id = $results->ID;
|
629 |
} else {
|
630 |
$any_bad_inputs = true;
|
631 |
+
$our_user_id = '';
|
632 |
}
|
633 |
}
|
634 |
if($our_user_id < 1) {
|
820 |
|
821 |
function wpsc_gateway_name() {
|
822 |
global $wpsc_gateway;
|
823 |
+
$display_name = '';
|
824 |
+
|
825 |
$payment_gateway_names = get_option('payment_gateway_names');
|
826 |
+
|
827 |
+
if(isset($payment_gateway_names[$wpsc_gateway->gateway['internalname']]) && $payment_gateway_names[$wpsc_gateway->gateway['internalname']] != '') {
|
828 |
$display_name = $payment_gateway_names[$wpsc_gateway->gateway['internalname']];
|
829 |
+
} elseif(isset($selected_gateway_data['payment_type'])) {
|
830 |
switch($selected_gateway_data['payment_type']) {
|
831 |
+
case "paypal":
|
832 |
+
case "paypal_pro":
|
833 |
+
case "wpsc_merchant_paypal_pro";
|
834 |
$display_name = "PayPal";
|
835 |
break;
|
836 |
|
848 |
break;
|
849 |
}
|
850 |
}
|
851 |
+
if($display_name == '') {
|
852 |
+
$display_name = 'Credit Card';
|
853 |
+
}
|
854 |
return $display_name;
|
855 |
}
|
856 |
|
894 |
return $output;
|
895 |
}
|
896 |
if($wpsc_gateway->gateway['internalname'] == 'authorize' || $wpsc_gateway->gateway['internalname'] == 'paypal_payflow'){
|
897 |
+
$output = @sprintf($gateway_checkout_form_fields[$wpsc_gateway->gateway['internalname']] ,wpsc_the_checkout_CC_validation_class(), $_SESSION['wpsc_gateway_error_messages']['card_number'],
|
898 |
wpsc_the_checkout_CCexpiry_validation_class(), $_SESSION['wpsc_gateway_error_messages']['expdate'],
|
899 |
wpsc_the_checkout_CCcvv_validation_class(), $_SESSION['wpsc_gateway_error_messages']['card_code']
|
900 |
);
|
wpsc-includes/display.functions.php
CHANGED
@@ -467,19 +467,18 @@ function wpsc_obtain_the_title() {
|
|
467 |
$product_list = array();
|
468 |
$full_product_name = $wpsc_title_data['product'][$product_name];
|
469 |
} else if($product_name != '') {
|
470 |
-
$product_id = $
|
471 |
-
$full_product_name = $wpdb->get_var("SELECT `
|
472 |
$wpsc_title_data['product'][$product_name] = $full_product_name;
|
473 |
} else {
|
474 |
$product_id = absint($_GET['product_id']);
|
475 |
-
$product_name = $wpdb->get_var("SELECT `
|
476 |
-
|
477 |
-
$full_product_name = $wpdb->get_var("SELECT `name` FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='{$product_id}' LIMIT 1");
|
478 |
$wpsc_title_data['product'][$product_name] = $full_product_name;
|
479 |
}
|
480 |
}
|
481 |
|
482 |
-
|
483 |
if(isset($full_product_name ) && ($full_product_name != null)) {
|
484 |
$output = htmlentities(stripslashes($full_product_name), ENT_QUOTES, 'UTF-8');
|
485 |
}
|
467 |
$product_list = array();
|
468 |
$full_product_name = $wpsc_title_data['product'][$product_name];
|
469 |
} else if($product_name != '') {
|
470 |
+
$product_id = $wp_query->post->ID;
|
471 |
+
$full_product_name = $wpdb->get_var("SELECT `post_title` FROM `$wpdb->posts` WHERE `ID`='{$product_id}' LIMIT 1");
|
472 |
$wpsc_title_data['product'][$product_name] = $full_product_name;
|
473 |
} else {
|
474 |
$product_id = absint($_GET['product_id']);
|
475 |
+
$product_name = $wpdb->get_var("SELECT `post_title` FROM `$wpdb->posts` WHERE `ID`='{$product_id}' LIMIT 1");
|
476 |
+
$full_product_name = $wpdb->get_var("SELECT `post_title` FROM `$wpdb->posts` WHERE `ID`='{$product_id}' LIMIT 1");
|
|
|
477 |
$wpsc_title_data['product'][$product_name] = $full_product_name;
|
478 |
}
|
479 |
}
|
480 |
|
481 |
+
// exit("<pre>".print_r($wp_query->post->ID,true)."</pre>");
|
482 |
if(isset($full_product_name ) && ($full_product_name != null)) {
|
483 |
$output = htmlentities(stripslashes($full_product_name), ENT_QUOTES, 'UTF-8');
|
484 |
}
|
wpsc-includes/install_and_update.functions.php
CHANGED
@@ -101,6 +101,7 @@ function wpsc_install() {
|
|
101 |
|
102 |
|
103 |
add_option('show_thumbnails', 1, __('Show Thumbnails', 'wpsc'), "yes");
|
|
|
104 |
|
105 |
add_option('product_image_width', '', __('product image width', 'wpsc'), 'yes');
|
106 |
add_option('product_image_height', '', __('product image height', 'wpsc'), 'yes');
|
@@ -522,6 +523,7 @@ function wpsc_add_checkout_fields() {
|
|
522 |
( '".__('Last Name', 'wpsc')."', 'text', '1', '1', '', '1', 3,'billinglastname'),
|
523 |
( '".__('Address', 'wpsc')."', 'address', '1', '0', '', '1', 4,'billingaddress'),
|
524 |
( '".__('City', 'wpsc')."', 'city', '1', '0', '', '1', 5,'billingcity'),
|
|
|
525 |
( '".__('Country', 'wpsc')."', 'country', '1', '0', '', '1', 7,'billingcountry'),
|
526 |
( '".__('Postal Code', 'wpsc')."', 'text', '0', '0', '', '1', 8,'billingpostcode'),
|
527 |
( '".__('Email', 'wpsc')."', 'email', '1', '1', '', '1', 9,'billingemail'),
|
101 |
|
102 |
|
103 |
add_option('show_thumbnails', 1, __('Show Thumbnails', 'wpsc'), "yes");
|
104 |
+
add_option('show_thumbnails_thickbox', 1, __('Use Thickbox Effect for product images', 'wpsc'), "yes");
|
105 |
|
106 |
add_option('product_image_width', '', __('product image width', 'wpsc'), 'yes');
|
107 |
add_option('product_image_height', '', __('product image height', 'wpsc'), 'yes');
|
523 |
( '".__('Last Name', 'wpsc')."', 'text', '1', '1', '', '1', 3,'billinglastname'),
|
524 |
( '".__('Address', 'wpsc')."', 'address', '1', '0', '', '1', 4,'billingaddress'),
|
525 |
( '".__('City', 'wpsc')."', 'city', '1', '0', '', '1', 5,'billingcity'),
|
526 |
+
( '".__('State', 'wpsc')."', 'text', '0', '0', '', '1', 6,'billingstate'),
|
527 |
( '".__('Country', 'wpsc')."', 'country', '1', '0', '', '1', 7,'billingcountry'),
|
528 |
( '".__('Postal Code', 'wpsc')."', 'text', '0', '0', '', '1', 8,'billingpostcode'),
|
529 |
( '".__('Email', 'wpsc')."', 'email', '1', '1', '', '1', 9,'billingemail'),
|
wpsc-includes/misc.functions.php
CHANGED
@@ -528,7 +528,7 @@ function wpsc_list_dir($dirname) {
|
|
528 |
$num = 0;
|
529 |
while(($file = @readdir($dir)) !== false) {
|
530 |
//filter out the dots and any backup files, dont be tempted to correct the "spelling mistake", its to filter out a previous spelling mistake.
|
531 |
-
if(($file != "..") && ($file != ".") && !stristr($file, "~") && !stristr($file, "Chekcout") && !( strpos($file, ".") === 0 )) {
|
532 |
$dirlist[$num] = $file;
|
533 |
$num++;
|
534 |
}
|
528 |
$num = 0;
|
529 |
while(($file = @readdir($dir)) !== false) {
|
530 |
//filter out the dots and any backup files, dont be tempted to correct the "spelling mistake", its to filter out a previous spelling mistake.
|
531 |
+
if(($file != "..") && ($file != ".") && !stristr($file, "~") && !stristr($file, "Chekcout") && !stristr($file, "error_log") && !( strpos($file, ".") === 0 )) {
|
532 |
$dirlist[$num] = $file;
|
533 |
$num++;
|
534 |
}
|
wpsc-includes/processing.functions.php
CHANGED
@@ -649,4 +649,29 @@ add_filter('wpsc_product_alert', 'wpsc_check_stock', 10, 2);
|
|
649 |
add_filter('wpsc_product_alert', 'wpsc_check_weight', 10, 2);
|
650 |
|
651 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
?>
|
649 |
add_filter('wpsc_product_alert', 'wpsc_check_weight', 10, 2);
|
650 |
|
651 |
|
652 |
+
|
653 |
+
/**
|
654 |
+
* WPSC Image Quality
|
655 |
+
*
|
656 |
+
* Returns the value to use for image quality when creating jpeg images.
|
657 |
+
* By default the quality is set to 75%. It is then run through the main jpeg_quality WordPress filter
|
658 |
+
* to add compatibility with other plugins that customise image quality.
|
659 |
+
*
|
660 |
+
* It is then run through the wpsc_jpeg_quality filter so that it is possible to override
|
661 |
+
* the quality setting just for WPSC images.
|
662 |
+
*
|
663 |
+
* @since 3.7.6
|
664 |
+
*
|
665 |
+
* @param (int) $quality Optional. Image quality when creating jpeg images.
|
666 |
+
* @return (int) The image quality.
|
667 |
+
*/
|
668 |
+
function wpsc_image_quality( $quality = 75 ) {
|
669 |
+
|
670 |
+
$quality = apply_filters( 'jpeg_quality', $quality );
|
671 |
+
return apply_filters( 'wpsc_jpeg_quality', $quality );
|
672 |
+
|
673 |
+
}
|
674 |
+
|
675 |
+
|
676 |
+
|
677 |
?>
|
wpsc-includes/product-template.php
CHANGED
@@ -41,7 +41,7 @@ function wpsc_product_image($attachment_id, $width = null, $height = null) {
|
|
41 |
$attachment_metadata = $image_meta['_wp_attachment_metadata'];
|
42 |
|
43 |
// determine if we already have an image of this size
|
44 |
-
if((count($attachment_metadata['sizes']) > 0) && (isset($attachment_metadata['sizes'][$intermediate_size]))) {
|
45 |
$intermediate_image_data = image_get_intermediate_size($attachment_id, $intermediate_size);
|
46 |
$image_exists = true;
|
47 |
$image_url = $intermediate_image_data['url'];
|
@@ -175,7 +175,7 @@ function wpsc_this_page_url() {
|
|
175 |
//echo "<pr".print_r($wpsc_query->category,true)."</pre>";
|
176 |
if($wpsc_query->is_single === true) {
|
177 |
$output = wpsc_product_url($wp_query->post->ID);
|
178 |
-
} else if($wpsc_query->category != null) {
|
179 |
$output = wpsc_category_url($wpsc_query->category);
|
180 |
if($wpsc_query->query_vars['page'] > 1) {
|
181 |
//
|
@@ -185,9 +185,11 @@ function wpsc_this_page_url() {
|
|
185 |
$output = add_query_arg('page_number', $wpsc_query->query_vars['page'], $output);
|
186 |
}
|
187 |
}
|
188 |
-
}
|
189 |
$output = get_permalink($id);
|
190 |
-
}
|
|
|
|
|
191 |
return $output;
|
192 |
}
|
193 |
|
@@ -391,8 +393,10 @@ function wpsc_product_external_link($id = null){
|
|
391 |
$id = get_the_ID();
|
392 |
}
|
393 |
$product_meta = get_post_meta($id, '_wpsc_product_metadata', true);
|
394 |
-
$
|
|
|
395 |
return $external_link;
|
|
|
396 |
}
|
397 |
|
398 |
/**
|
@@ -562,7 +566,7 @@ function wpsc_product_has_supplied_file() {
|
|
562 |
* @return string - currently only valid for flat rate
|
563 |
*/
|
564 |
function wpsc_product_postage_and_packaging() {
|
565 |
-
if(is_numeric($id) && ($id > 0)) {
|
566 |
$id = absint($id);
|
567 |
} else {
|
568 |
$id = get_the_ID();
|
@@ -638,6 +642,27 @@ function wpsc_the_product_thumbnail($width = null, $height = null) {
|
|
638 |
}
|
639 |
}
|
640 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
641 |
/**
|
642 |
* wpsc product comment link function
|
643 |
* @return string - javascript required to make the intense debate link work
|
@@ -666,8 +691,10 @@ function wpsc_product_comment_link() {
|
|
666 |
* @return string - javascript for the intensedebate comments
|
667 |
*/
|
668 |
function wpsc_product_comments() {
|
669 |
-
|
|
|
670 |
global $wpsc_query;
|
|
|
671 |
// add the product comments
|
672 |
if (get_option('wpsc_enable_comments') == 1) {
|
673 |
$enable_for_product = get_product_meta($wpsc_query->product['id'], 'enable_comments');
|
@@ -901,6 +928,7 @@ function wpsc_the_variation_out_of_stock() {
|
|
901 |
function wpsc_product_rater() {
|
902 |
global $wpsc_query;
|
903 |
$product_id =get_the_ID();
|
|
|
904 |
if(get_option('product_ratings') == 1) {
|
905 |
$output .= "<div class='product_footer'>";
|
906 |
|
@@ -919,7 +947,7 @@ function wpsc_product_rater() {
|
|
919 |
$output .= "</div>";
|
920 |
$output .= "</div>";
|
921 |
}
|
922 |
-
return
|
923 |
}
|
924 |
|
925 |
|
41 |
$attachment_metadata = $image_meta['_wp_attachment_metadata'];
|
42 |
|
43 |
// determine if we already have an image of this size
|
44 |
+
if(isset($attachment_metadata['sizes']) && (count($attachment_metadata['sizes']) > 0) && (isset($attachment_metadata['sizes'][$intermediate_size]))) {
|
45 |
$intermediate_image_data = image_get_intermediate_size($attachment_id, $intermediate_size);
|
46 |
$image_exists = true;
|
47 |
$image_url = $intermediate_image_data['url'];
|
175 |
//echo "<pr".print_r($wpsc_query->category,true)."</pre>";
|
176 |
if($wpsc_query->is_single === true) {
|
177 |
$output = wpsc_product_url($wp_query->post->ID);
|
178 |
+
} else if(isset($wpsc_query->category) && $wpsc_query->category != null) {
|
179 |
$output = wpsc_category_url($wpsc_query->category);
|
180 |
if($wpsc_query->query_vars['page'] > 1) {
|
181 |
//
|
185 |
$output = add_query_arg('page_number', $wpsc_query->query_vars['page'], $output);
|
186 |
}
|
187 |
}
|
188 |
+
} elseif(isset($id)) {
|
189 |
$output = get_permalink($id);
|
190 |
+
} else {
|
191 |
+
$output = get_permalink(get_the_ID());
|
192 |
+
}
|
193 |
return $output;
|
194 |
}
|
195 |
|
393 |
$id = get_the_ID();
|
394 |
}
|
395 |
$product_meta = get_post_meta($id, '_wpsc_product_metadata', true);
|
396 |
+
if(isset($product_meta['external_link'])) {
|
397 |
+
$external_link = $product_meta['external_link'];
|
398 |
return $external_link;
|
399 |
+
}
|
400 |
}
|
401 |
|
402 |
/**
|
566 |
* @return string - currently only valid for flat rate
|
567 |
*/
|
568 |
function wpsc_product_postage_and_packaging() {
|
569 |
+
if(isset($id) && is_numeric($id) && ($id > 0)) {
|
570 |
$id = absint($id);
|
571 |
} else {
|
572 |
$id = get_the_ID();
|
642 |
}
|
643 |
}
|
644 |
|
645 |
+
/**
|
646 |
+
* Return the class(es) that should be applied to a product image's <a> tag.
|
647 |
+
*
|
648 |
+
* If the thickbox effect is enabled for product images (presentation setting), the thickbox class name is included
|
649 |
+
*
|
650 |
+
* This function is called from theme files when outputting product img tags
|
651 |
+
*
|
652 |
+
* @since 3.8
|
653 |
+
* @return string space-separated list of class names (for use in a class="") attribute
|
654 |
+
*/
|
655 |
+
function wpsc_the_product_image_link_classes() {
|
656 |
+
$classes = array();
|
657 |
+
if ( get_option( 'show_thumbnails_thickbox' ) ) {
|
658 |
+
$classes[] = 'thickbox';
|
659 |
+
}
|
660 |
+
$classes[] = 'preview_link';
|
661 |
+
|
662 |
+
$classes = apply_filters( 'wpsc_the_product_image_link_classes', $classes );
|
663 |
+
return implode( ' ', $classes );
|
664 |
+
}
|
665 |
+
|
666 |
/**
|
667 |
* wpsc product comment link function
|
668 |
* @return string - javascript required to make the intense debate link work
|
691 |
* @return string - javascript for the intensedebate comments
|
692 |
*/
|
693 |
function wpsc_product_comments() {
|
694 |
+
//Commenting out deprecated functions - they aren't used properly, they need to specify the function that should be used.
|
695 |
+
// _deprecated_function( __FUNCTION__, '3.8', 'the updated '.__FUNCTION__.'' );
|
696 |
global $wpsc_query;
|
697 |
+
$output = '';
|
698 |
// add the product comments
|
699 |
if (get_option('wpsc_enable_comments') == 1) {
|
700 |
$enable_for_product = get_product_meta($wpsc_query->product['id'], 'enable_comments');
|
928 |
function wpsc_product_rater() {
|
929 |
global $wpsc_query;
|
930 |
$product_id =get_the_ID();
|
931 |
+
$output = '';
|
932 |
if(get_option('product_ratings') == 1) {
|
933 |
$output .= "<div class='product_footer'>";
|
934 |
|
947 |
$output .= "</div>";
|
948 |
$output .= "</div>";
|
949 |
}
|
950 |
+
return $output;
|
951 |
}
|
952 |
|
953 |
|
wpsc-includes/purchaselogs.class.php
CHANGED
@@ -208,8 +208,8 @@ function wpsc_the_purch_item_status(){
|
|
208 |
}
|
209 |
function wpsc_the_purch_status_id(){
|
210 |
global $purchlogs;
|
211 |
-
//
|
212 |
-
return $purchlogs->purchstatus[order];
|
213 |
}
|
214 |
function wpsc_is_checked_status(){
|
215 |
global $purchlogs;
|
@@ -219,7 +219,9 @@ function wpsc_is_checked_status(){
|
|
219 |
function wpsc_the_purch_status_name(){
|
220 |
global $purchlogs;
|
221 |
//exit(print_r($purchlogs->purchstatus, true));
|
222 |
-
|
|
|
|
|
223 |
}
|
224 |
function wpsc_purchlogs_getfirstdates(){
|
225 |
global $purchlogs;
|
@@ -1047,7 +1049,9 @@ class wpsc_purchaselogs_items{
|
|
1047 |
}
|
1048 |
$this->userinfo = $billingdetails;
|
1049 |
$this->shippinginfo= $shippinginfo;
|
1050 |
-
|
|
|
|
|
1051 |
$this->purch_item_count = count($cartcontent);
|
1052 |
// exit('<pre>'.print_r($cartcontent, true).'</pre>');
|
1053 |
}
|
208 |
}
|
209 |
function wpsc_the_purch_status_id(){
|
210 |
global $purchlogs;
|
211 |
+
//exit(print_r($purchlogs->purchstatus));
|
212 |
+
return $purchlogs->purchstatus['order'];
|
213 |
}
|
214 |
function wpsc_is_checked_status(){
|
215 |
global $purchlogs;
|
219 |
function wpsc_the_purch_status_name(){
|
220 |
global $purchlogs;
|
221 |
//exit(print_r($purchlogs->purchstatus, true));
|
222 |
+
if(isset($purchlogs->purchstatus['label'])) {
|
223 |
+
return $purchlogs->purchstatus['label'];
|
224 |
+
}
|
225 |
}
|
226 |
function wpsc_purchlogs_getfirstdates(){
|
227 |
global $purchlogs;
|
1049 |
}
|
1050 |
$this->userinfo = $billingdetails;
|
1051 |
$this->shippinginfo= $shippinginfo;
|
1052 |
+
if(isset($additionaldetails)) {
|
1053 |
+
$this->customcheckoutfields = $additionaldetails;
|
1054 |
+
}
|
1055 |
$this->purch_item_count = count($cartcontent);
|
1056 |
// exit('<pre>'.print_r($cartcontent, true).'</pre>');
|
1057 |
}
|
wpsc-includes/theme.functions.php
CHANGED
@@ -514,6 +514,9 @@ function wpsc_products_page($content = '') {
|
|
514 |
*/
|
515 |
function wpsc_count_themes_in_uploads_directory() {
|
516 |
$uploads_dir = @opendir(WPSC_THEMES_PATH); // might cause problems if dir doesnt exist
|
|
|
|
|
|
|
517 |
$file_names = array();
|
518 |
while(($file = @readdir($uploads_dir)) !== false) {
|
519 |
if(is_dir(WPSC_THEMES_PATH.$file) && ($file != "..") && ($file != ".") && ($file != ".svn")){
|
@@ -728,4 +731,4 @@ add_filter( 'body_class', 'wpsc_body_class' );
|
|
728 |
|
729 |
|
730 |
|
731 |
-
?>
|
514 |
*/
|
515 |
function wpsc_count_themes_in_uploads_directory() {
|
516 |
$uploads_dir = @opendir(WPSC_THEMES_PATH); // might cause problems if dir doesnt exist
|
517 |
+
if (!$uploads_dir) {
|
518 |
+
return FALSE;
|
519 |
+
}
|
520 |
$file_names = array();
|
521 |
while(($file = @readdir($uploads_dir)) !== false) {
|
522 |
if(is_dir(WPSC_THEMES_PATH.$file) && ($file != "..") && ($file != ".") && ($file != ".svn")){
|
731 |
|
732 |
|
733 |
|
734 |
+
?>
|