WordPress Simple PayPal Shopping Cart - Version 4.0.1

Version Description

  • Added a new filter to format the price in the shopping cart. Example usage: https://www.tipsandtricks-hq.com/ecommerce/customizing-price-amount-display-currency-formatting-3247
  • WordPress 4.0 compatibility.
Download this release

Release Info

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

Code changes from version 3.9.8 to 4.0.1

class-coupon.php CHANGED
@@ -72,12 +72,13 @@ class WPSPSC_COUPON_ITEM
72
var $id;
73
var $coupon_code;
74
var $discount_rate;
75
-
76
- function WPSPSC_COUPON_ITEM($coupon_code, $discount_rate)
77
{
78
$this->id = uniqid();
79
$this->coupon_code = $coupon_code;
80
$this->discount_rate = $discount_rate;
81
}
82
83
function print_coupon_item_details()
@@ -85,6 +86,7 @@ class WPSPSC_COUPON_ITEM
85
echo "<br />".(__("Coupon ID: ", "WSPSC")).$this->id;
86
echo "<br />".(__("Coupon Code: ", "WSPSC")).$this->coupon_code;
87
echo "<br />".(__("Discount Amt: ", "WSPSC")).$this->discount_rate;
88
}
89
}
90
@@ -96,7 +98,14 @@ function wpspsc_apply_cart_discount($coupon_code)
96
$_SESSION['wpspsc_cart_action_msg'] = '<div class="wpspsc_error_message">'.__("Coupon code used does not exist!", "WSPSC").'</div>';
97
return;
98
}
99
-
100
if (isset($_SESSION['wpspsc_discount_applied_once']) && $_SESSION['wpspsc_discount_applied_once'] == '1'){
101
$_SESSION['wpspsc_cart_action_msg'] = '<div class="wpspsc_error_message">'.__("Discount can only be applied once per checkout!", "WSPSC").'</div>';
102
return;
72
var $id;
73
var $coupon_code;
74
var $discount_rate;
75
+ var $expiry_date;
76
+ function WPSPSC_COUPON_ITEM($coupon_code, $discount_rate, $expiry_date)
77
{
78
$this->id = uniqid();
79
$this->coupon_code = $coupon_code;
80
$this->discount_rate = $discount_rate;
81
+ $this->expiry_date = $expiry_date;
82
}
83
84
function print_coupon_item_details()
86
echo "<br />".(__("Coupon ID: ", "WSPSC")).$this->id;
87
echo "<br />".(__("Coupon Code: ", "WSPSC")).$this->coupon_code;
88
echo "<br />".(__("Discount Amt: ", "WSPSC")).$this->discount_rate;
89
+ echo "<br />".(__("Expiry date: ", "WSPSC")).$this->expiry_date;
90
}
91
}
92
98
$_SESSION['wpspsc_cart_action_msg'] = '<div class="wpspsc_error_message">'.__("Coupon code used does not exist!", "WSPSC").'</div>';
99
return;
100
}
101
+ $coupon_expiry_date = $coupon_item->expiry_date;
102
+ if(!empty($coupon_expiry_date)){
103
+ $current_date = date("Y-m-d");
104
+ if($current_date > $coupon_expiry_date){
105
+ $_SESSION['wpspsc_cart_action_msg'] = '<div class="wpspsc_error_message">'.__("Coupon code expired!", "WSPSC").'</div>';
106
+ return;
107
+ }
108
+ }
109
if (isset($_SESSION['wpspsc_discount_applied_once']) && $_SESSION['wpspsc_discount_applied_once'] == '1'){
110
$_SESSION['wpspsc_cart_action_msg'] = '<div class="wpspsc_error_message">'.__("Discount can only be applied once per checkout!", "WSPSC").'</div>';
111
return;
languages/WSPSC-sv_SE.mo ADDED
Binary file
languages/WSPSC-sv_SE.po ADDED
@@ -0,0 +1,746 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WordPress Simple PayPal Shopping Cart\n"
4
+ "POT-Creation-Date: 2014-01-24 16:14+1000\n"
5
+ "PO-Revision-Date: 2014-07-11 18:08+0100\n"
6
+ "Last-Translator: Felicia Fortes <kontakt@feliciafortes.com>\n"
7
+ "Language-Team: \n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Generator: Poedit 1.6.6\n"
12
+ "X-Poedit-KeywordsList: _e;__\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "Language: sv_SE\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ #: class-coupon.php:19
19
+ msgid "Admin needs to configure some discount coupons before it can be used"
20
+ msgstr "Admin behöver ställa in rabattkuponger innan de kan användas"
21
+
22
+ #: class-coupon.php:85
23
+ msgid "Coupon ID: "
24
+ msgstr "Kupong ID:"
25
+
26
+ #: class-coupon.php:86
27
+ msgid "Coupon Code: "
28
+ msgstr "Kupongkod:"
29
+
30
+ #: class-coupon.php:87
31
+ msgid "Discount Amt: "
32
+ msgstr "Rabatt:"
33
+
34
+ #: class-coupon.php:96
35
+ msgid "Coupon code used does not exist!"
36
+ msgstr "Kupongkoden finns inte!"
37
+
38
+ #: class-coupon.php:101
39
+ msgid "Discount can only be applied once per checkout!"
40
+ msgstr "Rabatt kan bara gälla en gång/beställning!"
41
+
42
+ #: class-coupon.php:123
43
+ msgid "Discount applied successfully! Total Discount: "
44
+ msgstr "Rabatten har dragits! Total rabatt:"
45
+
46
+ #: wp_shopping_cart.php:167
47
+ msgid "Error! Your session is out of sync. Please reset your session."
48
+ msgstr ""
49
+ "Oj, nu blev det fel! Din session har blivit avbruten. Var god börja om."
50
+
51
+ #: wp_shopping_cart.php:177
52
+ msgid ""
53
+ "Shopping Cart Configuration Error! You must specify a value in the 'Checkout "
54
+ "Page URL' field for the automatic redirection feature to work!"
55
+ msgstr ""
56
+ "Fel i beställningsidesinställningarna! Du måste ange ett värde i "
57
+ "'Beställningssidans URL'-fältet för att den automatiska vidaresändningen ska "
58
+ "fungera!"
59
+
60
+ #: wp_shopping_cart.php:259
61
+ msgid "Visit The Shop"
62
+ msgstr "Besök butiken"
63
+
64
+ #: wp_shopping_cart.php:271 wp_shopping_cart_settings.php:101
65
+ msgid "USD"
66
+ msgstr "USD"
67
+
68
+ #: wp_shopping_cart.php:275 wp_shopping_cart_settings.php:104
69
+ msgid "quot;
70
+ msgstr "quot;
71
+
72
+ #: wp_shopping_cart.php:301
73
+ msgid "Cart"
74
+ msgstr "Kundvagn"
75
+
76
+ #: wp_shopping_cart.php:310
77
+ msgid "Hit enter to submit new Quantity."
78
+ msgstr "Tryck på Enter för att välja det nya antalet."
79
+
80
+ #: wp_shopping_cart.php:321
81
+ msgid "Item Name"
82
+ msgstr "Produkt"
83
+
84
+ #: wp_shopping_cart.php:321
85
+ msgid "Quantity"
86
+ msgstr "Antal"
87
+
88
+ #: wp_shopping_cart.php:321
89
+ msgid "Price"
90
+ msgstr "Pris"
91
+
92
+ #: wp_shopping_cart.php:355
93
+ msgid "Remove"
94
+ msgstr "Ta bort"
95
+
96
+ #: wp_shopping_cart.php:384
97
+ msgid "Subtotal"
98
+ msgstr "Totalt"
99
+
100
+ #: wp_shopping_cart.php:385
101
+ msgid "Shipping"
102
+ msgstr "Frakt"
103
+
104
+ #: wp_shopping_cart.php:388 wp_shopping_cart_orders.php:89
105
+ #: wp_shopping_cart_orders.php:152
106
+ msgid "Total"
107
+ msgstr "Summa"
108
+
109
+ #: wp_shopping_cart.php:397
110
+ msgid "Enter Coupon Code"
111
+ msgstr "Skriv in rabattkod"
112
+
113
+ #: wp_shopping_cart.php:400
114
+ msgid "Apply"
115
+ msgstr "Välj"
116
+
117
+ #: wp_shopping_cart.php:414
118
+ msgid "paypal_checkout_EN.png"
119
+ msgstr "paypal_checkout_EN.png"
120
+
121
+ #: wp_shopping_cart.php:414
122
+ msgid "Make payments with PayPal - it\\'s fast, free and secure!"
123
+ msgstr "Betala genom PayPal -det går snabbt, är gratis och säkert!"
124
+
125
+ #: wp_shopping_cart.php:476 wp_shopping_cart.php:559 wp_shopping_cart.php:618
126
+ #: wp_shopping_cart.php:666 wp_shopping_cart.php:672
127
+ #: wp_shopping_cart_settings.php:117
128
+ msgid "Add to Cart"
129
+ msgstr "Beställ"
130
+
131
+ #: wp_shopping_cart.php:744
132
+ msgid "WP Paypal Shopping Cart"
133
+ msgstr "WP Paypal Shopping Cart"
134
+
135
+ #: wp_shopping_cart.php:744
136
+ msgid "WP Shopping Cart"
137
+ msgstr "WP Shopping Cart"
138
+
139
+ #: wp_shopping_cart.php:767
140
+ msgid "Shopping Cart"
141
+ msgstr "Shopping Cart"
142
+
143
+ #: wp_shopping_cart.php:793
144
+ msgid "Settings"
145
+ msgstr "Inställningar"
146
+
147
+ #: wp_shopping_cart_discounts_menu.php:51 wp_shopping_cart_settings.php:172
148
+ #: wp_shopping_cart_settings.php:366
149
+ msgid ""
150
+ "For more information, updates, detailed documentation and video tutorial, "
151
+ "please visit:"
152
+ msgstr ""
153
+ "For more information, updates, detailed documentation and video tutorial, "
154
+ "please visit:"
155
+
156
+ #: wp_shopping_cart_discounts_menu.php:52 wp_shopping_cart_settings.php:173
157
+ #: wp_shopping_cart_settings.php:367
158
+ msgid "WP Simple Cart Homepage"
159
+ msgstr "WP Simple Cart Homepage"
160
+
161
+ #: wp_shopping_cart_discounts_menu.php:60
162
+ msgid "Coupon/Discount Settings"
163
+ msgstr "Kupong-/Rabattinställningar"
164
+
165
+ #: wp_shopping_cart_discounts_menu.php:67
166
+ msgid "Enable Discount Coupon Feature"
167
+ msgstr "Sätt på Rabatt/Kupong-funktionen"
168
+
169
+ #: wp_shopping_cart_discounts_menu.php:70
170
+ msgid ""
171
+ "When checked your customers will be able to enter a coupon code in the "
172
+ "shopping cart before checkout."
173
+ msgstr ""
174
+ "När du klickar för den här så kommer kunder kunna skriva in en rabattkod i "
175
+ "beställningen innan de betalar."
176
+
177
+ #: wp_shopping_cart_discounts_menu.php:77
178
+ msgid "Update &raquo;"
179
+ msgstr "Uppdatera &raquo;"
180
+
181
+ #: wp_shopping_cart_discounts_menu.php:93
182
+ msgid "Add Coupon/Discount"
183
+ msgstr "Lägg till kupong/rabatt"
184
+
185
+ #: wp_shopping_cart_discounts_menu.php:113
186
+ msgid "Save Coupon &raquo;"
187
+ msgstr "Spara kupong &raquo;"
188
+
189
+ #: wp_shopping_cart_discounts_menu.php:131
190
+ msgid "Coupon Code"
191
+ msgstr "Kupongkod"
192
+
193
+ #: wp_shopping_cart_discounts_menu.php:132
194
+ msgid "Discount Rate (%)"
195
+ msgstr "Rabatt (%)"
196
+
197
+ #: wp_shopping_cart_discounts_menu.php:161
198
+ msgid "No Coupons Configured."
199
+ msgstr "Inga kuponger inställda"
200
+
201
+ #: wp_shopping_cart_discounts_menu.php:166
202
+ msgid "No Record found"
203
+ msgstr "Ingen uppgift funnen"
204
+
205
+ #: wp_shopping_cart_misc_functions.php:155
206
+ msgid "Your Shopping Cart"
207
+ msgstr "Din beställning"
208
+
209
+ #: wp_shopping_cart_misc_functions.php:156
210
+ msgid "Your cart is empty"
211
+ msgstr "Din order är tom "
212
+
213
+ #: wp_shopping_cart_orders.php:10
214
+ msgid "Cart Orders"
215
+ msgstr "Beställningar"
216
+
217
+ #: wp_shopping_cart_orders.php:11
218
+ msgid "Cart Order"
219
+ msgstr "Beställning"
220
+
221
+ #: wp_shopping_cart_orders.php:12
222
+ msgid "Add New"
223
+ msgstr "Lägg till"
224
+
225
+ #: wp_shopping_cart_orders.php:13
226
+ msgid "Add New Order"
227
+ msgstr "Lägg till ny beställning"
228
+
229
+ #: wp_shopping_cart_orders.php:14
230
+ msgid "Edit"
231
+ msgstr "Ändra"
232
+
233
+ #: wp_shopping_cart_orders.php:15
234
+ msgid "Edit Order"
235
+ msgstr "Ändra beställning"
236
+
237
+ #: wp_shopping_cart_orders.php:16
238
+ msgid "New Order"
239
+ msgstr "Ny beställning"
240
+
241
+ #: wp_shopping_cart_orders.php:17
242
+ msgid "View"
243
+ msgstr "Se"
244
+
245
+ #: wp_shopping_cart_orders.php:18
246
+ msgid "View Order"
247
+ msgstr "Se beställning"
248
+
249
+ #: wp_shopping_cart_orders.php:19
250
+ msgid "Search Order"
251
+ msgstr "Sök beställning"
252
+
253
+ #: wp_shopping_cart_orders.php:20
254
+ msgid "No order found"
255
+ msgstr "Ingen beställning funnen"
256
+
257
+ #: wp_shopping_cart_orders.php:21
258
+ msgid "No order found in Trash"
259
+ msgstr "Ingen beställning funnen i Papperskorgen"
260
+
261
+ #: wp_shopping_cart_orders.php:22
262
+ msgid "Parent Order"
263
+ msgstr "Överordnad beställning"
264
+
265
+ #: wp_shopping_cart_orders.php:38
266
+ msgid "Order Review"
267
+ msgstr "Beställningssammanställning"
268
+
269
+ #: wp_shopping_cart_orders.php:68
270
+ msgid "Order ID: #"
271
+ msgstr "Beställnings-ID: #"
272
+
273
+ #: wp_shopping_cart_orders.php:70
274
+ msgid "Transaction ID: #"
275
+ msgstr "Transaktions-ID: #"
276
+
277
+ #: wp_shopping_cart_orders.php:73 wp_shopping_cart_orders.php:149
278
+ msgid "First Name"
279
+ msgstr "Förnamn"
280
+
281
+ #: wp_shopping_cart_orders.php:77 wp_shopping_cart_orders.php:150
282
+ msgid "Last Name"
283
+ msgstr "Efternamn"
284
+
285
+ #: wp_shopping_cart_orders.php:81
286
+ msgid "Email Address"
287
+ msgstr "Mailadress"
288
+
289
+ #: wp_shopping_cart_orders.php:85
290
+ msgid "IP Address"
291
+ msgstr "IP-adress"
292
+
293
+ #: wp_shopping_cart_orders.php:93
294
+ msgid "Address"
295
+ msgstr "Adress"
296
+
297
+ #: wp_shopping_cart_orders.php:97
298
+ msgid "Buyer Email Sent?"
299
+ msgstr "Kundmail sänt?"
300
+
301
+ #: wp_shopping_cart_orders.php:101
302
+ msgid "Item(s) Ordered:"
303
+ msgstr "Produkt(er) beställda:"
304
+
305
+ #: wp_shopping_cart_orders.php:105
306
+ msgid "Applied Coupon Code:"
307
+ msgstr "Tillämpad rabattkupong"
308
+
309
+ #: wp_shopping_cart_orders.php:148
310
+ msgid "Order ID"
311
+ msgstr "Beställnings-ID"
312
+
313
+ #: wp_shopping_cart_orders.php:151
314
+ msgid "Email"
315
+ msgstr "Mail"
316
+
317
+ #: wp_shopping_cart_orders.php:153
318
+ msgid "Status"
319
+ msgstr "Status"
320
+
321
+ #: wp_shopping_cart_orders.php:154
322
+ msgid "Date"
323
+ msgstr "Datum"
324
+
325
+ #: wp_shopping_cart_settings.php:10
326
+ msgid "WP Paypal Shopping Cart Options"
327
+ msgstr "WP Paypal Shopping Cart alternativ"
328
+
329
+ #: wp_shopping_cart_settings.php:97
330
+ msgid "Options Updated!"
331
+ msgstr "Inställningarna är uppdaterade!"
332
+
333
+ #: wp_shopping_cart_settings.php:169
334
+ msgid "Simple PayPal Shopping Cart Settings"
335
+ msgstr "Simple PayPal Shopping Cart inställningar"
336
+
337
+ #: wp_shopping_cart_settings.php:177
338
+ msgid "Quick Usage Guide"
339
+ msgstr "Snabbguide"
340
+
341
+ #: wp_shopping_cart_settings.php:180
342
+ msgid "Step 1) "
343
+ msgstr "Steg 1) "
344
+
345
+ #: wp_shopping_cart_settings.php:180
346
+ msgid "To add an 'Add to Cart' button for a product simply add the shortcode"
347
+ msgstr ""
348
+ "För att lägga till en 'Add to Cart' -knapp så lägger du helt enkelt till "
349
+ "shortcode:n"
350
+
351
+ #: wp_shopping_cart_settings.php:180
352
+ msgid "PRODUCT-NAME"
353
+ msgstr "PRODUCT-NAME"
354
+
355
+ #: wp_shopping_cart_settings.php:180
356
+ msgid "PRODUCT-PRICE"
357
+ msgstr "PRODUCT-PRICE"
358
+
359
+ #: wp_shopping_cart_settings.php:180
360
+ msgid ""
361
+ "to a post or page next to the product. Replace PRODUCT-NAME and PRODUCT-"
362
+ "PRICE with the actual name and price of your product."
363
+ msgstr ""
364
+ "bredvid produkten i ett inlägg eller på en sida. Byt ut PRODUCT-NAME och "
365
+ "PRODUCT-PRICE till det faktiska namnet och priset på produkten."
366
+
367
+ #: wp_shopping_cart_settings.php:181
368
+ msgid "Example add to cart button shortcode usage:"
369
+ msgstr ""
370
+ "Exempel på hut du använder shortcodes för att lägga till en 'add to cart'-"
371
+ "knapp:"
372
+
373
+ #: wp_shopping_cart_settings.php:182
374
+ msgid "Step 2) "
375
+ msgstr "Step 2) "
376
+
377
+ #: wp_shopping_cart_settings.php:182
378
+ msgid ""
379
+ "To add the shopping cart to a post or page (example: a checkout page) simply "
380
+ "add the shortcode"
381
+ msgstr ""
382
+ "Om du vill lägga till kundvagn till ett inlägg eller en sida (exempelvis: "
383
+ "Din order-sidan) så lägger du helt enkelt till shortcoden"
384
+
385
+ #: wp_shopping_cart_settings.php:182
386
+ msgid ""
387
+ "to a post or page or use the sidebar widget to add the shopping cart to the "
388
+ "sidebar."
389
+ msgstr ""
390
+ "till ett inlägg eller en sida eller använd sidebar-widgeten för att lägga "
391
+ "till kundvagnen i sidebaren."
392
+
393
+ #: wp_shopping_cart_settings.php:183
394
+ msgid "Example shopping cart shortcode usage:"
395
+ msgstr "Exempel på hur du använder Kundvagns-shortcode:"
396
+
397
+ #: wp_shopping_cart_settings.php:192
398
+ msgid "PayPal and Shopping Cart Settings"
399
+ msgstr "PayPal och Kundvagns-inställningar"
400
+
401
+ #: wp_shopping_cart_settings.php:198
402
+ msgid "Paypal Email Address"
403
+ msgstr "PayPal mailadress"
404
+
405
+ #: wp_shopping_cart_settings.php:202
406
+ msgid "Shopping Cart title"
407
+ msgstr "Kundvagnstitel"
408
+
409
+ #: wp_shopping_cart_settings.php:206
410
+ msgid "Text/Image to Show When Cart Empty"
411
+ msgstr "Text/Bild att visa när kundvagnen är tom"
412
+
413
+ #: wp_shopping_cart_settings.php:207
414
+ msgid ""
415
+ "You can either enter plain text or the URL of an image that you want to show "
416
+ "when the shopping cart is empty"
417
+ msgstr ""
418
+ "Du kan antingen skriva in vanlig text eller webbadressen till en bild som du "
419
+ "vill visa när kundvagn är tom"
420
+
421
+ #: wp_shopping_cart_settings.php:210
422
+ msgid "Currency"
423
+ msgstr "Valuta"
424
+
425
+ #: wp_shopping_cart_settings.php:211 wp_shopping_cart_settings.php:215
426
+ #: wp_shopping_cart_settings.php:242
427
+ msgid "e.g."
428
+ msgstr "t.ex."
429
+
430
+ #: wp_shopping_cart_settings.php:214
431
+ msgid "Currency Symbol"
432
+ msgstr "Valutasymbol"
433
+
434
+ #: wp_shopping_cart_settings.php:220
435
+ msgid "Base Shipping Cost"
436
+ msgstr "Grundfraktkostnaden"
437
+
438
+ #: wp_shopping_cart_settings.php:221
439
+ msgid ""
440
+ "This is the base shipping cost that will be added to the total of individual "
441
+ "products shipping cost. Put 0 if you do not want to charge shipping cost or "
442
+ "use base shipping cost."
443
+ msgstr ""
444
+ "Detta är grundfraktkostnaden som kommer att läggas till de individuella "
445
+ "produkternas fraktkostnad. Skriv 0 om du inte vill ta ut fraktkostnad eller "
446
+ "använda grundfraktkostnad."
447
+
448
+ #: wp_shopping_cart_settings.php:221
449
+ msgid "Learn More on Shipping Calculation"
450
+ msgstr "Lär dig mer om uträkning av fraktkostnad"
451
+
452
+ #: wp_shopping_cart_settings.php:225
453
+ msgid "Free Shipping for Orders Over"
454
+ msgstr "Gratis frakt för order över"
455
+
456
+ #: wp_shopping_cart_settings.php:226
457
+ msgid ""
458
+ "When a customer orders more than this amount he/she will get free shipping. "
459
+ "Leave empty if you do not want to use it."
460
+ msgstr ""
461
+ "När en kund beställer mer än detta belopp kommer hon/han att få fri frakt. "
462
+ "Lämna tomt om du inte vill använda den."
463
+
464
+ #: wp_shopping_cart_settings.php:230
465
+ msgid "Must Collect Shipping Address on PayPal"
466
+ msgstr "Ta in leveransadress på PayPal"
467
+
468
+ #: wp_shopping_cart_settings.php:231
469
+ msgid ""
470
+ "If checked the customer will be forced to enter a shipping address on PayPal "
471
+ "when checking out."
472
+ msgstr ""
473
+ "Klicka i om du vill att kunden ska tvingas att ange en leveransadress på "
474
+ "PayPal när hon/han checkar ut."
475
+
476
+ #: wp_shopping_cart_settings.php:235
477
+ msgid "Use PayPal Profile Based Shipping"
478
+ msgstr "Använd frakt baserat på PayPal-profil"
479
+
480
+ #: wp_shopping_cart_settings.php:236
481
+ msgid "Check this if you want to use"
482
+ msgstr "Klicka i om du vill använda"
483
+
484
+ #: wp_shopping_cart_settings.php:236
485
+ msgid "PayPal profile based shipping"
486
+ msgstr "frakt baserat på PayPal-profil"
487
+
488
+ #: wp_shopping_cart_settings.php:236
489
+ msgid ""
490
+ "Using this will ignore any other shipping options that you have specified in "
491
+ "this plugin."
492
+ msgstr ""
493
+ "Om du använder det här kommer de andra inställningarna för frakt som du "
494
+ "angett i tillägget att ignoreras."
495
+
496
+ #: wp_shopping_cart_settings.php:240
497
+ msgid "Add to Cart button text or Image"
498
+ msgstr "Beställ-knappens text eller bild"
499
+
500
+ #: wp_shopping_cart_settings.php:242
501
+ msgid ""
502
+ "To use a customized image as the button simply enter the URL of the image "
503
+ "file."
504
+ msgstr ""
505
+ "För att använda en egen knapp-bild ska du helt enkelt skriva in bildens "
506
+ "webbadress."
507
+
508
+ #: wp_shopping_cart_settings.php:248
509
+ msgid "Return URL"
510
+ msgstr "Återkomst-URL"
511
+
512
+ #: wp_shopping_cart_settings.php:249
513
+ msgid ""
514
+ "This is the URL the customer will be redirected to after a successful payment"
515
+ msgstr ""
516
+ "Det här är den webbsida (URL) som kunden kommer att skickas till efter att "
517
+ "betalningen är gjord"
518
+
519
+ #: wp_shopping_cart_settings.php:253
520
+ msgid "Products Page URL"
521
+ msgstr "Produktsidans URL"
522
+
523
+ #: wp_shopping_cart_settings.php:254
524
+ msgid ""
525
+ "This is the URL of your products page if you have any. If used, the shopping "
526
+ "cart widget will display a link to this page when cart is empty"
527
+ msgstr ""
528
+ "Det här är webbsidesadressen (URL) till produktsidan, om du använder en "
529
+ "sådan. Om du använder den så kommer Kundvagns-widgeten att visa en länk till "
530
+ "den sidan när kundvagnen är tom."
531
+
532
+ #: wp_shopping_cart_settings.php:258
533
+ msgid "Automatic redirection to checkout page"
534
+ msgstr "Automatisk vidaresändning till Din order-sidan"
535
+
536
+ #: wp_shopping_cart_settings.php:260
537
+ msgid "Checkout Page URL"
538
+ msgstr "Din order-sida"
539
+
540
+ #: wp_shopping_cart_settings.php:261
541
+ msgid ""
542
+ "If checked the visitor will be redirected to the Checkout page after a "
543
+ "product is added to the cart. You must enter a URL in the Checkout Page URL "
544
+ "field for this to work."
545
+ msgstr ""
546
+ "Klicka för om kunden ska skickas automatiskt till Din order-sidan efter att "
547
+ "en produkt beställts. Du måste skriva in en URL i Din order-sidans URL-fält "
548
+ "för att det ska fungera. "
549
+
550
+ #: wp_shopping_cart_settings.php:265
551
+ msgid "Reset Cart After Redirection to Return Page"
552
+ msgstr "Återställ ordern efter återkomst till webbsidan."
553
+
554
+ #: wp_shopping_cart_settings.php:267
555
+ msgid ""
556
+ "If checked the shopping cart will be reset when the customer lands on the "
557
+ "return URL (Thank You) page."
558
+ msgstr ""
559
+ "Klicka för om du vill återställa ordern när kunden kommer tillbaka till "
560
+ "sidans (Tack för beställningen)-sida."
561
+
562
+ #: wp_shopping_cart_settings.php:274
563
+ msgid "Hide Shopping Cart Image"
564
+ msgstr "Göm kundvagnsbild"
565
+
566
+ #: wp_shopping_cart_settings.php:275
567
+ msgid "If ticked the shopping cart image will not be shown."
568
+ msgstr "Klicka för om du vill dölja kundvagnsbilden."
569
+
570
+ #: wp_shopping_cart_settings.php:281
571
+ msgid "Customize the Note to Seller Text"
572
+ msgstr "Anpassa texten i meddelandet till försäljaren"
573
+
574
+ #: wp_shopping_cart_settings.php:283
575
+ msgid ""
576
+ "Specify the text that you want to use for the note field on PayPal checkout "
577
+ "page to collect special instruction (leave this field empty if you don't "
578
+ "need to customize it). The default label for the note field is \"Add special "
579
+ "instructions to merchant\"."
580
+ msgstr ""
581
+ "Skriv in texten sm du vill använda i noteringsfältet på PayPals checkout-"
582
+ "sida för att samla in speciella instruktioner (lämna det här fältet tomt om "
583
+ "du inte behöver anpassa texten). Grundinställningen för texten är \"Add "
584
+ "special instructions to merchant\"."
585
+
586
+ #: wp_shopping_cart_settings.php:289
587
+ msgid "Use WP Affiliate Platform"
588
+ msgstr "Anbänd WP Affiliate Platform"
589
+
590
+ #: wp_shopping_cart_settings.php:291
591
+ msgid "Check this if using with the"
592
+ msgstr "Klicka för om du använder med"
593
+
594
+ #: wp_shopping_cart_settings.php:291
595
+ msgid ""
596
+ "This plugin lets you run your own affiliate campaign/program and allows you "
597
+ "to reward (pay commission) your affiliates for referred sales"
598
+ msgstr ""
599
+ "Det här tillägget låter dig köra affiliate kampanjer/program och tillåter "
600
+ "att du belönar (betalar kommission) till samarbetspartners på deras kopplade "
601
+ "försäljningar"
602
+
603
+ #: wp_shopping_cart_settings.php:297
604
+ msgid "Testing and Debugging Settings"
605
+ msgstr "Test och Felsöknings-inställningar"
606
+
607
+ #: wp_shopping_cart_settings.php:303
608
+ msgid "Enable Debug"
609
+ msgstr "Sätt igång Debug"
610
+
611
+ #: wp_shopping_cart_settings.php:305
612
+ msgid ""
613
+ "If checked, debug output will be written to the log file. This is useful for "
614
+ "troubleshooting post payment failures"
615
+ msgstr ""
616
+ "Om du klickat i så skrivs det in debug-information i logg-filen. Det kan "
617
+ "vara användbart vid felsökning om betalningar misslyckas"
618
+
619
+ #: wp_shopping_cart_settings.php:315
620
+ msgid "Enable Sandbox Testing"
621
+ msgstr "Sätt igång Sandbox-test"
622
+
623
+ #: wp_shopping_cart_settings.php:317
624
+ msgid ""
625
+ "Check this option if you want to do PayPal sandbox testing. You will need to "
626
+ "create a PayPal sandbox account from PayPal Developer site"
627
+ msgstr ""
628
+ "Klicka i här om du vill testa med hjälp av PayPal sandbox. Du behöver skapa "
629
+ "ett PayPal sandbox-konto på PayPal Developer-sidan"
630
+
631
+ #: wp_shopping_cart_settings.php:326 wp_shopping_cart_settings.php:415
632
+ msgid "Update Options &raquo;"
633
+ msgstr "Uppdatera alternativ &raquo;"
634
+
635
+ #: wp_shopping_cart_settings.php:330
636
+ msgid "Like the Simple WordPress Shopping Cart Plugin?"
637
+ msgstr "Tycker du om Simple WordPress Shopping Cart-tillägget?"
638
+
639
+ #: wp_shopping_cart_settings.php:330
640
+ msgid "Give it a good rating"
641
+ msgstr "Ge tillägget en bra recension"
642
+
643
+ #: wp_shopping_cart_settings.php:333
644
+ msgid "Need a shopping cart plugin with more features? Checkout my "
645
+ msgstr "Behöver du ett shopping-tillägg med mer funktioner? Kolla in mitt"
646
+
647
+ #: wp_shopping_cart_settings.php:334
648
+ msgid "WP eStore Plugin"
649
+ msgstr "WP eStore-tillägg"
650
+
651
+ #: wp_shopping_cart_settings.php:375
652
+ msgid "Purchase Confirmation Email Settings"
653
+ msgstr "Inställningar av mail med beställningsbekräftelse"
654
+
655
+ #: wp_shopping_cart_settings.php:378
656
+ msgid ""
657
+ "The following options affect the emails that gets sent to your buyers after "
658
+ "a purchase."
659
+ msgstr ""
660
+ "Följande alternativ påverkar de mail som skickas till kunden efter ett köp."
661
+
662
+ #: wp_shopping_cart_settings.php:383
663
+ msgid "Send Emails to Buyer After Purchase"
664
+ msgstr "Skicka mail till kunden efter köp"
665
+
666
+ #: wp_shopping_cart_settings.php:384
667
+ msgid ""
668
+ "If checked the plugin will send an email to the buyer with the sale details. "
669
+ "If digital goods are purchased then the email will contain the download "
670
+ "links for the purchased products."
671
+ msgstr ""
672
+ "Om du klickat i här så kommer tillägget att skicka ett mail till kunden med "
673
+ "beställningsinformation. Om digitala produkter blivit köpta så kommer mailet "
674
+ "att även innehålla nedladdningslänken för produkten/produkterna."
675
+
676
+ #: wp_shopping_cart_settings.php:388
677
+ msgid "From Email Address"
678
+ msgstr "Från mailadress"
679
+
680
+ #: wp_shopping_cart_settings.php:390
681
+ msgid ""
682
+ "Example: Your Name &lt;sales@your-domain.com&gt; This is the email address "
683
+ "that will be used to send the email to the buyer. This name and email "
684
+ "address will appear in the from field of the email."
685
+ msgstr ""
686
+ "Exempel: Ditt namn &lt;order@domain.se&gt; Det här är mailadressen som "
687
+ "kommer att användas för att skicka mail till kunder. Det här namnet och "
688
+ "mailadressen kommer att synas i Från-fältet på mailet."
689
+
690
+ #: wp_shopping_cart_settings.php:394
691
+ msgid "Buyer Email Subject"
692
+ msgstr "Kundmailets ämnesrad"
693
+
694
+ #: wp_shopping_cart_settings.php:396
695
+ msgid "This is the subject of the email that will be sent to the buyer."
696
+ msgstr "Det här är ämnesraden på mail som skickas till kund. "
697
+
698
+ #: wp_shopping_cart_settings.php:400
699
+ msgid "Buyer Email Body"
700
+ msgstr "Kundmailets text"
701
+
702
+ #: wp_shopping_cart_settings.php:403
703
+ msgid ""
704
+ "This is the body of the email that will be sent to the buyer. Do not change "
705
+ "the text within the braces {}. You can use the following email tags in this "
706
+ "email body field:"
707
+ msgstr ""
708
+ "Det här är texten i mailet som skickas till kunden. Ändra inte texten "
709
+ "innanför gåsvingarna {}. Du kan använda följande mail-taggar i texten:"
710
+
711
+ #: wp_shopping_cart_settings.php:404
712
+ msgid "First name of the buyer"
713
+ msgstr "Kundens förnamn"
714
+
715
+ #: wp_shopping_cart_settings.php:405
716
+ msgid "Last name of the buyer"
717
+ msgstr "Kundens efternamn"
718
+
719
+ #: wp_shopping_cart_settings.php:406
720
+ msgid ""
721
+ "The item details of the purchased product (this will include the download "
722
+ "link for digital items)."
723
+ msgstr ""
724
+ "Den beställda produktens beskrivning (kommer att följa med "
725
+ "nedladdningslänken för digitala produkter).)"
726
+
727
+ #: wp_shopping_cart_shortcodes.php:16 wp_shopping_cart_shortcodes.php:40
728
+ msgid "Error! You must specify a product name in the shortcode."
729
+ msgstr ""
730
+ "Oj, nu blev det fel! Du måste ange ett namn för produkten i shortcoden."
731
+
732
+ #: wp_shopping_cart_shortcodes.php:19 wp_shopping_cart_shortcodes.php:43
733
+ msgid "Error! You must specify a price for your product in the shortcode."
734
+ msgstr ""
735
+ "Oj, nu blev det fel! Du måste ange ett pris för produkten i shortcoden."
736
+
737
+ #: wp_shopping_cart_shortcodes.php:46
738
+ msgid ""
739
+ "Error! You must specify a thumbnail image for your product in the shortcode."
740
+ msgstr ""
741
+ "Oj, där blev det fel! Du måste ange en tumnagel-bild för produkten i "
742
+ "shortcoden."
743
+
744
+ #: lib/gallery-wp-cart.php:32
745
+ msgid "[View with PicLens]"
746
+ msgstr "[Se med PicLens]"
lib/wpspsc_admin_side.js ADDED
@@ -0,0 +1,7 @@
1
+ jQuery(document).ready(function($){
2
+ $('.wpspsc_coupon_expiry').datepicker({
3
+ dateFormat : 'yy-mm-dd'
4
+ });
5
+ });
6
+
7
+
paypal.php CHANGED
@@ -165,7 +165,8 @@ class paypal_ipn_handler {
165
if($item_counter != 1){
166
$product_details .= "\n";
167
}
168
- $product_details .= $item['name']." x ".$item['quantity']." - ".$currency_symbol.$item['price']."\n";
169
if($item['file_url']){
170
$file_url = base64_decode($item['file_url']);
171
$product_details .= "Download Link: ".$file_url."\n";
165
if($item_counter != 1){
166
$product_details .= "\n";
167
}
168
+ $item_total = $item['price'] * $item['quantity'];
169
+ $product_details .= $item['name']." x ".$item['quantity']." - ".$currency_symbol.wpspsc_number_format_price($item_total)."\n";
170
if($item['file_url']){
171
$file_url = base64_decode($item['file_url']);
172
$product_details .= "Download Link: ".$file_url."\n";
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
=== WordPress Simple Paypal Shopping Cart ===
2
Contributors: Tips and Tricks HQ, Ruhul Amin, wptipsntricks
3
- Donate link: http://www.tipsandtricks-hq.com
4
- Tags: cart, shopping cart, WordPress shopping cart, Paypal shopping cart, sell, selling, sell products, online shop, shop, e-commerce, wordpress ecommerce, wordpress store, store, PayPal cart widget, sell digital products, sell service, digital downloads, paypal, paypal cart, e-shop, compact cart,
5
Requires at least: 3.0
6
- Tested up to: 3.9.1
7
- Stable tag: 3.9.8
8
License: GPLv2 or later
9
10
Very easy to use Simple WordPress Paypal Shopping Cart Plugin. Great for selling products online in one click from your WordPress site.
@@ -28,7 +28,7 @@ This plugin is a lightweight solution (with minimal number of lines of code and
28
WP simple Paypal Cart Plugin, interfaces with the Paypal sandbox to allow for testing.
29
30
For video tutorial, screenshots, detailed documentation, support and updates, please visit:
31
- [WP Simple Cart Details Page](http://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768)
32
or
33
[WP Simple Cart Documentation](http://www.tipsandtricks-hq.com/ecommerce/wp-shopping-cart)
34
@@ -49,11 +49,13 @@ or
49
* Ability to configure a sale notification email that gets sent to the site admin when a customer purchase your item(s).
50
* Ability to configure discount coupons. Offer special discounts on your store/shop.
51
* You can create coupons and give to your customers. When they use coupons during the checkout they will receive a discount.
52
* Compatible with WordPress Multi-site Installation.
53
* Ability to specify SKU (item number) for each of your products in the shortcode.
54
* Ability to customize the add to cart button image and use a custom image for your purchase buttons.
55
* Track coupons with the order to see which customer used which coupon code.
56
* Ability to add a compact shopping cart to your site using a shortcode.
57
* Ability to use a custom checkout page style.
58
* Ability to open checkout page in a new browser tab/window.
59
* Works nicely with responsive WordPress themes.
@@ -64,7 +66,7 @@ or
64
65
There is a series of video tutorials to show you how to setup the shopping cart on your site.
66
67
- Check the video tutorials [here](http://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768).
68
69
= Language Translations =
70
@@ -79,6 +81,7 @@ The following language translations are already available:
79
* Polish
80
* Czech
81
* Hebrew
82
83
You can translate the plugin using [this documentation](http://www.tipsandtricks-hq.com/ecommerce/translating-the-wp-simple-shopping-cart-plugin-2627).
84
@@ -159,7 +162,7 @@ Yes. you can setup discount coupons from the "Coupon/Discount" interface of the
159
Yes. You can configure sale notification from the "Email Settings" interface of the plugin.
160
161
== Screenshots ==
162
- Visit the plugin site at http://www.tipsandtricks-hq.com/?p=768 for screenshots.
163
164
== Upgrade Notice ==
165
@@ -167,6 +170,25 @@ None
167
168
== Changelog ==
169
170
= 3.9.8 =
171
- Added Hebrew Language translation to the plugin. The Hebrew translation file was submitted by Sagi Cooper.
172
- Added extra condition to address the "Invalid argument supplied" error that a few users were getting.
1
=== WordPress Simple Paypal Shopping Cart ===
2
Contributors: Tips and Tricks HQ, Ruhul Amin, wptipsntricks
3
+ Donate link: https://www.tipsandtricks-hq.com
4
+ Tags: cart, shopping cart, WordPress shopping cart, Paypal shopping cart, sell, selling, sell products, online shop, shop, e-commerce, wordpress ecommerce, wordpress store, store, PayPal cart widget, sell digital products, sell service, digital downloads, paypal, paypal cart, e-shop, compact cart, coupon, discount
5
Requires at least: 3.0
6
+ Tested up to: 4.0
7
+ Stable tag: 4.0.1
8
License: GPLv2 or later
9
10
Very easy to use Simple WordPress Paypal Shopping Cart Plugin. Great for selling products online in one click from your WordPress site.
28
WP simple Paypal Cart Plugin, interfaces with the Paypal sandbox to allow for testing.
29
30
For video tutorial, screenshots, detailed documentation, support and updates, please visit:
31
+ [WP Simple Cart Details Page](https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768)
32
or
33
[WP Simple Cart Documentation](http://www.tipsandtricks-hq.com/ecommerce/wp-shopping-cart)
34
49
* Ability to configure a sale notification email that gets sent to the site admin when a customer purchase your item(s).
50
* Ability to configure discount coupons. Offer special discounts on your store/shop.
51
* You can create coupons and give to your customers. When they use coupons during the checkout they will receive a discount.
52
+ * Create discount coupons with an expiry date. The coupon code automatically expires after the date you set.
53
* Compatible with WordPress Multi-site Installation.
54
* Ability to specify SKU (item number) for each of your products in the shortcode.
55
* Ability to customize the add to cart button image and use a custom image for your purchase buttons.
56
* Track coupons with the order to see which customer used which coupon code.
57
* Ability to add a compact shopping cart to your site using a shortcode.
58
+ * Ability to show shopping cart with product image thumbnails.
59
* Ability to use a custom checkout page style.
60
* Ability to open checkout page in a new browser tab/window.
61
* Works nicely with responsive WordPress themes.
66
67
There is a series of video tutorials to show you how to setup the shopping cart on your site.
68
69
+ Check the video tutorials [here](https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768).
70
71
= Language Translations =
72
81
* Polish
82
* Czech
83
* Hebrew
84
+ * Swedish
85
86
You can translate the plugin using [this documentation](http://www.tipsandtricks-hq.com/ecommerce/translating-the-wp-simple-shopping-cart-plugin-2627).
87
162
Yes. You can configure sale notification from the "Email Settings" interface of the plugin.
163
164
== Screenshots ==
165
+ Visit the plugin site at https://www.tipsandtricks-hq.com/?p=768 for screenshots.
166
167
== Upgrade Notice ==
168
170
171
== Changelog ==
172
173
+ = 4.0.1 =
174
+ - Added a new filter to format the price in the shopping cart. Example usage:
175
+ https://www.tipsandtricks-hq.com/ecommerce/customizing-price-amount-display-currency-formatting-3247
176
+ - WordPress 4.0 compatibility.
177
+
178
+ = 4.0.0 =
179
+ - Changed the permission on the orders menu so it is only available to admin users from the backend.
180
+ - Made some enhancement around the PHP session_start function call.
181
+ - Added an extra check to prevent direct access to the cart file.
182
+ - Added expiry date field in the discount coupon. You can now create discount coupons with an expiry.
183
+
184
+ = 3.9.9 =
185
+ - Added a new feature that allows you to show the product thumbnail image in the shopping cart. Use "show_thumbnail" parameter in the shopping cart shortcode for this.
186
+ - Added Swedish language translation to the plugin. The Swedish translation file was submitted by Felicia.
187
+ - Fixed a minor bug with the checkout page style feature.
188
+ - Added a new filter for the item name field in the shopping cart.
189
+ - Made some minor CSS improvements for the cart output.
190
+ - The {product_details} email shortcode will now show the full amount of the item (instead of the individual item amount).
191
+
192
= 3.9.8 =
193
- Added Hebrew Language translation to the plugin. The Hebrew translation file was submitted by Sagi Cooper.
194
- Added extra condition to address the "Invalid argument supplied" error that a few users were getting.
wp_shopping_cart.php CHANGED
@@ -1,22 +1,31 @@
1
<?php
2
/*
3
- Plugin Name: WP Simple Paypal Shopping cart
4
- Version: v3.9.8
5
- Plugin URI: http://www.tipsandtricks-hq.com/?p=768
6
- Author: Tips and Tricks HQ, Ruhul Amin
7
- Author URI: http://www.tipsandtricks-hq.com/
8
- Description: Simple WordPress Shopping Cart Plugin, very easy to use and great for selling products and services from your blog!
9
- */
10
-
11
- if(!isset($_SESSION)){
12
- session_start();
13
- }
14
-
15
- define('WP_CART_VERSION', '3.9.8');
16
define('WP_CART_FOLDER', dirname(plugin_basename(__FILE__)));
17
- define('WP_CART_PATH',plugin_dir_path( __FILE__ ));
18
- define('WP_CART_URL', plugins_url('',__FILE__));
19
- define('WP_CART_SITE_URL',site_url());
20
define('WP_CART_LIVE_PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr');
21
define('WP_CART_SANDBOX_PAYPAL_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
22
@@ -29,59 +38,49 @@ include_once('wp_shopping_cart_misc_functions.php');
29
include_once('wp_shopping_cart_orders.php');
30
include_once('class-coupon.php');
31
32
- function always_show_cart_handler($atts)
33
- {
34
- return print_wp_shopping_cart();
35
}
36
37
- function show_wp_shopping_cart_handler()
38
- {
39
$output = "";
40
- if (cart_not_empty())
41
- {
42
- $output = print_wp_shopping_cart();
43
}
44
- return $output;
45
}
46
47
- function shopping_cart_show($content)
48
- {
49
- if (strpos($content, "<!--show-wp-shopping-cart-->") !== FALSE)
50
- {
51
- if (cart_not_empty())
52
- {
53
- $content = preg_replace('/<p>\s*<!--(.*)-->\s*<\/p>/i', "<!--$1-->", $content);
54
- $matchingText = '<!--show-wp-shopping-cart-->';
55
- $replacementText = print_wp_shopping_cart();
56
- $content = str_replace($matchingText, $replacementText, $content);
57
- }
58
}
59
return $content;
60
}
61
62
// Reset cart option
63
- if (isset($_REQUEST["reset_wp_cart"]) && !empty($_REQUEST["reset_wp_cart"]))
64
- {
65
reset_wp_cart();
66
}
67
68
//Clear the cart if the customer landed on the thank you page
69
- if (get_option('wp_shopping_cart_reset_after_redirection_to_return_page'))
70
- {
71
//TODO - remove this field altogether later. Cart will always be reset using query prameter on the thank you page.
72
- if(get_option('cart_return_from_paypal_url') == cart_current_page_url()){
73
reset_wp_cart();
74
}
75
}
76
77
- function reset_wp_cart()
78
- {
79
$products = $_SESSION['simpleCart'];
80
- if(!is_array($products)){
81
return;
82
}
83
- foreach ($products as $key => $item)
84
- {
85
unset($products[$key]);
86
}
87
$_SESSION['simpleCart'] = $products;
@@ -91,62 +90,58 @@ function reset_wp_cart()
91
unset($_SESSION['wpspsc_applied_coupon_code']);
92
}
93
94
- function wpspc_cart_actions_handler()
95
- {
96
unset($_SESSION['wpspsc_cart_action_msg']);
97
- if (isset($_POST['addcart']))
98
- {
99
- setcookie("cart_in_use","true",time()+21600,"/",COOKIE_DOMAIN); //useful to not serve cached page when using with a caching plugin
100
- if (function_exists('wp_cache_serve_cache_file')){//WP Super cache workaround
101
- setcookie("comment_author_","wp_cart",time()+21600,"/",COOKIE_DOMAIN);
102
}
103
104
//sanitize data
105
- $_POST['product'] = strip_tags($_POST['product']);//for PHP5.2 use filter_var($_POST['product'], FILTER_SANITIZE_STRING);
106
$_POST['item_number'] = strip_tags($_POST['item_number']);
107
- if(isset($_POST['price']))$_POST['price'] = strip_tags($_POST['price']);
108
- isset($_POST['shipping'])?$_POST['shipping'] = strip_tags($_POST['shipping']):$_POST['shipping']='';
109
- isset($_POST['cartLink'])?$_POST['cartLink'] = strip_tags($_POST['cartLink']):$_POST['cartLink']='';
110
-
111
- $count = 1;
112
- $products = $_SESSION['simpleCart'];
113
- if (is_array($products))
114
- {
115
- foreach ($products as $key => $item)
116
- {
117
- if ($item['name'] == stripslashes($_POST['product']))
118
- {
119
$count += $item['quantity'];
120
$item['quantity']++;
121
unset($products[$key]);
122
array_push($products, $item);
123
}
124
}
125
- }
126
- else
127
- {
128
$products = array();
129
}
130
131
- if ($count == 1)
132
- {
133
- if (!empty($_POST[$_POST['product']])){
134
$price = $_POST[$_POST['product']];
135
- }
136
- else{
137
$price = $_POST['price'];
138
}
139
140
$default_cur_symbol = get_option('cart_currency_symbol');
141
- $price = str_replace($default_cur_symbol,"",$price);
142
143
$shipping = $_POST['shipping'];
144
- $shipping = str_replace($default_cur_symbol,"",$shipping);
145
146
- $product = array('name' => stripslashes($_POST['product']), 'price' => $price, 'price_orig' =>$price, 'quantity' => $count, 'shipping' => $shipping, 'cartLink' => $_POST['cartLink'], 'item_number' => $_POST['item_number']);
147
- if(isset($_POST['file_url']) && !empty($_POST['file_url'])){
148
$file_url = strip_tags($_POST['file_url']);
149
- $product['file_url'] = $file_url;
150
}
151
array_push($products, $product);
152
}
@@ -154,120 +149,92 @@ function wpspc_cart_actions_handler()
154
sort($products);
155
$_SESSION['simpleCart'] = $products;
156
157
- wpspsc_reapply_discount_coupon_if_needed();//Re-apply coupon to the cart if necessary
158
-
159
- if(!isset($_SESSION['simple_cart_id']) && empty($_SESSION['simple_cart_id']))
160
- {
161
wpspc_insert_new_record();
162
- }
163
- else
164
- {
165
//cart updating
166
- if(isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id']))
167
- {
168
wpspc_update_cart_items_record();
169
- }
170
- else{
171
- echo "<p>".(__("Error! Your session is out of sync. Please reset your session.", "WSPSC"))."</p>";
172
}
173
}
174
175
176
- if (get_option('wp_shopping_cart_auto_redirect_to_checkout_page'))
177
- {
178
$checkout_url = get_option('cart_checkout_page_url');
179
- if(empty($checkout_url))
180
- {
181
- echo "<br /><strong>".(__("Shopping Cart Configuration Error! You must specify a value in the 'Checkout Page URL' field for the automatic redirection feature to work!", "WSPSC"))."</strong><br />";
182
- }
183
- else
184
- {
185
- $redirection_parameter = 'Location: '.$checkout_url;
186
- header($redirection_parameter);
187
- exit;
188
}
189
- }
190
- }
191
- else if (isset($_POST['cquantity']))
192
- {
193
$products = $_SESSION['simpleCart'];
194
- foreach ($products as $key => $item)
195
- {
196
- if ((stripslashes($item['name']) == stripslashes($_POST['product'])) && $_POST['quantity'])
197
- {
198
$item['quantity'] = $_POST['quantity'];
199
unset($products[$key]);
200
array_push($products, $item);
201
- }
202
- else if (($item['name'] == stripslashes($_POST['product'])) && !$_POST['quantity']){
203
unset($products[$key]);
204
}
205
}
206
sort($products);
207
$_SESSION['simpleCart'] = $products;
208
-
209
- wpspsc_reapply_discount_coupon_if_needed();//Re-apply coupon to the cart if necessary
210
-
211
- if(isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id']))
212
- {
213
wpspc_update_cart_items_record();
214
}
215
- }
216
- else if (isset($_POST['delcart']))
217
- {
218
$products = $_SESSION['simpleCart'];
219
- foreach ($products as $key => $item)
220
- {
221
if ($item['name'] == stripslashes($_POST['product']))
222
- unset($products[$key]);
223
}
224
$_SESSION['simpleCart'] = $products;
225
-
226
- wpspsc_reapply_discount_coupon_if_needed();//Re-apply coupon to the cart if necessary
227
-
228
- if(isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id']))
229
- {
230
- wpspc_update_cart_items_record();
231
- }
232
- if(count($_SESSION['simpleCart']) < 1){
233
reset_wp_cart();
234
}
235
- }
236
- else if(isset($_POST['wpspsc_coupon_code']))
237
- {
238
$coupon_code = strip_tags($_POST['wpspsc_coupon_code']);
239
wpspsc_apply_cart_discount($coupon_code);
240
}
241
}
242
243
- function print_wp_shopping_cart()
244
- {
245
$output = "";
246
- if (!cart_not_empty())
247
- {
248
- $empty_cart_text = get_option('wp_cart_empty_text');
249
- if (!empty($empty_cart_text))
250
- {
251
- $output .= '<div class="wp_cart_empty_cart_section">';
252
- if (preg_match("/http/", $empty_cart_text))
253
- {
254
- $output .= '<img src="'.$empty_cart_text.'" alt="'.$empty_cart_text.'" class="wp_cart_empty_cart_image" />';
255
- }
256
- else
257
- {
258
- $output .= $empty_cart_text;
259
- }
260
- $output .= '</div>';
261
- }
262
- $cart_products_page_url = get_option('cart_products_page_url');
263
- if (!empty($cart_products_page_url))
264
- {
265
- $output .= '<div class="wp_cart_visit_shop_link"><a rel="nofollow" href="'.$cart_products_page_url.'">'.(__("Visit The Shop", "WSPSC")).'</a></div>';
266
- }
267
- return $output;
268
- }
269
$email = get_bloginfo('admin_email');
270
- $use_affiliate_platform = get_option('wp_use_aff_platform');
271
$defaultCurrency = get_option('cart_payment_currency');
272
$defaultSymbol = get_option('cart_currency_symbol');
273
$defaultEmail = get_option('cart_paypal_email');
@@ -282,319 +249,308 @@ function print_wp_shopping_cart()
282
283
if (!empty($defaultEmail))
284
$email = $defaultEmail;
285
-
286
- $decimal = '.';
287
- $urls = '';
288
-
289
$return = get_option('cart_return_from_paypal_url');
290
- if(empty($return)){
291
- $return = WP_CART_SITE_URL.'/';
292
}
293
$return_url = add_query_arg('reset_wp_cart', '1', $return);
294
295
- $urls .= '<input type="hidden" name="return" value="'.$return_url.'" />';
296
297
- $notify = WP_CART_SITE_URL.'/?simple_cart_ipn=1';
298
- $urls .= '<input type="hidden" name="notify_url" value="'.$notify.'" />';
299
300
$title = get_option('wp_cart_title');
301
//if (empty($title)) $title = __("Your Shopping Cart", "WSPSC");
302
-
303
global $plugin_dir_name;
304
- $output .= '<div class="shopping_cart" style=" padding: 5px;">';
305
- if (!get_option('wp_shopping_cart_image_hide'))
306
- {
307
- $output .= "<img src='".WP_CART_URL."/images/shopping_cart_icon.png' value='".(__("Cart", "WSPSC"))."' title='".(__("Cart", "WSPSC"))."' />";
308
}
309
- if(!empty($title))
310
- {
311
- $output .= '<h2>';
312
- $output .= $title;
313
- $output .= '</h2>';
314
- }
315
-
316
- $output .= '<br /><span id="pinfo" style="display: none; font-weight: bold; color: red;">'.(__("Hit enter to submit new Quantity.", "WSPSC")).'</span>';
317
- $output .= '<table style="width: 100%;">';
318
-
319
$count = 1;
320
$total_items = 0;
321
$total = 0;
322
$form = '';
323
- if ($_SESSION['simpleCart'] && is_array($_SESSION['simpleCart']))
324
- {
325
$output .= '
326
<tr>
327
- <th class="wspsc_cart_item_name_th">'.(__("Item Name", "WSPSC")).'</th><th class="wspsc_cart_qty_th">'.(__("Quantity", "WSPSC")).'</th><th class="wspsc_cart_price_th">'.(__("Price", "WSPSC")).'</th><th></th>
328
</tr>';
329
- $item_total_shipping = 0;
330
$postage_cost = 0;
331
- foreach ($_SESSION['simpleCart'] as $item)
332
- {
333
- $total += $item['price'] * $item['quantity'];
334
- $item_total_shipping += $item['shipping'] * $item['quantity'];
335
- $total_items += $item['quantity'];
336
- }
337
- if(!empty($item_total_shipping))
338
- {
339
- $baseShipping = get_option('cart_base_shipping_cost');
340
- $postage_cost = $item_total_shipping + $baseShipping;
341
- }
342
-
343
- $cart_free_shipping_threshold = get_option('cart_free_shipping_threshold');
344
- if (!empty($cart_free_shipping_threshold) && $total > $cart_free_shipping_threshold)
345
- {
346
- $postage_cost = 0;
347
- }
348
349
- foreach ($_SESSION['simpleCart'] as $item)
350
- {
351
- $output .= "
352
- <tr><td style='overflow: hidden;'><a href='".$item['cartLink']."'>".$item['name']."</a></td>
353
- <td style='text-align: center'><form method=\"post\" action=\"\" name='pcquantity' style='display: inline'>
354
- <input type=\"hidden\" name=\"product\" value=\"".htmlspecialchars($item['name'])."\" />
355
-
356
- <input type='hidden' name='cquantity' value='1' /><input type='text' name='quantity' value='".$item['quantity']."' size='1' onchange='document.pcquantity.submit();' onkeypress='document.getElementById(\"pinfo\").style.display = \"\";' /></form></td>
357
- <td style='text-align: center'>".print_payment_currency(($item['price'] * $item['quantity']), $paypal_symbol, $decimal)."</td>
358
- <td><form method=\"post\" action=\"\">
359
- <input type=\"hidden\" name=\"product\" value=\"".$item['name']."\" />
360
<input type='hidden' name='delcart' value='1' />
361
- <input type='image' src='".WP_CART_URL."/images/Shoppingcart_delete.png' value='".(__("Remove", "WSPSC"))."' title='".(__("Remove", "WSPSC"))."' /></form></td></tr>
362
";
363
-
364
- $form .= "
365
- <input type=\"hidden\" name=\"item_name_$count\" value=\"".$item['name']."\" />
366
- <input type=\"hidden\" name=\"amount_$count\" value='".wpspsc_number_format_price($item['price'])."' />
367
- <input type=\"hidden\" name=\"quantity_$count\" value=\"".$item['quantity']."\" />
368
- <input type='hidden' name='item_number_$count' value='".$item['item_number']."' />
369
- ";
370
- $count++;
371
- }
372
- if (!get_option('wp_shopping_cart_use_profile_shipping'))
373
- {
374
- $postage_cost = wpspsc_number_format_price($postage_cost);
375
- $form .= "<input type=\"hidden\" name=\"shipping_1\" value='".$postage_cost."' />"; //You can also use "handling_cart" variable to use shipping and handling here
376
- }
377
- if (get_option('wp_shopping_cart_collect_address'))//force address collection
378
- {
379
- $form .= "<input type=\"hidden\" name=\"no_shipping\" value=\"2\" />";
380
- }
381
- }
382
-
383
- $count--;
384
-
385
- if ($count)
386
- {
387
- if ($postage_cost != 0)
388
- {
389
- $output .= "
390
- <tr><td colspan='2' style='font-weight: bold; text-align: right;'>".(__("Subtotal", "WSPSC")).": </td><td style='text-align: center'>".print_payment_currency($total, $paypal_symbol, $decimal)."</td><td></td></tr>
391
- <tr><td colspan='2' style='font-weight: bold; text-align: right;'>".(__("Shipping", "WSPSC")).": </td><td style='text-align: center'>".print_payment_currency($postage_cost, $paypal_symbol, $decimal)."</td><td></td></tr>";
392
- }
393
394
- $output .= "<tr><td colspan='2' style='font-weight: bold; text-align: right;'>".(__("Total", "WSPSC")).": </td><td style='text-align: center'>".print_payment_currency(($total+$postage_cost), $paypal_symbol, $decimal)."</td><td></td></tr>";
395
396
- if(isset($_SESSION['wpspsc_cart_action_msg']) && !empty($_SESSION['wpspsc_cart_action_msg'])){
397
- $output .= '<tr><td colspan="4"><span class="wpspsc_cart_action_msg">'.$_SESSION['wpspsc_cart_action_msg'].'</span></td></tr>';
398
- }
399
-
400
- if (get_option('wpspsc_enable_coupon') == '1'){
401
- $output .= '<tr><td colspan="4">
402
<div class="wpspsc_coupon_section">
403
- <span class="wpspsc_coupon_label">'.(__("Enter Coupon Code", "WSPSC")).'</span>
404
<form method="post" action="" >
405
<input type="text" name="wpspsc_coupon_code" value="" size="10" />
406
- <span class="wpspsc_coupon_apply_button"><input type="submit" name="wpspsc_apply_coupon" class="wpspsc_apply_coupon" value="'.(__("Apply", "WSPSC")).'" /></span>
407
</form>
408
</div>
409
</td></tr>';
410
- }
411
-
412
- $paypal_checkout_url = WP_CART_LIVE_PAYPAL_URL;
413
- if (get_option('wp_shopping_cart_enable_sandbox')){
414
- $paypal_checkout_url = WP_CART_SANDBOX_PAYPAL_URL;
415
- }
416
-
417
- $form_target_code = '';
418
- if (get_option('wspsc_open_pp_checkout_in_new_tab')){
419
- $form_target_code = 'target="_blank"';
420
- }
421
-
422
- $output .= "<tr class='wpspsc_checkout_form'><td colspan='4'>";
423
- $output .= '<form action="'.$paypal_checkout_url.'" method="post" '.$form_target_code.'>';
424
- $output .= $form;
425
- if ($count)
426
- $output .= '<input type="image" src="'.WP_CART_URL.'/images/'.(__("paypal_checkout_EN.png", "WSPSC")).'" name="submit" class="wp_cart_checkout_button" alt="'.(__("Make payments with PayPal - it\'s fast, free and secure!", "WSPSC")).'" />';
427
-
428
- $output .= $urls.'
429
- <input type="hidden" name="business" value="'.$email.'" />
430
- <input type="hidden" name="currency_code" value="'.$paypal_currency.'" />
431
<input type="hidden" name="cmd" value="_cart" />
432
<input type="hidden" name="upload" value="1" />
433
<input type="hidden" name="rm" value="2" />
434
<input type="hidden" name="charset" value="utf-8" />
435
<input type="hidden" name="mrb" value="3FWGC6LFTMTUG" />';
436
- $wp_cart_note_to_seller_text = get_option('wp_cart_note_to_seller_text');
437
- if(!empty($wp_cart_note_to_seller_text)){
438
- $output .= '<input type="hidden" name="no_note" value="0" /><input type="hidden" name="cn" value="'.$wp_cart_note_to_seller_text.'" />';
439
- }
440
-
441
- $output .= wp_cart_add_custom_field();
442
- $output .= '</form>';
443
- $output .= '</td></tr>';
444
- }
445
- $output .= "</table></div>";
446
return $output;
447
}
448
449
- function wp_cart_add_custom_field()
450
- {
451
$_SESSION['wp_cart_custom_values'] = "";
452
$custom_field_val = "";
453
$name = 'wp_cart_id';
454
$value = $_SESSION['simple_cart_id'];
455
- $custom_field_val = wpc_append_values_to_custom_field($name,$value);
456
-
457
$clientip = $_SERVER['REMOTE_ADDR'];
458
- if (!empty($clientip)){
459
$name = 'ip';
460
$value = $clientip;
461
- $custom_field_val = wpc_append_values_to_custom_field($name,$value);
462
}
463
-
464
- if (function_exists('wp_aff_platform_install'))
465
- {
466
- $name = 'ap_id';
467
- $value = '';
468
- if(isset($_SESSION['ap_id'])){$value = $_SESSION['ap_id'];}
469
- else if (isset($_COOKIE['ap_id'])){$value = $_COOKIE['ap_id'];}
470
- if(!empty($value)){
471
- $custom_field_val = wpc_append_values_to_custom_field($name,$value);
472
- }
473
}
474
475
- if(isset($_SESSION['wpspsc_applied_coupon_code'])){
476
$name = "coupon_code";
477
$value = $_SESSION['wpspsc_applied_coupon_code'];
478
- $custom_field_val = wpc_append_values_to_custom_field($name,$value);
479
}
480
-
481
$custom_field_val = apply_filters('wpspc_cart_custom_field_value', $custom_field_val);
482
- $output = '<input type="hidden" name="custom" value="'.$custom_field_val.'" />';
483
return $output;
484
}
485
486
- function print_wp_cart_button_new($content)
487
- {
488
- $addcart = get_option('addToCartButtonName');
489
- if (!$addcart || ($addcart == '') )
490
- $addcart = __("Add to Cart", "WSPSC");
491
-
492
- $pattern = '#\[wp_cart:.+:price:.+:end]#';
493
- preg_match_all ($pattern, $content, $matches);
494
-
495
- foreach ($matches[0] as $match)
496
- {
497
- $var_output = '';
498
- $pos = strpos($match,":var1");
499
- if ($pos)
500
- {
501
- $match_tmp = $match;
502
- // Variation control is used
503
- $pos2 = strpos($match,":var2");
504
- if ($pos2)
505
- {
506
- //echo '<br />'.$match_tmp.'<br />';
507
- $pattern = '#var2\[.*]:#';
508
- preg_match_all ($pattern, $match_tmp, $matches3);
509
- $match3 = $matches3[0][0];
510
- //echo '<br />'.$match3.'<br />';
511
- $match_tmp = str_replace ($match3, '', $match_tmp);
512
-
513
- $pattern = 'var2[';
514
- $m3 = str_replace ($pattern, '', $match3);
515
- $pattern = ']:';
516
- $m3 = str_replace ($pattern, '', $m3);
517
- $pieces3 = explode('|',$m3);
518
-
519
- $variation2_name = $pieces3[0];
520
- $var_output .= $variation2_name." : ";
521
- $var_output .= '<select name="variation2" onchange="ReadForm (this.form, false);">';
522
- for ($i=1;$i<sizeof($pieces3); $i++)
523
- {
524
- $var_output .= '<option value="'.$pieces3[$i].'">'.$pieces3[$i].'</option>';
525
- }
526
- $var_output .= '</select><br />';
527
- }
528
-
529
- $pattern = '#var1\[.*]:#';
530
- preg_match_all ($pattern, $match_tmp, $matches2);
531
- $match2 = $matches2[0][0];
532
-
533
- $match_tmp = str_replace ($match2, '', $match_tmp);
534
-
535
- $pattern = 'var1[';
536
- $m2 = str_replace ($pattern, '', $match2);
537
- $pattern = ']:';
538
- $m2 = str_replace ($pattern, '', $m2);
539
- $pieces2 = explode('|',$m2);
540
-
541
- $variation_name = $pieces2[0];
542
- $var_output .= $variation_name." : ";
543
- $var_output .= '<select name="variation1" onchange="ReadForm (this.form, false);">';
544
- for ($i=1;$i<sizeof($pieces2); $i++)
545
- {
546
- $var_output .= '<option value="'.$pieces2[$i].'">'.$pieces2[$i].'</option>';
547
- }
548
- $var_output .= '</select><br />';
549
-
550
- }
551
-
552
- $pattern = '[wp_cart:';
553
- $m = str_replace ($pattern, '', $match);
554
-
555
- $pattern = 'price:';
556
- $m = str_replace ($pattern, '', $m);
557
- $pattern = 'shipping:';
558
- $m = str_replace ($pattern, '', $m);
559
- $pattern = ':end]';
560
- $m = str_replace ($pattern, '', $m);
561
-
562
- $pieces = explode(':',$m);
563
-
564
- $replacement = '<div class="wp_cart_button_wrapper">';
565
- $replacement .= '<form method="post" class="wp-cart-button-form" action="" style="display:inline" onsubmit="return ReadForm(this, true);">';
566
- if (!empty($var_output))
567
- {
568
- $replacement .= $var_output;
569
- }
570
-
571
- if (preg_match("/http/", $addcart)) // Use the image as the 'add to cart' button
572
- {
573
- $replacement .= '<input type="image" src="'.$addcart.'" class="wp_cart_button" alt="'.(__("Add to Cart", "WSPSC")).'"/>';
574
- }
575
- else
576
- {
577
- $replacement .= '<input type="submit" value="'.$addcart.'" />';
578
- }
579
-
580
- $replacement .= '<input type="hidden" name="product" value="'.$pieces['0'].'" /><input type="hidden" name="price" value="'.$pieces['1'].'" />';
581
- $replacement .= '<input type="hidden" name="product_tmp" value="'.$pieces['0'].'" />';
582
- if (sizeof($pieces) >2 )
583
- {
584
- //we have shipping
585
- $replacement .= '<input type="hidden" name="shipping" value="'.$pieces['2'].'" />';
586
}
587
- $replacement .= '<input type="hidden" name="cartLink" value="'.cart_current_page_url().'" />';
588
- $replacement .= '<input type="hidden" name="addcart" value="1" /></form>';
589
- $replacement .= '</div>';
590
- $content = str_replace ($match, $replacement, $content);
591
}
592
- return $content;
593
}
594
595
- function wp_cart_add_read_form_javascript()
596
- {
597
- echo '
598
<script type="text/javascript">
599
<!--
600
//
@@ -623,211 +579,221 @@ function wp_cart_add_read_form_javascript()
623
obj1.product.value = val_total;
624
}
625
//-->
626
- </script>';
627
}
628
- function print_wp_cart_button_for_product($name, $price, $shipping=0, $var1='', $var2='', $var3='', $atts=array())
629
{
630
- $addcart = get_option('addToCartButtonName');
631
- if (!$addcart || ($addcart == '') )
632
- $addcart = __("Add to Cart", "WSPSC");
633
-
634
- $var_output = "";
635
- if(!empty($var1))
636
- {
637
- $var1_pieces = explode('|',$var1);
638
- $variation1_name = $var1_pieces[0];
639
- $var_output .= '<span class="wp_cart_variation_name">'.$variation1_name.' : </span>';
640
- $var_output .= '<select name="variation1" onchange="ReadForm (this.form, false);">';
641
- for ($i=1;$i<sizeof($var1_pieces); $i++)
642
- {
643
- $var_output .= '<option value="'.$var1_pieces[$i].'">'.$var1_pieces[$i].'</option>';
644
- }
645
- $var_output .= '</select><br />';
646
- }
647
- if(!empty($var2))
648
- {
649
- $var2_pieces = explode('|',$var2);
650
- $variation2_name = $var2_pieces[0];
651
- $var_output .= '<span class="wp_cart_variation_name">'.$variation2_name.' : </span>';
652
- $var_output .= '<select name="variation2" onchange="ReadForm (this.form, false);">';
653
- for ($i=1;$i<sizeof($var2_pieces); $i++)
654
- {
655
- $var_output .= '<option value="'.$var2_pieces[$i].'">'.$var2_pieces[$i].'</option>';
656
- }
657
- $var_output .= '</select><br />';
658
- }
659
- if(!empty($var3))
660
- {
661
- $var3_pieces = explode('|',$var3);
662
- $variation3_name = $var3_pieces[0];
663
- $var_output .= '<span class="wp_cart_variation_name">'.$variation3_name.' : </span>';
664
- $var_output .= '<select name="variation3" onchange="ReadForm (this.form, false);">';
665
- for ($i=1;$i<sizeof($var3_pieces); $i++)
666
- {
667
- $var_output .= '<option value="'.$var3_pieces[$i].'">'.$var3_pieces[$i].'</option>';
668
- }
669
- $var_output .= '</select><br />';
670
- }
671
-
672
- $replacement = '<div class="wp_cart_button_wrapper">';
673
- $replacement .= '<form method="post" class="wp-cart-button-form" action="" style="display:inline" onsubmit="return ReadForm(this, true);">';
674
- if (!empty($var_output)){//Show variation
675
- $replacement .= '<div class="wp_cart_variation_section">'.$var_output.'</div>';
676
- }
677
-
678
- if(isset($atts['button_image']) && !empty($atts['button_image'])){
679
- //Use the custom button image for this shortcode
680
- $replacement .= '<input type="image" src="'.$atts['button_image'].'" class="wp_cart_button" alt="'.(__("Add to Cart", "WSPSC")).'"/>';
681
- }
682
- else
683
- {
684
- //Use the button text or image value from the settings
685
- if (preg_match("/http:/", $addcart) || preg_match("/https:/", $addcart)){ // Use the image as the 'add to cart' button
686
- $replacement .= '<input type="image" src="'.$addcart.'" class="wp_cart_button" alt="'.(__("Add to Cart", "WSPSC")).'"/>';
687
- }
688
- else{
689
- $replacement .= '<input type="submit" value="'.$addcart.'" />';
690
- }
691
}
692
-
693
- $replacement .= '<input type="hidden" name="product" value="'.$name.'" /><input type="hidden" name="price" value="'.$price.'" /><input type="hidden" name="shipping" value="'.$shipping.'" /><input type="hidden" name="addcart" value="1" /><input type="hidden" name="cartLink" value="'.cart_current_page_url().'" />';
694
- $replacement .= '<input type="hidden" name="product_tmp" value="'.$name.'" />';
695
- isset($atts['item_number'])?$item_num = $atts['item_number']: $item_num = '';
696
- $replacement .= '<input type="hidden" name="item_number" value="'.$item_num.'" />';
697
-
698
- if(isset($atts['file_url'])){
699
- $file_url = $atts['file_url'];
700
- $file_url = base64_encode($file_url);
701
- $replacement .= '<input type="hidden" name="file_url" value="'.$file_url.'" />';
702
}
703
- $page_style_name = get_option('wp_cart_paypal_co_page_style');
704
- if(!empty($page_style_name)){
705
- $replacement .= '<input type="hidden" name="page_style" value="'.$page_style_name.'" />';
706
}
707
- $replacement .= '</form>';
708
- $replacement .= '</div>';
709
- return $replacement;
710
}
711
712
- function cart_not_empty()
713
- {
714
- $count = 0;
715
- if (isset($_SESSION['simpleCart']) && is_array($_SESSION['simpleCart']))
716
- {
717
- foreach ($_SESSION['simpleCart'] as $item)
718
- $count++;
719
- return $count;
720
- }
721
- else
722
- return 0;
723
}
724
725
- function print_payment_currency($price, $symbol, $decimal='.')
726
- {
727
- return $symbol.number_format($price, 2, $decimal, ',');
728
}
729
730
function cart_current_page_url() {
731
- $pageURL = 'http';
732
- if(!isset($_SERVER["HTTPS"])){$_SERVER["HTTPS"]="";}
733
- if(!isset($_SERVER["SERVER_PORT"])){$_SERVER["SERVER_PORT"]="";}
734
-
735
- if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
736
- $pageURL .= "://";
737
- if ($_SERVER["SERVER_PORT"] != "80") {
738
- $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
739
- }
740
- else {
741
- $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
742
- }
743
- return $pageURL;
744
}
745
746
- function simple_cart_total()
747
- {
748
- $grand_total = 0;
749
- foreach ((array) $_SESSION['simpleCart'] as $item)
750
- {
751
- $total += $item['price'] * $item['quantity'];
752
- $item_total_shipping += $item['shipping'] * $item['quantity'];
753
- }
754
- $grand_total = $total + $item_total_shipping;
755
- return wpspsc_number_format_price($grand_total);
756
}
757
758
// Handle the options page display
759
- function wp_cart_options_page ()
760
- {
761
include_once('wp_shopping_cart_settings.php');
762
add_options_page(__("WP Paypal Shopping Cart", "WSPSC"), __("WP Shopping Cart", "WSPSC"), 'manage_options', 'wordpress-paypal-shopping-cart', 'wp_cart_options');
763
}
764
765
- function wp_paypal_shopping_cart_load_widgets()
766
- {
767
- register_widget('WP_PayPal_Cart_Widget');
768
}
769
770
class WP_PayPal_Cart_Widget extends WP_Widget {
771
- function WP_PayPal_Cart_Widget() {
772
- parent::WP_Widget('wp_paypal_shopping_cart_widgets', 'WP Paypal Shopping Cart', array('description' => 'WP Paypal Shopping Cart Widget') );
773
- }
774
- function form($instance) {
775
- // outputs the options form on admin
776
- }
777
- function update($new_instance, $old_instance) {
778
- // processes widget options to be saved
779
- }
780
- function widget($args, $instance) {
781
- // outputs the content of the widget
782
- extract( $args );
783
-
784
- $cart_title = get_option('wp_cart_title');
785
- if (empty($cart_title)) $cart_title = __("Shopping Cart", "WSPSC");
786
-
787
- echo $before_widget;
788
- echo $before_title . $cart_title . $after_title;
789
- echo print_wp_shopping_cart();
790
- echo $after_widget;
791
- }
792
}
793
794
- function wp_cart_css()
795
- {
796
- $debug_marker = "<!-- WP Simple Shopping Cart plugin v" . WP_CART_VERSION . " - http://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768/ -->";
797
- echo "\n${debug_marker}\n";
798
- echo '<link type="text/css" rel="stylesheet" href="'.WP_CART_URL.'/wp_shopping_cart_style.css" />'."\n";
799
}
800
801
- function wpspc_plugin_install()
802
- {
803
wpspc_run_activation();
804
}
805
- register_activation_hook(__FILE__,'wpspc_plugin_install');
806
807
// Add the settings link
808
- function wp_simple_cart_add_settings_link($links, $file)
809
- {
810
- if ($file == plugin_basename(__FILE__)){
811
- $settings_link = '<a href="options-general.php?page=wordpress-paypal-shopping-cart">'.(__("Settings", "WSPSC")).'</a>';
812
- array_unshift($links, $settings_link);
813
- }
814
- return $links;
815
}
816
- add_filter('plugin_action_links', 'wp_simple_cart_add_settings_link', 10, 2 );
817
818
// Insert the options page to the admin menu
819
- add_action('admin_menu','wp_cart_options_page');
820
- add_action('widgets_init','wp_paypal_shopping_cart_load_widgets');
821
822
- add_action('init','wp_cart_init_handler');
823
- add_action( 'admin_init', 'wp_cart_admin_init_handler' );
824
825
//add_filter('the_content', 'print_wp_cart_button',11);
826
- add_filter('the_content', 'print_wp_cart_button_new',11);
827
add_filter('the_content', 'shopping_cart_show');
828
829
- if (!is_admin())
830
- {add_filter('widget_text', 'do_shortcode');}
831
832
add_shortcode('show_wp_shopping_cart', 'show_wp_shopping_cart_handler');
833
add_shortcode('always_show_wp_shopping_cart', 'always_show_cart_handler');
@@ -837,3 +803,4 @@ add_shortcode('wp_compact_cart', 'wspsc_compact_cart_handler');
837
838
add_action('wp_head', 'wp_cart_css');
839
add_action('wp_head', 'wp_cart_add_read_form_javascript');
1
<?php
2
+
3
/*
4
+ Plugin Name: WP Simple Paypal Shopping cart
5
+ Version: v4.0.1
6
+ Plugin URI: https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768
7
+ Author: Tips and Tricks HQ, Ruhul Amin
8
+ Author URI: https://www.tipsandtricks-hq.com/
9
+ Description: Simple WordPress Shopping Cart Plugin, very easy to use and great for selling products and services from your blog!
10
+ */
11
+
12
+ if (!defined('ABSPATH'))exit; //Exit if accessed directly
13
+
14
+ if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
15
+ if (session_status() == PHP_SESSION_NONE) {
16
+ session_start();
17
+ }
18
+ } else {
19
+ if (session_id() == '') {
20
+ session_start();
21
+ }
22
+ }
23
+
24
+ define('WP_CART_VERSION', '4.0.1');
25
define('WP_CART_FOLDER', dirname(plugin_basename(__FILE__)));
26
+ define('WP_CART_PATH', plugin_dir_path(__FILE__));
27
+ define('WP_CART_URL', plugins_url('', __FILE__));
28
+ define('WP_CART_SITE_URL', site_url());
29
define('WP_CART_LIVE_PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr');
30
define('WP_CART_SANDBOX_PAYPAL_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
31
38
include_once('wp_shopping_cart_orders.php');
39
include_once('class-coupon.php');
40
41
+ function always_show_cart_handler($atts) {
42
+ return print_wp_shopping_cart($atts);
43
}
44
45
+ function show_wp_shopping_cart_handler($atts) {
46
$output = "";
47
+ if (cart_not_empty()) {
48
+ $output = print_wp_shopping_cart($atts);
49
}
50
+ return $output;
51
}
52
53
+ function shopping_cart_show($content) {
54
+ if (strpos($content, "<!--show-wp-shopping-cart-->") !== FALSE) {
55
+ if (cart_not_empty()) {
56
+ $content = preg_replace('/<p>\s*<!--(.*)-->\s*<\/p>/i', "<!--$1-->", $content);
57
+ $matchingText = '<!--show-wp-shopping-cart-->';
58
+ $replacementText = print_wp_shopping_cart();
59
+ $content = str_replace($matchingText, $replacementText, $content);
60
+ }
61
}
62
return $content;
63
}
64
65
// Reset cart option
66
+ if (isset($_REQUEST["reset_wp_cart"]) && !empty($_REQUEST["reset_wp_cart"])) {
67
reset_wp_cart();
68
}
69
70
//Clear the cart if the customer landed on the thank you page
71
+ if (get_option('wp_shopping_cart_reset_after_redirection_to_return_page')) {
72
//TODO - remove this field altogether later. Cart will always be reset using query prameter on the thank you page.
73
+ if (get_option('cart_return_from_paypal_url') == cart_current_page_url()) {
74
reset_wp_cart();
75
}
76
}
77
78
+ function reset_wp_cart() {
79
$products = $_SESSION['simpleCart'];
80
+ if (!is_array($products)) {
81
return;
82
}
83
+ foreach ($products as $key => $item) {
84
unset($products[$key]);
85
}
86
$_SESSION['simpleCart'] = $products;
90
unset($_SESSION['wpspsc_applied_coupon_code']);
91
}
92
93
+ function wpspc_cart_actions_handler() {
94
unset($_SESSION['wpspsc_cart_action_msg']);
95
+ if (isset($_POST['addcart'])) {
96
+ setcookie("cart_in_use", "true", time() + 21600, "/", COOKIE_DOMAIN); //useful to not serve cached page when using with a caching plugin
97
+ if (function_exists('wp_cache_serve_cache_file')) {//WP Super cache workaround
98
+ setcookie("comment_author_", "wp_cart", time() + 21600, "/", COOKIE_DOMAIN);
99
}
100
101
//sanitize data
102
+ $_POST['product'] = strip_tags($_POST['product']); //for PHP5.2 use filter_var($_POST['product'], FILTER_SANITIZE_STRING);
103
$_POST['item_number'] = strip_tags($_POST['item_number']);
104
+ if (isset($_POST['price']))
105
+ $_POST['price'] = strip_tags($_POST['price']);
106
+ isset($_POST['shipping']) ? $_POST['shipping'] = strip_tags($_POST['shipping']) : $_POST['shipping'] = '';
107
+ isset($_POST['cartLink']) ? $_POST['cartLink'] = strip_tags($_POST['cartLink']) : $_POST['cartLink'] = '';
108
+
109
+ $count = 1;
110
+ $products = $_SESSION['simpleCart'];
111
+ if (is_array($products)) {
112
+ foreach ($products as $key => $item) {
113
+ if ($item['name'] == stripslashes($_POST['product'])) {
114
$count += $item['quantity'];
115
$item['quantity']++;
116
unset($products[$key]);
117
array_push($products, $item);
118
}
119
}
120
+ } else {
121
$products = array();
122
}
123
124
+ if ($count == 1) {
125
+ if (!empty($_POST[$_POST['product']])) {
126
$price = $_POST[$_POST['product']];
127
+ } else {
128
$price = $_POST['price'];
129
}
130
131
$default_cur_symbol = get_option('cart_currency_symbol');
132
+ $price = str_replace($default_cur_symbol, "", $price);
133
134
$shipping = $_POST['shipping'];
135
+ $shipping = str_replace($default_cur_symbol, "", $shipping);
136
137
+ $product = array('name' => stripslashes($_POST['product']), 'price' => $price, 'price_orig' => $price, 'quantity' => $count, 'shipping' => $shipping, 'cartLink' => $_POST['cartLink'], 'item_number' => $_POST['item_number']);
138
+ if (isset($_POST['file_url']) && !empty($_POST['file_url'])) {
139
$file_url = strip_tags($_POST['file_url']);
140
+ $product['file_url'] = $file_url;
141
+ }
142
+ if (isset($_POST['thumbnail']) && !empty($_POST['thumbnail'])) {
143
+ $thumbnail = strip_tags($_POST['thumbnail']);
144
+ $product['thumbnail'] = $thumbnail;
145
}
146
array_push($products, $product);
147
}
149
sort($products);
150
$_SESSION['simpleCart'] = $products;
151
152
+ wpspsc_reapply_discount_coupon_if_needed(); //Re-apply coupon to the cart if necessary
153
+
154
+ if (!isset($_SESSION['simple_cart_id']) && empty($_SESSION['simple_cart_id'])) {
155
wpspc_insert_new_record();
156
+ } else {
157
//cart updating
158
+ if (isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id'])) {
159
wpspc_update_cart_items_record();
160
+ } else {
161
+ echo "<p>" . (__("Error! Your session is out of sync. Please reset your session.", "WSPSC")) . "</p>";
162
}
163
}
164
165
166
+ if (get_option('wp_shopping_cart_auto_redirect_to_checkout_page')) {
167
$checkout_url = get_option('cart_checkout_page_url');
168
+ if (empty($checkout_url)) {
169
+ echo "<br /><strong>" . (__("Shopping Cart Configuration Error! You must specify a value in the 'Checkout Page URL' field for the automatic redirection feature to work!", "WSPSC")) . "</strong><br />";
170
+ } else {
171
+ $redirection_parameter = 'Location: ' . $checkout_url;
172
+ header($redirection_parameter);
173
+ exit;
174
}
175
+ }
176
+ } else if (isset($_POST['cquantity'])) {
177
$products = $_SESSION['simpleCart'];
178
+ foreach ($products as $key => $item) {
179
+ if ((stripslashes($item['name']) == stripslashes($_POST['product'])) && $_POST['quantity']) {
180
$item['quantity'] = $_POST['quantity'];
181
unset($products[$key]);
182
array_push($products, $item);
183
+ } else if (($item['name'] == stripslashes($_POST['product'])) && !$_POST['quantity']) {
184
unset($products[$key]);
185
}
186
}
187
sort($products);
188
$_SESSION['simpleCart'] = $products;
189
+
190
+ wpspsc_reapply_discount_coupon_if_needed(); //Re-apply coupon to the cart if necessary
191
+
192
+ if (isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id'])) {
193
wpspc_update_cart_items_record();
194
}
195
+ } else if (isset($_POST['delcart'])) {
196
$products = $_SESSION['simpleCart'];
197
+ foreach ($products as $key => $item) {
198
if ($item['name'] == stripslashes($_POST['product']))
199
+ unset($products[$key]);
200
}
201
$_SESSION['simpleCart'] = $products;
202
+
203
+ wpspsc_reapply_discount_coupon_if_needed(); //Re-apply coupon to the cart if necessary
204
+
205
+ if (isset($_SESSION['simple_cart_id']) && !empty($_SESSION['simple_cart_id'])) {
206
+ wpspc_update_cart_items_record();
207
+ }
208
+ if (count($_SESSION['simpleCart']) < 1) {
209
reset_wp_cart();
210
}
211
+ } else if (isset($_POST['wpspsc_coupon_code'])) {
212
$coupon_code = strip_tags($_POST['wpspsc_coupon_code']);
213
wpspsc_apply_cart_discount($coupon_code);
214
}
215
}
216
217
+ function print_wp_shopping_cart($args = array()) {
218
$output = "";
219
+ if (!cart_not_empty()) {
220
+ $empty_cart_text = get_option('wp_cart_empty_text');
221
+ if (!empty($empty_cart_text)) {
222
+ $output .= '<div class="wp_cart_empty_cart_section">';
223
+ if (preg_match("/http/", $empty_cart_text)) {
224
+ $output .= '<img src="' . $empty_cart_text . '" alt="' . $empty_cart_text . '" class="wp_cart_empty_cart_image" />';
225
+ } else {
226
+ $output .= $empty_cart_text;
227
+ }
228
+ $output .= '</div>';
229
+ }
230
+ $cart_products_page_url = get_option('cart_products_page_url');
231
+ if (!empty($cart_products_page_url)) {
232
+ $output .= '<div class="wp_cart_visit_shop_link"><a rel="nofollow" href="' . $cart_products_page_url . '">' . (__("Visit The Shop", "WSPSC")) . '</a></div>';
233
+ }
234
+ return $output;
235
+ }
236
$email = get_bloginfo('admin_email');
237
+ $use_affiliate_platform = get_option('wp_use_aff_platform');
238
$defaultCurrency = get_option('cart_payment_currency');
239
$defaultSymbol = get_option('cart_currency_symbol');
240
$defaultEmail = get_option('cart_paypal_email');
249
250
if (!empty($defaultEmail))
251
$email = $defaultEmail;
252
+
253
+ $decimal = '.';
254
+ $urls = '';
255
+
256
$return = get_option('cart_return_from_paypal_url');
257
+ if (empty($return)) {
258
+ $return = WP_CART_SITE_URL . '/';
259
}
260
$return_url = add_query_arg('reset_wp_cart', '1', $return);
261
262
+ $urls .= '<input type="hidden" name="return" value="' . $return_url . '" />';
263
264
+ $notify = WP_CART_SITE_URL . '/?simple_cart_ipn=1';
265
+ $urls .= '<input type="hidden" name="notify_url" value="' . $notify . '" />';
266
267
$title = get_option('wp_cart_title');
268
//if (empty($title)) $title = __("Your Shopping Cart", "WSPSC");
269
+
270
global $plugin_dir_name;
271
+ $output .= '<div class="shopping_cart">';
272
+ if (!get_option('wp_shopping_cart_image_hide')) {
273
+ $output .= "<img src='" . WP_CART_URL . "/images/shopping_cart_icon.png' value='" . (__("Cart", "WSPSC")) . "' title='" . (__("Cart", "WSPSC")) . "' />";
274
}
275
+ if (!empty($title)) {
276
+ $output .= '<h2>';
277
+ $output .= $title;
278
+ $output .= '</h2>';
279
+ }
280
+
281
+ $output .= '<br /><span id="pinfo" style="display: none; font-weight: bold; color: red;">' . (__("Hit enter to submit new Quantity.", "WSPSC")) . '</span>';
282
+ $output .= '<table style="width: 100%;">';
283
+
284
$count = 1;
285
$total_items = 0;
286
$total = 0;
287
$form = '';
288
+ if ($_SESSION['simpleCart'] && is_array($_SESSION['simpleCart'])) {
289
$output .= '
290
<tr>
291
+ <th class="wspsc_cart_item_name_th">' . (__("Item Name", "WSPSC")) . '</th><th class="wspsc_cart_qty_th">' . (__("Quantity", "WSPSC")) . '</th><th class="wspsc_cart_price_th">' . (__("Price", "WSPSC")) . '</th><th></th>
292
</tr>';
293
+ $item_total_shipping = 0;
294
+ $postage_cost = 0;
295
+ foreach ($_SESSION['simpleCart'] as $item) {
296
+ $total += $item['price'] * $item['quantity'];
297
+ $item_total_shipping += $item['shipping'] * $item['quantity'];
298
+ $total_items += $item['quantity'];
299
+ }
300
+ if (!empty($item_total_shipping)) {
301
+ $baseShipping = get_option('cart_base_shipping_cost');
302
+ $postage_cost = $item_total_shipping + $baseShipping;
303
+ }
304
+
305
+ $cart_free_shipping_threshold = get_option('cart_free_shipping_threshold');
306
+ if (!empty($cart_free_shipping_threshold) && $total > $cart_free_shipping_threshold) {
307
$postage_cost = 0;
308
+ }
309
310
+ foreach ($_SESSION['simpleCart'] as $item) {
311
+
312
+ $output .= "<tr><td style='overflow: hidden;'>";
313
+ $output .= '<div class="wp_cart_item_info">';
314
+ if(isset($args['show_thumbnail'])){
315
+ $output .= '<span class="wp_cart_item_thumbnail"><img src="'.$item['thumbnail'].'" class="wp_cart_thumb_image" ></span>';
316
+ }
317
+ $item_info = apply_filters('wspsc_cart_item_name', '<a href="'.$item['cartLink'].'">'.$item['name'].'</a>', $item);
318
+ $output .= '<span class="wp_cart_item_name">'.$item_info.'</span>';
319
+ $output .= '<span class="wp_cart_clear_float"></span>';
320
+ $output .= '</div>';
321
+ $output .= '</td>';
322
+
323
+ $output .= "<td style='text-align: center'><form method=\"post\" action=\"\" name='pcquantity' style='display: inline'>
324
+ <input type=\"hidden\" name=\"product\" value=\"" . htmlspecialchars($item['name']) . "\" />
325
+ <input type='hidden' name='cquantity' value='1' /><input type='text' name='quantity' value='" . $item['quantity'] . "' size='1' onchange='document.pcquantity.submit();' onkeypress='document.getElementById(\"pinfo\").style.display = \"\";' /></form></td>
326
+ <td style='text-align: center'>" . print_payment_currency(($item['price'] * $item['quantity']), $paypal_symbol, $decimal) . "</td>
327
+ <td><form method=\"post\" action=\"\" class=\"wp_cart_remove_item_form\">
328
+ <input type=\"hidden\" name=\"product\" value=\"" . $item['name'] . "\" />
329
<input type='hidden' name='delcart' value='1' />
330
+ <input type='image' src='" . WP_CART_URL . "/images/Shoppingcart_delete.png' value='" . (__("Remove", "WSPSC")) . "' title='" . (__("Remove", "WSPSC")) . "' /></form></td></tr>
331
";
332
333
+ $form .= "
334
+ <input type=\"hidden\" name=\"item_name_$count\" value=\"" . $item['name'] . "\" />
335
+ <input type=\"hidden\" name=\"amount_$count\" value='" . wpspsc_number_format_price($item['price']) . "' />
336
+ <input type=\"hidden\" name=\"quantity_$count\" value=\"" . $item['quantity'] . "\" />
337
+ <input type='hidden' name='item_number_$count' value='" . $item['item_number'] . "' />
338
+ ";
339
+ $count++;
340
+ }
341
+ if (!get_option('wp_shopping_cart_use_profile_shipping')) {
342
+ $postage_cost = wpspsc_number_format_price($postage_cost);
343
+ $form .= "<input type=\"hidden\" name=\"shipping_1\" value='" . $postage_cost . "' />"; //You can also use "handling_cart" variable to use shipping and handling here
344
+ }
345
+ if (get_option('wp_shopping_cart_collect_address')) {//force address collection
346
+ $form .= "<input type=\"hidden\" name=\"no_shipping\" value=\"2\" />";
347
+ }
348
+ }
349
+
350
+ $count--;
351
+
352
+ if ($count) {
353
+ if ($postage_cost != 0) {
354
+ $output .= "
355
+ <tr><td colspan='2' style='font-weight: bold; text-align: right;'>" . (__("Subtotal", "WSPSC")) . ": </td><td style='text-align: center'>" . print_payment_currency($total, $paypal_symbol, $decimal) . "</td><td></td></tr>
356
+ <tr><td colspan='2' style='font-weight: bold; text-align: right;'>" . (__("Shipping", "WSPSC")) . ": </td><td style='text-align: center'>" . print_payment_currency($postage_cost, $paypal_symbol, $decimal) . "</td><td></td></tr>";
357
+ }
358
+
359
+ $output .= "<tr><td colspan='2' style='font-weight: bold; text-align: right;'>" . (__("Total", "WSPSC")) . ": </td><td style='text-align: center'>" . print_payment_currency(($total + $postage_cost), $paypal_symbol, $decimal) . "</td><td></td></tr>";
360
+
361
+ if (isset($_SESSION['wpspsc_cart_action_msg']) && !empty($_SESSION['wpspsc_cart_action_msg'])) {
362
+ $output .= '<tr><td colspan="4"><span class="wpspsc_cart_action_msg">' . $_SESSION['wpspsc_cart_action_msg'] . '</span></td></tr>';
363
+ }
364
365
+ if (get_option('wpspsc_enable_coupon') == '1') {
366
+ $output .= '<tr><td colspan="4">
367
<div class="wpspsc_coupon_section">
368
+ <span class="wpspsc_coupon_label">' . (__("Enter Coupon Code", "WSPSC")) . '</span>
369
<form method="post" action="" >
370
<input type="text" name="wpspsc_coupon_code" value="" size="10" />
371
+ <span class="wpspsc_coupon_apply_button"><input type="submit" name="wpspsc_apply_coupon" class="wpspsc_apply_coupon" value="' . (__("Apply", "WSPSC")) . '" /></span>
372
</form>
373
</div>
374
</td></tr>';
375
+ }
376
+
377
+ $paypal_checkout_url = WP_CART_LIVE_PAYPAL_URL;
378
+ if (get_option('wp_shopping_cart_enable_sandbox')) {
379
+ $paypal_checkout_url = WP_CART_SANDBOX_PAYPAL_URL;
380
+ }
381
+
382
+ $form_target_code = '';
383
+ if (get_option('wspsc_open_pp_checkout_in_new_tab')) {
384
+ $form_target_code = 'target="_blank"';
385
+ }
386
+
387
+ $output .= "<tr class='wpspsc_checkout_form'><td colspan='4'>";
388
+ $output .= '<form action="' . $paypal_checkout_url . '" method="post" ' . $form_target_code . '>';
389
+ $output .= $form;
390
+ if ($count)
391
+ $output .= '<input type="image" src="' . WP_CART_URL . '/images/' . (__("paypal_checkout_EN.png", "WSPSC")) . '" name="submit" class="wp_cart_checkout_button" alt="' . (__("Make payments with PayPal - it\'s fast, free and secure!", "WSPSC")) . '" />';
392
+
393
+ $output .= $urls . '
394
+ <input type="hidden" name="business" value="' . $email . '" />
395
+ <input type="hidden" name="currency_code" value="' . $paypal_currency . '" />
396
<input type="hidden" name="cmd" value="_cart" />
397
<input type="hidden" name="upload" value="1" />
398
<input type="hidden" name="rm" value="2" />
399
<input type="hidden" name="charset" value="utf-8" />
400
<input type="hidden" name="mrb" value="3FWGC6LFTMTUG" />';
401
+ $wp_cart_note_to_seller_text = get_option('wp_cart_note_to_seller_text');
402
+ if (!empty($wp_cart_note_to_seller_text)) {
403
+ $output .= '<input type="hidden" name="no_note" value="0" /><input type="hidden" name="cn" value="' . $wp_cart_note_to_seller_text . '" />';
404
+ }
405
+ $page_style_name = get_option('wp_cart_paypal_co_page_style');
406
+ if (!empty($page_style_name)) {
407
+ $output .= '<input type="hidden" name="page_style" value="' . $page_style_name . '" />';
408
+ }
409
+ $output .= wp_cart_add_custom_field();
410
+ $output .= '</form>';
411
+ $output .= '</td></tr>';
412
+ }
413
+ $output .= "</table></div>";
414
return $output;
415
}
416
417
+ function wp_cart_add_custom_field() {
418
$_SESSION['wp_cart_custom_values'] = "";
419
$custom_field_val = "";
420
$name = 'wp_cart_id';
421
$value = $_SESSION['simple_cart_id'];
422
+ $custom_field_val = wpc_append_values_to_custom_field($name, $value);
423
+
424
$clientip = $_SERVER['REMOTE_ADDR'];
425
+ if (!empty($clientip)) {
426
$name = 'ip';
427
$value = $clientip;
428
+ $custom_field_val = wpc_append_values_to_custom_field($name, $value);
429
}
430
+
431
+ if (function_exists('wp_aff_platform_install')) {
432
+ $name = 'ap_id';
433
+ $value = '';
434
+ if (isset($_SESSION['ap_id'])) {
435
+ $value = $_SESSION['ap_id'];
436
+ } else if (isset($_COOKIE['ap_id'])) {
437
+ $value = $_COOKIE['ap_id'];
438
+ }
439
+ if (!empty($value)) {
440
+ $custom_field_val = wpc_append_values_to_custom_field($name, $value);
441
+ }
442
}
443
444
+ if (isset($_SESSION['wpspsc_applied_coupon_code'])) {
445
$name = "coupon_code";
446
$value = $_SESSION['wpspsc_applied_coupon_code'];
447
+ $custom_field_val = wpc_append_values_to_custom_field($name, $value);
448
}
449
+
450
$custom_field_val = apply_filters('wpspc_cart_custom_field_value', $custom_field_val);
451
+ $output = '<input type="hidden" name="custom" value="' . $custom_field_val . '" />';
452
return $output;
453
}
454
455
+ function print_wp_cart_button_new($content) {
456
+ $addcart = get_option('addToCartButtonName');
457
+ if (!$addcart || ($addcart == ''))
458
+ $addcart = __("Add to Cart", "WSPSC");
459
+
460
+ $pattern = '#\[wp_cart:.+:price:.+:end]#';
461
+ preg_match_all($pattern, $content, $matches);
462
+
463
+ foreach ($matches[0] as $match) {
464
+ $var_output = '';
465
+ $pos = strpos($match, ":var1");
466
+ if ($pos) {
467
+ $match_tmp = $match;
468
+ // Variation control is used
469
+ $pos2 = strpos($match, ":var2");
470
+ if ($pos2) {
471
+ //echo '<br />'.$match_tmp.'<br />';
472
+ $pattern = '#var2\[.*]:#';
473
+ preg_match_all($pattern, $match_tmp, $matches3);
474
+ $match3 = $matches3[0][0];
475
+ //echo '<br />'.$match3.'<br />';
476
+ $match_tmp = str_replace($match3, '', $match_tmp);
477
+
478
+ $pattern = 'var2[';
479
+ $m3 = str_replace($pattern, '', $match3);
480
+ $pattern = ']:';
481
+ $m3 = str_replace($pattern, '', $m3);
482
+ $pieces3 = explode('|', $m3);
483
+
484
+ $variation2_name = $pieces3[0];
485
+ $var_output .= $variation2_name . " : ";
486
+ $var_output .= '<select name="variation2" onchange="ReadForm (this.form, false);">';
487
+ for ($i = 1; $i < sizeof($pieces3); $i++) {
488
+ $var_output .= '<option value="' . $pieces3[$i] . '">' . $pieces3[$i] . '</option>';
489
}
490
+ $var_output .= '</select><br />';
491
+ }
492
+
493
+ $pattern = '#var1\[.*]:#';
494
+ preg_match_all($pattern, $match_tmp, $matches2);
495
+ $match2 = $matches2[0][0];
496
+
497
+ $match_tmp = str_replace($match2, '', $match_tmp);
498
+
499
+ $pattern = 'var1[';
500
+ $m2 = str_replace($pattern, '', $match2);
501
+ $pattern = ']:';
502
+ $m2 = str_replace($pattern, '', $m2);
503
+ $pieces2 = explode('|', $m2);
504
+
505
+ $variation_name = $pieces2[0];
506
+ $var_output .= $variation_name . " : ";
507
+ $var_output .= '<select name="variation1" onchange="ReadForm (this.form, false);">';
508
+ for ($i = 1; $i < sizeof($pieces2); $i++) {
509
+ $var_output .= '<option value="' . $pieces2[$i] . '">' . $pieces2[$i] . '</option>';
510
+ }
511
+ $var_output .= '</select><br />';
512
+ }
513
+
514
+ $pattern = '[wp_cart:';
515
+ $m = str_replace($pattern, '', $match);
516
+
517
+ $pattern = 'price:';
518
+ $m = str_replace($pattern, '', $m);
519
+ $pattern = 'shipping:';
520
+ $m = str_replace($pattern, '', $m);
521
+ $pattern = ':end]';
522
+ $m = str_replace($pattern, '', $m);
523
+
524
+ $pieces = explode(':', $m);
525
+
526
+ $replacement = '<div class="wp_cart_button_wrapper">';
527
+ $replacement .= '<form method="post" class="wp-cart-button-form" action="" style="display:inline" onsubmit="return ReadForm(this, true);">';
528
+ if (!empty($var_output)) {
529
+ $replacement .= $var_output;
530
}
531
+
532
+ if (preg_match("/http/", $addcart)) { // Use the image as the 'add to cart' button
533
+ $replacement .= '<input type="image" src="' . $addcart . '" class="wp_cart_button" alt="' . (__("Add to Cart", "WSPSC")) . '"/>';
534
+ } else {
535
+ $replacement .= '<input type="submit" value="' . $addcart . '" />';
536
+ }
537
+
538
+ $replacement .= '<input type="hidden" name="product" value="' . $pieces['0'] . '" /><input type="hidden" name="price" value="' . $pieces['1'] . '" />';
539
+ $replacement .= '<input type="hidden" name="product_tmp" value="' . $pieces['0'] . '" />';
540
+ if (sizeof($pieces) > 2) {
541
+ //we have shipping
542
+ $replacement .= '<input type="hidden" name="shipping" value="' . $pieces['2'] . '" />';
543
+ }
544
+ $replacement .= '<input type="hidden" name="cartLink" value="' . cart_current_page_url() . '" />';
545
+ $replacement .= '<input type="hidden" name="addcart" value="1" /></form>';
546
+ $replacement .= '</div>';
547
+ $content = str_replace($match, $replacement, $content);
548
+ }
549
+ return $content;
550
}
551
552
+ function wp_cart_add_read_form_javascript() {
553
+ echo '
554
<script type="text/javascript">
555
<!--
556
//
579
obj1.product.value = val_total;
580
}
581
//-->
582
+ </script>';
583
}
584
+
585
+ function wpspsc_admin_side_enqueue_scripts()
586
{
587
+ if ($_GET['page'] == 'wordpress-paypal-shopping-cart') //simple paypal shopping cart discount page
588
+ {
589
+ wp_enqueue_style('jquery-ui-style', '//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css');
590
+ wp_register_script('wpspsc-admin', WP_CART_URL.'/lib/wpspsc_admin_side.js', array('jquery', 'jquery-ui-datepicker'));
591
+ wp_enqueue_script('wpspsc-admin');
592
+ }
593
+ }
594
+
595
+ function print_wp_cart_button_for_product($name, $price, $shipping = 0, $var1 = '', $var2 = '', $var3 = '', $atts = array()) {
596
+ $addcart = get_option('addToCartButtonName');
597
+ if (!$addcart || ($addcart == ''))
598
+ $addcart = __("Add to Cart", "WSPSC");
599
+
600
+ $var_output = "";
601
+ if (!empty($var1)) {
602
+ $var1_pieces = explode('|', $var1);
603
+ $variation1_name = $var1_pieces[0];
604
+ $var_output .= '<span class="wp_cart_variation_name">' . $variation1_name . ' : </span>';
605
+ $var_output .= '<select name="variation1" onchange="ReadForm (this.form, false);">';
606
+ for ($i = 1; $i < sizeof($var1_pieces); $i++) {
607
+ $var_output .= '<option value="' . $var1_pieces[$i] . '">' . $var1_pieces[$i] . '</option>';
608
}
609
+ $var_output .= '</select><br />';
610
+ }
611
+ if (!empty($var2)) {
612
+ $var2_pieces = explode('|', $var2);
613
+ $variation2_name = $var2_pieces[0];
614
+ $var_output .= '<span class="wp_cart_variation_name">' . $variation2_name . ' : </span>';
615
+ $var_output .= '<select name="variation2" onchange="ReadForm (this.form, false);">';
616
+ for ($i = 1; $i < sizeof($var2_pieces); $i++) {
617
+ $var_output .= '<option value="' . $var2_pieces[$i] . '">' . $var2_pieces[$i] . '</option>';
618
}
619
+ $var_output .= '</select><br />';
620
+ }
621
+ if (!empty($var3)) {
622
+ $var3_pieces = explode('|', $var3);
623
+ $variation3_name = $var3_pieces[0];
624
+ $var_output .= '<span class="wp_cart_variation_name">' . $variation3_name . ' : </span>';
625
+ $var_output .= '<select name="variation3" onchange="ReadForm (this.form, false);">';
626
+ for ($i = 1; $i < sizeof($var3_pieces); $i++) {
627
+ $var_output .= '<option value="' . $var3_pieces[$i] . '">' . $var3_pieces[$i] . '</option>';
628
}
629
+ $var_output .= '</select><br />';
630
+ }
631
+
632
+ $replacement = '<div class="wp_cart_button_wrapper">';
633
+ $replacement .= '<form method="post" class="wp-cart-button-form" action="" style="display:inline" onsubmit="return ReadForm(this, true);">';
634
+ if (!empty($var_output)) {//Show variation
635
+ $replacement .= '<div class="wp_cart_variation_section">' . $var_output . '</div>';
636
+ }
637
+
638
+ if (isset($atts['button_image']) && !empty($atts['button_image'])) {
639
+ //Use the custom button image for this shortcode
640
+ $replacement .= '<input type="image" src="' . $atts['button_image'] . '" class="wp_cart_button" alt="' . (__("Add to Cart", "WSPSC")) . '"/>';
641
+ } else {
642 <