Version Description
- New: Payment Gateway UI is revamped.
- New: Sales Log UI is revamped.
- New: wpsc_single_purchase_log_date_time_format and wpsc_single_purchase_log_date_format (Used in new Sales Log UI).
- New: Added 'wpsc_usps_domestic_rate' and 'wpsc_usps_intl_rate' filters.
- New: 'wpsc_country_get_property' filter.
- New: WPSC_Country::get_data() method and 'wpsc_country_get_data' filter.
- New: Added generic 'wpsc_save_' . $this->current_tab_id . '_settings' action.
- New: 'wpsc_shipping_module_settings_form' filter on admin shipping module form output.
- New: Choose either AND or OR for coupon conditions logic.
- Change: Reduced internal usage of get_option( 'siteurl' ) in favor of home_url().
- Change: Updated Colorbox.js to v.1.4.15.
- Change: Eliminated internal usage of 'index.php' as an AJAX callback URL. Nginx users, rejoice.
- Change: Eliminated internal usage of eval() in javascript.
- Change: wpsc_get_country() uses WPSC_Country now.
- Change: .on() is now used in place of .livequery(), .bind(), .live() and .delegate().
- Change: Minor cleanup of Marketing settings tab UI.
- Change: wpsc_the_product_image() optimized to utilize the product thumbnail earlier in the function.
- Change: wpsc_the_variation_price() output is now filtered through wpsc_do_convert_price filter.
- Change: Submitted_Form_Data table now has a value field with a LONGTEXT data type, rather than varchar(255).
- Change: Continued internal cleanup of coding standards and documentation.
- Fix: Properly substitute placeholder in "Out of stock" email to administrator.
- Fix: Fixed PHP notices when accessing Dashboard as subscriber.
- Fix: Coupon logic improvements (edge case of using 'not_contains" logic with item_quantity).
- Fix: Automated fix when possible, and nag when not, for 3.8.10 regression in User Management templates.
- Fix: Error notices on category functions.
- Fix: fetch_feed() error on GetShopped news.
- Fix: Variation terms were not being applied to the parent product.
- Fix: If you emptied variation sale price, the stock levels would not work any more.
- Fix: A notice was thrown if you had UPS selected but had not saved settings for it.
- Fix: USPS Shipping Module now correctly respects testing environement settings.
- Fix: Correcting casting price value to float instead of integer in coupon logic conditions for sub_total.
- Fix: 'wpsc_transaction_result_content' now returns the $cart_item as an array instead of an object (which was a regression).
Download this release
Release Info
Developer | JustinSainton |
Plugin | WP eCommerce |
Version | 3.8.11 |
Comparing to | |
See all releases |
Code changes from version 3.8.10 to 3.8.11
- readme.md +4 -4
- readme.txt +55 -31
- wp-shopping-cart.php +2 -2
- wpsc-admin/admin-form-functions.php +2 -2
- wpsc-admin/admin.php +42 -10
- wpsc-admin/ajax-and-init.php +1 -1
- wpsc-admin/ajax.php +2 -2
- wpsc-admin/css/admin.css +17 -51
- wpsc-admin/css/settingspage.css +24 -5
- wpsc-admin/db-upgrades/routines/4.php +42 -0
- wpsc-admin/display-coupon-add.php +2 -1
- wpsc-admin/display-coupon-edit.php +11 -2
- wpsc-admin/display-coupons.php +1 -1
- wpsc-admin/display-items.page.php +30 -15
- wpsc-admin/display-sales-logs.php +411 -368
- wpsc-admin/display-upgrades.page.php +2 -2
- wpsc-admin/includes/display-items-functions.php +2 -3
- wpsc-admin/includes/product-functions.php +1 -1
- wpsc-admin/includes/product-variation-list-table.class.php +3 -2
- wpsc-admin/includes/product-variations-page.class.php +4 -1
- wpsc-admin/includes/purchase-logs-page/item-details.php +45 -35
- wpsc-admin/includes/save-data.functions.php +6 -6
- wpsc-admin/includes/settings-tabs/gateway.php +89 -57
- wpsc-admin/includes/settings-tabs/marketing.php +145 -76
- wpsc-admin/includes/settings-tabs/shipping.php +2 -2
- wpsc-admin/init.php +2 -2
- wpsc-admin/js/admin.js +81 -436
- wpsc-admin/js/product-variations.js +14 -13
- wpsc-admin/js/purchase-logs.js +10 -10
- wpsc-admin/js/settings-page.js +126 -111
- wpsc-admin/js/sortable-table.js +2 -2
- wpsc-admin/settings-page.php +7 -4
- wpsc-components/merchant-core-v2/helpers/admin.php +6 -6
- wpsc-components/merchant-core-v2/helpers/gateways.php +51 -8
- wpsc-core/js/jquery.colorbox-min.js +6 -22
- wpsc-core/js/wp-e-commerce.js +215 -112
- wpsc-core/wpsc-constants.php +4 -4
- wpsc-includes/ajax.functions.php +127 -230
- wpsc-includes/category.functions.php +1 -1
- wpsc-includes/checkout-form-data.class.php +3 -3
- wpsc-includes/checkout.class.php +1 -1
- wpsc-includes/country.class.php +16 -1
- wpsc-includes/coupons.class.php +26 -4
- wpsc-includes/display.functions.php +0 -1
- wpsc-includes/form-display.functions.php +0 -1
- wpsc-includes/merchant.class.php +1 -1
- wpsc-includes/meta.functions.php +56 -50
- wpsc-includes/misc.functions.php +39 -4
- wpsc-includes/processing.functions.php +2 -2
- wpsc-includes/product-template.php +60 -73
- wpsc-includes/productfeed.php +2 -2
- wpsc-includes/purchase-log-notification.class.php +2 -2
- wpsc-includes/purchase-log.helpers.php +1 -1
- wpsc-includes/purchaselogs.class.php +15 -7
- wpsc-includes/rss_template.php +2 -2
- wpsc-includes/shipping.helper.php +8 -4
- wpsc-includes/shopping_cart_functions.php +1 -1
- wpsc-includes/theme.functions.php +6 -8
- wpsc-languages/EN_en.php +1 -1
- wpsc-merchants/GoogleCheckout-XML.php +141 -134
- wpsc-merchants/chronopay.php +67 -77
- wpsc-merchants/paypal-express.merchant.php +321 -316
- wpsc-merchants/paypal-pro.merchant.php +27 -23
- wpsc-merchants/paypal-standard.merchant.php +279 -311
- wpsc-merchants/testmode.merchant.php +13 -9
- wpsc-shipping/australiapost.php +1 -1
- wpsc-shipping/ups_20.php +5 -7
- wpsc-shipping/usps_20.php +6 -6
- wpsc-taxes/controllers/taxes_controller.class.php +2 -2
- wpsc-theme/functions/wpsc-user_log_functions.php +5 -8
- wpsc-theme/wpsc-shopping_cart_page.php +1 -1
- wpsc-updates/database_template.php +2 -2
- wpsc-widgets/donations_widget.php +1 -3
- wpsc-widgets/latest_product_widget.php +0 -1
- wpsc-widgets/price_range_widget.php +0 -1
- wpsc-widgets/specials_widget.php +0 -2
readme.md
CHANGED
@@ -15,10 +15,10 @@ If you're looking for general user support, please submit your support request o
|
|
15 |
Development status
|
16 |
-------------------------
|
17 |
|
18 |
-
* The latest stable version is [3.8.
|
19 |
-
* Active development version: 3.8.
|
20 |
-
* [Roadmap for 3.8.
|
21 |
-
* [3.8.
|
22 |
|
23 |
How to contribute code
|
24 |
-----------------------------
|
15 |
Development status
|
16 |
-------------------------
|
17 |
|
18 |
+
* The latest stable version is [3.8.11](http://wordpress.org/extend/plugins/wp-e-commerce).
|
19 |
+
* Active development version: 3.8.12-dev (branch [master](https://github.com/wp-e-commerce/WP-e-Commerce))
|
20 |
+
* [Roadmap for 3.8.12](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Roadmap)
|
21 |
+
* [3.8.12 tickets](https://github.com/wp-e-commerce/wp-e-commerce/issues?labels=&milestone=10&page=1&sort=updated&state=open)
|
22 |
|
23 |
How to contribute code
|
24 |
-----------------------------
|
readme.txt
CHANGED
@@ -3,14 +3,14 @@ Contributors: mufasa, garyc40, JustinSainton, mychelle
|
|
3 |
Donate link: http://getshopped.org
|
4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
5 |
Requires at least: 3.4
|
6 |
-
Tested up to: 3.6
|
7 |
-
Stable tag: 3.8.
|
8 |
|
9 |
WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
We make setting up an ecommerce shop easy, and with over 2.
|
14 |
|
15 |
Features:
|
16 |
|
@@ -20,24 +20,24 @@ Features:
|
|
20 |
* Plays well with other Plugins
|
21 |
* Supports regular WordPress widgets, as well as a few snazzy ones of our own
|
22 |
* Utilizes shortcodes and template tags (just like WordPress)
|
23 |
-
* Works out-of-the-box with WordPress
|
24 |
|
25 |
= 100% Customizable =
|
26 |
-
*
|
27 |
* Easy to modify templates
|
28 |
|
29 |
-
=
|
30 |
* Lots of video tutorials
|
31 |
-
*
|
32 |
* Access to instant support from our community of users
|
33 |
|
34 |
= Payment Gateways Integration =
|
35 |
-
* Manual Payment (checks/money orders)
|
36 |
-
* PayPal Payments Standard
|
37 |
-
* PayPal Payments Pro
|
38 |
-
* PayPal Express Checkout
|
39 |
-
* Google
|
40 |
-
* Chronopay
|
41 |
* PayPal Payflow Pro (available with Gold Cart)
|
42 |
* Authorize.net (available with Gold Cart)
|
43 |
* FirstData/LinkPoint (available with Gold Cart)
|
@@ -47,7 +47,7 @@ Features:
|
|
47 |
* DPS (available with Gold Cart)
|
48 |
* Paystation (available with Gold Cart)
|
49 |
* SagePay (available with Gold Cart)
|
50 |
-
*
|
51 |
|
52 |
= Marketing =
|
53 |
* Flexible coupon/discount pricing rules
|
@@ -57,24 +57,20 @@ Features:
|
|
57 |
* Multi-tier pricing for quantity discounts.
|
58 |
* Search Engine Friendly URLs
|
59 |
* New Products widget
|
60 |
-
* Cross-sells on product pages
|
61 |
-
* Google
|
62 |
* Uses the popular “Share This” button for easily promoting your products on popular social networking sites
|
63 |
-
* Integrates with Facebook Marketplace (Facebook Marketplace API has closed – we’re working on it)
|
64 |
* Integrates with Google Base
|
65 |
-
* Integrates with Campaign Monitor for advanced email marketing
|
66 |
-
* Integrates with Intense Debate for shared comments
|
67 |
-
* Mail Chimp integration coming soon
|
68 |
|
69 |
= Search Engine Optimization =
|
70 |
* 100% Search Engine Friendly
|
71 |
* Meta-information for products and categories
|
72 |
* RSS feeds for products and categories
|
73 |
* Integrates with Google (XML site maps and Google Merchant Centre)
|
74 |
-
* Integrates with the All in One SEO plugin for WordPress
|
75 |
|
76 |
= Internationalization Support =
|
77 |
-
*
|
78 |
* Support for multiple currencies
|
79 |
* Ability to target specific countries
|
80 |
|
@@ -87,7 +83,6 @@ Features:
|
|
87 |
* Weight rate shipping
|
88 |
|
89 |
= Checkout =
|
90 |
-
* One-Page Checkout or Stepped Checkout, whichever you prefer
|
91 |
* SSL security support for orders on both front-end and back-end
|
92 |
* Checkout without account/Guest Checkout
|
93 |
* Shopping Cart with tax and shipping estimates
|
@@ -104,30 +99,25 @@ Features:
|
|
104 |
= Catalog Management =
|
105 |
* Single-page product data entry
|
106 |
* Ability to duplicate products
|
107 |
-
* Quickly edit your products from the store front
|
108 |
-
*
|
109 |
* Batch import/export of catalog
|
110 |
-
* Google Base integration
|
111 |
* Product variation management
|
112 |
-
* Create attributes on the fly
|
113 |
* Downloadable/Digital Products
|
114 |
* Support for donations
|
115 |
* Customer Personalized Products
|
116 |
* Media Manager with automatic image resizing
|
117 |
-
* Handles multiple product images with easy drag-and-drop sorting
|
118 |
-
* support for Special Prices
|
119 |
* Tax rates per location
|
120 |
* Basic inventory control
|
121 |
|
122 |
= Catalog Browsing =
|
123 |
-
* Live product search – mmm just like apple.com (available add on)
|
124 |
* Cross-sells
|
125 |
* Product listing in list format
|
126 |
* Product listing in grid format (available with Gold Cart)
|
127 |
* Breadcrumbs
|
128 |
* Product Image Zoom-in Capability
|
129 |
* Stock Availability
|
130 |
-
* Multiple Images Per Product (
|
131 |
* Product comments
|
132 |
* Filter by Product Tags
|
133 |
* New Products widget
|
@@ -155,6 +145,40 @@ Before updating please make a backup of your existing files and database. Just i
|
|
155 |
After upgrading from earlier versions look for link "Update Store". This will update your database structure to work with new version.
|
156 |
|
157 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
= 3.8.10 =
|
159 |
* New: Coupon UI is revamped.
|
160 |
* New: [Shipwire] Addition of Shipping Services, Economy, Plus & Premium.
|
3 |
Donate link: http://getshopped.org
|
4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
5 |
Requires at least: 3.4
|
6 |
+
Tested up to: 3.6
|
7 |
+
Stable tag: 3.8.11
|
8 |
|
9 |
WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
We make setting up an ecommerce shop easy, and with over 2.4 Million downloads, we have unparalleled experience.
|
14 |
|
15 |
Features:
|
16 |
|
20 |
* Plays well with other Plugins
|
21 |
* Supports regular WordPress widgets, as well as a few snazzy ones of our own
|
22 |
* Utilizes shortcodes and template tags (just like WordPress)
|
23 |
+
* Works out-of-the-box with WordPress Multisite (make sure you use sub-domains with your Multisite setup)
|
24 |
|
25 |
= 100% Customizable =
|
26 |
+
* Use your own HTML & CSS and have complete control over the look and feel of your store
|
27 |
* Easy to modify templates
|
28 |
|
29 |
+
= Support =
|
30 |
* Lots of video tutorials
|
31 |
+
* Speedy response (through our premium forums)
|
32 |
* Access to instant support from our community of users
|
33 |
|
34 |
= Payment Gateways Integration =
|
35 |
+
* Manual Payment (checks/money orders)
|
36 |
+
* PayPal Payments Standard
|
37 |
+
* PayPal Payments Pro
|
38 |
+
* PayPal Express Checkout
|
39 |
+
* Google Wallet (Level 2)
|
40 |
+
* Chronopay
|
41 |
* PayPal Payflow Pro (available with Gold Cart)
|
42 |
* Authorize.net (available with Gold Cart)
|
43 |
* FirstData/LinkPoint (available with Gold Cart)
|
47 |
* DPS (available with Gold Cart)
|
48 |
* Paystation (available with Gold Cart)
|
49 |
* SagePay (available with Gold Cart)
|
50 |
+
* Need a different gateway? We have documentation available for developing your own custom payment gateway
|
51 |
|
52 |
= Marketing =
|
53 |
* Flexible coupon/discount pricing rules
|
57 |
* Multi-tier pricing for quantity discounts.
|
58 |
* Search Engine Friendly URLs
|
59 |
* New Products widget
|
60 |
+
* Cross-sells on product pages
|
61 |
+
* Google Sitemap and Google Analytics
|
62 |
* Uses the popular “Share This” button for easily promoting your products on popular social networking sites
|
|
|
63 |
* Integrates with Google Base
|
|
|
|
|
|
|
64 |
|
65 |
= Search Engine Optimization =
|
66 |
* 100% Search Engine Friendly
|
67 |
* Meta-information for products and categories
|
68 |
* RSS feeds for products and categories
|
69 |
* Integrates with Google (XML site maps and Google Merchant Centre)
|
70 |
+
* Integrates with the All in One SEO plugin for WordPress
|
71 |
|
72 |
= Internationalization Support =
|
73 |
+
* Basic support for popular multi-lingual plugins (qTranslate and WPML)
|
74 |
* Support for multiple currencies
|
75 |
* Ability to target specific countries
|
76 |
|
83 |
* Weight rate shipping
|
84 |
|
85 |
= Checkout =
|
|
|
86 |
* SSL security support for orders on both front-end and back-end
|
87 |
* Checkout without account/Guest Checkout
|
88 |
* Shopping Cart with tax and shipping estimates
|
99 |
= Catalog Management =
|
100 |
* Single-page product data entry
|
101 |
* Ability to duplicate products
|
102 |
+
* Quickly edit your products from the store front
|
103 |
+
* Organize your products with hierarchical categories
|
104 |
* Batch import/export of catalog
|
|
|
105 |
* Product variation management
|
|
|
106 |
* Downloadable/Digital Products
|
107 |
* Support for donations
|
108 |
* Customer Personalized Products
|
109 |
* Media Manager with automatic image resizing
|
|
|
|
|
110 |
* Tax rates per location
|
111 |
* Basic inventory control
|
112 |
|
113 |
= Catalog Browsing =
|
|
|
114 |
* Cross-sells
|
115 |
* Product listing in list format
|
116 |
* Product listing in grid format (available with Gold Cart)
|
117 |
* Breadcrumbs
|
118 |
* Product Image Zoom-in Capability
|
119 |
* Stock Availability
|
120 |
+
* Multiple Images Per Product (available with Gold Cart)
|
121 |
* Product comments
|
122 |
* Filter by Product Tags
|
123 |
* New Products widget
|
145 |
After upgrading from earlier versions look for link "Update Store". This will update your database structure to work with new version.
|
146 |
|
147 |
== Changelog ==
|
148 |
+
= 3.8.11 =
|
149 |
+
* New: Payment Gateway UI is revamped.
|
150 |
+
* New: Sales Log UI is revamped.
|
151 |
+
* New: wpsc_single_purchase_log_date_time_format and wpsc_single_purchase_log_date_format (Used in new Sales Log UI).
|
152 |
+
* New: Added 'wpsc_usps_domestic_rate' and 'wpsc_usps_intl_rate' filters.
|
153 |
+
* New: 'wpsc_country_get_property' filter.
|
154 |
+
* New: WPSC_Country::get_data() method and 'wpsc_country_get_data' filter.
|
155 |
+
* New: Added generic 'wpsc_save_' . $this->current_tab_id . '_settings' action.
|
156 |
+
* New: 'wpsc_shipping_module_settings_form' filter on admin shipping module form output.
|
157 |
+
* New: Choose either AND or OR for coupon conditions logic.
|
158 |
+
* Change: Reduced internal usage of get_option( 'siteurl' ) in favor of home_url().
|
159 |
+
* Change: Updated Colorbox.js to v.1.4.15.
|
160 |
+
* Change: Eliminated internal usage of 'index.php' as an AJAX callback URL. Nginx users, rejoice.
|
161 |
+
* Change: Eliminated internal usage of eval() in javascript.
|
162 |
+
* Change: wpsc_get_country() uses WPSC_Country now.
|
163 |
+
* Change: .on() is now used in place of .livequery(), .bind(), .live() and .delegate().
|
164 |
+
* Change: Minor cleanup of Marketing settings tab UI.
|
165 |
+
* Change: wpsc_the_product_image() optimized to utilize the product thumbnail earlier in the function.
|
166 |
+
* Change: wpsc_the_variation_price() output is now filtered through wpsc_do_convert_price filter.
|
167 |
+
* Change: Submitted_Form_Data table now has a value field with a LONGTEXT data type, rather than varchar(255).
|
168 |
+
* Change: Continued internal cleanup of coding standards and documentation.
|
169 |
+
* Fix: Properly substitute placeholder in "Out of stock" email to administrator.
|
170 |
+
* Fix: Fixed PHP notices when accessing Dashboard as subscriber.
|
171 |
+
* Fix: Coupon logic improvements (edge case of using 'not_contains" logic with item_quantity).
|
172 |
+
* Fix: Automated fix when possible, and nag when not, for 3.8.10 regression in User Management templates.
|
173 |
+
* Fix: Error notices on category functions.
|
174 |
+
* Fix: fetch_feed() error on GetShopped news.
|
175 |
+
* Fix: Variation terms were not being applied to the parent product.
|
176 |
+
* Fix: If you emptied variation sale price, the stock levels would not work any more.
|
177 |
+
* Fix: A notice was thrown if you had UPS selected but had not saved settings for it.
|
178 |
+
* Fix: USPS Shipping Module now correctly respects testing environement settings.
|
179 |
+
* Fix: Correcting casting price value to float instead of integer in coupon logic conditions for sub_total.
|
180 |
+
* Fix: 'wpsc_transaction_result_content' now returns the $cart_item as an array instead of an object (which was a regression).
|
181 |
+
|
182 |
= 3.8.10 =
|
183 |
* New: Coupon UI is revamped.
|
184 |
* New: [Shipwire] Addition of Shipping Services, Economy, Plus & Premium.
|
wp-shopping-cart.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WP e-Commerce
|
4 |
* Plugin URI: http://getshopped.org/
|
5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
6 |
-
* Version: 3.8.
|
7 |
* Author: Instinct Entertainment
|
8 |
* Author URI: http://getshopped.org/
|
9 |
**/
|
@@ -257,4 +257,4 @@ $wpec = new WP_eCommerce();
|
|
257 |
|
258 |
// Activation
|
259 |
register_activation_hook( __FILE__, array( $wpec, 'install' ) );
|
260 |
-
register_deactivation_hook( __FILE__, array( $wpec, 'deactivate' ) );
|
3 |
* Plugin Name: WP e-Commerce
|
4 |
* Plugin URI: http://getshopped.org/
|
5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
6 |
+
* Version: 3.8.11
|
7 |
* Author: Instinct Entertainment
|
8 |
* Author URI: http://getshopped.org/
|
9 |
**/
|
257 |
|
258 |
// Activation
|
259 |
register_activation_hook( __FILE__, array( $wpec, 'install' ) );
|
260 |
+
register_deactivation_hook( __FILE__, array( $wpec, 'deactivate' ) );
|
wpsc-admin/admin-form-functions.php
CHANGED
@@ -170,7 +170,7 @@ return $output;
|
|
170 |
function setting_button(){
|
171 |
$next_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=wpsc-edit-products";
|
172 |
|
173 |
-
// $output.="<div><img src='".
|
174 |
$output.="<div style='float: right; margin-top: 0px; position: relative;'> | <a href='#' onclick='display_settings_button(); return false;' style='text-decoration: underline;'>".esc_html__('Settings', 'wpsc')." »</a>";
|
175 |
$output.="<span id='settings_button' style='width:180px;background-color:#f1f1f1;position:absolute; right: 10px; border:1px solid black; display:none;'>";
|
176 |
$output.="<ul class='settings_button'>";
|
@@ -332,7 +332,7 @@ function wpsc_packing_slip( $purchase_id ) {
|
|
332 |
|
333 |
if ( 2 == get_option( 'payment_method' ) ) {
|
334 |
$gateway_name = '';
|
335 |
-
$nzshpcrt_gateways
|
336 |
|
337 |
foreach( $nzshpcrt_gateways as $gateway ) {
|
338 |
if ( $purch_data['gateway'] != 'testmode' ) {
|
170 |
function setting_button(){
|
171 |
$next_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=wpsc-edit-products";
|
172 |
|
173 |
+
// $output.="<div><img src='" . plugins_url( WPSC_DIR_NAME . '/images/settings_button.jpg' ) . "' onclick='display_settings_button()'>";
|
174 |
$output.="<div style='float: right; margin-top: 0px; position: relative;'> | <a href='#' onclick='display_settings_button(); return false;' style='text-decoration: underline;'>".esc_html__('Settings', 'wpsc')." »</a>";
|
175 |
$output.="<span id='settings_button' style='width:180px;background-color:#f1f1f1;position:absolute; right: 10px; border:1px solid black; display:none;'>";
|
176 |
$output.="<ul class='settings_button'>";
|
332 |
|
333 |
if ( 2 == get_option( 'payment_method' ) ) {
|
334 |
$gateway_name = '';
|
335 |
+
global $nzshpcrt_gateways;
|
336 |
|
337 |
foreach( $nzshpcrt_gateways as $gateway ) {
|
338 |
if ( $purch_data['gateway'] != 'testmode' ) {
|
wpsc-admin/admin.php
CHANGED
@@ -560,7 +560,10 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
|
|
560 |
'variation_parent_swap' => esc_html_x( 'New Variation Set', 'Variation taxonomy parent', 'wpsc' ),
|
561 |
/* translators : This string is prepended to the 'New Variation Set' string */
|
562 |
'variation_helper_text' => esc_html_x( 'Choose the Variation Set you want to add variants to. If you\'re creating a new variation set then select', 'Variation helper text', 'wpsc' ),
|
563 |
-
'variations_tutorial' => esc_html__( 'Variations allow you to create options for your products. For example, if you\'re selling T-Shirts, they will generally have a "Size" option. Size will be the Variation Set name, and it will be a "New Variant Set". You will then create variants (small, medium, large) which will have the "Variation Set" of Size. Once you have made your set you can use the table on the right to manage them (edit, delete). You will be able to order your variants by dragging and dropping them within their Variation Set.', 'wpsc' )
|
|
|
|
|
|
|
564 |
) );
|
565 |
}
|
566 |
if ( $pagehook == 'wpsc-product-variations-iframe' ) {
|
@@ -601,7 +604,6 @@ function wpsc_admin_dynamic_js() {
|
|
601 |
header( 'Cache-Control: public, must-revalidate, max-age=86400' );
|
602 |
header( 'Pragma: public' );
|
603 |
|
604 |
-
$siteurl = get_option( 'siteurl' );
|
605 |
$hidden_boxes = get_option( 'wpsc_hidden_box' );
|
606 |
|
607 |
$form_types1 = get_option( 'wpsc_checkout_form_fields' );
|
@@ -618,7 +620,7 @@ function wpsc_admin_dynamic_js() {
|
|
618 |
}
|
619 |
|
620 |
$hidden_boxes = implode( ',', (array)$hidden_boxes );
|
621 |
-
echo "var base_url = '" . esc_js(
|
622 |
echo "var WPSC_URL = '" . esc_js( WPSC_URL ) . "';\n\r";
|
623 |
echo "var WPSC_IMAGE_URL = '" . esc_js( WPSC_IMAGE_URL ) . "';\n\r";
|
624 |
echo "var WPSC_DIR_NAME = '" . esc_js( WPSC_DIR_NAME ) . "';\n\r";
|
@@ -814,7 +816,7 @@ function wpsc_dashboard_widget_setup() {
|
|
814 |
|
815 |
// Add the dashboard widgets
|
816 |
if ( current_user_can( $news_cap ) )
|
817 |
-
wp_add_dashboard_widget( 'wpsc_dashboard_news', __( '
|
818 |
if ( current_user_can( $sales_cap ) )
|
819 |
wp_add_dashboard_widget( 'wpsc_dashboard_widget', __( 'Sales Summary', 'wpsc' ), 'wpsc_dashboard_widget' );
|
820 |
if ( current_user_can( $quarterly_sales_cap ) )
|
@@ -824,7 +826,10 @@ function wpsc_dashboard_widget_setup() {
|
|
824 |
|
825 |
// Sort the Dashboard widgets so ours it at the top
|
826 |
global $wp_meta_boxes;
|
827 |
-
$
|
|
|
|
|
|
|
828 |
|
829 |
// Backup and delete our new dashbaord widget from the end of the array
|
830 |
$wpsc_widget_backup = array();
|
@@ -866,8 +871,8 @@ add_action( 'wp_dashboard_setup', 'wpsc_dashboard_widget_setup' );
|
|
866 |
* @uses wp_widget_rss_output() Display the RSS entries in a list
|
867 |
*/
|
868 |
function wpsc_dashboard_news() {
|
869 |
-
$rss = fetch_feed( 'http://getshopped.org/
|
870 |
-
$args = array( 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1, 'items'=>3 );
|
871 |
wp_widget_rss_output( $rss, $args );
|
872 |
|
873 |
}
|
@@ -1347,7 +1352,7 @@ function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
|
|
1347 |
$post_content = $post->post_content;
|
1348 |
$post_content_filtered = $post->post_content_filtered;
|
1349 |
$post_excerpt = $post->post_excerpt;
|
1350 |
-
$post_title =
|
1351 |
$post_name = $post->post_name;
|
1352 |
$comment_status = $post->comment_status;
|
1353 |
$ping_status = $post->ping_status;
|
@@ -1489,8 +1494,35 @@ function _wpsc_admin_notices_3dot8dot9() {
|
|
1489 |
echo '<div id="wpsc-3.8.9-notice" class="error">' . $message . '</div>';
|
1490 |
}
|
1491 |
|
1492 |
-
if ( isset( $_REQUEST['dismiss_389_upgrade_notice'] ) )
|
1493 |
update_option( 'wpsc_hide_3.8.9_notices', true );
|
1494 |
|
1495 |
if ( ! get_option( 'wpsc_hide_3.8.9_notices' ) )
|
1496 |
-
add_action( 'admin_notices', '_wpsc_admin_notices_3dot8dot9' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
560 |
'variation_parent_swap' => esc_html_x( 'New Variation Set', 'Variation taxonomy parent', 'wpsc' ),
|
561 |
/* translators : This string is prepended to the 'New Variation Set' string */
|
562 |
'variation_helper_text' => esc_html_x( 'Choose the Variation Set you want to add variants to. If you\'re creating a new variation set then select', 'Variation helper text', 'wpsc' ),
|
563 |
+
'variations_tutorial' => esc_html__( 'Variations allow you to create options for your products. For example, if you\'re selling T-Shirts, they will generally have a "Size" option. Size will be the Variation Set name, and it will be a "New Variant Set". You will then create variants (small, medium, large) which will have the "Variation Set" of Size. Once you have made your set you can use the table on the right to manage them (edit, delete). You will be able to order your variants by dragging and dropping them within their Variation Set.', 'wpsc' ),
|
564 |
+
/* translators : These strings are dynamically inserted as a drop-down for the Coupon comparison conditions */
|
565 |
+
'coupons_compare_or' => esc_html_x( 'OR' , 'Coupon comparison logic', 'wpsc' ),
|
566 |
+
'coupons_compare_and' => esc_html_x( 'AND' , 'Coupon comparison logic', 'wpsc' ),
|
567 |
) );
|
568 |
}
|
569 |
if ( $pagehook == 'wpsc-product-variations-iframe' ) {
|
604 |
header( 'Cache-Control: public, must-revalidate, max-age=86400' );
|
605 |
header( 'Pragma: public' );
|
606 |
|
|
|
607 |
$hidden_boxes = get_option( 'wpsc_hidden_box' );
|
608 |
|
609 |
$form_types1 = get_option( 'wpsc_checkout_form_fields' );
|
620 |
}
|
621 |
|
622 |
$hidden_boxes = implode( ',', (array)$hidden_boxes );
|
623 |
+
echo "var base_url = '" . esc_js( site_url() ) . "';\n\r";
|
624 |
echo "var WPSC_URL = '" . esc_js( WPSC_URL ) . "';\n\r";
|
625 |
echo "var WPSC_IMAGE_URL = '" . esc_js( WPSC_IMAGE_URL ) . "';\n\r";
|
626 |
echo "var WPSC_DIR_NAME = '" . esc_js( WPSC_DIR_NAME ) . "';\n\r";
|
816 |
|
817 |
// Add the dashboard widgets
|
818 |
if ( current_user_can( $news_cap ) )
|
819 |
+
wp_add_dashboard_widget( 'wpsc_dashboard_news', __( 'WP e-Commerce News' , 'wpsc' ), 'wpsc_dashboard_news' );
|
820 |
if ( current_user_can( $sales_cap ) )
|
821 |
wp_add_dashboard_widget( 'wpsc_dashboard_widget', __( 'Sales Summary', 'wpsc' ), 'wpsc_dashboard_widget' );
|
822 |
if ( current_user_can( $quarterly_sales_cap ) )
|
826 |
|
827 |
// Sort the Dashboard widgets so ours it at the top
|
828 |
global $wp_meta_boxes;
|
829 |
+
$boxes = $wp_meta_boxes['dashboard'];
|
830 |
+
$normal = isset( $wp_meta_boxes['dashboard']['normal'] ) ? $wp_meta_boxes['dashboard']['normal'] : array();
|
831 |
+
|
832 |
+
$normal_dashboard = isset( $normal['core'] ) ? $normal['core'] : array();
|
833 |
|
834 |
// Backup and delete our new dashbaord widget from the end of the array
|
835 |
$wpsc_widget_backup = array();
|
871 |
* @uses wp_widget_rss_output() Display the RSS entries in a list
|
872 |
*/
|
873 |
function wpsc_dashboard_news() {
|
874 |
+
$rss = fetch_feed( 'http://getshopped.org/feed/?category_name=wp-e-commerce-plugin' );
|
875 |
+
$args = array( 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1, 'items' => 3 );
|
876 |
wp_widget_rss_output( $rss, $args );
|
877 |
|
878 |
}
|
1352 |
$post_content = $post->post_content;
|
1353 |
$post_content_filtered = $post->post_content_filtered;
|
1354 |
$post_excerpt = $post->post_excerpt;
|
1355 |
+
$post_title = sprintf( __( '%s (Duplicate)', 'wpsc' ), $post->post_title );
|
1356 |
$post_name = $post->post_name;
|
1357 |
$comment_status = $post->comment_status;
|
1358 |
$ping_status = $post->ping_status;
|
1494 |
echo '<div id="wpsc-3.8.9-notice" class="error">' . $message . '</div>';
|
1495 |
}
|
1496 |
|
1497 |
+
if ( isset( $_REQUEST['dismiss_389_upgrade_notice'] ) || version_compare( WPSC_VERSION, '3.8.10', '>=' ) )
|
1498 |
update_option( 'wpsc_hide_3.8.9_notices', true );
|
1499 |
|
1500 |
if ( ! get_option( 'wpsc_hide_3.8.9_notices' ) )
|
1501 |
+
add_action( 'admin_notices', '_wpsc_admin_notices_3dot8dot9' );
|
1502 |
+
|
1503 |
+
/**
|
1504 |
+
* @todo docs
|
1505 |
+
* @access private
|
1506 |
+
*
|
1507 |
+
* @uses add_query_arg() Adds argument to the WordPress query
|
1508 |
+
* @uses update_option() Updates an option in the WordPress database given string and value
|
1509 |
+
* @uses get_option() Gets option from the database given string
|
1510 |
+
*/
|
1511 |
+
function _wpsc_admin_notices_3dot8dot11() {
|
1512 |
+
$message = '<p>' . __( 'You are currently using WPeC 3.8.11. We have included a fix for a <a href="%1$s">bug on the User Account management page</a>. We are able to fix this automatically on most sites, but it appears that you have made changes to your wpsc-user-log.php page. For that reason, we have some <a href="%2$s">simple instructions for you to follow</a> to resolve the issue. We are sorry for the inconvenience.' , 'wpsc' ) . '</p>';
|
1513 |
+
$message .= "\n<p>" . __( '<a href="%3$s">Hide this warning</a>', 'wpsc' ) . '</p>';
|
1514 |
+
$message = sprintf(
|
1515 |
+
$message,
|
1516 |
+
'https://github.com/wp-e-commerce/WP-e-Commerce/issues/359',
|
1517 |
+
'http://docs.getshopped.org/documentation/3-8-11-user-logs',
|
1518 |
+
add_query_arg( 'dismiss_3811_upgrade_notice', 1 )
|
1519 |
+
);
|
1520 |
+
|
1521 |
+
echo '<div id="wpsc-3.8.11-notice" class="error">' . $message . '</div>';
|
1522 |
+
}
|
1523 |
+
|
1524 |
+
if ( isset( $_REQUEST['dismiss_3811_upgrade_notice'] ) )
|
1525 |
+
update_option( '_wpsc_3811_user_log_notice', false );
|
1526 |
+
|
1527 |
+
if ( get_option( '_wpsc_3811_user_log_notice' ) )
|
1528 |
+
add_action( 'admin_notices', '_wpsc_admin_notices_3dot8dot11' );
|
wpsc-admin/ajax-and-init.php
CHANGED
@@ -93,7 +93,7 @@ if ( isset( $_REQUEST['ajax'] ) && isset( $_REQUEST['admin'] ) && ($_REQUEST['aj
|
|
93 |
* @todo docs
|
94 |
* @uses $wpdb WordPress database object for queries
|
95 |
*/
|
96 |
-
function wpsc_change_currency() {
|
97 |
if ( is_numeric( $_POST['currencyid'] ) ) {
|
98 |
$currency_data = $wpdb->get_results( $wpdb->prepare( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`=%d LIMIT 1", $_POST['currencyid'] ), ARRAY_A );
|
99 |
$price_out = null;
|
93 |
* @todo docs
|
94 |
* @uses $wpdb WordPress database object for queries
|
95 |
*/
|
96 |
+
function wpsc_change_currency() {
|
97 |
if ( is_numeric( $_POST['currencyid'] ) ) {
|
98 |
$currency_data = $wpdb->get_results( $wpdb->prepare( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`=%d LIMIT 1", $_POST['currencyid'] ), ARRAY_A );
|
99 |
$price_out = null;
|
wpsc-admin/ajax.php
CHANGED
@@ -678,7 +678,7 @@ function _wpsc_ajax_upload_product_file() {
|
|
678 |
* @since 3.8.9
|
679 |
* @access private
|
680 |
*
|
681 |
-
* @uses wpsc_update_variations() Updates
|
682 |
* @uses wpsc_admin_product_listing() DEPRECATED
|
683 |
*
|
684 |
* @return array|WP_Error Response args if successful, WP_Error if otherwise
|
@@ -807,4 +807,4 @@ function _wpsc_ajax_set_variation_product_thumbnail() {
|
|
807 |
echo json_encode( $response );
|
808 |
exit;
|
809 |
}
|
810 |
-
add_action( 'wp_ajax_wpsc_set_variation_product_thumbnail', '_wpsc_ajax_set_variation_product_thumbnail' );
|
678 |
* @since 3.8.9
|
679 |
* @access private
|
680 |
*
|
681 |
+
* @uses wpsc_update_variations() Updates product variations given
|
682 |
* @uses wpsc_admin_product_listing() DEPRECATED
|
683 |
*
|
684 |
* @return array|WP_Error Response args if successful, WP_Error if otherwise
|
807 |
echo json_encode( $response );
|
808 |
exit;
|
809 |
}
|
810 |
+
add_action( 'wp_ajax_wpsc_set_variation_product_thumbnail', '_wpsc_ajax_set_variation_product_thumbnail' );
|
wpsc-admin/css/admin.css
CHANGED
@@ -203,7 +203,6 @@ th#status{
|
|
203 |
#wpsc_shipping_details_box{
|
204 |
width:45%;
|
205 |
float:left;
|
206 |
-
border:1px #d3d3d3 solid;
|
207 |
margin:.4em;
|
208 |
padding:.6em;
|
209 |
margin-right:5em;
|
@@ -214,6 +213,12 @@ th#status{
|
|
214 |
margin:.4em;
|
215 |
padding:.6em;
|
216 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
#wpsc_purchlog_searchbox{
|
218 |
width:100%;
|
219 |
text-align:right;
|
@@ -231,13 +236,6 @@ textarea#additional_description{
|
|
231 |
border: 1px solid #dfdfdf;
|
232 |
/* width:465px !important; */
|
233 |
}
|
234 |
-
.wpsc-separator {
|
235 |
-
background:transparent url(../../images/menu-arrows.gif) no-repeat scroll left 5px;
|
236 |
-
cursor:w-resize;
|
237 |
-
height:21px;
|
238 |
-
margin:0;
|
239 |
-
padding:0;
|
240 |
-
}
|
241 |
|
242 |
#poststuff h3.form_heading {
|
243 |
font-size:1.1em;
|
@@ -470,43 +468,6 @@ div.flash-image-uploader {
|
|
470 |
height: 16px;
|
471 |
}
|
472 |
|
473 |
-
|
474 |
-
button#add-product-image {
|
475 |
-
float: left;
|
476 |
-
}
|
477 |
-
|
478 |
-
div#swfupload_img_indicator {
|
479 |
-
float: left;
|
480 |
-
height: 20px;
|
481 |
-
width: 20px;
|
482 |
-
display: none;
|
483 |
-
}
|
484 |
-
|
485 |
-
div#swfupload_img_indicator img{
|
486 |
-
margin: 4px 2px 2px 4px;
|
487 |
-
}
|
488 |
-
|
489 |
-
ul#gallery_list{
|
490 |
-
clear:both;
|
491 |
-
list-style-type:none;
|
492 |
-
list-style-position: inside;
|
493 |
-
cursor: pointer;
|
494 |
-
min-height:70px;
|
495 |
-
_height:70px;
|
496 |
-
padding-left:0px;
|
497 |
-
margin: 6px 0px 0px 6px;
|
498 |
-
}
|
499 |
-
|
500 |
-
ul#gallery_list li{
|
501 |
-
float:left;
|
502 |
-
}
|
503 |
-
|
504 |
-
ul#gallery_list li *{
|
505 |
-
z-index:79;
|
506 |
-
}
|
507 |
-
ul#gallery_list li.first *{
|
508 |
-
z-index:80;
|
509 |
-
}
|
510 |
.ui-selected {
|
511 |
border:2px dashed #969696;
|
512 |
}
|
@@ -598,11 +559,6 @@ tr.edit_product_image *{
|
|
598 |
z-index:80;
|
599 |
}
|
600 |
|
601 |
-
a.closeimagesettings{
|
602 |
-
cursor:pointer;
|
603 |
-
margin-left:90px;
|
604 |
-
}
|
605 |
-
|
606 |
div.browser-image-uploader {
|
607 |
|
608 |
}
|
@@ -2012,4 +1968,14 @@ span.wpsc-button-round {
|
|
2012 |
|
2013 |
.wpsc-coupon-status-inactive {
|
2014 |
color: #e01b1b;
|
2015 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
#wpsc_shipping_details_box{
|
204 |
width:45%;
|
205 |
float:left;
|
|
|
206 |
margin:.4em;
|
207 |
padding:.6em;
|
208 |
margin-right:5em;
|
213 |
margin:.4em;
|
214 |
padding:.6em;
|
215 |
}
|
216 |
+
|
217 |
+
#wpsc_shipping_details_box em.field-blank,
|
218 |
+
#wpsc_billing_details_box em.field-blank {
|
219 |
+
color: #999;
|
220 |
+
}
|
221 |
+
|
222 |
#wpsc_purchlog_searchbox{
|
223 |
width:100%;
|
224 |
text-align:right;
|
236 |
border: 1px solid #dfdfdf;
|
237 |
/* width:465px !important; */
|
238 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
|
240 |
#poststuff h3.form_heading {
|
241 |
font-size:1.1em;
|
468 |
height: 16px;
|
469 |
}
|
470 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
.ui-selected {
|
472 |
border:2px dashed #969696;
|
473 |
}
|
559 |
z-index:80;
|
560 |
}
|
561 |
|
|
|
|
|
|
|
|
|
|
|
562 |
div.browser-image-uploader {
|
563 |
|
564 |
}
|
1968 |
|
1969 |
.wpsc-coupon-status-inactive {
|
1970 |
color: #e01b1b;
|
1971 |
+
}
|
1972 |
+
|
1973 |
+
th.right-col {
|
1974 |
+
text-align: right;
|
1975 |
+
padding: 0;
|
1976 |
+
}
|
1977 |
+
|
1978 |
+
div.new_layer,
|
1979 |
+
div#table_rate {
|
1980 |
+
display:none;
|
1981 |
+
}
|
wpsc-admin/css/settingspage.css
CHANGED
@@ -108,19 +108,40 @@ table.wpsc-edit-module-options tr td {
|
|
108 |
padding: 0 0 8px 8px;
|
109 |
width:394px;
|
110 |
}
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
width: 200px;
|
113 |
}
|
|
|
|
|
|
|
|
|
114 |
tr.rate_row td input[type=text]{
|
115 |
width:50px;
|
116 |
}
|
117 |
div.wpsc_newlayer input[type=text]{
|
118 |
width:50px;
|
119 |
}
|
120 |
-
|
121 |
width:100%;
|
122 |
}
|
123 |
-
|
124 |
margin-bottom:5px;
|
125 |
}
|
126 |
|
@@ -382,14 +403,12 @@ div.wpsc_shipping_options, div.wpsc-select-gateway {
|
|
382 |
}
|
383 |
.wpsc-shipping-actions, .wpsc-gateway-actions {
|
384 |
visibility:hidden;
|
385 |
-
font-size: 10px;
|
386 |
line-height: 16px;
|
387 |
margin:0px 9em 0 0;
|
388 |
float:right;
|
389 |
}
|
390 |
div.wpsc_shipping_options:hover .wpsc-shipping-actions,
|
391 |
div.wpsc-select-gateway:hover .wpsc-gateway-actions {
|
392 |
-
font-size:10px;
|
393 |
visibility:visible;
|
394 |
}
|
395 |
div.wpsc-select-gateway p, div.wpsc_shipping_options p {
|
108 |
padding: 0 0 8px 8px;
|
109 |
width:394px;
|
110 |
}
|
111 |
+
.gateway_settings_form {
|
112 |
+
padding: .5em;
|
113 |
+
}
|
114 |
+
.widefat .gateway_settings_form td {
|
115 |
+
border: none;
|
116 |
+
overflow: initial;
|
117 |
+
}
|
118 |
+
.widefat p.description {
|
119 |
+
color: #666;
|
120 |
+
}
|
121 |
+
.widefat .inactive p.description {
|
122 |
+
margin-left: 0;
|
123 |
+
}
|
124 |
+
.gateway_settings_form p.submit {
|
125 |
+
margin-top: 2em;
|
126 |
+
}
|
127 |
+
|
128 |
+
.gateway_settings input[type=text]{
|
129 |
width: 200px;
|
130 |
}
|
131 |
+
.edit-payment-module-update {
|
132 |
+
float: right;
|
133 |
+
}
|
134 |
+
|
135 |
tr.rate_row td input[type=text]{
|
136 |
width:50px;
|
137 |
}
|
138 |
div.wpsc_newlayer input[type=text]{
|
139 |
width:50px;
|
140 |
}
|
141 |
+
.gateway_settings textarea{
|
142 |
width:100%;
|
143 |
}
|
144 |
+
.gateway_settings h4{
|
145 |
margin-bottom:5px;
|
146 |
}
|
147 |
|
403 |
}
|
404 |
.wpsc-shipping-actions, .wpsc-gateway-actions {
|
405 |
visibility:hidden;
|
|
|
406 |
line-height: 16px;
|
407 |
margin:0px 9em 0 0;
|
408 |
float:right;
|
409 |
}
|
410 |
div.wpsc_shipping_options:hover .wpsc-shipping-actions,
|
411 |
div.wpsc-select-gateway:hover .wpsc-gateway-actions {
|
|
|
412 |
visibility:visible;
|
413 |
}
|
414 |
div.wpsc-select-gateway p, div.wpsc_shipping_options p {
|
wpsc-admin/db-upgrades/routines/4.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function _wpsc_db_upgrade_4() {
|
4 |
+
_wpsc_maybe_update_submitted_form_data_value();
|
5 |
+
_wpsc_maybe_update_user_log_file();
|
6 |
+
}
|
7 |
+
|
8 |
+
function _wpsc_maybe_update_submitted_form_data_value() {
|
9 |
+
global $wpdb;
|
10 |
+
$wpdb->query( 'ALTER TABLE ' . WPSC_TABLE_SUBMITTED_FORM_DATA . ' MODIFY value LONGTEXT;' );
|
11 |
+
}
|
12 |
+
|
13 |
+
function _wpsc_maybe_update_user_log_file() {
|
14 |
+
$hashes = array(
|
15 |
+
'3.8' => '1526bcf18869f9ea2f4061f528a1a21a',
|
16 |
+
'3.8.4' => '1d17c7fb086e2afcf942ca497629b4c9',
|
17 |
+
'3.8.8' => 'f9549ba1b1956c78f96b1551ab965c13',
|
18 |
+
'3.8.9' => '4d0bcba88d211147399e79661cf3b41d',
|
19 |
+
'3.8.10' => '09e2cb9c753587c9228a4e9e8008a82f',
|
20 |
+
);
|
21 |
+
|
22 |
+
wpsc_flush_theme_transients( true );
|
23 |
+
|
24 |
+
//Make sure the theme has actually been moved.
|
25 |
+
$file = wpsc_get_template_file_path( 'wpsc-user-log.php' );
|
26 |
+
if ( false !== strpos( WPSC_CORE_THEME_PATH, $file ) )
|
27 |
+
return;
|
28 |
+
|
29 |
+
//If it has been moved, but it's the 3.8.10 version, we should be good to go.
|
30 |
+
$hash = md5_file( $file );
|
31 |
+
if ( $hashes['3.8.10'] === $hash )
|
32 |
+
return;
|
33 |
+
|
34 |
+
//At this point, we know the file has been moved to the active file folder. Checking now if it has been modified.
|
35 |
+
if ( in_array( $hash, $hashes ) ) {
|
36 |
+
//We now know that they've moved the file, but haven't actually changed anything. We can safely overwrite the file with the new core file.
|
37 |
+
@ copy( $file, path_join( get_stylesheet_directory(), 'wpsc-user-log.php' ) );
|
38 |
+
} else {
|
39 |
+
//This means they have indeed changed the file. We need to add a notice letting them know about the issue and how to fix it.
|
40 |
+
update_option( '_wpsc_3811_user_log_notice', '1' );
|
41 |
+
}
|
42 |
+
}
|
wpsc-admin/display-coupon-add.php
CHANGED
@@ -89,6 +89,7 @@
|
|
89 |
<label><strong><?php _e( 'Conditions', 'wpsc' ); ?></strong></label>
|
90 |
</th>
|
91 |
<td>
|
|
|
92 |
<div class='coupon-condition' >
|
93 |
<select class="ruleprops" name="rules[property][]">
|
94 |
<option value="item_name" rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
|
@@ -123,4 +124,4 @@
|
|
123 |
|
124 |
</form>
|
125 |
</div>
|
126 |
-
</div><!--end .wrap-->
|
89 |
<label><strong><?php _e( 'Conditions', 'wpsc' ); ?></strong></label>
|
90 |
</th>
|
91 |
<td>
|
92 |
+
<input type="hidden" name="rules[operator][]" value="" />
|
93 |
<div class='coupon-condition' >
|
94 |
<select class="ruleprops" name="rules[property][]">
|
95 |
<option value="item_name" rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
|
124 |
|
125 |
</form>
|
126 |
</div>
|
127 |
+
</div><!--end .wrap-->
|
wpsc-admin/display-coupon-edit.php
CHANGED
@@ -113,6 +113,7 @@ $coupon = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_COUP
|
|
113 |
<label><strong><?php _e( 'Conditions', 'wpsc' ); ?></strong></label>
|
114 |
</th>
|
115 |
<td>
|
|
|
116 |
<?php
|
117 |
$conditions = maybe_unserialize( $coupon['condition'] );
|
118 |
|
@@ -124,9 +125,17 @@ $coupon = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_COUP
|
|
124 |
'value' => '',
|
125 |
)
|
126 |
);
|
127 |
-
foreach( $conditions as $key => $condition ) :
|
128 |
?>
|
129 |
<div class='coupon-condition'>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
<select class="ruleprops" name="rules[property][]">
|
131 |
<option value="item_name"<?php selected( 'item_name', $condition['property'] ); ?> rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
|
132 |
<option value="item_quantity"<?php selected( 'item_quantity', $condition['property'] ); ?> rel="order"><?php _e( 'Item quantity', 'wpsc' ); ?></option>
|
@@ -163,4 +172,4 @@ $coupon = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_COUP
|
|
163 |
|
164 |
</form>
|
165 |
</div>
|
166 |
-
</div><!--end .wrap-->
|
113 |
<label><strong><?php _e( 'Conditions', 'wpsc' ); ?></strong></label>
|
114 |
</th>
|
115 |
<td>
|
116 |
+
<input type="hidden" name="rules[operator][]" value="" />
|
117 |
<?php
|
118 |
$conditions = maybe_unserialize( $coupon['condition'] );
|
119 |
|
125 |
'value' => '',
|
126 |
)
|
127 |
);
|
128 |
+
foreach ( $conditions as $key => $condition ) :
|
129 |
?>
|
130 |
<div class='coupon-condition'>
|
131 |
+
<?php
|
132 |
+
if ( isset( $condition["operator"] ) && ! empty( $condition["operator"] ) ) :
|
133 |
+
?>
|
134 |
+
<select name="rules[operator][]">
|
135 |
+
<option value="and"<?php selected( 'and', $condition["operator"] ); ?>><?php _ex( 'AND', 'Coupon comparison logic', 'wpsc' );?></option>
|
136 |
+
<option value="or"<?php selected( 'or' , $condition["operator"] ); ?>><?php _ex( 'OR' , 'Coupon comparison logic', 'wpsc' );?></option>
|
137 |
+
</select>
|
138 |
+
<?php endif; ?>
|
139 |
<select class="ruleprops" name="rules[property][]">
|
140 |
<option value="item_name"<?php selected( 'item_name', $condition['property'] ); ?> rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
|
141 |
<option value="item_quantity"<?php selected( 'item_quantity', $condition['property'] ); ?> rel="order"><?php _e( 'Item quantity', 'wpsc' ); ?></option>
|
172 |
|
173 |
</form>
|
174 |
</div>
|
175 |
+
</div><!--end .wrap-->
|
wpsc-admin/display-coupons.php
CHANGED
@@ -149,4 +149,4 @@ function wpsc_display_coupons_page() {
|
|
149 |
</div>
|
150 |
<?php
|
151 |
} // end view check
|
152 |
-
}
|
149 |
</div>
|
150 |
<?php
|
151 |
} // end view check
|
152 |
+
}
|
wpsc-admin/display-items.page.php
CHANGED
@@ -497,34 +497,49 @@ add_filter( 'manage_wpsc-product_posts_columns', 'wpsc_additional_column_names'
|
|
497 |
* @uses wp_get_referrer() Retrieve referer from '_wp_http_referer' or HTTP referer.
|
498 |
*/
|
499 |
function wpsc_update_featured_products() {
|
500 |
-
|
501 |
-
|
502 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
$status = get_option( 'sticky_products' );
|
504 |
|
505 |
-
$new_status =
|
506 |
|
507 |
if ( $new_status ) {
|
508 |
-
|
509 |
$status[] = $product_id;
|
510 |
} else {
|
511 |
$status = array_diff( $status, array( $product_id ) );
|
512 |
$status = array_values( $status );
|
513 |
}
|
|
|
514 |
update_option( 'sticky_products', $status );
|
515 |
|
516 |
-
if (
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
|
|
|
|
|
|
523 |
exit();
|
524 |
}
|
525 |
wp_redirect( wp_get_referer() );
|
526 |
-
exit
|
|
|
527 |
}
|
|
|
528 |
add_filter( 'page_row_actions','my_action_row', 10, 2 );
|
529 |
|
530 |
/**
|
@@ -549,5 +564,5 @@ function my_action_row( $actions, $post ) {
|
|
549 |
return $actions;
|
550 |
}
|
551 |
|
552 |
-
|
553 |
-
|
497 |
* @uses wp_get_referrer() Retrieve referer from '_wp_http_referer' or HTTP referer.
|
498 |
*/
|
499 |
function wpsc_update_featured_products() {
|
500 |
+
if ( ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) &&
|
501 |
+
! ( isset( $_REQUEST['wpsc_admin_action'] ) &&
|
502 |
+
( $_REQUEST['wpsc_admin_action'] == 'update_featured_product' ) ) )
|
503 |
+
return;
|
504 |
+
|
505 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update_featured_product' !== $_REQUEST['action'] )
|
506 |
+
return;
|
507 |
+
|
508 |
+
$product_id = absint( $_REQUEST['product_id'] );
|
509 |
+
|
510 |
+
if ( ! DOING_AJAX )
|
511 |
+
check_admin_referer( 'feature_product_' . $product_id );
|
512 |
+
|
513 |
$status = get_option( 'sticky_products' );
|
514 |
|
515 |
+
$new_status = ! in_array( $product_id, $status );
|
516 |
|
517 |
if ( $new_status ) {
|
|
|
518 |
$status[] = $product_id;
|
519 |
} else {
|
520 |
$status = array_diff( $status, array( $product_id ) );
|
521 |
$status = array_values( $status );
|
522 |
}
|
523 |
+
|
524 |
update_option( 'sticky_products', $status );
|
525 |
|
526 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
527 |
+
$json_response = array(
|
528 |
+
'text' => $new_status ? esc_attr__( 'Unmark as Featured', 'wpsc' ) : esc_attr__( 'Mark as Featured', 'wpsc' ),
|
529 |
+
'product_id' => $product_id,
|
530 |
+
'class' => $new_status ? 'gold-star' : 'grey-star',
|
531 |
+
'image' => $new_status ? WPSC_CORE_IMAGES_URL . '/gold-star.gif' : WPSC_CORE_IMAGES_URL . '/grey-star.gif'
|
532 |
+
);
|
533 |
+
|
534 |
+
echo json_encode( $json_response );
|
535 |
+
|
536 |
exit();
|
537 |
}
|
538 |
wp_redirect( wp_get_referer() );
|
539 |
+
exit;
|
540 |
+
|
541 |
}
|
542 |
+
|
543 |
add_filter( 'page_row_actions','my_action_row', 10, 2 );
|
544 |
|
545 |
/**
|
564 |
return $actions;
|
565 |
}
|
566 |
|
567 |
+
add_action( 'wp_ajax_update_featured_product', 'wpsc_update_featured_products' );
|
568 |
+
add_action( 'admin_init' , 'wpsc_update_featured_products' );
|
wpsc-admin/display-sales-logs.php
CHANGED
@@ -11,377 +11,420 @@
|
|
11 |
|
12 |
|
13 |
class WPSC_Purchase_Log_Page {
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
'unique_name' => $value
|
92 |
-
|
93 |
-
|
94 |
'id' => $key
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
echo wpsc_currency_display( wpsc_purchaselog_details_price() );
|
199 |
do_action( 'wpsc_additional_sales_amount_info', wpsc_purchaselog_details_id() );
|
200 |
-
|
201 |
</td> <!-- PRICE! -->
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
}
|
11 |
|
12 |
|
13 |
class WPSC_Purchase_Log_Page {
|
14 |
+
private $list_table;
|
15 |
+
private $output;
|
16 |
+
|
17 |
+
public function __construct() {
|
18 |
+
$controller = 'default';
|
19 |
+
$controller_method = 'controller_default';
|
20 |
+
|
21 |
+
if ( isset( $_REQUEST['c'] ) && method_exists( $this, 'controller_' . $_REQUEST['c'] ) ) {
|
22 |
+
$controller = $_REQUEST['c'];
|
23 |
+
$controller_method = 'controller_' . $controller;
|
24 |
+
}
|
25 |
+
|
26 |
+
$this->$controller_method();
|
27 |
+
}
|
28 |
+
|
29 |
+
private function needs_update() {
|
30 |
+
global $wpdb;
|
31 |
+
|
32 |
+
if ( get_option( '_wpsc_purchlogs_3.8_updated' ) )
|
33 |
+
return false;
|
34 |
+
|
35 |
+
$c = $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE plugin_version IN ('3.6', '3.7')" );
|
36 |
+
if ( $c > 0 )
|
37 |
+
return true;
|
38 |
+
|
39 |
+
update_option( '_wpsc_purchlogs_3.8_updated', true );
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
|
43 |
+
public function controller_upgrade_purchase_logs_3_7() {
|
44 |
+
add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_upgrade_purchase_logs_3_7' ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
private function purchase_logs_fix_options( $id ) {
|
48 |
+
?>
|
49 |
+
<select name='<?php echo $id; ?>'>
|
50 |
+
<option value='-1'><?php echo esc_html_x( 'Select an Option', 'Dropdown default when called in uniquename dropdown', 'wpsc' ); ?>'</option>
|
51 |
+
<option value='billingfirstname'><?php esc_html_e( 'Billing First Name', 'wpsc' ); ?></option>
|
52 |
+
<option value='billinglastname'><?php esc_html_e( 'Billing Last Name', 'wpsc' ); ?></option>
|
53 |
+
<option value='billingaddress'><?php esc_html_e( 'Billing Address', 'wpsc' ); ?></option>
|
54 |
+
<option value='billingcity'><?php esc_html_e( 'Billing City', 'wpsc' ); ?></option>
|
55 |
+
<option value='billingstate'><?php esc_html_e( 'Billing State', 'wpsc' ); ?></option>
|
56 |
+
<option value='billingcountry'><?php esc_html_e( 'Billing Country', 'wpsc' ); ?></option>
|
57 |
+
<option value='billingemail'><?php esc_html_e( 'Billing Email', 'wpsc' ); ?></option>
|
58 |
+
<option value='billingphone'><?php esc_html_e( 'Billing Phone', 'wpsc' ); ?></option>
|
59 |
+
<option value='billingpostcode'><?php esc_html_e( 'Billing Post Code', 'wpsc' ); ?></option>
|
60 |
+
<option value='shippingfirstname'><?php esc_html_e( 'Shipping First Name', 'wpsc' ); ?></option>
|
61 |
+
<option value='shippinglastname'><?php esc_html_e( 'Shipping Last Name', 'wpsc' ); ?></option>
|
62 |
+
<option value='shippingaddress'><?php esc_html_e( 'Shipping Address', 'wpsc' ); ?></option>
|
63 |
+
<option value='shippingcity'><?php esc_html_e( 'Shipping City', 'wpsc' ); ?></option>
|
64 |
+
<option value='shippingstate'><?php esc_html_e( 'Shipping State', 'wpsc' ); ?></option>
|
65 |
+
<option value='shippingcountry'><?php esc_html_e( 'Shipping Country', 'wpsc' ); ?></option>
|
66 |
+
<option value='shippingpostcode'><?php esc_html_e( 'Shipping Post Code', 'wpsc' ); ?></option>
|
67 |
+
</select>
|
68 |
+
<?php
|
69 |
+
}
|
70 |
+
|
71 |
+
public function display_upgrade_purchase_logs_3_7() {
|
72 |
+
global $wpdb;
|
73 |
+
$numChanged = 0;
|
74 |
+
$numQueries = 0;
|
75 |
+
$purchlog = "SELECT DISTINCT id FROM `".WPSC_TABLE_PURCHASE_LOGS."` LIMIT 1";
|
76 |
+
$id = $wpdb->get_var($purchlog);
|
77 |
+
$usersql = "SELECT DISTINCT `".WPSC_TABLE_SUBMITTED_FORM_DATA."`.value, `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` LEFT JOIN `".WPSC_TABLE_SUBMITTED_FORM_DATA."` ON `".WPSC_TABLE_CHECKOUT_FORMS."`.id = `".WPSC_TABLE_SUBMITTED_FORM_DATA."`.`form_id` WHERE `".WPSC_TABLE_SUBMITTED_FORM_DATA."`.log_id=".$id." ORDER BY `".WPSC_TABLE_CHECKOUT_FORMS."`.`checkout_order`" ;
|
78 |
+
$formfields = $wpdb->get_results($usersql);
|
79 |
+
|
80 |
+
if(count($formfields) < 1){
|
81 |
+
$usersql = "SELECT DISTINCT `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type` != 'heading'";
|
82 |
+
$formfields = $wpdb->get_results($usersql);
|
83 |
+
}
|
84 |
+
|
85 |
+
if(isset($_POST)){
|
86 |
+
foreach($_POST as $key=>$value){
|
87 |
+
if($value != '-1'){
|
88 |
+
$complete = $wpdb->update(
|
89 |
+
WPSC_TABLE_CHECKOUT_FORMS,
|
90 |
+
array(
|
91 |
'unique_name' => $value
|
92 |
+
),
|
93 |
+
array(
|
94 |
'id' => $key
|
95 |
+
),
|
96 |
+
'%s',
|
97 |
+
'%d'
|
98 |
+
);
|
99 |
+
}
|
100 |
+
$numChanged++;
|
101 |
+
$numQueries ++;
|
102 |
+
}
|
103 |
+
|
104 |
+
$sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='delivertoafriend' WHERE `name` = '2. Shipping details'";
|
105 |
+
$wpdb->query($sql);
|
106 |
+
|
107 |
+
add_option('wpsc_purchaselogs_fixed',true);
|
108 |
+
}
|
109 |
+
|
110 |
+
include( 'includes/purchase-logs-page/upgrade.php' );
|
111 |
+
}
|
112 |
+
|
113 |
+
public function display_upgrade_purchase_logs_3_8() {
|
114 |
+
?>
|
115 |
+
<div class="wrap">
|
116 |
+
<h2><?php echo esc_html( __('Sales', 'wpsc') ); ?> </h2>
|
117 |
+
<div class="updated">
|
118 |
+
<p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.' , 'wpsc' ), remove_query_arg( 'c' ) ); ?></p>
|
119 |
+
</div>
|
120 |
+
</div>
|
121 |
+
<?php
|
122 |
+
}
|
123 |
+
|
124 |
+
public function controller_upgrade_purchase_logs_3_8() {
|
125 |
+
if ( $this->needs_update() )
|
126 |
+
wpsc_update_purchase_logs();
|
127 |
+
|
128 |
+
add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_upgrade_purchase_logs_3_8' ) );
|
129 |
+
}
|
130 |
+
|
131 |
+
function purchase_logs_pagination() {
|
132 |
+
global $wpdb, $purchlogitem;
|
133 |
+
?>
|
134 |
+
<span class='tablenav'><span class='tablenav-pages'><span class='pagination-links'>
|
135 |
+
<?php
|
136 |
+
$href = "#";
|
137 |
+
$disabled = "disabled";
|
138 |
+
if ( $this->log_id > 1 ) {
|
139 |
+
$href = $this->get_purchase_log_url( ( $this->log_id - 1 ) );
|
140 |
+
$disabled = '';
|
141 |
+
}
|
142 |
+
?>
|
143 |
+
<a href='<?php esc_attr_e( $href ); ?>' class='prev-page <?php echo $disabled; ?>'>‹ <?php _e( 'Previous', 'wpsc' ); ?></a>
|
144 |
+
<?php
|
145 |
+
|
146 |
+
$max_purchase_id = wpsc_max_purchase_id();
|
147 |
+
$href = "#";
|
148 |
+
$disabled = "disabled";
|
149 |
+
if ( $max_purchase_id > $this->log_id ) {
|
150 |
+
$href = $this->get_purchase_log_url( ( $this->log_id + 1 ) );
|
151 |
+
$disabled = '';
|
152 |
+
}
|
153 |
+
?>
|
154 |
+
<a href='<?php esc_attr_e( $href ); ?>' class='next-page <?php echo $disabled; ?>'><?php _e( 'Next', 'wpsc' ); ?> ›</a>
|
155 |
+
|
156 |
+
</span></span></span>
|
157 |
+
<?php
|
158 |
+
}
|
159 |
+
|
160 |
+
function purchase_logs_checkout_fields(){
|
161 |
+
global $purchlogitem;
|
162 |
+
|
163 |
+
if ( ! empty( $purchlogitem->additional_fields ) ) {
|
164 |
+
?>
|
165 |
+
<div class="metabox-holder">
|
166 |
+
<div id="custom_checkout_fields" class="postbox">
|
167 |
+
<h3 class='hndle'><?php esc_html_e( 'Additional Checkout Fields' , 'wpsc' ); ?></h3>
|
168 |
+
<div class='inside'>
|
169 |
+
<?php
|
170 |
+
foreach( (array) $purchlogitem->additional_fields as $value ) {
|
171 |
+
$value['value'] = maybe_unserialize ( $value['value'] );
|
172 |
+
if ( is_array( $value['value'] ) ) {
|
173 |
+
?>
|
174 |
+
<p><strong><?php echo $value['name']; ?> :</strong> <?php echo implode( stripslashes( $value['value'] ), ',' ); ?></p>
|
175 |
+
<?php
|
176 |
+
} else {
|
177 |
+
$thevalue = esc_html( stripslashes( $value['value'] ));
|
178 |
+
if ( empty( $thevalue ) ) {
|
179 |
+
$thevalue = __( '<em>blank</em>', 'wpsc' );
|
180 |
+
}
|
181 |
+
?>
|
182 |
+
<p><strong><?php echo $value['name']; ?> :</strong> <?php echo $thevalue; ?></p>
|
183 |
+
<?php
|
184 |
+
}
|
185 |
+
}
|
186 |
+
?>
|
187 |
+
</div>
|
188 |
+
</div>
|
189 |
+
</div>
|
190 |
+
<?php
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
private function purchase_log_custom_fields(){
|
195 |
+
if( wpsc_purchlogs_has_customfields() ){?>
|
196 |
+
<div class='metabox-holder'>
|
197 |
+
<div id='purchlogs_customfields' class='postbox'>
|
198 |
+
<h3 class='hndle'><?php esc_html_e( 'Users Custom Fields' , 'wpsc' ); ?></h3>
|
199 |
+
<div class='inside'>
|
200 |
+
<?php $messages = wpsc_purchlogs_custommessages(); ?>
|
201 |
+
<?php $files = wpsc_purchlogs_customfiles(); ?>
|
202 |
+
<?php if(count($files) > 0){ ?>
|
203 |
+
<h4><?php esc_html_e( 'Cart Items with Custom Files' , 'wpsc' ); ?>:</h4>
|
204 |
+
<?php
|
205 |
+
foreach($files as $file){
|
206 |
+
echo $file;
|
207 |
+
}
|
208 |
+
}?>
|
209 |
+
<?php if(count($messages) > 0){ ?>
|
210 |
+
<h4><?php esc_html_e( 'Cart Items with Custom Messages' , 'wpsc' ); ?>:</h4>
|
211 |
+
<?php
|
212 |
+
foreach($messages as $message){
|
213 |
+
echo esc_html( $message['title'] ) . ':<br />' . nl2br( esc_html( $message['message'] ) );
|
214 |
+
}
|
215 |
+
} ?>
|
216 |
+
</div>
|
217 |
+
</div>
|
218 |
+
</div>
|
219 |
+
<?php
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
private function purchase_log_cart_items() {
|
224 |
+
while( wpsc_have_purchaselog_details() ) : wpsc_the_purchaselog_item(); ?>
|
225 |
+
<tr>
|
226 |
+
<td><?php echo wpsc_purchaselog_details_name(); ?></td> <!-- NAME! -->
|
227 |
+
<td><?php echo wpsc_purchaselog_details_SKU(); ?></td> <!-- SKU! -->
|
228 |
+
<td><?php echo wpsc_purchaselog_details_quantity(); ?></td> <!-- QUANTITY! -->
|
229 |
+
<td>
|
230 |
+
<?php
|
231 |
echo wpsc_currency_display( wpsc_purchaselog_details_price() );
|
232 |
do_action( 'wpsc_additional_sales_amount_info', wpsc_purchaselog_details_id() );
|
233 |
+
?>
|
234 |
</td> <!-- PRICE! -->
|
235 |
+
<td><?php echo wpsc_currency_display( wpsc_purchaselog_details_shipping() ); ?></td> <!-- SHIPPING! -->
|
236 |
+
<?php if( wpec_display_product_tax() ): ?>
|
237 |
+
<td><?php echo wpsc_currency_display( wpsc_purchaselog_details_tax() ); ?></td> <!-- TAX! -->
|
238 |
+
<?php endif; ?>
|
239 |
+
<!-- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_discount() ); ?></td> --> <!-- DISCOUNT! -->
|
240 |
+
<td class="amount"><?php echo wpsc_currency_display( wpsc_purchaselog_details_total() ); ?></td> <!-- TOTAL! -->
|
241 |
+
</tr>
|
242 |
+
<?php
|
243 |
+
endwhile;
|
244 |
+
}
|
245 |
+
|
246 |
+
public function controller_item_details() {
|
247 |
+
if ( ! isset( $_REQUEST['id'] ) )
|
248 |
+
die( __( 'Invalid sales log ID', 'wpsc' ) );
|
249 |
+
|
250 |
+
global $purchlogitem;
|
251 |
+
|
252 |
+
$this->log_id = (int) $_REQUEST['id'];
|
253 |
+
|
254 |
+
// TODO: seriously get rid of all these badly coded purchaselogs.class.php functions in 4.0
|
255 |
+
$purchlogitem = new wpsc_purchaselogs_items( $this->log_id );
|
256 |
+
|
257 |
+
$columns = array(
|
258 |
+
'title' => __( 'Name', 'wpsc' ),
|
259 |
+
'sku' => __( 'SKU', 'wpsc' ),
|
260 |
+
'quantity' => __( 'Quantity','wpsc' ),
|
261 |
+
'price' => __( 'Price', 'wpsc' ),
|
262 |
+
'shipping' => __( 'Item Shipping', 'wpsc'),
|
263 |
+
);
|
264 |
+
|
265 |
+
if ( wpec_display_product_tax() ) {
|
266 |
+
$columns['tax'] = __( 'Item Tax', 'wpsc' );
|
267 |
+
}
|
268 |
+
|
269 |
+
$columns['total'] = __( 'Item Total','wpsc' );
|
270 |
+
|
271 |
+
register_column_headers( 'wpsc_purchase_log_item_details', $columns );
|
272 |
+
|
273 |
+
add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_purchase_log' ) );
|
274 |
+
}
|
275 |
+
|
276 |
+
public function controller_packing_slip() {
|
277 |
+
if ( ! isset( $_REQUEST['id'] ) )
|
278 |
+
die( __( 'Invalid sales log ID', 'wpsc' ) );
|
279 |
+
|
280 |
+
global $purchlogitem;
|
281 |
+
|
282 |
+
$this->log_id = (int) $_REQUEST['id'];
|
283 |
+
|
284 |
+
$purchlogitem = new wpsc_purchaselogs_items( $this->log_id );
|
285 |
+
|
286 |
+
$columns = array(
|
287 |
+
'title' => __( 'Item Name','wpsc' ),
|
288 |
+
'sku' => __( 'SKU','wpsc' ),
|
289 |
+
'quantity' => __( 'Quantity','wpsc' ),
|
290 |
+
'price' => __( 'Price','wpsc' ),
|
291 |
+
'shipping' => __( 'Item Shipping','wpsc'),
|
292 |
+
);
|
293 |
+
|
294 |
+
if ( wpec_display_product_tax() ) {
|
295 |
+
$columns['tax'] = __( 'Item Tax', 'wpsc' );
|
296 |
+
}
|
297 |
+
|
298 |
+
$columns['total'] = __( 'Item Total','wpsc' );
|
299 |
+
|
300 |
+
$cols = count( $columns ) - 2;
|
301 |
+
|
302 |
+
register_column_headers( 'wpsc_purchase_log_item_details', $columns );
|
303 |
+
|
304 |
+
include( 'includes/purchase-logs-page/packing-slip.php' );
|
305 |
+
exit;
|
306 |
+
}
|
307 |
+
|
308 |
+
public function controller_default() {
|
309 |
+
//Create an instance of our package class...
|
310 |
+
$this->list_table = new WPSC_Purchase_Log_List_Table();
|
311 |
+
$this->process_bulk_action();
|
312 |
+
$this->list_table->prepare_items();
|
313 |
+
add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_list_table' ) );
|
314 |
+
}
|
315 |
+
|
316 |
+
public function display_purchase_log() {
|
317 |
+
if ( wpec_display_product_tax() )
|
318 |
+
$cols = 5;
|
319 |
+
else
|
320 |
+
$cols = 4;
|
321 |
+
$receipt_sent = ! empty( $_GET['sent'] );
|
322 |
+
$receipt_not_sent = isset( $_GET['sent'] ) && ! $_GET['sent'];
|
323 |
+
include( 'includes/purchase-logs-page/item-details.php' );
|
324 |
+
}
|
325 |
+
|
326 |
+
public function download_csv() {
|
327 |
+
$_REQUEST['rss_key'] = 'key';
|
328 |
+
wpsc_purchase_log_csv();
|
329 |
+
}
|
330 |
+
|
331 |
+
public function process_bulk_action() {
|
332 |
+
global $wpdb;
|
333 |
+
$current_action = $this->list_table->current_action();
|
334 |
+
|
335 |
+
do_action( 'wpsc_sales_log_process_bulk_action', $current_action );
|
336 |
+
|
337 |
+
if ( ! $current_action || ( 'download_csv' != $current_action && empty( $_REQUEST['post'] ) ) ) {
|
338 |
+
if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
|
339 |
+
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'action', 'action2' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
|
340 |
+
exit;
|
341 |
+
}
|
342 |
+
|
343 |
+
unset( $_REQUEST['post'] );
|
344 |
+
return;
|
345 |
+
}
|
346 |
+
|
347 |
+
if ( 'download_csv' == $current_action ) {
|
348 |
+
$this->download_csv();
|
349 |
+
exit;
|
350 |
+
}
|
351 |
+
|
352 |
+
$sendback = remove_query_arg( array(
|
353 |
+
'_wpnonce',
|
354 |
+
'_wp_http_referer',
|
355 |
+
'action',
|
356 |
+
'action2',
|
357 |
+
'confirm',
|
358 |
+
'post',
|
359 |
+
'last_paged'
|
360 |
+
) );
|
361 |
+
|
362 |
+
if ( 'delete' == $current_action ) {
|
363 |
+
|
364 |
+
// delete action
|
365 |
+
if ( empty( $_REQUEST['confirm'] ) ) {
|
366 |
+
$this->list_table->disable_search_box();
|
367 |
+
$this->list_table->disable_bulk_actions();
|
368 |
+
$this->list_table->disable_sortable();
|
369 |
+
$this->list_table->disable_month_filter();
|
370 |
+
$this->list_table->disable_views();
|
371 |
+
$this->list_table->set_per_page(0);
|
372 |
+
add_action( 'wpsc_purchase_logs_list_table_before', array( $this, 'action_list_table_before' ) );
|
373 |
+
return;
|
374 |
+
} else {
|
375 |
+
if ( empty( $_REQUEST['post'] ) )
|
376 |
+
return;
|
377 |
+
|
378 |
+
$ids = array_map( 'intval', $_REQUEST['post'] );
|
379 |
+
$in = implode( ', ', $ids );
|
380 |
+
$wpdb->query( "DELETE FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE id IN ($in)" );
|
381 |
+
$wpdb->query( "DELETE FROM " . WPSC_TABLE_CLAIMED_STOCK . " WHERE cart_id IN ($in)" );
|
382 |
+
$wpdb->query( "DELETE FROM " . WPSC_TABLE_CART_CONTENTS . " WHERE purchaseid IN ($in)" );
|
383 |
+
$wpdb->query( "DELETE FROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " WHERE log_id IN ($in)" );
|
384 |
+
|
385 |
+
$sendback = add_query_arg( array(
|
386 |
+
'paged' => $_REQUEST['last_paged'],
|
387 |
+
'deleted' => count( $_REQUEST['post'] ),
|
388 |
+
), $sendback );
|
389 |
+
|
390 |
+
}
|
391 |
+
}
|
392 |
+
|
393 |
+
// change status actions
|
394 |
+
if ( is_numeric( $current_action ) && $current_action < 7 && ! empty( $_REQUEST['post'] ) ) {
|
395 |
+
|
396 |
+
foreach ( $_REQUEST['post'] as $id )
|
397 |
+
wpsc_purchlog_edit_status( $id, $current_action );
|
398 |
+
|
399 |
+
$sendback = add_query_arg( array(
|
400 |
+
'updated' => count( $_REQUEST['post'] ),
|
401 |
+
), $sendback );
|
402 |
+
}
|
403 |
+
|
404 |
+
wp_redirect( $sendback );
|
405 |
+
exit;
|
406 |
+
}
|
407 |
+
|
408 |
+
public function action_list_table_before() {
|
409 |
+
include( 'includes/purchase-logs-page/bulk-delete-confirm.php' );
|
410 |
+
}
|
411 |
+
|
412 |
+
public function display_list_table() {
|
413 |
+
if ( ! empty( $this->output ) ) {
|
414 |
+
echo $this->output;
|
415 |
+
return;
|
416 |
+
}
|
417 |
+
|
418 |
+
include( 'includes/purchase-logs-page/list-table.php' );
|
419 |
+
}
|
420 |
+
|
421 |
+
private function get_purchase_log_url( $id ) {
|
422 |
+
$location = add_query_arg( array(
|
423 |
+
'page' => 'wpsc-purchase-logs',
|
424 |
+
'c' => 'item_details',
|
425 |
+
'id' => $id,
|
426 |
+
), admin_url( 'index.php' ) );
|
427 |
+
return $location;
|
428 |
+
}
|
429 |
+
|
430 |
}
|
wpsc-admin/display-upgrades.page.php
CHANGED
@@ -124,7 +124,7 @@ function wpsc_display_upgrades_page() {
|
|
124 |
function wpsc_reset_api_key() {
|
125 |
if ( isset( $_POST['reset_api_key'] ) && ( $_POST['reset_api_key'] == 'true' ) ) {
|
126 |
if ( $_POST['activation_name'] != null ) {
|
127 |
-
$target = "http://instinct.co.nz/wp-goldcart-api/api_register.php?name=" . $_POST['activation_name'] . "&key=" . $_POST['activation_key'] . "&url=" .
|
128 |
|
129 |
$remote_access_fail = false;
|
130 |
$useragent = 'WP e-Commerce plugin';
|
@@ -133,7 +133,7 @@ function wpsc_reset_api_key() {
|
|
133 |
$activation_key = urlencode( $_POST['activation_key'] );
|
134 |
$activation_state = update_option( 'activation_state', "false" );
|
135 |
|
136 |
-
$siteurl = urlencode(
|
137 |
$request = '';
|
138 |
|
139 |
$http_request = "GET /wp-goldcart-api/api_register.php?name=$activation_name&key=&url=$siteurl HTTP/1.0\r\n";
|
124 |
function wpsc_reset_api_key() {
|
125 |
if ( isset( $_POST['reset_api_key'] ) && ( $_POST['reset_api_key'] == 'true' ) ) {
|
126 |
if ( $_POST['activation_name'] != null ) {
|
127 |
+
$target = "http://instinct.co.nz/wp-goldcart-api/api_register.php?name=" . $_POST['activation_name'] . "&key=" . $_POST['activation_key'] . "&url=" . site_url() . "";
|
128 |
|
129 |
$remote_access_fail = false;
|
130 |
$useragent = 'WP e-Commerce plugin';
|
133 |
$activation_key = urlencode( $_POST['activation_key'] );
|
134 |
$activation_state = update_option( 'activation_state', "false" );
|
135 |
|
136 |
+
$siteurl = urlencode( site_url() );
|
137 |
$request = '';
|
138 |
|
139 |
$http_request = "GET /wp-goldcart-api/api_register.php?name=$activation_name&key=&url=$siteurl HTTP/1.0\r\n";
|
wpsc-admin/includes/display-items-functions.php
CHANGED
@@ -823,7 +823,6 @@ if ( ( isset( $_REQUEST['parent_page'] ) && ( $_REQUEST['parent_page'] == 'wpsc-
|
|
823 |
add_filter( 'gettext', 'wpsc_filter_delete_text', 12 , 3 );
|
824 |
add_filter( 'attachment_fields_to_edit', 'wpsc_attachment_fields', 11, 2 );
|
825 |
add_filter( 'attachment_fields_to_save', 'wpsc_save_attachment_fields', 9, 2 );
|
826 |
-
add_filter( 'gettext', 'wpsc_filter_feature_image_text', 12, 3 );
|
827 |
add_filter( 'gettext_with_context', 'wpsc_filter_gettex_with_context', 12, 4);
|
828 |
|
829 |
/*
|
@@ -851,6 +850,7 @@ function wpsc_filter_gettex_with_context( $translation, $text, $context, $domain
|
|
851 |
* specifically for the words 'Use as featured image' with 'Use as Product Thumbnail' when the user is selecting a Product Thumbnail
|
852 |
* using media gallery.
|
853 |
*
|
|
|
854 |
* @param $translation The current translation
|
855 |
* @param $text The text being translated
|
856 |
* @param $domain The domain for the translation
|
@@ -1044,9 +1044,8 @@ function wpsc_filter_delete_text( $translation, $text, $domain ) {
|
|
1044 |
}
|
1045 |
function edit_multiple_image_gallery( $post ) {
|
1046 |
global $wpdb;
|
1047 |
-
//Make sure thumbnail isn't duplicated
|
1048 |
-
$siteurl = site_url();
|
1049 |
|
|
|
1050 |
if ( $post->ID > 0 ) {
|
1051 |
if ( has_post_thumbnail( $post->ID ) )
|
1052 |
echo get_the_post_thumbnail( $post->ID, 'admin-product-thumbnails' );
|
823 |
add_filter( 'gettext', 'wpsc_filter_delete_text', 12 , 3 );
|
824 |
add_filter( 'attachment_fields_to_edit', 'wpsc_attachment_fields', 11, 2 );
|
825 |
add_filter( 'attachment_fields_to_save', 'wpsc_save_attachment_fields', 9, 2 );
|
|
|
826 |
add_filter( 'gettext_with_context', 'wpsc_filter_gettex_with_context', 12, 4);
|
827 |
|
828 |
/*
|
850 |
* specifically for the words 'Use as featured image' with 'Use as Product Thumbnail' when the user is selecting a Product Thumbnail
|
851 |
* using media gallery.
|
852 |
*
|
853 |
+
* @todo As this feature is entirely cosmetic and breaks with WP_DEBUG on in WP 3.5+, we've removed the filter for it. Will revisit the functionality in 3.9 when we look at new media workflows.
|
854 |
* @param $translation The current translation
|
855 |
* @param $text The text being translated
|
856 |
* @param $domain The domain for the translation
|
1044 |
}
|
1045 |
function edit_multiple_image_gallery( $post ) {
|
1046 |
global $wpdb;
|
|
|
|
|
1047 |
|
1048 |
+
// Make sure thumbnail isn't duplicated
|
1049 |
if ( $post->ID > 0 ) {
|
1050 |
if ( has_post_thumbnail( $post->ID ) )
|
1051 |
echo get_the_post_thumbnail( $post->ID, 'admin-product-thumbnails' );
|
wpsc-admin/includes/product-functions.php
CHANGED
@@ -1090,7 +1090,7 @@ function _wpsc_refresh_parent_product_terms( $parent_id ) {
|
|
1090 |
|
1091 |
$children_ids = wp_list_pluck( $children, 'ID' );
|
1092 |
|
1093 |
-
$children_terms =
|
1094 |
$new_terms = array();
|
1095 |
foreach ( $children_terms as $term ) {
|
1096 |
if ( $term->parent )
|
1090 |
|
1091 |
$children_ids = wp_list_pluck( $children, 'ID' );
|
1092 |
|
1093 |
+
$children_terms = wp_get_object_terms( $children_ids, 'wpsc-variation' );
|
1094 |
$new_terms = array();
|
1095 |
foreach ( $children_terms as $term ) {
|
1096 |
if ( $term->parent )
|
wpsc-admin/includes/product-variation-list-table.class.php
CHANGED
@@ -241,7 +241,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
|
|
241 |
*/
|
242 |
public function column_stock( $item ) {
|
243 |
$stock = get_product_meta( $item->ID, 'stock', true );
|
244 |
-
if (
|
245 |
$stock = absint( $stock );
|
246 |
?>
|
247 |
<input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][stock]" value="<?php echo esc_attr( $stock ); ?>" />
|
@@ -258,7 +258,8 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
|
|
258 |
|
259 |
public function column_sale_price( $item ) {
|
260 |
$sale_price = get_product_meta( $item->ID, 'special_price', true );
|
261 |
-
|
|
|
262 |
?>
|
263 |
<input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][sale_price]" value="<?php echo esc_attr( $sale_price ); ?>">
|
264 |
<?php
|
241 |
*/
|
242 |
public function column_stock( $item ) {
|
243 |
$stock = get_product_meta( $item->ID, 'stock', true );
|
244 |
+
if ( is_numeric( $stock ) )
|
245 |
$stock = absint( $stock );
|
246 |
?>
|
247 |
<input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][stock]" value="<?php echo esc_attr( $stock ); ?>" />
|
258 |
|
259 |
public function column_sale_price( $item ) {
|
260 |
$sale_price = get_product_meta( $item->ID, 'special_price', true );
|
261 |
+
if ( is_numeric( $sale_price ) )
|
262 |
+
$sale_price = wpsc_format_number( $sale_price );
|
263 |
?>
|
264 |
<input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][sale_price]" value="<?php echo esc_attr( $sale_price ); ?>">
|
265 |
<?php
|
wpsc-admin/includes/product-variations-page.class.php
CHANGED
@@ -52,7 +52,10 @@ class WPSC_Product_Variations_Page {
|
|
52 |
update_product_meta( $id, 'price', wpsc_string_to_float( $data['price'] ) );
|
53 |
|
54 |
if ( isset( $data['sale_price'] ) )
|
55 |
-
|
|
|
|
|
|
|
56 |
|
57 |
if ( isset( $data['sku'] ) )
|
58 |
update_product_meta( $id, 'sku', $data['sku'] );
|
52 |
update_product_meta( $id, 'price', wpsc_string_to_float( $data['price'] ) );
|
53 |
|
54 |
if ( isset( $data['sale_price'] ) )
|
55 |
+
if ( is_numeric( $data['sale_price'] ) )
|
56 |
+
update_product_meta( $id, 'special_price', wpsc_string_to_float( $data['sale_price'] ) );
|
57 |
+
else
|
58 |
+
update_product_meta( $id, 'special_price', '' );
|
59 |
|
60 |
if ( isset( $data['sku'] ) )
|
61 |
update_product_meta( $id, 'sku', $data['sku'] );
|
wpsc-admin/includes/purchase-logs-page/item-details.php
CHANGED
@@ -2,8 +2,9 @@
|
|
2 |
<div id="icon-users" class="icon32"><br/></div>
|
3 |
<h2>
|
4 |
<?php esc_html_e( 'Sales Log Details', 'wpsc' ); ?>
|
5 |
-
<span class="subtitle">#<?php echo $this->log_id; ?></span>
|
6 |
-
|
|
|
7 |
<?php if ( $receipt_sent ): ?>
|
8 |
<div class="updated">
|
9 |
<p><?php esc_html_e( 'Receipt has been resent successfully.', 'wpsc' ); ?></p>
|
@@ -18,43 +19,52 @@
|
|
18 |
<?php if ( wpsc_has_purchlog_shipping() ): ?>
|
19 |
<div id='wpsc_shipping_details_box'>
|
20 |
<h3><?php esc_html_e( 'Shipping Details', 'wpsc' ); ?></h3>
|
21 |
-
<
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<p>
|
24 |
-
<?php echo
|
25 |
-
<?php echo wpsc_display_purchlog_shipping_city(); ?><br />
|
26 |
-
<?php echo wpsc_display_purchlog_shipping_state_and_postcode(); ?><br />
|
27 |
-
<?php echo wpsc_display_purchlog_shipping_country(); ?><br />
|
28 |
</p>
|
29 |
-
<h4><?php esc_html_e( 'Shipping Options', 'wpsc' ); ?></h4>
|
30 |
<p>
|
31 |
-
<?php esc_html_e( 'Shipping
|
32 |
-
|
33 |
-
|
|
|
34 |
<?php echo esc_html_x( 'Tracking ID:', 'purchase log', 'wpsc' ); ?> <?php echo wpsc_purchlogitem_trackid(); ?><br />
|
35 |
<?php esc_html_e( 'Shipping Status:', 'wpsc' ); ?> <?php echo wpsc_purchlogitem_trackstatus(); ?><br />
|
36 |
<?php esc_html_e( 'Track History:', 'wpsc' ); ?> <?php echo wpsc_purchlogitem_trackhistory(); ?>
|
37 |
-
|
38 |
-
|
39 |
</div>
|
40 |
<?php endif ?>
|
41 |
|
42 |
<div id='wpsc_billing_details_box'>
|
43 |
<?php do_action( 'wpsc_billing_details_top' ); ?>
|
44 |
<h3><?php esc_html_e( 'Billing Details', 'wpsc' ); ?></h3>
|
45 |
-
<
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
<p>
|
49 |
-
<strong><?php esc_html_e( '
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
<?php echo wpsc_display_purchlog_buyers_country(); ?><br />
|
54 |
</p>
|
55 |
-
|
56 |
-
<p><strong><?php esc_html_e( 'Phone:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_buyers_phone(); ?></p>
|
57 |
-
<p><strong><?php esc_html_e( 'Email:', 'wpsc' ); ?> </strong><a href="mailto:<?php echo wpsc_display_purchlog_buyers_email(); ?>?subject=<?php echo rawurlencode( sprintf( __( 'Message from %s', 'wpsc' ), site_url() ) ); ?>"><?php echo wpsc_display_purchlog_buyers_email(); ?></a></p>
|
58 |
<p><strong><?php esc_html_e( 'Payment Method:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_paymentmethod(); ?></p>
|
59 |
<?php if(wpsc_display_purchlog_display_howtheyfoundus()) : ?>
|
60 |
<p><strong><?php esc_html_e( 'How User Found Us:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_howtheyfoundus(); ?></p>
|
@@ -80,26 +90,26 @@
|
|
80 |
<?php esc_html_e( 'Coupon Code', 'wpsc' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
|
81 |
<?php endif; ?>
|
82 |
</td>
|
83 |
-
<th><?php esc_html_e( 'Discount', 'wpsc' ); ?> </th>
|
84 |
<td><?php echo wpsc_display_purchlog_discount(); ?></td>
|
85 |
</tr>
|
86 |
|
87 |
<?php if( ! wpec_display_product_tax() ): ?>
|
88 |
<tr>
|
89 |
<td colspan='<?php echo $cols; ?>'></td>
|
90 |
-
<th><?php esc_html_e( 'Taxes', 'wpsc' ); ?> </th>
|
91 |
<td><?php echo wpsc_display_purchlog_taxes(); ?></td>
|
92 |
</tr>
|
93 |
<?php endif; ?>
|
94 |
|
95 |
<tr>
|
96 |
<td colspan='<?php echo $cols; ?>'></td>
|
97 |
-
<th><?php esc_html_e( 'Shipping', 'wpsc' ); ?> </th>
|
98 |
<td><?php echo wpsc_display_purchlog_shipping(); ?></td>
|
99 |
</tr>
|
100 |
<tr>
|
101 |
<td colspan='<?php echo $cols; ?>'></td>
|
102 |
-
<th><?php esc_html_e( 'Total', 'wpsc' ); ?> </th>
|
103 |
<td><?php echo wpsc_display_purchlog_totalprice(); ?></td>
|
104 |
</tr>
|
105 |
</tbody>
|
@@ -117,12 +127,12 @@
|
|
117 |
<input type='hidden' name='purchlog_id' value='<?php echo $this->log_id; ?>' />
|
118 |
<p>
|
119 |
<textarea name="purchlog_notes" rows="3" wrap="virtual" id="purchlog_notes" style="width:100%;"><?php
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
</p>
|
127 |
<p><input class="button" type="submit" name="button" id="button" value="<?php _e( 'Update Notes', 'wpsc' ); ?>" /></p>
|
128 |
</form>
|
2 |
<div id="icon-users" class="icon32"><br/></div>
|
3 |
<h2>
|
4 |
<?php esc_html_e( 'Sales Log Details', 'wpsc' ); ?>
|
5 |
+
<span class="subtitle">#<?php echo $this->log_id; ?> – <?php echo wpsc_purchaselog_details_date_time(); ?></span>
|
6 |
+
<?php $this->purchase_logs_pagination() ?>
|
7 |
+
</h2>
|
8 |
<?php if ( $receipt_sent ): ?>
|
9 |
<div class="updated">
|
10 |
<p><?php esc_html_e( 'Receipt has been resent successfully.', 'wpsc' ); ?></p>
|
19 |
<?php if ( wpsc_has_purchlog_shipping() ): ?>
|
20 |
<div id='wpsc_shipping_details_box'>
|
21 |
<h3><?php esc_html_e( 'Shipping Details', 'wpsc' ); ?></h3>
|
22 |
+
<blockquote>
|
23 |
+
<strong>
|
24 |
+
<?php echo ( wpsc_display_purchlog_shipping_name() != "" ) ? wpsc_display_purchlog_shipping_name() . "<br />" : '<span class="field-blank">' . __( 'Anonymous', 'wpsc' ) . '</span>' ; ?>
|
25 |
+
</strong>
|
26 |
+
<?php echo ( wpsc_display_purchlog_shipping_address() != "" ) ? wpsc_display_purchlog_shipping_address() . "<br />" : '' ; ?>
|
27 |
+
<?php echo ( wpsc_display_purchlog_shipping_city() != "" ) ? wpsc_display_purchlog_shipping_city() . "<br />" : '' ; ?>
|
28 |
+
<?php echo ( wpsc_display_purchlog_shipping_state_and_postcode() != "" ) ? wpsc_display_purchlog_shipping_state_and_postcode() . "<br />" : '' ; ?>
|
29 |
+
<?php echo ( wpsc_display_purchlog_shipping_country() != "" ) ? wpsc_display_purchlog_shipping_country() . "<br />" : '<span class="field-blank">' . __( 'Country not specified', 'wpsc' ) . '</span>' ; ?>
|
30 |
+
</blockquote>
|
31 |
+
<h4><?php esc_html_e( 'Shipping Details', 'wpsc' ); ?></h4>
|
32 |
<p>
|
33 |
+
<?php esc_html_e( 'Shipping Method:', 'wpsc' ); ?> <?php echo wpsc_display_purchlog_shipping_method(); ?>
|
|
|
|
|
|
|
34 |
</p>
|
|
|
35 |
<p>
|
36 |
+
<?php esc_html_e( 'Shipping Option:', 'wpsc' ); ?> <?php echo wpsc_display_purchlog_shipping_option(); ?>
|
37 |
+
</p>
|
38 |
+
<?php if( wpsc_purchlogs_has_tracking() ) : ?>
|
39 |
+
<p>
|
40 |
<?php echo esc_html_x( 'Tracking ID:', 'purchase log', 'wpsc' ); ?> <?php echo wpsc_purchlogitem_trackid(); ?><br />
|
41 |
<?php esc_html_e( 'Shipping Status:', 'wpsc' ); ?> <?php echo wpsc_purchlogitem_trackstatus(); ?><br />
|
42 |
<?php esc_html_e( 'Track History:', 'wpsc' ); ?> <?php echo wpsc_purchlogitem_trackhistory(); ?>
|
43 |
+
</p>
|
44 |
+
<?php endif; ?>
|
45 |
</div>
|
46 |
<?php endif ?>
|
47 |
|
48 |
<div id='wpsc_billing_details_box'>
|
49 |
<?php do_action( 'wpsc_billing_details_top' ); ?>
|
50 |
<h3><?php esc_html_e( 'Billing Details', 'wpsc' ); ?></h3>
|
51 |
+
<blockquote>
|
52 |
+
<strong>
|
53 |
+
<?php echo ( wpsc_display_purchlog_buyers_name() != "" ) ? wpsc_display_purchlog_buyers_name() . "<br />" : '<span class="field-blank">' . __( 'Anonymous', 'wpsc' ) . '</span>' ; ?>
|
54 |
+
</strong>
|
55 |
+
<?php echo ( wpsc_display_purchlog_buyers_address() != "" ) ? wpsc_display_purchlog_buyers_address() . "<br />" : '' ; ?>
|
56 |
+
<?php echo ( wpsc_display_purchlog_buyers_city() != "" ) ? wpsc_display_purchlog_buyers_city() . "<br />" : '' ; ?>
|
57 |
+
<?php echo ( wpsc_display_purchlog_buyers_state_and_postcode() != "" ) ? wpsc_display_purchlog_buyers_state_and_postcode() . "<br />" : '' ; ?>
|
58 |
+
<?php echo ( wpsc_display_purchlog_buyers_country() != "" ) ? wpsc_display_purchlog_buyers_country() . "<br />" : '<span class="field-blank">' . __( 'Country not specified', 'wpsc' ) . '</span>' ; ?>
|
59 |
+
</blockquote>
|
60 |
+
<h4><?php esc_html_e( 'Payment Details', 'wpsc' ); ?></h4>
|
61 |
+
<p><strong><?php esc_html_e( 'Phone:', 'wpsc' ); ?> </strong><?php echo ( wpsc_display_purchlog_buyers_phone() != "" ) ? wpsc_display_purchlog_buyers_phone() : __( '<em class="field-blank">not provided</em>', 'wpsc' ); ?></p>
|
62 |
<p>
|
63 |
+
<strong><?php esc_html_e( 'Email:', 'wpsc' ); ?> </strong>
|
64 |
+
<a href="mailto:<?php echo wpsc_display_purchlog_buyers_email(); ?>?subject=<?php echo rawurlencode( sprintf( __( 'Message from %s', 'wpsc' ), site_url() ) ); ?>">
|
65 |
+
<?php echo ( wpsc_display_purchlog_buyers_email() != "" ) ? wpsc_display_purchlog_buyers_email() : __( '<em class="field-blank">not provided</em>', 'wpsc' ); ?>
|
66 |
+
</a>
|
|
|
67 |
</p>
|
|
|
|
|
|
|
68 |
<p><strong><?php esc_html_e( 'Payment Method:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_paymentmethod(); ?></p>
|
69 |
<?php if(wpsc_display_purchlog_display_howtheyfoundus()) : ?>
|
70 |
<p><strong><?php esc_html_e( 'How User Found Us:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_howtheyfoundus(); ?></p>
|
90 |
<?php esc_html_e( 'Coupon Code', 'wpsc' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
|
91 |
<?php endif; ?>
|
92 |
</td>
|
93 |
+
<th class='right-col'><?php esc_html_e( 'Discount', 'wpsc' ); ?> </th>
|
94 |
<td><?php echo wpsc_display_purchlog_discount(); ?></td>
|
95 |
</tr>
|
96 |
|
97 |
<?php if( ! wpec_display_product_tax() ): ?>
|
98 |
<tr>
|
99 |
<td colspan='<?php echo $cols; ?>'></td>
|
100 |
+
<th class='right-col'><?php esc_html_e( 'Taxes', 'wpsc' ); ?> </th>
|
101 |
<td><?php echo wpsc_display_purchlog_taxes(); ?></td>
|
102 |
</tr>
|
103 |
<?php endif; ?>
|
104 |
|
105 |
<tr>
|
106 |
<td colspan='<?php echo $cols; ?>'></td>
|
107 |
+
<th class='right-col'><?php esc_html_e( 'Shipping', 'wpsc' ); ?> </th>
|
108 |
<td><?php echo wpsc_display_purchlog_shipping(); ?></td>
|
109 |
</tr>
|
110 |
<tr>
|
111 |
<td colspan='<?php echo $cols; ?>'></td>
|
112 |
+
<th class='right-col'><?php esc_html_e( 'Total', 'wpsc' ); ?> </th>
|
113 |
<td><?php echo wpsc_display_purchlog_totalprice(); ?></td>
|
114 |
</tr>
|
115 |
</tbody>
|
127 |
<input type='hidden' name='purchlog_id' value='<?php echo $this->log_id; ?>' />
|
128 |
<p>
|
129 |
<textarea name="purchlog_notes" rows="3" wrap="virtual" id="purchlog_notes" style="width:100%;"><?php
|
130 |
+
if ( isset( $_POST['purchlog_notes'] ) ) {
|
131 |
+
echo esc_textarea( stripslashes( $_POST['purchlog_notes'] ) );
|
132 |
+
} else {
|
133 |
+
echo wpsc_display_purchlog_notes();
|
134 |
+
}
|
135 |
+
?></textarea>
|
136 |
</p>
|
137 |
<p><input class="button" type="submit" name="button" id="button" value="<?php _e( 'Update Notes', 'wpsc' ); ?>" /></p>
|
138 |
</form>
|
wpsc-admin/includes/save-data.functions.php
CHANGED
@@ -160,9 +160,9 @@ function wpsc_admin_category_forms_add() {
|
|
160 |
</td>
|
161 |
<td>
|
162 |
<select name='display_type'>
|
163 |
-
<option value='default'<?php
|
164 |
-
<option value='list'<?php disabled( _wpsc_is_display_type_supported( 'list' ), false ); ?><?php
|
165 |
-
<option value='grid'<?php disabled( _wpsc_is_display_type_supported( 'grid' ), false ); ?><?php
|
166 |
</select><br /><br />
|
167 |
</td>
|
168 |
</tr>
|
@@ -333,9 +333,9 @@ function wpsc_admin_category_forms_edit() {
|
|
333 |
$display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
|
334 |
?>
|
335 |
<select name='display_type'>
|
336 |
-
<option value='default'<?php
|
337 |
-
<option value='list'<?php disabled( _wpsc_is_display_type_supported( 'list' ), false ); ?><?php
|
338 |
-
<option value='grid' <?php disabled( _wpsc_is_display_type_supported( 'grid' ), false ); ?><?php
|
339 |
</select><br />
|
340 |
<span class="description"><?php esc_html_e( 'To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc' ); ?></span>
|
341 |
</td>
|
160 |
</td>
|
161 |
<td>
|
162 |
<select name='display_type'>
|
163 |
+
<option value='default'<?php selected( $display_type, 'default' ); ?>><?php esc_html_e('Default View', 'wpsc'); ?></option>
|
164 |
+
<option value='list'<?php disabled( _wpsc_is_display_type_supported( 'list' ), false ); ?><?php selected( $display_type, 'list' ); ?>><?php esc_html_e('List View', 'wpsc'); ?></option>
|
165 |
+
<option value='grid'<?php disabled( _wpsc_is_display_type_supported( 'grid' ), false ); ?><?php selected( $display_type, 'grid' ); ?>><?php esc_html_e('Grid View', 'wpsc'); ?></option>
|
166 |
</select><br /><br />
|
167 |
</td>
|
168 |
</tr>
|
333 |
$display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
|
334 |
?>
|
335 |
<select name='display_type'>
|
336 |
+
<option value='default'<?php selected( $display_type, 'default' ); ?>><?php esc_html_e( 'Default View', 'wpsc' ); ?></option>
|
337 |
+
<option value='list'<?php disabled( _wpsc_is_display_type_supported( 'list' ), false ); ?><?php selected( $display_type, 'list' ); ?>><?php esc_html_e('List View', 'wpsc'); ?></option>
|
338 |
+
<option value='grid' <?php disabled( _wpsc_is_display_type_supported( 'grid' ), false ); ?><?php selected( $display_type, 'grid' ); ?>><?php esc_html_e( 'Grid View', 'wpsc' ); ?></option>
|
339 |
</select><br />
|
340 |
<span class="description"><?php esc_html_e( 'To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc' ); ?></span>
|
341 |
</td>
|
wpsc-admin/includes/settings-tabs/gateway.php
CHANGED
@@ -5,9 +5,11 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
|
|
5 |
private $gateway_names;
|
6 |
|
7 |
public function __construct() {
|
8 |
-
if ( isset( $_REQUEST['payment_gateway_id'] ) )
|
9 |
update_user_option( get_current_user_id(), 'wpsc_settings_selected_payment_gateway', $_REQUEST['payment_gateway_id'] );
|
10 |
-
|
|
|
|
|
11 |
$this->active_gateways = get_option( 'custom_gateway_options' );
|
12 |
$this->gateway_names = get_option( 'payment_gateway_names' );
|
13 |
|
@@ -20,19 +22,19 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
|
|
20 |
|
21 |
private function get_gateway_settings_url( $gateway ) {
|
22 |
$location = isset( $_REQUEST['current_url'] ) ? $_REQUEST['current_url'] : $_SERVER['REQUEST_URI'];
|
23 |
-
$
|
|
|
|
|
24 |
'tab' => 'gateway',
|
25 |
'page' => 'wpsc-settings',
|
26 |
-
'payment_gateway_id' => $gateway
|
27 |
), $location );
|
28 |
-
return $location;
|
29 |
}
|
30 |
|
31 |
-
public function display_payment_gateway_settings_form() {
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
$payment_data = $this->get_gateway_form( $selected_gateway );
|
37 |
if ( ! $payment_data ) {
|
38 |
$payment_data = array(
|
@@ -41,83 +43,113 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
|
|
41 |
'has_submit_button' => 1,
|
42 |
);
|
43 |
}
|
|
|
44 |
?>
|
45 |
-
<
|
46 |
-
<div class='postbox'>
|
47 |
-
<h3 class='hndle'><?php echo $payment_data['name']; ?></h3>
|
48 |
-
<div class='inside'>
|
49 |
<table class='form-table'>
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
</table>
|
52 |
-
<?php if ( empty( $payment_data['has_submit_button'] ) ) : ?>
|
53 |
-
<?php submit_button( __( 'Save Changes' ) ); ?>
|
54 |
-
<?php endif ?>
|
55 |
</div>
|
56 |
-
</td>
|
57 |
<?php
|
58 |
}
|
59 |
|
60 |
public function display() {
|
61 |
global $wpdb, $nzshpcrt_gateways;
|
62 |
-
if ( empty( $nzshpcrt_gateways ) )
|
63 |
-
$nzshpcrt_gateways = nzshpcrt_get_gateways();
|
64 |
?>
|
65 |
|
66 |
-
<
|
67 |
-
|
|
|
|
|
|
|
68 |
<tr>
|
69 |
-
<
|
70 |
-
|
71 |
-
|
72 |
-
<div class='inside'>
|
73 |
-
<p><?php _e( 'Activate the payment gateways that you want to make available to your customers by selecting them below.', 'wpsc' ); ?></p>
|
74 |
-
<br />
|
75 |
-
<?php $this->gateway_list(); ?>
|
76 |
-
<?php submit_button( __( 'Save Changes' ) ); ?>
|
77 |
-
</div>
|
78 |
-
</div>
|
79 |
-
|
80 |
-
<h4><?php _e( 'We Recommend', 'wpsc' ); ?></h4>
|
81 |
-
<a style="border-bottom:none;" href="https://www.paypal.com/nz/mrb/pal=LENKCHY6CU2VY" target="_blank"><img src="<?php echo WPSC_CORE_IMAGES_URL; ?>/paypal-referal.gif" border="0" alt="<?php esc_attr_e( 'Sign up for PayPal and start accepting credit card payments instantly.', 'wpsc' ); ?>" /></a> <br /><br />
|
82 |
-
<a style="border-bottom:none;" href="http://checkout.google.com/sell/?promo=seinstinct" target="_blank"><img src="https://checkout.google.com/buyer/images/google_checkout.gif" border="0" alt="<?php esc_attr_e( 'Sign up for Google Checkout', 'wpsc' ); ?>" /></a>
|
83 |
-
|
84 |
-
</td>
|
85 |
-
|
86 |
-
<?php $this->display_payment_gateway_settings_form(); ?>
|
87 |
</tr>
|
88 |
-
</
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
<?php
|
92 |
}
|
93 |
|
94 |
-
private function gateway_list_item( $gateway ) {
|
95 |
$checked = in_array( $gateway['id'], $this->active_gateways );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
?>
|
97 |
-
<
|
98 |
-
<
|
99 |
-
<
|
100 |
-
<a class='edit-payment-module' data-gateway-id="<?php echo esc_attr( $gateway['id'] ); ?>" title="<?php esc_attr_e( "Edit this Payment Gateway's Settings", 'wpsc' ) ?>" href='<?php echo esc_url( $this->get_gateway_settings_url( $gateway['id'] ) ); ?>'><?php esc_html_e( 'Edit', 'wpsc' ); ?></a>
|
101 |
-
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
|
102 |
-
</span>
|
103 |
-
</div>
|
104 |
-
<p>
|
105 |
<input name='wpsc_options[custom_gateway_options][]' <?php checked( $checked ); ?> type='checkbox' value='<?php echo esc_attr( $gateway['id'] ); ?>' id='<?php echo esc_attr( $gateway['id'] ); ?>_id' />
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
<?php
|
110 |
}
|
111 |
|
112 |
private function gateway_list() {
|
113 |
$gateways = apply_filters( 'wpsc_settings_get_gateways', array() );
|
114 |
|
|
|
|
|
115 |
foreach ( $gateways as $gateway ) {
|
116 |
-
$this->gateway_list_item( $gateway );
|
117 |
}
|
118 |
}
|
119 |
|
120 |
public function callback_submit_options() {
|
121 |
do_action( 'wpsc_submit_gateway_options' );
|
122 |
}
|
123 |
-
}
|
5 |
private $gateway_names;
|
6 |
|
7 |
public function __construct() {
|
8 |
+
if ( isset( $_REQUEST['payment_gateway_id'] ) ) {
|
9 |
update_user_option( get_current_user_id(), 'wpsc_settings_selected_payment_gateway', $_REQUEST['payment_gateway_id'] );
|
10 |
+
} else {
|
11 |
+
update_user_option( get_current_user_id(), 'wpsc_settings_selected_payment_gateway', '' );
|
12 |
+
}
|
13 |
$this->active_gateways = get_option( 'custom_gateway_options' );
|
14 |
$this->gateway_names = get_option( 'payment_gateway_names' );
|
15 |
|
22 |
|
23 |
private function get_gateway_settings_url( $gateway ) {
|
24 |
$location = isset( $_REQUEST['current_url'] ) ? $_REQUEST['current_url'] : $_SERVER['REQUEST_URI'];
|
25 |
+
$gateway = ! empty( $gateway ) ? $gateway : '';
|
26 |
+
|
27 |
+
return add_query_arg( array(
|
28 |
'tab' => 'gateway',
|
29 |
'page' => 'wpsc-settings',
|
30 |
+
'payment_gateway_id' => $gateway
|
31 |
), $location );
|
|
|
32 |
}
|
33 |
|
34 |
+
public function display_payment_gateway_settings_form( $selected_gateway = null ) {
|
35 |
+
if ( ! $selected_gateway ) {
|
36 |
+
$selected_gateway = (string) get_user_option( 'wpsc_settings_selected_payment_gateway', get_current_user_id() );
|
37 |
+
}
|
|
|
38 |
$payment_data = $this->get_gateway_form( $selected_gateway );
|
39 |
if ( ! $payment_data ) {
|
40 |
$payment_data = array(
|
43 |
'has_submit_button' => 1,
|
44 |
);
|
45 |
}
|
46 |
+
|
47 |
?>
|
48 |
+
<div id="gateway_settings_<?php echo esc_attr( $selected_gateway ); ?>_form" class='gateway_settings_form'>
|
|
|
|
|
|
|
49 |
<table class='form-table'>
|
50 |
+
<tbody>
|
51 |
+
<?php echo $payment_data['form_fields']; ?>
|
52 |
+
<tr><td colspan="2">
|
53 |
+
<?php // hidden because most gateways provide their own update button. ?>
|
54 |
+
<?php if ( $payment_data['has_submit_button'] !== 1 ) { ?>
|
55 |
+
<p class="submit inline-edit-save">
|
56 |
+
<a class="button edit-payment-module-cancel" title="<?php esc_attr_e( "Cancel editing this Payment Gateway's settings", 'wpsc' ) ?>"><?php esc_html_e( "Cancel", 'wpsc' ); ?></a>
|
57 |
+
<input type="submit" name="submit" class="button button-primary edit-payment-module-update" value='<?php _e( "Update »", 'wpsc' ); ?>'>
|
58 |
+
</p>
|
59 |
+
<?php } ?>
|
60 |
+
</td></tr>
|
61 |
+
</tbody>
|
62 |
</table>
|
|
|
|
|
|
|
63 |
</div>
|
|
|
64 |
<?php
|
65 |
}
|
66 |
|
67 |
public function display() {
|
68 |
global $wpdb, $nzshpcrt_gateways;
|
|
|
|
|
69 |
?>
|
70 |
|
71 |
+
<h3><?php _e( 'Select Payment Gateways', 'wpsc' ); ?></h3>
|
72 |
+
<p><?php _e( 'Activate the payment gateways that you want to make available to your customers by selecting them below.', 'wpsc' ); ?></p>
|
73 |
+
|
74 |
+
<table id='wpsc-payment-gateway-settings' class='wpsc-edit-module-options wp-list-table widefat plugins'>
|
75 |
+
<thead>
|
76 |
<tr>
|
77 |
+
<th scope="col" id="wpsc-gateway-active" class="manage-column"><?php _e( 'Active', 'wpsc' ); ?></th>
|
78 |
+
<th scope="col" id="wpsc-gateway-name" class="manage-column column-name"><?php _e( 'Payment Gateway', 'wpsc' ); ?></th>
|
79 |
+
<th scope="col" id="wpsc-gateway-display-name" class="manage-column column-description"><?php _e( 'Display Name', 'wpsc' ); ?></th>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
</tr>
|
81 |
+
</thead>
|
82 |
+
<tfoot>
|
83 |
+
<tr>
|
84 |
+
<th scope="col" id="wpsc-gateway-active" class="manage-column"><?php _e( 'Active', 'wpsc' ); ?></th>
|
85 |
+
<th scope="col" id="wpsc-gateway-name" class="manage-column column-name"><?php _e( 'Payment Gateway', 'wpsc' ); ?></th>
|
86 |
+
<th scope="col" id="wpsc-gateway-display-name" class="manage-column column-description"><?php _e( 'Display Name', 'wpsc' ); ?></th>
|
87 |
+
</tr>
|
88 |
+
</tfoot>
|
89 |
+
<tbody>
|
90 |
+
<?php $this->gateway_list(); ?>
|
91 |
+
</tbody>
|
92 |
+
</table>
|
93 |
+
<?php submit_button( __( 'Save Changes' ) ); ?>
|
94 |
+
<h4><?php _e( 'WP e-Commerce Recommends', 'wpsc' ); ?></h4>
|
95 |
+
<a style="border-bottom:none;" href="https://www.paypal.com/nz/mrb/pal=LENKCHY6CU2VY" target="_blank"><img src="<?php echo WPSC_CORE_IMAGES_URL; ?>/paypal-referal.gif" border="0" alt="<?php esc_attr_e( 'Sign up for PayPal and start accepting credit card payments instantly.', 'wpsc' ); ?>" /></a>
|
96 |
+
<a style="border-bottom:none;" href="http://checkout.google.com/sell/?promo=seinstinct" target="_blank"><img src="https://checkout.google.com/buyer/images/google_checkout.gif" border="0" alt="<?php esc_attr_e( 'Sign up for Google Checkout', 'wpsc' ); ?>" /></a>
|
97 |
|
98 |
<?php
|
99 |
}
|
100 |
|
101 |
+
private function gateway_list_item( $gateway, $force ) {
|
102 |
$checked = in_array( $gateway['id'], $this->active_gateways );
|
103 |
+
|
104 |
+
$active = $checked ? 'active' : 'inactive';
|
105 |
+
$hidden = $force ? '' : "style='display: none;'";
|
106 |
+
|
107 |
+
$edithidden = $hidden;
|
108 |
+
|
109 |
+
$payment_gateway_names = get_option( 'payment_gateway_names' );
|
110 |
+
$display_name = isset( $payment_gateway_names[ $gateway['id'] ] ) ? $payment_gateway_names[ $gateway['id'] ] : '' ;
|
111 |
+
$gateway_data = false;
|
112 |
?>
|
113 |
+
<tr class="wpsc-select-gateway <?php echo $active; ?>" data-gateway-id="<?php echo esc_attr( $gateway['id'] ); ?>" id="gateway_list_item_<?php echo $gateway['id'];?>">
|
114 |
+
<th scope="row" class="check-column">
|
115 |
+
<label class="screen-reader-text" for="<?php echo esc_attr( $gateway['id'] ); ?>_id"><?php _e( "Select", "wpsc" ); ?> <?php echo esc_html( $gateway['name'] ); ?></label>
|
|
|
|
|
|
|
|
|
|
|
116 |
<input name='wpsc_options[custom_gateway_options][]' <?php checked( $checked ); ?> type='checkbox' value='<?php echo esc_attr( $gateway['id'] ); ?>' id='<?php echo esc_attr( $gateway['id'] ); ?>_id' />
|
117 |
+
</th>
|
118 |
+
<td class="plugin-title">
|
119 |
+
<label for='<?php echo esc_attr( $gateway['id'] ); ?>_id'><strong><?php echo esc_html( $gateway['name'] ); ?></strong></label>
|
120 |
+
<div class="row-actions-visible">
|
121 |
+
<span class="edit">
|
122 |
+
<a class='edit-payment-module' title="<?php esc_attr_e( "Edit this Payment Gateway's Settings", 'wpsc' ) ?>" href='<?php echo esc_url( $this->get_gateway_settings_url( $gateway['id'] ) ); ?>'><?php esc_html_e( 'Settings', 'wpsc' ); ?></a>
|
123 |
+
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
|
124 |
+
</span>
|
125 |
+
</div>
|
126 |
+
</td>
|
127 |
+
<td class="plugin-description">
|
128 |
+
<?php echo esc_html( $display_name ); ?>
|
129 |
+
</td>
|
130 |
+
</tr>
|
131 |
+
<tr id="wpsc_gateway_settings_<?php echo esc_attr( $gateway['id'] ); ?>" data-gateway-id="<?php echo esc_attr( $gateway['id'] ); ?>" class='gateway_settings <?php echo $active; ?>' <?php echo $hidden; ?> >
|
132 |
+
<td colspan="3" id="wpsc_gateway_settings_<?php echo esc_attr( $gateway['id'] ); ?>_container">
|
133 |
+
<?php if ( $force ) {
|
134 |
+
$this->display_payment_gateway_settings_form( $gateway['id'] );
|
135 |
+
} ?>
|
136 |
+
</td>
|
137 |
+
</tr>
|
138 |
+
|
139 |
<?php
|
140 |
}
|
141 |
|
142 |
private function gateway_list() {
|
143 |
$gateways = apply_filters( 'wpsc_settings_get_gateways', array() );
|
144 |
|
145 |
+
$selected_gateway = (string) get_user_option( 'wpsc_settings_selected_payment_gateway', get_current_user_id() );
|
146 |
+
|
147 |
foreach ( $gateways as $gateway ) {
|
148 |
+
$this->gateway_list_item( $gateway, $selected_gateway === $gateway['id'] );
|
149 |
}
|
150 |
}
|
151 |
|
152 |
public function callback_submit_options() {
|
153 |
do_action( 'wpsc_submit_gateway_options' );
|
154 |
}
|
155 |
+
}
|
wpsc-admin/includes/settings-tabs/marketing.php
CHANGED
@@ -20,111 +20,180 @@ class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab {
|
|
20 |
}
|
21 |
|
22 |
public function display() {
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
add_meta_box( 'wpsc_rss_address', __( 'RSS Address', 'wpsc' ), array( $this, 'rss_address_meta_box' ), 'wpsc' );
|
28 |
-
add_meta_box( 'wpsc_google_merch_center', __( 'Google Merchant Centre / Google Product Search', 'wpsc' ), array( $this, 'google_merch_center_meta_box' ), 'wpsc' );
|
29 |
-
add_meta_box( 'wpsc_google_analytics_integration', __( 'Google Analytics', 'wpsc' ), array( $this, 'google_analytics_integration' ), 'wpsc' );
|
30 |
-
|
31 |
-
do_meta_boxes( 'wpsc', 'advanced', null );
|
32 |
-
?>
|
33 |
-
|
34 |
-
</div>
|
35 |
-
<?php
|
36 |
}
|
37 |
|
38 |
-
public function
|
39 |
-
?>
|
40 |
-
<input type='hidden' name='change-settings' value='true' />
|
41 |
-
<p>
|
42 |
-
<span class='input_label'><?php _e( 'Disable Google Analytics tracking', 'wpsc' ); ?></span>
|
43 |
-
<input value='1' <?php checked( '1', get_option( 'wpsc_ga_disable_tracking' ) ); ?> type='checkbox' name='wpsc_ga_disable_tracking' />
|
44 |
-
<span class='description'><?php _e( 'If, for whatever reason, you decide you do not want any tracking, disable it.', 'wpsc' ); ?></span>
|
45 |
-
</p><br />
|
46 |
-
<p class="wpsc_ga_currently_tracking">
|
47 |
-
<span class='input_label'><?php _e( 'Currently tracking Google Analytics', 'wpsc' ); ?></span>
|
48 |
-
<input value='1' <?php checked( '1', get_option( 'wpsc_ga_currently_tracking' ) ); ?> type='checkbox' name='wpsc_ga_currently_tracking' />
|
49 |
-
<span class='description'><?php _e( 'If you have already manually placed your Google Analytics tracking code in your theme, or have another plugin handling it, check this box.', 'wpsc' ); ?></span>
|
50 |
-
</p><br />
|
51 |
-
<p class="wpsc_ga_advanced">
|
52 |
-
<span class='input_label'><?php _e( 'Advanced', 'wpsc' ); ?></span>
|
53 |
-
<input value='1' <?php checked( '1', get_option( 'wpsc_ga_advanced' ) ); ?> type='checkbox' name='wpsc_ga_advanced' /><br />
|
54 |
-
<span class='description'><?php _e( 'By default, we insert the multiple-domain asynchronous tracking code. This should be fine for 99% of users. If you need to fine-tune it, select the Advanced option. Then, instead of simply entering your tracking ID, you will enter the enter tracking code from Google Analytics into the header.php file of your theme.', 'wpsc' ); ?></span>
|
55 |
-
</p><br />
|
56 |
-
<p class='wpsc_ga_tracking_id'>
|
57 |
-
<span class='input_label'><?php _ex( 'Tracking ID', 'google analytics', 'wpsc' ); ?></span>
|
58 |
-
<input value="<?php echo esc_attr( get_option( 'wpsc_ga_tracking_id' ) ); ?>" type='text' name='wpsc_ga_tracking_id' />
|
59 |
-
<span class='description'><?php _e( 'Enter your tracking ID here.', 'wpsc' ); ?></span>
|
60 |
-
</p><br />
|
61 |
-
<?php
|
62 |
-
}
|
63 |
-
|
64 |
-
public function marketing_meta_box() {
|
65 |
|
66 |
$wpsc_also_bought = get_option( 'wpsc_also_bought' );
|
67 |
$wpsc_also_bought1 = '';
|
68 |
|
69 |
if ( '1' == $wpsc_also_bought )
|
70 |
-
$wpsc_also_bought1 = "checked
|
71 |
|
72 |
$wpsc_share_this = get_option( 'wpsc_share_this' );
|
73 |
$wpsc_share_this1 = '';
|
74 |
|
75 |
if ( '1' == $wpsc_share_this )
|
76 |
-
$wpsc_share_this1 = "checked
|
77 |
|
78 |
$facebook_like = get_option( 'wpsc_facebook_like' );
|
79 |
$facebook_like1 = '';
|
80 |
if ( 'on' == $facebook_like )
|
81 |
-
$facebook_like1 = "checked
|
82 |
|
83 |
$display_find_us = get_option( 'display_find_us' );
|
84 |
$display_find_us1 = '';
|
85 |
|
86 |
if ( '1' == $display_find_us )
|
87 |
-
$display_find_us1 = "checked
|
88 |
-
<input type='hidden' name='change-settings' value='true' />
|
89 |
-
<p>
|
90 |
-
<span class='input_label'><?php esc_html_e( 'Display Cross Sales', 'wpsc' ); ?></span>
|
91 |
-
<input <?php echo $wpsc_also_bought1; ?> type='checkbox' name='wpsc_also_bought' />
|
92 |
-
<span class='description'><?php esc_html_e( 'Adds the \'Users who bought this also bought\' item to the single products page.', 'wpsc' ); ?></span>
|
93 |
-
</p><br />
|
94 |
-
<p>
|
95 |
-
<span class='input_label'><?php esc_html_e( 'Show Share This (Social Bookmarks)', 'wpsc' ); ?></span>
|
96 |
-
<input <?php echo $wpsc_share_this1; ?> type='checkbox' name='wpsc_share_this' />
|
97 |
-
<span class='description'> <?php esc_html_e( 'Adds the \'Share this link\' item to the single products page.', 'wpsc' ); ?></span>
|
98 |
-
</p><br />
|
99 |
-
<p>
|
100 |
-
<span class='input_label'> <?php esc_html_e( 'Display How Customer Found Us Survey', 'wpsc' ) ?></span>
|
101 |
-
<input <?php echo $display_find_us1; ?> type='checkbox' name='display_find_us' />
|
102 |
-
<span class='description'> <?php esc_html_e( 'Adds the \'How did you find out about us\' drop-down option at checkout.', 'wpsc' ) ?></span>
|
103 |
-
</p><br />
|
104 |
-
<p>
|
105 |
-
<span class='input_label'> <?php esc_html_e( 'Display Facebook Like', 'wpsc' ) ?></span>
|
106 |
-
<input type='hidden' value='0' name='wpsc_options[wpsc_facebook_like]' />
|
107 |
-
<input <?php echo $facebook_like1; ?> type='checkbox' name='wpsc_options[wpsc_facebook_like]' />
|
108 |
-
<span class='description'> <?php esc_html_e( 'Adds the Facebook Like button on your single products page.', 'wpsc' ) ?></span>
|
109 |
-
</p><br />
|
110 |
-
<?php
|
111 |
-
}
|
112 |
|
113 |
-
public function rss_address_meta_box() {
|
114 |
?>
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
<?php
|
118 |
}
|
119 |
|
120 |
-
function
|
121 |
?>
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
<?php
|
129 |
}
|
|
|
130 |
}
|
20 |
}
|
21 |
|
22 |
public function display() {
|
23 |
+
$this->marketing_settings_form();
|
24 |
+
$this->rss_address_settings_form();
|
25 |
+
$this->google_merch_center_settings_form();
|
26 |
+
$this->google_analytics_integration_settings_form();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
+
public function marketing_settings_form() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
$wpsc_also_bought = get_option( 'wpsc_also_bought' );
|
32 |
$wpsc_also_bought1 = '';
|
33 |
|
34 |
if ( '1' == $wpsc_also_bought )
|
35 |
+
$wpsc_also_bought1 = "checked='checked'";
|
36 |
|
37 |
$wpsc_share_this = get_option( 'wpsc_share_this' );
|
38 |
$wpsc_share_this1 = '';
|
39 |
|
40 |
if ( '1' == $wpsc_share_this )
|
41 |
+
$wpsc_share_this1 = "checked='checked'";
|
42 |
|
43 |
$facebook_like = get_option( 'wpsc_facebook_like' );
|
44 |
$facebook_like1 = '';
|
45 |
if ( 'on' == $facebook_like )
|
46 |
+
$facebook_like1 = "checked='checked'";
|
47 |
|
48 |
$display_find_us = get_option( 'display_find_us' );
|
49 |
$display_find_us1 = '';
|
50 |
|
51 |
if ( '1' == $display_find_us )
|
52 |
+
$display_find_us1 = "checked='checked'";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
|
|
54 |
?>
|
55 |
+
|
56 |
+
<h3><?php esc_html_e( 'Marketing Settings', 'wpsc'); ?></h3>
|
57 |
+
<table class='form-table'>
|
58 |
+
<tr>
|
59 |
+
<th>
|
60 |
+
<?php esc_html_e( "'Users who bought this also bought'", 'wpsc' ); ?>
|
61 |
+
</th>
|
62 |
+
<td>
|
63 |
+
<label>
|
64 |
+
<input <?php echo $wpsc_also_bought1; ?> type='checkbox' name='wpsc_also_bought' />
|
65 |
+
<?php esc_html_e( "Add 'Users who bought this also bought' item to the single products page.", 'wpsc' ); ?>
|
66 |
+
</label>
|
67 |
+
</td>
|
68 |
+
</tr>
|
69 |
+
<tr>
|
70 |
+
<th>
|
71 |
+
<?php esc_html_e( "'Share This' Social Bookmarks", 'wpsc' ); ?>
|
72 |
+
</th>
|
73 |
+
<td>
|
74 |
+
<label>
|
75 |
+
<input <?php echo $wpsc_share_this1; ?> type='checkbox' name='wpsc_share_this' />
|
76 |
+
<?php esc_html_e( 'Add the \'Share this link\' item to the single products page.', 'wpsc' ); ?>
|
77 |
+
</label>
|
78 |
+
</td>
|
79 |
+
</tr>
|
80 |
+
<tr>
|
81 |
+
<th>
|
82 |
+
<?php esc_html_e( "'How Customer Found Us' Survey", 'wpsc' ) ?>
|
83 |
+
</th>
|
84 |
+
<td>
|
85 |
+
<label>
|
86 |
+
<input <?php echo $display_find_us1; ?> type='checkbox' name='display_find_us' />
|
87 |
+
<?php esc_html_e( 'Add the \'How did you find out about us\' drop-down option at checkout.', 'wpsc' ); ?>
|
88 |
+
</label>
|
89 |
+
</td>
|
90 |
+
</tr>
|
91 |
+
<tr>
|
92 |
+
<th>
|
93 |
+
<?php esc_html_e( "Facebook 'Like' Button", 'wpsc' ) ?>
|
94 |
+
</th>
|
95 |
+
<td>
|
96 |
+
<input type='hidden' value='0' name='wpsc_options[wpsc_facebook_like]' />
|
97 |
+
<input <?php echo $facebook_like1; ?> type='checkbox' name='wpsc_options[wpsc_facebook_like]' />
|
98 |
+
<?php esc_html_e( 'Add the Facebook Like button on your single products page.', 'wpsc' ); ?>
|
99 |
+
</td>
|
100 |
+
</tr>
|
101 |
+
</table>
|
102 |
<?php
|
103 |
}
|
104 |
|
105 |
+
public function rss_address_settings_form() {
|
106 |
?>
|
107 |
+
<h3><?php esc_html_e( 'Product RSS Address', 'wpsc'); ?></h3>
|
108 |
+
<p><?php esc_html_e( 'People can use this RSS feed to keep up to date with your product list.', 'wpsc' ); ?></p>
|
109 |
+
|
110 |
+
<table class='form-table'>
|
111 |
+
<tr>
|
112 |
+
<th>
|
113 |
+
<?php esc_html_e( 'RSS Feed Address', 'wpsc' ); ?>
|
114 |
+
</th>
|
115 |
+
<td>
|
116 |
+
<?php $rss_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list' ), home_url( '/' ) ); ?>
|
117 |
+
<a href="<?php echo esc_url( $rss_url ); ?>"><code><?php echo esc_url( $rss_url ); ?></code></a>
|
118 |
+
</td>
|
119 |
+
</tr>
|
120 |
+
</table>
|
121 |
+
<?php
|
122 |
+
}
|
123 |
|
124 |
+
public function google_merch_center_settings_form() {
|
125 |
+
?>
|
126 |
+
<h3><?php esc_html_e( 'Google Merchant Centre / Google Product Search', 'wpsc'); ?></h3>
|
127 |
+
<p><?php printf( __( 'To import your products into <a href="%s" target="_blank">Google Merchant Centre</a> so that they appear within Google Product Search results, sign up for a Google Merchant Centre account and add a scheduled data feed with the following URL:', 'wpsc' ), 'http://www.google.com/merchants/' ); ?></p>
|
128 |
+
|
129 |
+
<table class='form-table'>
|
130 |
+
<tr>
|
131 |
+
<th>
|
132 |
+
<?php esc_html_e( 'Google Product Feed', 'wpsc' ); ?>
|
133 |
+
</th>
|
134 |
+
<td>
|
135 |
+
<?php $google_feed_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list', 'xmlformat' => 'google' ), home_url( '/' ) ); ?>
|
136 |
+
<a href="<?php echo esc_url( $google_feed_url ); ?>"><code><?php echo esc_url( $google_feed_url ); ?></code></a>
|
137 |
+
</td>
|
138 |
+
</tr>
|
139 |
+
</table>
|
140 |
+
<?php
|
141 |
+
}
|
142 |
|
143 |
+
public function google_analytics_integration_settings_form() {
|
144 |
+
?>
|
145 |
+
<h3><?php esc_html_e( 'Google Analytics E-Commerce Tracking', 'wpsc' ); ?></h3>
|
146 |
+
<p><?php printf( __( 'Track successful transactions and items purchased in <a href="%s">Google Analytics</a>.', 'wpsc' ), 'http://www.google.com/analytics/' ); ?></p>
|
147 |
+
<input type='hidden' name='change-settings' value='true' />
|
148 |
+
<table class='form-table'>
|
149 |
+
<tr>
|
150 |
+
<th>
|
151 |
+
<?php _e( 'Enable', 'wpsc' ); ?>
|
152 |
+
</th>
|
153 |
+
<td>
|
154 |
+
<label><?php echo get_option( 'wpsc_ga_disable_tracking' ); ?>
|
155 |
+
<input value='1' type='hidden' name='wpsc_ga_disable_tracking' />
|
156 |
+
<input value='0' <?php checked( '0', get_option( 'wpsc_ga_disable_tracking' ) ); ?> type='checkbox' name='wpsc_ga_disable_tracking' />
|
157 |
+
<?php _e( 'Enable Google Analytics tracking', 'wpsc' ); ?>
|
158 |
+
</label>
|
159 |
+
<p class='description'><?php _e( 'If, for whatever reason, you decide you do not want any tracking, disable it.', 'wpsc' ); ?></p>
|
160 |
+
</td>
|
161 |
+
</tr>
|
162 |
+
<tr>
|
163 |
+
<th>
|
164 |
+
<?php _ex( 'Google Analytics Tracking ID', 'google analytics', 'wpsc' ); ?>
|
165 |
+
</th>
|
166 |
+
<td>
|
167 |
+
<input value="<?php echo esc_attr( get_option( 'wpsc_ga_tracking_id' ) ); ?>" type='text' name='wpsc_ga_tracking_id' />
|
168 |
+
<span class='description'><?php _e( 'e.g. <code>UA-XXXXX-Y</code>', 'wpsc' ); ?></span>
|
169 |
+
</td>
|
170 |
+
</tr>
|
171 |
+
<tr>
|
172 |
+
<th>
|
173 |
+
<?php _e( 'Tracking Code Present', 'wpsc' ); ?>
|
174 |
+
</th>
|
175 |
+
<td>
|
176 |
+
<label>
|
177 |
+
<input value='1' <?php checked( '1', get_option( 'wpsc_ga_currently_tracking' ) ); ?> type='checkbox' name='wpsc_ga_currently_tracking' />
|
178 |
+
<?php _e( 'Google Analytics is tracking my site', 'wpsc' ); ?>
|
179 |
+
</label>
|
180 |
+
<p class='description'><?php printf( __( 'Enable this if the Google Analytics tracking code is already present on your site, e.g. manually placed your in your theme, or managed by another plugin. We will only insert the <a href="%s">E-Commerce tracking events</a> on the transaction results page.', 'wpsc' ), 'https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce'); ?></p>
|
181 |
+
</td>
|
182 |
+
</tr>
|
183 |
+
<tr>
|
184 |
+
<th>
|
185 |
+
<?php _e( 'Advanced Mode', 'wpsc' ); ?>
|
186 |
+
</th>
|
187 |
+
<td>
|
188 |
+
<label>
|
189 |
+
<input value='1' <?php checked( '1', get_option( 'wpsc_ga_advanced' ) ); ?> type='checkbox' name='wpsc_ga_advanced' />
|
190 |
+
<?php _e( 'Enable Advanced Mode', 'wpsc' ); ?>
|
191 |
+
</label>
|
192 |
+
<p class='description'><?php _e( 'By default, we insert the multiple-domain asynchronous tracking code. This should be fine for 99% of users. If you need to fine-tune it, select the Advanced option. Then, instead of simply entering your tracking ID, you will enter the enter tracking code from Google Analytics into the header.php file of your theme.', 'wpsc' ); ?></p>
|
193 |
+
</td>
|
194 |
+
</tr>
|
195 |
+
</table>
|
196 |
<?php
|
197 |
}
|
198 |
+
|
199 |
}
|
wpsc-admin/includes/settings-tabs/shipping.php
CHANGED
@@ -69,7 +69,7 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
|
|
69 |
if ( $found_selected_module ) {
|
70 |
$selected_module = $wpsc_shipping_modules[$selected_module_id];
|
71 |
$title = $selected_module->name;
|
72 |
-
$content = $selected_module->getForm();
|
73 |
$classes[] = 'wpsc-shipping-module-settings-' . $selected_module_id;
|
74 |
} else {
|
75 |
$title = __( 'Edit Shipping Module Settings', 'wpsc' );
|
@@ -328,4 +328,4 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
|
|
328 |
</div>
|
329 |
<?php
|
330 |
}
|
331 |
-
}
|
69 |
if ( $found_selected_module ) {
|
70 |
$selected_module = $wpsc_shipping_modules[$selected_module_id];
|
71 |
$title = $selected_module->name;
|
72 |
+
$content = apply_filters( 'wpsc_shipping_module_settings_form', $selected_module->getForm(), $selected_module );
|
73 |
$classes[] = 'wpsc-shipping-module-settings-' . $selected_module_id;
|
74 |
} else {
|
75 |
$title = __( 'Edit Shipping Module Settings', 'wpsc' );
|
328 |
</div>
|
329 |
<?php
|
330 |
}
|
331 |
+
}
|
wpsc-admin/init.php
CHANGED
@@ -227,12 +227,12 @@ function wpsc_admin_sale_rss() {
|
|
227 |
$output .= "<rss version='2.0'>\n\r";
|
228 |
$output .= " <channel>\n\r";
|
229 |
$output .= " <title>" . _x( 'WP e-Commerce Product Log', 'admin rss product feed', 'wpsc' ) . "</title>\n\r";
|
230 |
-
$output .= " <link>" .
|
231 |
$output .= " <description>" . _x( 'This is the WP e-Commerce Product Log RSS feed', 'admin rss product feed', 'wpsc' ) . "</description>\n\r";
|
232 |
$output .= " <generator>" . _x( 'WP e-Commerce Plugin', 'admin rss product feed', 'wpsc' ) . "</generator>\n\r";
|
233 |
|
234 |
foreach ( (array)$purchase_log as $purchase ) {
|
235 |
-
$purchase_link =
|
236 |
$purchase_title = _x( 'Purchase # %d', 'admin rss product feed', 'wpsc' );
|
237 |
$purchase_title = sprintf( $purchase_title, $purchase['id'] );
|
238 |
$output .= " <item>\n\r";
|
227 |
$output .= "<rss version='2.0'>\n\r";
|
228 |
$output .= " <channel>\n\r";
|
229 |
$output .= " <title>" . _x( 'WP e-Commerce Product Log', 'admin rss product feed', 'wpsc' ) . "</title>\n\r";
|
230 |
+
$output .= " <link>" . admin_url( 'admin.php?page=' . WPSC_DIR_NAME . '/display-log.php' ) . "</link>\n\r";
|
231 |
$output .= " <description>" . _x( 'This is the WP e-Commerce Product Log RSS feed', 'admin rss product feed', 'wpsc' ) . "</description>\n\r";
|
232 |
$output .= " <generator>" . _x( 'WP e-Commerce Plugin', 'admin rss product feed', 'wpsc' ) . "</generator>\n\r";
|
233 |
|
234 |
foreach ( (array)$purchase_log as $purchase ) {
|
235 |
+
$purchase_link = admin_url( 'admin.php?page=' . WPSC_DIR_NAME . '/display-log.php' ) . "&purchaseid=" . $purchase['id'];
|
236 |
$purchase_title = _x( 'Purchase # %d', 'admin rss product feed', 'wpsc' );
|
237 |
$purchase_title = sprintf( $purchase_title, $purchase['id'] );
|
238 |
$output .= " <item>\n\r";
|
wpsc-admin/js/admin.js
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
* Wrapper for $.get. Takes care of the 'wpsc_action' and 'action' data arguments.
|
18 |
*
|
19 |
* @since 3.8.9
|
20 |
-
* @param {object} data
|
21 |
* @param {function} handler Response handler
|
22 |
*/
|
23 |
$.wpsc_get = function(data, handler) {
|
@@ -48,8 +48,8 @@
|
|
48 |
console.log(t.data('events').click);
|
49 |
if (t.data('events'))
|
50 |
submit_handlers = t.data('events').click;
|
51 |
-
t.
|
52 |
-
t.
|
53 |
var form = $(this).parents('form');
|
54 |
if (! validateForm( form ) )
|
55 |
return false;
|
@@ -58,9 +58,9 @@
|
|
58 |
|
59 |
var restore_ajax_submit = function() {
|
60 |
var t = $('#submit');
|
61 |
-
t.
|
62 |
$.each(submit_handlers, function(index, obj) {
|
63 |
-
t.
|
64 |
});
|
65 |
};
|
66 |
|
@@ -78,7 +78,7 @@
|
|
78 |
|
79 |
$('.edit-tags-php form').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');
|
80 |
|
81 |
-
$('[name="image"]').
|
82 |
var t = $(this);
|
83 |
|
84 |
if (t.val())
|
@@ -100,7 +100,7 @@
|
|
100 |
});
|
101 |
}
|
102 |
|
103 |
-
$(document).
|
104 |
var t = $(this);
|
105 |
var post_data = {
|
106 |
'select_product_file[]' : [],
|
@@ -125,11 +125,11 @@
|
|
125 |
find('p:even').removeClass('alt').end().
|
126 |
find('p:odd').addClass('alt');
|
127 |
});
|
128 |
-
|
129 |
});
|
130 |
|
131 |
// delete upload
|
132 |
-
$(document).
|
133 |
var t = $(this),
|
134 |
post_values = {
|
135 |
action : 'delete_file',
|
@@ -185,58 +185,11 @@ jQuery(document).ready(function(){
|
|
185 |
}
|
186 |
});
|
187 |
|
188 |
-
//Animateedit products columns
|
189 |
-
jQuery('.wpsc-separator').livequery(function(){
|
190 |
-
jQuery(this).click(function(){
|
191 |
-
if(jQuery('#wpsc-col-left').css('width') == '20px'){
|
192 |
-
left_col_width = '50%';
|
193 |
-
right_col_width = '48%';
|
194 |
-
|
195 |
-
}else{
|
196 |
-
left_col_width = '20px';
|
197 |
-
right_col_width = '95%';
|
198 |
-
}
|
199 |
-
if(left_col_width == '50%'){
|
200 |
-
jQuery('.tablenav').show();
|
201 |
-
jQuery('#posts-filter').show();
|
202 |
-
}else{
|
203 |
-
jQuery('.tablenav').hide();
|
204 |
-
jQuery('#posts-filter').hide();
|
205 |
-
|
206 |
-
}
|
207 |
-
//jQuery(this).css('background-position','0');
|
208 |
-
jQuery('#wpsc-col-left').animate(
|
209 |
-
{
|
210 |
-
width : left_col_width
|
211 |
-
},
|
212 |
-
50,
|
213 |
-
function(){
|
214 |
-
//On complete
|
215 |
-
|
216 |
-
}
|
217 |
-
);
|
218 |
-
jQuery('#wpsc-col-right').animate(
|
219 |
-
{
|
220 |
-
width : right_col_width
|
221 |
-
},
|
222 |
-
50,
|
223 |
-
function(){
|
224 |
-
//On complete
|
225 |
-
|
226 |
-
}
|
227 |
-
);
|
228 |
-
});
|
229 |
-
|
230 |
-
});
|
231 |
-
|
232 |
//new currency JS in admin product page
|
233 |
-
jQuery('div.new_layer').livequery(function(){
|
234 |
-
jQuery(this).hide();
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
jQuery('a.wpsc_add_new_currency'
|
239 |
-
jQuery(this).click(function(event){
|
240 |
if(firstclick == true){
|
241 |
jQuery('div.new_layer').show();
|
242 |
html = jQuery('div.new_layer').html();
|
@@ -245,76 +198,18 @@ jQuery(document).ready(function(){
|
|
245 |
jQuery('div.new_layer').after('<div>'+html+'</div>');
|
246 |
}
|
247 |
event.preventDefault();
|
248 |
-
});
|
249 |
});
|
|
|
250 |
//delete currency layer in admin product page
|
251 |
-
jQuery('a.wpsc_delete_currency_layer'
|
252 |
-
jQuery(this).click(function(event){
|
253 |
jQuery(this).prev('input').val('');
|
254 |
jQuery(this).prev('select').val('');
|
255 |
jQuery(this).parent('div:first').hide();
|
256 |
event.preventDefault();
|
257 |
-
});
|
258 |
-
});
|
259 |
-
|
260 |
-
//delete currency layer in admin product page
|
261 |
-
jQuery('a.wpsc_mass_resize').livequery(function(){
|
262 |
-
jQuery(this).click(function(event){
|
263 |
-
this_href = jQuery(this).attr('href');
|
264 |
-
parent_element = jQuery(this).parent();
|
265 |
-
extra_parameters = jQuery("input[type='text']", parent_element).serialize();
|
266 |
-
window.location = this_href+"&"+extra_parameters;
|
267 |
-
return false;
|
268 |
-
});
|
269 |
-
});
|
270 |
-
|
271 |
-
jQuery('#wpsc_product_list .wpsc_ie_save').live('click', function(){
|
272 |
-
jQuery(this).parents('tr:first').find('.loading_indicator').css('visibility', 'visible');
|
273 |
-
var id =jQuery(this).parents('tr:first').find('.wpsc_ie_id').val();
|
274 |
-
var title = jQuery(this).parents('tr:first').find('.wpsc_ie_title').val();
|
275 |
-
var weight = jQuery(this).parents('tr:first').find('.wpsc_ie_weight').val();
|
276 |
-
var stock = jQuery(this).parents('tr:first').find('.wpsc_ie_stock').val();
|
277 |
-
var price = jQuery(this).parents('tr:first').find('.wpsc_ie_price').val();
|
278 |
-
var special_price = jQuery(this).parents('tr:first').find('.wpsc_ie_special_price').val();
|
279 |
-
var sku = jQuery(this).parents('tr:first').find('.wpsc_ie_sku').val();
|
280 |
-
//post stuff
|
281 |
-
var data = {
|
282 |
-
action: 'wpsc_ie_save',
|
283 |
-
id: id,
|
284 |
-
title: title,
|
285 |
-
weight: weight,
|
286 |
-
stock: stock,
|
287 |
-
price: price,
|
288 |
-
special_price: special_price,
|
289 |
-
sku: sku
|
290 |
-
};
|
291 |
-
|
292 |
-
jQuery.post(ajaxurl, data, function(response) {
|
293 |
-
response = eval(response);
|
294 |
-
if(response.error){
|
295 |
-
alert(response.error);
|
296 |
-
jQuery('#post-' + response.id + ' a.row-title, #post-' + response.id + ' td > span').show();
|
297 |
-
jQuery('#post-' + response.id + ' td input.wpsc_ie_field, #post-' + response.id + ' td .wpsc_inline_actions').show();
|
298 |
-
jQuery('#post-' + response.id + ' .loading_indicator').css('visibility', 'hidden');
|
299 |
-
}
|
300 |
-
else{
|
301 |
-
jQuery('#post-' + response.id + ' .post-title a.row-title').text(response.title);
|
302 |
-
jQuery('#post-' + response.id + ' .column-weight span').text(response.weight);
|
303 |
-
jQuery('#post-' + response.id + ' .column-stock span').text(response.stock);
|
304 |
-
jQuery('#post-' + response.id + ' .column-SKU span').text(response.sku);
|
305 |
-
|
306 |
-
jQuery('#post-' + response.id + ' .column-price .pricedisplay').html(jQuery(response.price).text());
|
307 |
-
jQuery('#post-' + response.id + ' .column-sale_price .pricedisplay').html(jQuery(response.special_price).text());
|
308 |
-
|
309 |
-
jQuery('#post-' + response.id + ' a.row-title, #post-' + response.id + ' td > span').hide();
|
310 |
-
jQuery('#post-' + response.id + ' td input.wpsc_ie_field, #post-' + response.id + ' td .wpsc_inline_actions').show();
|
311 |
-
jQuery('#post-' + response.id + ' .loading_indicator').css('visibility', 'hidden');
|
312 |
-
}
|
313 |
-
});
|
314 |
});
|
315 |
|
316 |
-
|
317 |
-
|
318 |
jQuery('.inline-edit-password-input').closest('.inline-edit-group').css('display', 'none');
|
319 |
var vcl = jQuery('.inline-edit-col input[name="tax_input[wpsc-variation][]"]').css('display', 'none');
|
320 |
vcl.each(function(){
|
@@ -325,10 +220,10 @@ jQuery(document).ready(function(){
|
|
325 |
jQuery('#bulk-edit select[name=post_parent]').closest('fieldset').css('display', 'none');
|
326 |
jQuery('.inline-edit-col select[name=post_parent]').parent().css('display', 'none');
|
327 |
jQuery('.inline-edit-status').parent().css('display', 'none');
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
update: function(event, ui) {
|
333 |
var category_id = jQuery('select#wpsc_product_category option:selected').val(),
|
334 |
product_order = jQuery('table.widefat').sortable( 'toArray' ),
|
@@ -347,127 +242,11 @@ jQuery(document).ready(function(){
|
|
347 |
axis: 'y',
|
348 |
containment: 'table.widefat tbody',
|
349 |
placeholder: 'product-placeholder',
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
}
|
354 |
|
355 |
-
// this helps show the links in the product list table, it is partially done using CSS, but that breaks in IE6
|
356 |
-
jQuery("tr.product-edit").hover(
|
357 |
-
function() {
|
358 |
-
jQuery(".wpsc-row-actions", this).css("visibility", "visible");
|
359 |
-
},
|
360 |
-
function() {
|
361 |
-
jQuery(".wpsc-row-actions", this).css("visibility", "hidden");
|
362 |
-
}
|
363 |
-
);
|
364 |
-
|
365 |
-
jQuery("div.admin_product_name a.shorttag_toggle").livequery(function(){
|
366 |
-
jQuery(this).toggle(
|
367 |
-
function () {
|
368 |
-
jQuery("div.admin_product_shorttags", jQuery(this).parents("table.product_editform")).css('display', 'block');
|
369 |
-
return false;
|
370 |
-
},
|
371 |
-
function () {
|
372 |
-
//jQuery("div#admin_product_name a.shorttag_toggle").toggleClass('toggled');
|
373 |
-
jQuery("div.admin_product_shorttags", jQuery(this).parents("table.product_editform")).css('display', 'none');
|
374 |
-
return false;
|
375 |
-
}
|
376 |
-
);
|
377 |
-
});
|
378 |
-
jQuery('.editinline').live('click', function(){
|
379 |
-
setTimeout('editinline_get_id()',200);
|
380 |
-
|
381 |
-
});
|
382 |
-
|
383 |
-
jQuery('a.add_variation_item_form').livequery(function(){
|
384 |
-
jQuery(this).click(function() {
|
385 |
-
form_field_container = jQuery(this).siblings('#variation_values');
|
386 |
-
form_field = jQuery("div.variation_value", form_field_container).eq(0).clone();
|
387 |
-
|
388 |
-
jQuery('input.text',form_field).attr('name','new_variation_values[]');
|
389 |
-
jQuery('input.text',form_field).val('');
|
390 |
-
jQuery('input.variation_values_id',form_field).remove();
|
391 |
-
|
392 |
-
jQuery(form_field_container).append(form_field);
|
393 |
-
return false;
|
394 |
-
});
|
395 |
-
});
|
396 |
-
|
397 |
-
|
398 |
-
jQuery('div.variation_value a.delete_variation_value').livequery(function(){
|
399 |
-
jQuery(this).click( function() {
|
400 |
-
element_count = jQuery("#variation_values div").size();
|
401 |
-
|
402 |
-
if(element_count > 1) {
|
403 |
-
|
404 |
-
parent_element = jQuery(this).parent("div.variation_value");
|
405 |
-
variation_value_id = jQuery("input.variation_values_id", parent_element).val();
|
406 |
-
|
407 |
-
delete_url = jQuery(this).attr('href');
|
408 |
-
post_values = "remove_variation_value=true&variation_value_id="+variation_value_id;
|
409 |
-
jQuery.post( delete_url, "ajax=true", function(returned_data) {
|
410 |
-
jQuery("#variation_row_"+returned_data).fadeOut('fast', function() {
|
411 |
-
jQuery(this).remove();
|
412 |
-
});
|
413 |
-
});
|
414 |
-
}
|
415 |
-
return false;
|
416 |
-
});
|
417 |
-
});
|
418 |
-
|
419 |
-
|
420 |
-
jQuery("#add-product-image").click(function(){
|
421 |
-
swfu.selectFiles();
|
422 |
-
});
|
423 |
-
|
424 |
-
|
425 |
-
jQuery('a.closeimagesettings').livequery(function(){
|
426 |
-
jQuery(this).click( function() {
|
427 |
-
jQuery('.image_settings_box').hide();
|
428 |
-
});
|
429 |
-
});
|
430 |
-
|
431 |
-
setTimeout(bulkedit_edit_tags_hack, 1000);
|
432 |
-
|
433 |
-
|
434 |
-
jQuery("#gallery_list").livequery(function(){
|
435 |
-
jQuery(this).sortable({
|
436 |
-
revert: false,
|
437 |
-
placeholder: "ui-selected",
|
438 |
-
start: function(e,ui) {
|
439 |
-
jQuery('#image_settings_box').hide();
|
440 |
-
jQuery('a.editButton').hide();
|
441 |
-
jQuery('img.deleteButton').hide();
|
442 |
-
jQuery('ul#gallery_list').children('li').removeClass('first');
|
443 |
-
},
|
444 |
-
stop:function (e,ui) {
|
445 |
-
jQuery('ul#gallery_list').children('li:first').addClass('first');
|
446 |
-
},
|
447 |
-
update: function (e,ui){
|
448 |
-
input_set = jQuery.makeArray(jQuery("#gallery_list li:not(.ui-sortable-helper) input.image-id"));
|
449 |
-
//console.log(input_set);
|
450 |
-
set = new Array();
|
451 |
-
for( var i in input_set) {
|
452 |
-
set[i] = jQuery(input_set[i]).val();
|
453 |
-
}
|
454 |
-
|
455 |
-
order = set.join(',');
|
456 |
-
product_id = jQuery('#product_id').val();
|
457 |
-
|
458 |
-
postVars = "product_id="+product_id+"&order="+order;
|
459 |
-
jQuery.post( 'index.php?wpsc_admin_action=rearrange_images', postVars, function(returned_data) {
|
460 |
-
eval(returned_data);
|
461 |
-
jQuery('#gallery_image_'+image_id).children('a.editButton').remove();
|
462 |
-
jQuery('#gallery_image_'+image_id).children('div.image_settings_box').remove();
|
463 |
-
jQuery('#gallery_image_'+image_id).append(image_menu);
|
464 |
-
});
|
465 |
-
|
466 |
-
},
|
467 |
-
'opacity':0.5
|
468 |
-
});
|
469 |
-
});
|
470 |
-
|
471 |
var limited_stock_checkbox = jQuery('input.limited_stock_checkbox');
|
472 |
var toggle_stock_fields = function(checked) {
|
473 |
jQuery('div.edit_stock').toggle(checked);
|
@@ -481,95 +260,55 @@ jQuery(document).ready(function(){
|
|
481 |
}
|
482 |
|
483 |
// show or hide the stock input forms
|
484 |
-
limited_stock_checkbox.
|
485 |
toggle_stock_fields(limited_stock_checkbox.is(':checked'));
|
486 |
});
|
487 |
|
488 |
-
|
489 |
-
|
490 |
-
|
|
|
491 |
jQuery("#table_rate").hide();
|
492 |
}
|
493 |
-
jQuery(this).click( function() {
|
494 |
-
if (this.checked) {
|
495 |
-
jQuery("#table_rate").show();
|
496 |
-
} else {
|
497 |
-
jQuery("#table_rate").hide();
|
498 |
-
}
|
499 |
-
});
|
500 |
});
|
501 |
|
502 |
-
jQuery("#custom_tax_checkbox").
|
503 |
-
jQuery(this).click( function() {
|
504 |
if (this.checked) {
|
505 |
jQuery("#custom_tax").show();
|
506 |
} else {
|
507 |
jQuery("#custom_tax input").val('');
|
508 |
jQuery("#custom_tax").hide();
|
509 |
}
|
510 |
-
});
|
511 |
-
});
|
512 |
-
|
513 |
-
jQuery(".add_level").livequery(function(){
|
514 |
-
jQuery(this).click(function() {
|
515 |
-
added = jQuery(this).parent().children('table').append('<tr><td><input type="text" size="10" value="" name="table_rate_price[quantity][]"/> and above</td><td><input type="text" size="10" value="" name="table_rate_price[table_price][]"/></td></tr>');
|
516 |
-
});
|
517 |
});
|
518 |
|
519 |
-
|
520 |
-
|
521 |
-
jQuery(this).click(function() {
|
522 |
-
jQuery(this).parent().parent('tr').remove();
|
523 |
-
});
|
524 |
});
|
525 |
|
526 |
-
|
527 |
-
|
528 |
-
jQuery(this).hover(
|
529 |
-
function () {
|
530 |
-
jQuery(this).children('img.deleteButton').show();
|
531 |
-
if(jQuery('div.image_settings_box').css('display')!='block')
|
532 |
-
jQuery(this).children('a.editButton').show();
|
533 |
-
},
|
534 |
-
function () {
|
535 |
-
jQuery(this).children('img.deleteButton').hide();
|
536 |
-
jQuery(this).children('a.editButton').hide();
|
537 |
-
}
|
538 |
-
);
|
539 |
});
|
540 |
|
|
|
|
|
|
|
|
|
|
|
541 |
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
jQuery(this).hide();
|
546 |
-
jQuery('div.image_settings_box').show('fast');
|
547 |
-
});
|
548 |
-
});
|
549 |
-
// hide image editing menu
|
550 |
-
jQuery("a.closeimagesettings").livequery(function(){
|
551 |
-
jQuery(this).click(function (e) {
|
552 |
-
jQuery("div#image_settings_box").hide();
|
553 |
-
});
|
554 |
-
});
|
555 |
|
556 |
-
|
557 |
-
jQuery(this).click(function(event){
|
558 |
-
target_url = jQuery(this).attr('href');
|
559 |
-
post_values = "ajax=true";
|
560 |
-
jQuery.post(target_url, post_values, function(returned_data){
|
561 |
-
eval(returned_data);
|
562 |
-
});
|
563 |
-
return false;
|
564 |
-
});
|
565 |
});
|
566 |
|
567 |
// Fill in values when inline editor appears.
|
|
|
568 |
jQuery('.inline-editor').livequery(function() {
|
569 |
var id = jQuery(this).attr('id');
|
570 |
-
id
|
571 |
|
572 |
-
if (!id || !parseInt(id)) {
|
573 |
return;
|
574 |
}
|
575 |
|
@@ -586,22 +325,48 @@ jQuery(document).ready(function(){
|
|
586 |
jQuery(this).find('.wpsc_ie_sku').val(sku);
|
587 |
});
|
588 |
|
589 |
-
jQuery('.coupon-
|
590 |
-
|
591 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
|
593 |
prototype.find('select').val('');
|
594 |
prototype.find('input').val('');
|
595 |
-
prototype.
|
596 |
-
prototype.insertAfter(parent)
|
|
|
|
|
|
|
|
|
|
|
597 |
|
598 |
return false;
|
599 |
});
|
600 |
|
601 |
-
jQuery('.coupon-conditions').on('click', '.wpsc-button-minus', function() {
|
602 |
var parent = jQuery(this).closest('.coupon-condition'),
|
603 |
-
|
604 |
-
|
|
|
|
|
|
|
605 |
|
606 |
if (conditions_count == 1) {
|
607 |
prototype = parent.clone();
|
@@ -628,7 +393,7 @@ jQuery(document).ready(function(){
|
|
628 |
// function for adding more custom meta
|
629 |
function add_more_meta(e) {
|
630 |
var current_meta_forms = jQuery(e).parent().children("div.product_custom_meta:last"), // grab the form container
|
631 |
-
|
632 |
|
633 |
new_meta_forms.find('input, textarea').val('');
|
634 |
current_meta_forms.after(new_meta_forms); // append it after the container of the clicked element
|
@@ -656,32 +421,6 @@ function remove_meta(e, meta_id) {
|
|
656 |
return false;
|
657 |
}
|
658 |
|
659 |
-
|
660 |
-
// function for switching the state of the image upload forms
|
661 |
-
function wpsc_upload_switcher(target_state) {
|
662 |
-
switch(target_state) {
|
663 |
-
case 'flash':
|
664 |
-
jQuery("div.browser-image-uploader").css("display","none");
|
665 |
-
jQuery("div.flash-image-uploader").css("display","block");
|
666 |
-
jQuery.post( 'index.php?admin=true', "admin=true&ajax=true&save_image_upload_state=true&image_upload_state=1", function(returned_data) { });
|
667 |
-
break;
|
668 |
-
|
669 |
-
case 'browser':
|
670 |
-
jQuery("div.flash-image-uploader").css("display","none");
|
671 |
-
jQuery("div.browser-image-uploader").css("display","block");
|
672 |
-
jQuery.post( 'index.php?admin=true', "admin=true&ajax=true&save_image_upload_state=true&image_upload_state=0", function(returned_data) { });
|
673 |
-
break;
|
674 |
-
}
|
675 |
-
}
|
676 |
-
|
677 |
-
// function for switching the state of the extra resize forms
|
678 |
-
function image_resize_extra_forms(option) {
|
679 |
-
container = jQuery(option).parent();
|
680 |
-
jQuery("div.image_resize_extra_forms").css('display', 'none');
|
681 |
-
jQuery("div.image_resize_extra_forms",container).css('display', 'block');
|
682 |
-
}
|
683 |
-
|
684 |
-
|
685 |
var prevElement = null;
|
686 |
var prevOption = null;
|
687 |
|
@@ -712,81 +451,8 @@ function hideelement(id) {
|
|
712 |
}
|
713 |
}
|
714 |
|
715 |
-
/*
|
716 |
-
* Modified copy of the wordpress edToolbar function that does the same job, it uses document.write, we cannot.
|
717 |
-
*/
|
718 |
-
function wpsc_edToolbar() {
|
719 |
-
//document.write('<div id="ed_toolbar">');
|
720 |
-
output = '';
|
721 |
-
for (i = 0; i < edButtons.length; i++) {
|
722 |
-
output += wpsc_edShowButton(edButtons[i], i);
|
723 |
-
}
|
724 |
-
output += '<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />';
|
725 |
-
output += '<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" />';
|
726 |
-
// edShowLinks(); // disabled by default
|
727 |
-
//document.write('</div>');
|
728 |
-
jQuery('div#ed_toolbar').html(output);
|
729 |
-
}
|
730 |
-
|
731 |
-
|
732 |
-
/*
|
733 |
-
* Modified copy of the wordpress edShowButton function that does the same job, it uses document.write, we cannot.
|
734 |
-
*/
|
735 |
-
|
736 |
-
function wpsc_edShowButton(button, i) {
|
737 |
-
if (button.id == 'ed_img') {
|
738 |
-
output = '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage(edCanvas);" value="' + button.display + '" />';
|
739 |
-
}
|
740 |
-
else if (button.id == 'ed_link') {
|
741 |
-
output = '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />';
|
742 |
-
}
|
743 |
-
else {
|
744 |
-
output = '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertTag(edCanvas, ' + i + ');" value="' + button.display + '" />';
|
745 |
-
}
|
746 |
-
return output;
|
747 |
-
}
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
function fillcategoryform(catid) {
|
752 |
-
post_values = 'ajax=true&admin=true&catid='+catid;
|
753 |
-
jQuery.post( 'index.php', post_values, function(returned_data) {
|
754 |
-
jQuery('#formcontent').html( returned_data );
|
755 |
-
jQuery('form.edititem').css('display', 'block');
|
756 |
-
jQuery('#additem').css('display', 'none');
|
757 |
-
jQuery('#blank_item').css('display', 'none');
|
758 |
-
jQuery('#productform').css('display', 'block');
|
759 |
-
jQuery("#loadingindicator_span").css('visibility','hidden');
|
760 |
-
});
|
761 |
-
}
|
762 |
-
|
763 |
-
function submit_status_form(id) {
|
764 |
-
document.getElementById(id).submit();
|
765 |
-
}
|
766 |
-
|
767 |
function getcurrency(id) {
|
768 |
-
//ajax.post("index.php",gercurrency,"wpsc_admin_action=change_currency¤cyid="+id);
|
769 |
-
}
|
770 |
-
|
771 |
-
function showadd_categorisation_form() {
|
772 |
-
if(jQuery('div_categorisation').css('display') != 'block') {
|
773 |
-
jQuery('div#add_categorisation').css('display', 'block');
|
774 |
-
jQuery('div#edit_categorisation').css('display', 'none');
|
775 |
-
} else {
|
776 |
-
jQuery('div#add_categorisation').css('display', 'none');
|
777 |
-
}
|
778 |
-
return false;
|
779 |
-
}
|
780 |
-
|
781 |
-
|
782 |
-
function showedit_categorisation_form() {
|
783 |
-
if(jQuery('div#edit_categorisation').css('display') != 'block') {
|
784 |
-
jQuery('div#edit_categorisation').css('display', 'block');
|
785 |
-
jQuery('div#add_categorisation').css('display', 'none');
|
786 |
-
} else {
|
787 |
-
jQuery('div#edit_categorisation').css('display', 'none');
|
788 |
-
}
|
789 |
-
return false;
|
790 |
}
|
791 |
|
792 |
function hideelement1(id, item_value) {
|
@@ -809,24 +475,3 @@ function show_status_box(id,image_id) {
|
|
809 |
}
|
810 |
return false;
|
811 |
}
|
812 |
-
|
813 |
-
function editinline_get_id(){
|
814 |
-
id = jQuery('.inline-edit-row').attr('id');
|
815 |
-
id = id.replace('edit-','');
|
816 |
-
has_var = jQuery('#inline_'+id+'_has_var').val();
|
817 |
-
if( has_var == '1'){
|
818 |
-
jQuery(".wpsc-cols").css('display', 'none');
|
819 |
-
jQuery(".wpsc-cols:first").text(wpsc_adminL10n.bulk_edit_no_vars)
|
820 |
-
.addClass('wpsc_var_description')
|
821 |
-
.css('display','block');
|
822 |
-
}else{
|
823 |
-
jQuery(".wpsc-cols").css('display', 'block');
|
824 |
-
}
|
825 |
-
|
826 |
-
|
827 |
-
}
|
828 |
-
|
829 |
-
// inline-edit-post.dev.js prepend tag edit textarea into the last fieldset. We need to undo that
|
830 |
-
function bulkedit_edit_tags_hack() {
|
831 |
-
jQuery('<fieldset class="inline-edit-col-right"><div class="inline-edit-col"></div></fieldset>').insertBefore('#bulk-edit .wpsc-cols:first').find('.inline-edit-col').append(jQuery('#bulk-edit .inline-edit-tags'));
|
832 |
-
}
|
17 |
* Wrapper for $.get. Takes care of the 'wpsc_action' and 'action' data arguments.
|
18 |
*
|
19 |
* @since 3.8.9
|
20 |
+
* @param {object} data Data to pass to the AJAX destination
|
21 |
* @param {function} handler Response handler
|
22 |
*/
|
23 |
$.wpsc_get = function(data, handler) {
|
48 |
console.log(t.data('events').click);
|
49 |
if (t.data('events'))
|
50 |
submit_handlers = t.data('events').click;
|
51 |
+
t.off('click');
|
52 |
+
t.on('click', function() {
|
53 |
var form = $(this).parents('form');
|
54 |
if (! validateForm( form ) )
|
55 |
return false;
|
58 |
|
59 |
var restore_ajax_submit = function() {
|
60 |
var t = $('#submit');
|
61 |
+
t.off('click');
|
62 |
$.each(submit_handlers, function(index, obj) {
|
63 |
+
t.on('click', obj.handler);
|
64 |
});
|
65 |
};
|
66 |
|
78 |
|
79 |
$('.edit-tags-php form').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');
|
80 |
|
81 |
+
$('[name="image"]').on('change', function() {
|
82 |
var t = $(this);
|
83 |
|
84 |
if (t.val())
|
100 |
});
|
101 |
}
|
102 |
|
103 |
+
$(document).on( 'click', 'form input.prdfil', function(){
|
104 |
var t = $(this);
|
105 |
var post_data = {
|
106 |
'select_product_file[]' : [],
|
125 |
find('p:even').removeClass('alt').end().
|
126 |
find('p:odd').addClass('alt');
|
127 |
});
|
128 |
+
return false;
|
129 |
});
|
130 |
|
131 |
// delete upload
|
132 |
+
$(document).on( 'click', '.file_delete_button', function(){
|
133 |
var t = $(this),
|
134 |
post_values = {
|
135 |
action : 'delete_file',
|
185 |
}
|
186 |
});
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
//new currency JS in admin product page
|
|
|
|
|
189 |
|
190 |
+
var firstclick = true;
|
191 |
+
|
192 |
+
jQuery('#wpsc_price_control_forms').on( 'click', 'a.wpsc_add_new_currency', function( event ){
|
|
|
193 |
if(firstclick == true){
|
194 |
jQuery('div.new_layer').show();
|
195 |
html = jQuery('div.new_layer').html();
|
198 |
jQuery('div.new_layer').after('<div>'+html+'</div>');
|
199 |
}
|
200 |
event.preventDefault();
|
|
|
201 |
});
|
202 |
+
|
203 |
//delete currency layer in admin product page
|
204 |
+
jQuery('#wpsc_price_control_forms').on( 'click', 'a.wpsc_delete_currency_layer', function(event){
|
|
|
205 |
jQuery(this).prev('input').val('');
|
206 |
jQuery(this).prev('select').val('');
|
207 |
jQuery(this).parent('div:first').hide();
|
208 |
event.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
});
|
210 |
|
211 |
+
//As far as I can tell, WP provides no good way of unsetting elements in the bulk edit area...tricky jQuery action will do for now....not ideal whatsoever, nor eternally stable.
|
212 |
+
if( pagenow == 'edit-wpsc-product' ) {
|
213 |
jQuery('.inline-edit-password-input').closest('.inline-edit-group').css('display', 'none');
|
214 |
var vcl = jQuery('.inline-edit-col input[name="tax_input[wpsc-variation][]"]').css('display', 'none');
|
215 |
vcl.each(function(){
|
220 |
jQuery('#bulk-edit select[name=post_parent]').closest('fieldset').css('display', 'none');
|
221 |
jQuery('.inline-edit-col select[name=post_parent]').parent().css('display', 'none');
|
222 |
jQuery('.inline-edit-status').parent().css('display', 'none');
|
223 |
+
}
|
224 |
+
if( wpsc_adminL10n.dragndrop_set == "true" && typenow == "wpsc-product" && adminpage == "edit-php" ) {
|
225 |
+
// this makes the product list table sortable
|
226 |
+
jQuery('table.widefat:not(.tags)').sortable({
|
227 |
update: function(event, ui) {
|
228 |
var category_id = jQuery('select#wpsc_product_category option:selected').val(),
|
229 |
product_order = jQuery('table.widefat').sortable( 'toArray' ),
|
242 |
axis: 'y',
|
243 |
containment: 'table.widefat tbody',
|
244 |
placeholder: 'product-placeholder',
|
245 |
+
cursor: 'move',
|
246 |
+
cancel: 'tr.inline-edit-wpsc-product'
|
247 |
+
});
|
248 |
}
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
var limited_stock_checkbox = jQuery('input.limited_stock_checkbox');
|
251 |
var toggle_stock_fields = function(checked) {
|
252 |
jQuery('div.edit_stock').toggle(checked);
|
260 |
}
|
261 |
|
262 |
// show or hide the stock input forms
|
263 |
+
limited_stock_checkbox.on('click', function () {
|
264 |
toggle_stock_fields(limited_stock_checkbox.is(':checked'));
|
265 |
});
|
266 |
|
267 |
+
jQuery("#table_rate_price").on( 'click', function(){
|
268 |
+
if (this.checked) {
|
269 |
+
jQuery("#table_rate").show();
|
270 |
+
} else {
|
271 |
jQuery("#table_rate").hide();
|
272 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
});
|
274 |
|
275 |
+
jQuery("#custom_tax_checkbox").on( 'click', function(){
|
|
|
276 |
if (this.checked) {
|
277 |
jQuery("#custom_tax").show();
|
278 |
} else {
|
279 |
jQuery("#custom_tax input").val('');
|
280 |
jQuery("#custom_tax").hide();
|
281 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
});
|
283 |
|
284 |
+
jQuery( 'div#table_rate' ).on( 'click', '.add_level', function(){
|
285 |
+
added = jQuery(this).parent().children('table').append('<tr><td><input type="text" size="10" value="" name="table_rate_price[quantity][]"/> and above</td><td><input type="text" size="10" value="" name="table_rate_price[table_price][]"/></td></tr>');
|
|
|
|
|
|
|
286 |
});
|
287 |
|
288 |
+
jQuery( 'div#table_rate' ).on( 'click', '.remove_line', function(){
|
289 |
+
jQuery(this).parent().parent('tr').remove();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
});
|
291 |
|
292 |
+
jQuery( '.wpsc_featured_product_toggle' ).on( 'click', function(){
|
293 |
+
post_values = {
|
294 |
+
product_id : jQuery( this ).parents( 'tr' ).attr( 'id' ).replace( 'post-', '' ),
|
295 |
+
action : 'update_featured_product'
|
296 |
+
};
|
297 |
|
298 |
+
jQuery.post( ajaxurl, post_values, function( response ) {
|
299 |
+
jQuery( '.featured_toggle_' + response.product_id ).html( "<img class='" + response.class + "' src='" + response.image + "' alt='" + response.text + "' title='" + response.text + "' />" );
|
300 |
+
}, 'json' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
|
302 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
});
|
304 |
|
305 |
// Fill in values when inline editor appears.
|
306 |
+
// This should be done properly so we don't need livequery here - see http://codex.wordpress.org/Plugin_API/Action_Reference/quick_edit_custom_box
|
307 |
jQuery('.inline-editor').livequery(function() {
|
308 |
var id = jQuery(this).attr('id');
|
309 |
+
id = id.replace(/^edit-/, '');
|
310 |
|
311 |
+
if ( ! id || ! parseInt( id, 10 ) ) {
|
312 |
return;
|
313 |
}
|
314 |
|
325 |
jQuery(this).find('.wpsc_ie_sku').val(sku);
|
326 |
});
|
327 |
|
328 |
+
jQuery( 'div.coupon-condition' ).each( function( index, value ){
|
329 |
+
if( jQuery( 'select[name="rules[operator][]"]', jQuery( this ) ).length !== 0 ) {
|
330 |
+
margin = jQuery( 'select.ruleprops', jQuery( this ) ).offset().left - jQuery( this ).offset().left;
|
331 |
+
margin = parseInt( margin, 10 ) - 1;
|
332 |
+
jQuery( 'select[name="rules[operator][]"]', jQuery( this ) ).css( 'margin-left', '-' + margin + 'px' );
|
333 |
+
}
|
334 |
+
});
|
335 |
+
|
336 |
+
jQuery( '.coupon-conditions' ).on( 'click', '.wpsc-button-plus', function() {
|
337 |
+
var parent = jQuery( this ).closest( '.coupon-condition' ),
|
338 |
+
conditions_count = jQuery( '.coupon-condition' ).size(),
|
339 |
+
prototype = parent.clone();
|
340 |
+
|
341 |
+
var operator_box = jQuery('<select/>',{name:'rules[operator][]'});
|
342 |
+
|
343 |
+
if ( jQuery( 'select[name="rules[operator][]"]', prototype ).length === 0 ) {
|
344 |
+
operator_box.append("<option value='and'>" + wpsc_adminL10n.coupons_compare_and + "</option>");
|
345 |
+
operator_box.append("<option value='or'>" + wpsc_adminL10n.coupons_compare_or + "</option>");
|
346 |
+
prototype.prepend(operator_box);
|
347 |
+
}
|
348 |
+
|
349 |
|
350 |
prototype.find('select').val('');
|
351 |
prototype.find('input').val('');
|
352 |
+
prototype.css( { 'opacity' : '0' } );
|
353 |
+
prototype.insertAfter(parent);
|
354 |
+
|
355 |
+
margin = jQuery( 'select.ruleprops', prototype ).offset().left - prototype.offset().left;
|
356 |
+
margin = parseInt( margin, 10 ) - 1;
|
357 |
+
|
358 |
+
prototype.animate( { opacity: 1, 'margin-left': '-' + margin + 'px', height: 'show' }, 150 );
|
359 |
|
360 |
return false;
|
361 |
});
|
362 |
|
363 |
+
jQuery('.coupon-conditions').on( 'click', '.wpsc-button-minus', function() {
|
364 |
var parent = jQuery(this).closest('.coupon-condition'),
|
365 |
+
conditions_count = jQuery('.coupon-condition').size(),
|
366 |
+
prototype;
|
367 |
+
|
368 |
+
if ( jQuery( this ).index( jQuery( '.wpsc-button-minus' ) ) === 0 )
|
369 |
+
return false;
|
370 |
|
371 |
if (conditions_count == 1) {
|
372 |
prototype = parent.clone();
|
393 |
// function for adding more custom meta
|
394 |
function add_more_meta(e) {
|
395 |
var current_meta_forms = jQuery(e).parent().children("div.product_custom_meta:last"), // grab the form container
|
396 |
+
new_meta_forms = current_meta_forms.clone(); // clone the form container
|
397 |
|
398 |
new_meta_forms.find('input, textarea').val('');
|
399 |
current_meta_forms.after(new_meta_forms); // append it after the container of the clicked element
|
421 |
return false;
|
422 |
}
|
423 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
var prevElement = null;
|
425 |
var prevOption = null;
|
426 |
|
451 |
}
|
452 |
}
|
453 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
function getcurrency(id) {
|
455 |
+
//ajax.post("index.php",gercurrency,"wpsc_admin_action=change_currency¤cyid="+id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
}
|
457 |
|
458 |
function hideelement1(id, item_value) {
|
475 |
}
|
476 |
return false;
|
477 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wpsc-admin/js/product-variations.js
CHANGED
@@ -23,19 +23,20 @@
|
|
23 |
var new_variation_set_count = 0;
|
24 |
|
25 |
$(function(){
|
26 |
-
$('.variation_checkboxes').
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
$('a.add_variation_set_action').
|
32 |
-
$('#add-new-variation-set .button').
|
33 |
-
$('#add-new-variation-set input[type="text"]').
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
$('.wpsc-
|
38 |
-
|
|
|
39 |
});
|
40 |
|
41 |
var event_bulk_edit_textboxes_keyup = function() {
|
23 |
var new_variation_set_count = 0;
|
24 |
|
25 |
$(function(){
|
26 |
+
$('.variation_checkboxes').on( 'click', '.variation-set', event_toggle_checkboxes );
|
27 |
+
$('.variation_checkboxes').on( 'click', 'a.expand', event_toggle_children );
|
28 |
+
$('.variation_checkboxes').on( 'click', '.selectit input:checkbox', event_display_apply_variations );
|
29 |
+
$('.variation_checkboxes').on( 'click', '.children input:checkbox', event_toggle_parent );
|
30 |
+
|
31 |
+
$('a.add_variation_set_action').on( 'click', event_add_new_variation_set );
|
32 |
+
$('#add-new-variation-set .button').on( 'click', event_variation_set_add );
|
33 |
+
$('#add-new-variation-set input[type="text"]').on( 'keypress', event_variation_set_inputs_keypress );
|
34 |
+
$('#add-new-variation-set input[type="text"]').on( 'focus', event_variation_set_inputs_focus );
|
35 |
+
$('#add-new-variation-set input[type="text"]').on( 'blur', event_variation_set_inputs_blur );
|
36 |
+
|
37 |
+
$('.wpsc-product-variation-thumbnail a').on( 'click', event_variation_thumbnail_click );
|
38 |
+
$('.wpsc-bulk-edit').on( 'change', 'input.wpsc-bulk-edit-fields', event_bulk_edit_checkboxes_changed );
|
39 |
+
$('.wpsc-bulk-edit').on( 'keyup', 'input[type="text"]', event_bulk_edit_textboxes_keyup );
|
40 |
});
|
41 |
|
42 |
var event_bulk_edit_textboxes_keyup = function() {
|
wpsc-admin/js/purchase-logs.js
CHANGED
@@ -5,16 +5,16 @@
|
|
5 |
|
6 |
init : function() {
|
7 |
$(function(){
|
8 |
-
$('table.purchase-logs')
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
});
|
19 |
},
|
20 |
|
5 |
|
6 |
init : function() {
|
7 |
$(function(){
|
8 |
+
var wrapper = $('table.purchase-logs');
|
9 |
+
wrapper.on( 'change' , '.wpsc-purchase-log-status' , WPSC_Purchase_Logs_Admin.event_log_status_change );
|
10 |
+
wrapper.on( 'focus' , '.wpsc-purchase-log-tracking-id', WPSC_Purchase_Logs_Admin.event_tracking_id_focused );
|
11 |
+
wrapper.on( 'click' , '.column-tracking a.add' , WPSC_Purchase_Logs_Admin.event_button_add_clicked );
|
12 |
+
wrapper.on( 'blur' , '.wpsc-purchase-log-tracking-id', WPSC_Purchase_Logs_Admin.event_tracking_id_blurred );
|
13 |
+
wrapper.on( 'click' , '.column-tracking a.save' , WPSC_Purchase_Logs_Admin.event_button_save_clicked );
|
14 |
+
wrapper.on( 'click' , '.column-tracking .send-email a', WPSC_Purchase_Logs_Admin.event_button_send_email_clicked );
|
15 |
+
wrapper.on( 'keypress' , '.wpsc-purchase-log-tracking-id', WPSC_Purchase_Logs_Admin.event_enter_key_pressed );
|
16 |
+
wrapper.on( 'mousedown', '.column-tracking a.save' , WPSC_Purchase_Logs_Admin.event_disable_textbox_resize );
|
17 |
+
wrapper.on( 'focus' , '.column-tracking a.save' , WPSC_Purchase_Logs_Admin.event_disable_textbox_resize );
|
18 |
});
|
19 |
},
|
20 |
|
wpsc-admin/js/settings-page.js
CHANGED
@@ -39,13 +39,14 @@
|
|
39 |
}
|
40 |
|
41 |
// load the correct settings tab when back/forward browser button is used
|
42 |
-
$(window).bind('popstate', WPSC_Settings_Page.event_pop_state);
|
43 |
|
|
|
44 |
$(function(){
|
45 |
-
$('#wpsc_options')
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
49 |
$(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded');
|
50 |
$(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded_' + WPSC_Settings_Page.current_tab);
|
51 |
$('.settings-error').insertAfter('.nav-tab-wrapper');
|
@@ -187,9 +188,9 @@
|
|
187 |
*/
|
188 |
event_init : function() {
|
189 |
var wrapper = $('#options_general');
|
190 |
-
wrapper.
|
191 |
-
|
192 |
-
|
193 |
},
|
194 |
|
195 |
/**
|
@@ -236,7 +237,7 @@
|
|
236 |
$.wpsc_post(postdata, ajax_callback);
|
237 |
}
|
238 |
};
|
239 |
-
$(WPSC_Settings_Page).
|
240 |
|
241 |
/**
|
242 |
* Presentation tab
|
@@ -257,9 +258,9 @@
|
|
257 |
*/
|
258 |
event_init : function() {
|
259 |
var wrapper = $('#options_presentation'),
|
260 |
-
|
261 |
-
wrapper.
|
262 |
-
wrapper.
|
263 |
},
|
264 |
|
265 |
/**
|
@@ -283,7 +284,7 @@
|
|
283 |
}
|
284 |
}
|
285 |
};
|
286 |
-
$(WPSC_Settings_Page).
|
287 |
|
288 |
/**
|
289 |
* Checkout Tab
|
@@ -299,16 +300,16 @@
|
|
299 |
*/
|
300 |
event_init : function() {
|
301 |
var wrapper = $('#options_checkout');
|
302 |
-
wrapper.
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
$('#wpsc-settings-form').
|
312 |
|
313 |
wrapper.find('#wpsc_checkout_list').
|
314 |
sortable({
|
@@ -478,7 +479,7 @@
|
|
478 |
|
479 |
event_form_submit : function() {
|
480 |
var sort_order = $('#wpsc_checkout_list').sortable('toArray');
|
481 |
-
for (index in sort_order) {
|
482 |
$(this).append('<input type="hidden" name="sort_order[]" value="' + sort_order[index] + '" />');
|
483 |
}
|
484 |
return true;
|
@@ -678,7 +679,7 @@
|
|
678 |
$('#wpsc-delete-checkout-set').show();
|
679 |
}
|
680 |
};
|
681 |
-
$(WPSC_Settings_Page).
|
682 |
|
683 |
/**
|
684 |
* Taxes tab
|
@@ -692,11 +693,12 @@
|
|
692 |
*/
|
693 |
event_init : function() {
|
694 |
var wrapper = $('#options_taxes');
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
|
|
700 |
},
|
701 |
|
702 |
/**
|
@@ -705,7 +707,7 @@
|
|
705 |
*/
|
706 |
event_country_drop_down_changed : function() {
|
707 |
var c = $(this),
|
708 |
-
|
709 |
action : 'add_tax_rate',
|
710 |
wpec_taxes_action : 'wpec_taxes_get_regions',
|
711 |
current_key : c.data('key'),
|
@@ -770,26 +772,26 @@
|
|
770 |
*/
|
771 |
add_field : function(type) {
|
772 |
var button_wrapper = $('#wpsc-add-tax-' + type),
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
|
788 |
button_wrapper.find('img').toggleClass('ajax-feedback-active');
|
789 |
$.wpsc_post(post_data, ajax_callback);
|
790 |
}
|
791 |
};
|
792 |
-
$(WPSC_Settings_Page).
|
793 |
|
794 |
/**
|
795 |
* Shipping Tab
|
@@ -804,12 +806,12 @@
|
|
804 |
event_init : function() {
|
805 |
WPSC_Settings_Page.Shipping.wrapper = $('#options_shipping');
|
806 |
WPSC_Settings_Page.Shipping.table_rate = WPSC_Settings_Page.Shipping.wrapper.find('.table-rate');
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
},
|
814 |
|
815 |
/**
|
@@ -846,7 +848,7 @@
|
|
846 |
}
|
847 |
|
848 |
var this_row = $(this).closest('tr'),
|
849 |
-
|
850 |
|
851 |
clone.find('input').val('');
|
852 |
clone.find('.cell-wrapper').hide();
|
@@ -883,26 +885,26 @@
|
|
883 |
*/
|
884 |
event_edit_shipping_module : function() {
|
885 |
var element = $(this),
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
|
907 |
spinner.toggleClass('ajax-feedback-active');
|
908 |
$.wpsc_post(post_data, ajax_callback);
|
@@ -915,19 +917,19 @@
|
|
915 |
*/
|
916 |
event_sync_shipwire : function() {
|
917 |
var element = $(this),
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
spinner.toggleClass('ajax-feedback-active');
|
932 |
$.post(ajaxurl, post_data, ajax_callback, 'json');
|
933 |
return false;
|
@@ -942,7 +944,7 @@
|
|
942 |
WPSC_Settings_Page.Shipping.wrapper.find('#wpsc-shipping-module-settings tr:odd').addClass('alternate');
|
943 |
}
|
944 |
};
|
945 |
-
$(WPSC_Settings_Page).
|
946 |
|
947 |
/**
|
948 |
* Payments Tab
|
@@ -952,38 +954,51 @@
|
|
952 |
WPSC_Settings_Page.Gateway = {
|
953 |
event_init : function() {
|
954 |
var wrapper = $('#options_gateway');
|
955 |
-
wrapper.
|
|
|
956 |
},
|
957 |
-
|
958 |
event_edit_payment_gateway : function() {
|
959 |
-
var element = $(this),
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
action : 'payment_gateway_settings_form',
|
964 |
'payment_gateway_id' : payment_gateway_id,
|
965 |
nonce : WPSC_Settings_Page.payment_gateway_settings_form_nonce
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
|
|
|
|
980 |
|
981 |
spinner.toggleClass('ajax-feedback-active');
|
982 |
$.wpsc_post(post_data, ajax_callback);
|
983 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
984 |
}
|
985 |
};
|
986 |
-
$(WPSC_Settings_Page).
|
987 |
|
988 |
/**
|
989 |
* Marketing Tab
|
@@ -995,14 +1010,14 @@
|
|
995 |
|
996 |
var wrapper = $('div#wpsc_google_analytics_integration');
|
997 |
|
998 |
-
wrapper.
|
999 |
|
1000 |
var checkbox = $( 'div#wpsc_google_analytics_integration input[type="checkbox"]' );
|
1001 |
|
1002 |
$.each( checkbox, function( i, e ) {
|
1003 |
if ( $(this).is( ':checked' ) )
|
1004 |
$(this).parent('p').nextAll('p').hide();
|
1005 |
-
})
|
1006 |
},
|
1007 |
|
1008 |
event_show_hide_dependencies : function () {
|
@@ -1016,7 +1031,7 @@
|
|
1016 |
|
1017 |
};
|
1018 |
|
1019 |
-
$(WPSC_Settings_Page).
|
1020 |
|
1021 |
})(jQuery);
|
1022 |
|
39 |
}
|
40 |
|
41 |
// load the correct settings tab when back/forward browser button is used
|
|
|
42 |
|
43 |
+
$(window).on('popstate', WPSC_Settings_Page.event_pop_state);
|
44 |
$(function(){
|
45 |
+
var wpsc_options = $('#wpsc_options');
|
46 |
+
wpsc_options.on( 'click' , 'a.nav-tab' , WPSC_Settings_Page.event_tab_button_clicked);
|
47 |
+
wpsc_options.on( 'change', 'input, textarea, select', WPSC_Settings_Page.event_settings_changed);
|
48 |
+
wpsc_options.on( 'submit', '#wpsc-settings-form' , WPSC_Settings_Page.event_settings_form_submitted);
|
49 |
+
$(window).on('beforeunload', WPSC_Settings_Page.event_before_unload);
|
50 |
$(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded');
|
51 |
$(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded_' + WPSC_Settings_Page.current_tab);
|
52 |
$('.settings-error').insertAfter('.nav-tab-wrapper');
|
188 |
*/
|
189 |
event_init : function() {
|
190 |
var wrapper = $('#options_general');
|
191 |
+
wrapper.on( 'change', '#wpsc-base-country-drop-down', WPSC_Settings_Page.General.event_base_country_changed);
|
192 |
+
wrapper.on( 'click' , '.wpsc-select-all' , WPSC_Settings_Page.General.event_select_all);
|
193 |
+
wrapper.on( 'click' ,'.wpsc-select-none' , WPSC_Settings_Page.General.event_select_none);
|
194 |
},
|
195 |
|
196 |
/**
|
237 |
$.wpsc_post(postdata, ajax_callback);
|
238 |
}
|
239 |
};
|
240 |
+
$(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_general', WPSC_Settings_Page.General.event_init);
|
241 |
|
242 |
/**
|
243 |
* Presentation tab
|
258 |
*/
|
259 |
event_init : function() {
|
260 |
var wrapper = $('#options_presentation'),
|
261 |
+
checkbox_selector = '#' + WPSC_Settings_Page.Presentation.grid_view_boxes.join(',#');
|
262 |
+
wrapper.on( 'click', '#wpsc-show-images-only', WPSC_Settings_Page.Presentation.event_show_images_only_clicked);
|
263 |
+
wrapper.on( 'click', checkbox_selector , WPSC_Settings_Page.Presentation.event_grid_view_boxes_clicked);
|
264 |
},
|
265 |
|
266 |
/**
|
284 |
}
|
285 |
}
|
286 |
};
|
287 |
+
$(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_presentation', WPSC_Settings_Page.Presentation.event_init);
|
288 |
|
289 |
/**
|
290 |
* Checkout Tab
|
300 |
*/
|
301 |
event_init : function() {
|
302 |
var wrapper = $('#options_checkout');
|
303 |
+
wrapper.on( 'click', '.add_new_form_set', WPSC_Settings_Page.Checkout.event_add_new_form_set);
|
304 |
+
wrapper.on( 'click', '.actionscol a.wpsc-button-plus', WPSC_Settings_Page.Checkout.event_add_new_field);
|
305 |
+
wrapper.on( 'click', '.actionscol a.wpsc-button-minus', WPSC_Settings_Page.Checkout.event_delete_field);
|
306 |
+
wrapper.on( 'click', 'a.edit-options', WPSC_Settings_Page.Checkout.event_edit_field_options);
|
307 |
+
wrapper.on( 'change', 'select[name^="form_type"], select[name^="new_field_type"]', WPSC_Settings_Page.Checkout.event_form_type_changed);
|
308 |
+
wrapper.on( 'click', '.field-option-cell-wrapper .wpsc-button-plus', WPSC_Settings_Page.Checkout.event_add_field_option);
|
309 |
+
wrapper.on( 'click', '.field-option-cell-wrapper .wpsc-button-minus', WPSC_Settings_Page.Checkout.event_delete_field_option);
|
310 |
+
wrapper.on( 'click', '#wpsc-delete-checkout-set', WPSC_Settings_Page.Checkout.event_delete_checkout_set);
|
311 |
+
wrapper.on( 'change', '#wpsc_form_set', WPSC_Settings_Page.Checkout.event_select_form_set);
|
312 |
+
$('#wpsc-settings-form').on( 'submit', WPSC_Settings_Page.Checkout.event_form_submit);
|
313 |
|
314 |
wrapper.find('#wpsc_checkout_list').
|
315 |
sortable({
|
479 |
|
480 |
event_form_submit : function() {
|
481 |
var sort_order = $('#wpsc_checkout_list').sortable('toArray');
|
482 |
+
for (var index in sort_order) {
|
483 |
$(this).append('<input type="hidden" name="sort_order[]" value="' + sort_order[index] + '" />');
|
484 |
}
|
485 |
return true;
|
679 |
$('#wpsc-delete-checkout-set').show();
|
680 |
}
|
681 |
};
|
682 |
+
$(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_checkout', WPSC_Settings_Page.Checkout.event_init);
|
683 |
|
684 |
/**
|
685 |
* Taxes tab
|
693 |
*/
|
694 |
event_init : function() {
|
695 |
var wrapper = $('#options_taxes');
|
696 |
+
|
697 |
+
wrapper.on( 'click' , '#wpsc-add-tax-rates a' , WPSC_Settings_Page.Taxes.event_add_tax_rate);
|
698 |
+
wrapper.on( 'click' , '.wpsc-taxes-rates-delete' , WPSC_Settings_Page.Taxes.event_delete_tax_rate);
|
699 |
+
wrapper.on( 'click' , '#wpsc-add-tax-bands a' , WPSC_Settings_Page.Taxes.event_add_tax_band);
|
700 |
+
wrapper.on( 'click' , '.wpsc-taxes-bands-delete' , WPSC_Settings_Page.Taxes.event_delete_tax_band);
|
701 |
+
wrapper.on( 'change', '.wpsc-taxes-country-drop-down', WPSC_Settings_Page.Taxes.event_country_drop_down_changed);
|
702 |
},
|
703 |
|
704 |
/**
|
707 |
*/
|
708 |
event_country_drop_down_changed : function() {
|
709 |
var c = $(this),
|
710 |
+
post_data = {
|
711 |
action : 'add_tax_rate',
|
712 |
wpec_taxes_action : 'wpec_taxes_get_regions',
|
713 |
current_key : c.data('key'),
|
772 |
*/
|
773 |
add_field : function(type) {
|
774 |
var button_wrapper = $('#wpsc-add-tax-' + type),
|
775 |
+
count = $('.wpsc-tax-' + type + '-row').size(),
|
776 |
+
post_data = {
|
777 |
+
action : 'add_tax_rate',
|
778 |
+
wpec_taxes_action : 'wpec_taxes_build_' + type + '_form',
|
779 |
+
current_key : count,
|
780 |
+
nonce : WPSC_Settings_Page.add_tax_rate_nonce
|
781 |
+
},
|
782 |
+
ajax_callback = function(response) {
|
783 |
+
if (! response.is_successful) {
|
784 |
+
alert(response.error.messages.join("\n"));
|
785 |
+
return;
|
786 |
+
}
|
787 |
+
button_wrapper.before(response.obj.content).find('img').toggleClass('ajax-feedback-active');
|
788 |
+
};
|
789 |
|
790 |
button_wrapper.find('img').toggleClass('ajax-feedback-active');
|
791 |
$.wpsc_post(post_data, ajax_callback);
|
792 |
}
|
793 |
};
|
794 |
+
$(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_taxes', WPSC_Settings_Page.Taxes.event_init);
|
795 |
|
796 |
/**
|
797 |
* Shipping Tab
|
806 |
event_init : function() {
|
807 |
WPSC_Settings_Page.Shipping.wrapper = $('#options_shipping');
|
808 |
WPSC_Settings_Page.Shipping.table_rate = WPSC_Settings_Page.Shipping.wrapper.find('.table-rate');
|
809 |
+
|
810 |
+
WPSC_Settings_Page.Shipping.wrapper.on( 'click' , '.edit-shipping-module' , WPSC_Settings_Page.Shipping.event_edit_shipping_module);
|
811 |
+
WPSC_Settings_Page.Shipping.wrapper.on( 'click' , '.table-rate .wpsc-button-plus' , WPSC_Settings_Page.Shipping.event_add_table_rate_layer);
|
812 |
+
WPSC_Settings_Page.Shipping.wrapper.on( 'click' , '.table-rate .wpsc-button-minus', WPSC_Settings_Page.Shipping.event_delete_table_rate_layer);
|
813 |
+
WPSC_Settings_Page.Shipping.wrapper.on( 'keypress', '.table-rate input[type="text"]', WPSC_Settings_Page.Shipping.event_enter_key_pressed);
|
814 |
+
WPSC_Settings_Page.Shipping.wrapper.on( 'click' , 'a.shipwire_sync' , WPSC_Settings_Page.Shipping.event_sync_shipwire);
|
815 |
},
|
816 |
|
817 |
/**
|
848 |
}
|
849 |
|
850 |
var this_row = $(this).closest('tr'),
|
851 |
+
clone = this_row.clone();
|
852 |
|
853 |
clone.find('input').val('');
|
854 |
clone.find('.cell-wrapper').hide();
|
885 |
*/
|
886 |
event_edit_shipping_module : function() {
|
887 |
var element = $(this),
|
888 |
+
shipping_module_id = element.data('module-id'),
|
889 |
+
spinner = element.siblings('.ajax-feedback'),
|
890 |
+
post_data = {
|
891 |
+
action : 'shipping_module_settings_form',
|
892 |
+
'shipping_module_id' : shipping_module_id,
|
893 |
+
nonce : WPSC_Settings_Page.shipping_module_settings_form_nonce
|
894 |
+
},
|
895 |
+
ajax_callback = function(response) {
|
896 |
+
if (! response.is_successful) {
|
897 |
+
alert(response.error.messages.join("\n"));
|
898 |
+
return;
|
899 |
+
}
|
900 |
+
|
901 |
+
if (history.pushState) {
|
902 |
+
var new_url = '?page=wpsc-settings&tab=' + WPSC_Settings_Page.current_tab + '&shipping_module_id=' + shipping_module_id;
|
903 |
+
history.pushState({url : new_url}, '', new_url);
|
904 |
+
}
|
905 |
+
spinner.toggleClass('ajax-feedback-active');
|
906 |
+
$('#wpsc-shipping-module-settings').replaceWith(response.obj.content);
|
907 |
+
};
|
908 |
|
909 |
spinner.toggleClass('ajax-feedback-active');
|
910 |
$.wpsc_post(post_data, ajax_callback);
|
917 |
*/
|
918 |
event_sync_shipwire : function() {
|
919 |
var element = $(this),
|
920 |
+
spinner = element.siblings('.ajax-feedback'),
|
921 |
+
post_data = {
|
922 |
+
action : 'sync_shipwire_products',
|
923 |
+
nonce : WPSC_Settings_Page.shipping_module_settings_form_nonce
|
924 |
+
},
|
925 |
+
ajax_callback = function(response) {
|
926 |
+
$('<div class="updated shipwire-update"><p><strong>' + response.tracking + '<br />' + response.inventory + '</strong></p></div>').
|
927 |
+
insertBefore(element).
|
928 |
+
fadeIn('slow').
|
929 |
+
delay(5500).
|
930 |
+
fadeOut('slow');
|
931 |
+
spinner.toggleClass('ajax-feedback-active');
|
932 |
+
};
|
933 |
spinner.toggleClass('ajax-feedback-active');
|
934 |
$.post(ajaxurl, post_data, ajax_callback, 'json');
|
935 |
return false;
|
944 |
WPSC_Settings_Page.Shipping.wrapper.find('#wpsc-shipping-module-settings tr:odd').addClass('alternate');
|
945 |
}
|
946 |
};
|
947 |
+
$(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_shipping', WPSC_Settings_Page.Shipping.event_init);
|
948 |
|
949 |
/**
|
950 |
* Payments Tab
|
954 |
WPSC_Settings_Page.Gateway = {
|
955 |
event_init : function() {
|
956 |
var wrapper = $('#options_gateway');
|
957 |
+
wrapper.on( 'click', '.edit-payment-module' , WPSC_Settings_Page.Gateway.event_edit_payment_gateway);
|
958 |
+
wrapper.on( 'click', '.edit-payment-module-cancel', WPSC_Settings_Page.Gateway.event_edit_payment_gateway_cancel);
|
959 |
},
|
|
|
960 |
event_edit_payment_gateway : function() {
|
961 |
+
var element = $(this), // edit link
|
962 |
+
payment_gateway_id = element.closest('.wpsc-select-gateway').data('gateway-id'),
|
963 |
+
spinner = element.siblings('.ajax-feedback'),
|
964 |
+
post_data = {
|
965 |
action : 'payment_gateway_settings_form',
|
966 |
'payment_gateway_id' : payment_gateway_id,
|
967 |
nonce : WPSC_Settings_Page.payment_gateway_settings_form_nonce
|
968 |
+
},
|
969 |
+
ajax_callback = function(response) {
|
970 |
+
if (! response.is_successful) {
|
971 |
+
alert(response.error.messages.join("\n"));
|
972 |
+
return;
|
973 |
+
}
|
974 |
+
|
975 |
+
if (history.pushState) {
|
976 |
+
var new_url = '?page=wpsc-settings&tab=' + WPSC_Settings_Page.current_tab + '&payment_gateway_id=' + payment_gateway_id;
|
977 |
+
history.pushState({'url' : new_url}, '', new_url);
|
978 |
+
}
|
979 |
+
spinner.toggleClass('ajax-feedback-active');
|
980 |
+
$('#gateway_settings_' + payment_gateway_id + '_form').remove();
|
981 |
+
$('#wpsc_gateway_settings_'+ payment_gateway_id).show();
|
982 |
+
$('#wpsc_gateway_settings_'+ payment_gateway_id + '_container').append(response.obj.content);
|
983 |
+
};
|
984 |
|
985 |
spinner.toggleClass('ajax-feedback-active');
|
986 |
$.wpsc_post(post_data, ajax_callback);
|
987 |
return false;
|
988 |
+
},
|
989 |
+
event_edit_payment_gateway_cancel : function() {
|
990 |
+
var element = $(this),
|
991 |
+
payment_gateway_id = element.closest('.gateway_settings').data('gateway-id');
|
992 |
+
if (history.pushState) {
|
993 |
+
var new_url = '?page=wpsc-settings&tab=' + WPSC_Settings_Page.current_tab;
|
994 |
+
history.pushState({'url' : new_url}, '', new_url);
|
995 |
+
}
|
996 |
+
$('#gateway_settings_' + payment_gateway_id + '_form').remove();
|
997 |
+
$('#wpsc_gateway_settings_'+ payment_gateway_id).hide();
|
998 |
+
return false;
|
999 |
}
|
1000 |
};
|
1001 |
+
$(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_gateway', WPSC_Settings_Page.Gateway.event_init);
|
1002 |
|
1003 |
/**
|
1004 |
* Marketing Tab
|
1010 |
|
1011 |
var wrapper = $('div#wpsc_google_analytics_integration');
|
1012 |
|
1013 |
+
wrapper.on( 'click', 'input[type="checkbox"]', WPSC_Settings_Page.Marketing.event_show_hide_dependencies);
|
1014 |
|
1015 |
var checkbox = $( 'div#wpsc_google_analytics_integration input[type="checkbox"]' );
|
1016 |
|
1017 |
$.each( checkbox, function( i, e ) {
|
1018 |
if ( $(this).is( ':checked' ) )
|
1019 |
$(this).parent('p').nextAll('p').hide();
|
1020 |
+
});
|
1021 |
},
|
1022 |
|
1023 |
event_show_hide_dependencies : function () {
|
1031 |
|
1032 |
};
|
1033 |
|
1034 |
+
$(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_marketing', WPSC_Settings_Page.Marketing.event_init);
|
1035 |
|
1036 |
})(jQuery);
|
1037 |
|
wpsc-admin/js/sortable-table.js
CHANGED
@@ -87,7 +87,7 @@
|
|
87 |
var t = $(this);
|
88 |
t.find('tr').addClass('sortable');
|
89 |
t.sortable({
|
90 |
-
|
91 |
items : 'tr.sortable',
|
92 |
containment : t,
|
93 |
placeholder : 'wpsc-sortable-table-placeholder',
|
@@ -99,4 +99,4 @@
|
|
99 |
});
|
100 |
});
|
101 |
};
|
102 |
-
})(jQuery);
|
87 |
var t = $(this);
|
88 |
t.find('tr').addClass('sortable');
|
89 |
t.sortable({
|
90 |
+
axis : 'y',
|
91 |
items : 'tr.sortable',
|
92 |
containment : t,
|
93 |
placeholder : 'wpsc-sortable-table-placeholder',
|
99 |
});
|
100 |
});
|
101 |
};
|
102 |
+
})(jQuery);
|
wpsc-admin/settings-page.php
CHANGED
@@ -378,7 +378,10 @@ final class WPSC_Settings_Page {
|
|
378 |
|
379 |
if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'submit_options' ) ) {
|
380 |
check_admin_referer( 'update-options', 'wpsc-update-options' );
|
|
|
381 |
$this->save_options();
|
|
|
|
|
382 |
$query_args = array();
|
383 |
if ( is_callable( array( $this->current_tab, 'callback_submit_options' ) ) ) {
|
384 |
$additional_query_args = $this->current_tab->callback_submit_options();
|
@@ -477,7 +480,7 @@ final class WPSC_Settings_Page {
|
|
477 |
}
|
478 |
?>
|
479 |
|
480 |
-
<?php do_action('wpsc_' . $this->current_tab_id . '_settings_page'); ?>
|
481 |
<div class="submit">
|
482 |
<input type='hidden' name='wpsc_admin_action' value='submit_options' />
|
483 |
<?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
|
@@ -509,7 +512,7 @@ final class WPSC_Settings_Page {
|
|
509 |
</h2>
|
510 |
<?php $this->output_tabs(); ?>
|
511 |
<div id='wpsc_options_page'>
|
512 |
-
<form method='post' action='<?php echo
|
513 |
<?php $this->display_current_tab(); ?>
|
514 |
</form>
|
515 |
</div>
|
@@ -526,7 +529,7 @@ final class WPSC_Settings_Page {
|
|
526 |
* @uses wpdb::get_col() Queries the database.
|
527 |
* @access public
|
528 |
*/
|
529 |
-
private function save_options( $selected='' ) {
|
530 |
global $wpdb, $wpsc_gateways;
|
531 |
$updated = 0;
|
532 |
|
@@ -702,4 +705,4 @@ final class WPSC_Settings_Page {
|
|
702 |
}
|
703 |
}
|
704 |
|
705 |
-
WPSC_Settings_Page::init();
|
378 |
|
379 |
if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'submit_options' ) ) {
|
380 |
check_admin_referer( 'update-options', 'wpsc-update-options' );
|
381 |
+
|
382 |
$this->save_options();
|
383 |
+
do_action( 'wpsc_save_' . $this->current_tab_id . '_settings', $this->current_tab );
|
384 |
+
|
385 |
$query_args = array();
|
386 |
if ( is_callable( array( $this->current_tab, 'callback_submit_options' ) ) ) {
|
387 |
$additional_query_args = $this->current_tab->callback_submit_options();
|
480 |
}
|
481 |
?>
|
482 |
|
483 |
+
<?php do_action( 'wpsc_' . $this->current_tab_id . '_settings_page' ); ?>
|
484 |
<div class="submit">
|
485 |
<input type='hidden' name='wpsc_admin_action' value='submit_options' />
|
486 |
<?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
|
512 |
</h2>
|
513 |
<?php $this->output_tabs(); ?>
|
514 |
<div id='wpsc_options_page'>
|
515 |
+
<form method='post' action='<?php echo esc_url( $this->submit_url() ); ?>' enctype='multipart/form-data' id='wpsc-settings-form'>
|
516 |
<?php $this->display_current_tab(); ?>
|
517 |
</form>
|
518 |
</div>
|
529 |
* @uses wpdb::get_col() Queries the database.
|
530 |
* @access public
|
531 |
*/
|
532 |
+
private function save_options( $selected = '' ) {
|
533 |
global $wpdb, $wpsc_gateways;
|
534 |
$updated = 0;
|
535 |
|
705 |
}
|
706 |
}
|
707 |
|
708 |
+
WPSC_Settings_Page::init();
|
wpsc-components/merchant-core-v2/helpers/admin.php
CHANGED
@@ -40,9 +40,9 @@ function _wpsc_filter_merchant_v2_gateway_form( $form, $selected_gateway ) {
|
|
40 |
}
|
41 |
|
42 |
if ( $selected_gateway_data ) {
|
43 |
-
if ( array_key_exists( $selected_gateway, $payment_gateway_names ) ) {
|
44 |
$display_name = $payment_gateway_names[$selected_gateway];
|
45 |
-
} elseif ( ! empty( $selected_gateway_data['display_name'] ) ) {
|
46 |
$display_name = $selected_gateway_data['display_name'];
|
47 |
} else {
|
48 |
switch($selected_gateway_data['payment_type']) {
|
@@ -68,10 +68,10 @@ function _wpsc_filter_merchant_v2_gateway_form( $form, $selected_gateway ) {
|
|
68 |
ob_start();
|
69 |
?>
|
70 |
<tr>
|
71 |
-
<td><?php esc_html_e( 'Display Name', 'wpsc' ); ?></td>
|
72 |
<td>
|
73 |
-
<input type="text" name="user_defined_name[<?php echo esc_attr( $selected_gateway ); ?>]" value="<?php echo esc_html( $display_name ); ?>"
|
74 |
-
<
|
75 |
</td>
|
76 |
</tr>
|
77 |
<?php
|
@@ -103,7 +103,7 @@ function _wpsc_action_merchant_v2_submit_gateway_options() {
|
|
103 |
}
|
104 |
$custom_gateways = get_option( 'custom_gateway_options' );
|
105 |
|
106 |
-
$nzshpcrt_gateways
|
107 |
foreach ( $nzshpcrt_gateways as $gateway ) {
|
108 |
if ( in_array( $gateway['internalname'], $custom_gateways ) ) {
|
109 |
if ( isset( $gateway['submit_function'] ) ) {
|
40 |
}
|
41 |
|
42 |
if ( $selected_gateway_data ) {
|
43 |
+
if ( array_key_exists( $selected_gateway, $payment_gateway_names ) && $payment_gateway_names[$selected_gateway] !== "") {
|
44 |
$display_name = $payment_gateway_names[$selected_gateway];
|
45 |
+
} elseif ( ! empty( $selected_gateway_data['display_name'] ) && $selected_gateway_data['display_name'] !== "" ) {
|
46 |
$display_name = $selected_gateway_data['display_name'];
|
47 |
} else {
|
48 |
switch($selected_gateway_data['payment_type']) {
|
68 |
ob_start();
|
69 |
?>
|
70 |
<tr>
|
71 |
+
<td width="150"><?php esc_html_e( 'Display Name', 'wpsc' ); ?></td>
|
72 |
<td>
|
73 |
+
<input type="text" name="user_defined_name[<?php echo esc_attr( $selected_gateway ); ?>]" value="<?php echo esc_html( $display_name ); ?>" />
|
74 |
+
<p class="description"><?php esc_html_e( 'The text that people see when making a purchase.', 'wpsc' ); ?></p>
|
75 |
</td>
|
76 |
</tr>
|
77 |
<?php
|
103 |
}
|
104 |
$custom_gateways = get_option( 'custom_gateway_options' );
|
105 |
|
106 |
+
global $nzshpcrt_gateways;
|
107 |
foreach ( $nzshpcrt_gateways as $gateway ) {
|
108 |
if ( in_array( $gateway['internalname'], $custom_gateways ) ) {
|
109 |
if ( isset( $gateway['submit_function'] ) ) {
|
wpsc-components/merchant-core-v2/helpers/gateways.php
CHANGED
@@ -4,17 +4,28 @@
|
|
4 |
* The WPSC Gateway functions
|
5 |
*/
|
6 |
|
|
|
|
|
|
|
|
|
7 |
function wpsc_have_gateways() {
|
8 |
global $wpsc_gateway;
|
9 |
return $wpsc_gateway->have_gateways();
|
10 |
}
|
11 |
|
|
|
|
|
|
|
|
|
12 |
function wpsc_the_gateway() {
|
13 |
global $wpsc_gateway;
|
14 |
return $wpsc_gateway->the_gateway();
|
15 |
}
|
16 |
|
17 |
-
|
|
|
|
|
|
|
18 |
function wpsc_show_gateway_image(){
|
19 |
global $wpsc_gateway;
|
20 |
if( isset($wpsc_gateway->gateway['image']) && !empty($wpsc_gateway->gateway['image']) )
|
@@ -23,8 +34,10 @@ function wpsc_show_gateway_image(){
|
|
23 |
return false;
|
24 |
}
|
25 |
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
function wpsc_gateway_image_url(){
|
29 |
global $wpsc_gateway;
|
30 |
if( wpsc_show_gateway_image() )
|
@@ -33,6 +46,10 @@ function wpsc_gateway_image_url(){
|
|
33 |
return false;
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
36 |
function wpsc_gateway_name() {
|
37 |
global $wpsc_gateway;
|
38 |
$display_name = '';
|
@@ -69,11 +86,20 @@ function wpsc_gateway_name() {
|
|
69 |
return $display_name;
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
72 |
function wpsc_gateway_internal_name() {
|
73 |
global $wpsc_gateway;
|
74 |
return $wpsc_gateway->gateway['internalname'];
|
75 |
}
|
76 |
|
|
|
|
|
|
|
|
|
77 |
function wpsc_gateway_is_checked() {
|
78 |
global $wpsc_gateway;
|
79 |
$is_checked = false;
|
@@ -96,6 +122,11 @@ function wpsc_gateway_is_checked() {
|
|
96 |
return $output;
|
97 |
}
|
98 |
|
|
|
|
|
|
|
|
|
|
|
99 |
function wpsc_gateway_form_fields() {
|
100 |
global $wpsc_gateway, $gateway_checkout_form_fields, $wpsc_gateway_error_messages;
|
101 |
|
@@ -108,6 +139,8 @@ function wpsc_gateway_form_fields() {
|
|
108 |
'cctype' => empty( $messages['cctype'] ) ? '' : $messages['cctype'],
|
109 |
);
|
110 |
|
|
|
|
|
111 |
// Match fields to gateway
|
112 |
switch ( $wpsc_gateway->gateway['internalname'] ) {
|
113 |
|
@@ -142,12 +175,19 @@ function wpsc_gateway_form_fields() {
|
|
142 |
|
143 |
}
|
144 |
|
145 |
-
if (
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
|
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
|
|
151 |
function wpsc_gateway_form_field_style() {
|
152 |
global $wpsc_gateway;
|
153 |
$is_checked = false;
|
@@ -174,6 +214,9 @@ add_action(
|
|
174 |
'_wpsc_merchant_v2_before_shopping_cart'
|
175 |
);
|
176 |
|
|
|
|
|
|
|
177 |
function _wpsc_merchant_v2_before_shopping_cart() {
|
178 |
$GLOBALS['wpsc_gateway'] = new wpsc_gateways();
|
179 |
-
}
|
4 |
* The WPSC Gateway functions
|
5 |
*/
|
6 |
|
7 |
+
/**
|
8 |
+
* @todo Needs desription adding, and return value clarifying.
|
9 |
+
* @return bool [description]
|
10 |
+
*/
|
11 |
function wpsc_have_gateways() {
|
12 |
global $wpsc_gateway;
|
13 |
return $wpsc_gateway->have_gateways();
|
14 |
}
|
15 |
|
16 |
+
/**
|
17 |
+
* @todo Needs desription adding, and return value clarifying.
|
18 |
+
* @return [type] [description]
|
19 |
+
*/
|
20 |
function wpsc_the_gateway() {
|
21 |
global $wpsc_gateway;
|
22 |
return $wpsc_gateway->the_gateway();
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* Indicate if the current gateway has an image provided.
|
27 |
+
* @return bool True if the gateway has an image, false if not.
|
28 |
+
*/
|
29 |
function wpsc_show_gateway_image(){
|
30 |
global $wpsc_gateway;
|
31 |
if( isset($wpsc_gateway->gateway['image']) && !empty($wpsc_gateway->gateway['image']) )
|
34 |
return false;
|
35 |
}
|
36 |
|
37 |
+
/**
|
38 |
+
* Return the current gateway's image url if there is one.
|
39 |
+
* @return string|bool Returns the URL of the gateway image, or false if none set.
|
40 |
+
*/
|
41 |
function wpsc_gateway_image_url(){
|
42 |
global $wpsc_gateway;
|
43 |
if( wpsc_show_gateway_image() )
|
46 |
return false;
|
47 |
}
|
48 |
|
49 |
+
/**
|
50 |
+
* Return the current gateway's name.
|
51 |
+
* @return string The current gateway's name.
|
52 |
+
*/
|
53 |
function wpsc_gateway_name() {
|
54 |
global $wpsc_gateway;
|
55 |
$display_name = '';
|
86 |
return $display_name;
|
87 |
}
|
88 |
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Return the current gateway's internal name
|
92 |
+
* @return string The current gateway's internal name.
|
93 |
+
*/
|
94 |
function wpsc_gateway_internal_name() {
|
95 |
global $wpsc_gateway;
|
96 |
return $wpsc_gateway->gateway['internalname'];
|
97 |
}
|
98 |
|
99 |
+
/**
|
100 |
+
* Return HTML to check a radio button if the current gateway is the currently selected gateway.
|
101 |
+
* @return string HTML checked attribute if the current gateway is selectedd. Empty string otherwise.
|
102 |
+
*/
|
103 |
function wpsc_gateway_is_checked() {
|
104 |
global $wpsc_gateway;
|
105 |
$is_checked = false;
|
122 |
return $output;
|
123 |
}
|
124 |
|
125 |
+
/**
|
126 |
+
* Return the HTML output for the current gateway's checkout fields.
|
127 |
+
* @return string The HTML of the current gateway's checkout fields.
|
128 |
+
* @uses apply_filters() Filters output through wpsc_gateway_checkout_form_{gateway_internal_name}
|
129 |
+
*/
|
130 |
function wpsc_gateway_form_fields() {
|
131 |
global $wpsc_gateway, $gateway_checkout_form_fields, $wpsc_gateway_error_messages;
|
132 |
|
139 |
'cctype' => empty( $messages['cctype'] ) ? '' : $messages['cctype'],
|
140 |
);
|
141 |
|
142 |
+
$output = '';
|
143 |
+
|
144 |
// Match fields to gateway
|
145 |
switch ( $wpsc_gateway->gateway['internalname'] ) {
|
146 |
|
175 |
|
176 |
}
|
177 |
|
178 |
+
if ( empty( $output ) && isset( $gateway_checkout_form_fields[$wpsc_gateway->gateway['internalname']] ) ) {
|
179 |
+
$output = $gateway_checkout_form_fields[$wpsc_gateway->gateway['internalname']];
|
180 |
+
}
|
181 |
+
|
182 |
+
return apply_filters ( 'wpsc_gateway_checkout_form_' . $wpsc_gateway->gateway['internalname'], $output );
|
183 |
+
|
184 |
}
|
185 |
|
186 |
+
/**
|
187 |
+
* Return HTML class to be added to a checkout field to indicate if thi field belongs to the
|
188 |
+
* currently selected gateway.
|
189 |
+
* @return string HTML class
|
190 |
+
*/
|
191 |
function wpsc_gateway_form_field_style() {
|
192 |
global $wpsc_gateway;
|
193 |
$is_checked = false;
|
214 |
'_wpsc_merchant_v2_before_shopping_cart'
|
215 |
);
|
216 |
|
217 |
+
/**
|
218 |
+
* @todo Clarify what this is doing
|
219 |
+
*/
|
220 |
function _wpsc_merchant_v2_before_shopping_cart() {
|
221 |
$GLOBALS['wpsc_gateway'] = new wpsc_gateways();
|
222 |
+
}
|
wpsc-core/js/jquery.colorbox-min.js
CHANGED
@@ -1,22 +1,6 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
K,c);i.removeClass(f+"off").addClass(f+"on");e=setTimeout(g.next,a.slideshowSpeed)},c=function(){clearTimeout(e);B.text(a.slideshowStart).unbind([P,Q,K,b].join(" ")).one(b,function(){g.next();d()});i.removeClass(f+"on").addClass(f+"off")},a.slideshowAuto?d():c()):i.removeClass(f+"off "+f+"on")}function da(e){if(!L){k=e;ca();l=b(k);p=0;"nofollow"!==a.rel&&(l=b("."+C).filter(function(){var e=b.data(this,q),d;e&&(d=e.rel||this.rel);return d===a.rel}),p=l.index(k),-1===p&&(l=l.add(k),p=l.length-1));if(!r){r=
|
7 |
-
D=!0;i.show();if(a.returnFocus)b(k).blur().one(ea,function(){b(this).focus()});v.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":"auto"}).show();a.w=n(a.initialWidth,"x");a.h=n(a.initialHeight,"y");g.position();E&&h.bind("resize."+M+" scroll."+M,function(){v.css({width:h.width(),height:h.height(),top:h.scrollTop(),left:h.scrollLeft()})}).trigger("resize."+M);y(fa,a.onOpen);R.add(S).hide();T.html(a.close).show()}g.load(!0)}}function ga(){!i&&A.body&&(U=!1,h=b(aa),i=d(c).attr({id:q,"class":F?
|
8 |
-
o+(E?"IE6":"IE"):""}).hide(),v=d(c,"Overlay",E?"position:absolute":"").hide(),z=d(c,"Wrapper"),s=d(c,"Content").append(m=d(c,"LoadedContent","width:0; height:0; overflow:hidden"),V=d(c,"LoadingOverlay").add(d(c,"LoadingGraphic")),S=d(c,"Title"),W=d(c,"Current"),G=d(c,"Next"),H=d(c,"Previous"),B=d(c,"Slideshow").bind(fa,ia),T=d(c,"Close")),z.append(d(c).append(d(c,"TopLeft"),X=d(c,"TopCenter"),d(c,"TopRight")),d(c,!1,"clear:left").append(Y=d(c,"MiddleLeft"),s,Z=d(c,"MiddleRight")),d(c,!1,"clear:left").append(d(c,
|
9 |
-
"BottomLeft"),$=d(c,"BottomCenter"),d(c,"BottomRight"))).find("div div").css({"float":"left"}),I=d(c,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),R=G.add(H).add(W).add(B),b(A.body).append(v,i.append(z,I)))}function ja(){return i?(U||(U=!0,w=X.height()+$.height()+s.outerHeight(!0)-s.height(),x=Y.width()+Z.width()+s.outerWidth(!0)-s.width(),t=m.outerHeight(!0),u=m.outerWidth(!0),i.css({"padding-bottom":w,"padding-right":x}),G.click(function(){g.next()}),H.click(function(){g.prev()}),
|
10 |
-
T.click(function(){g.close()}),v.click(function(){a.overlayClose&&g.close()}),b(A).bind("keydown."+o,function(e){var b=e.keyCode;r&&(a.escKey&&27===b)&&(e.preventDefault(),g.close());r&&(a.arrowKey&&l[1])&&(37===b?(e.preventDefault(),H.click()):39===b&&(e.preventDefault(),G.click()))}),b("."+C,A).live("click",function(a){1<a.which||(a.shiftKey||a.altKey||a.metaKey)||(a.preventDefault(),da(this))})),!0):!1}var O={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,
|
11 |
-
height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:0.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",open:!1,returnFocus:!0,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",
|
12 |
-
onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0},q="colorbox",o="cbox",C=o+"Element",fa=o+"_open",Q=o+"_load",P=o+"_complete",K=o+"_cleanup",ea=o+"_closed",N=o+"_purge",F=!b.support.opacity&&!b.support.style,E=F&&!aa.XMLHttpRequest,M=o+"_IE6",v,i,z,s,X,Y,Z,$,l,h,m,I,V,S,W,B,G,H,T,R,a,w,x,t,u,k,p,j,r,D,L,ha,g,c="div",U;b.colorbox||(b(ga),g=b.fn[q]=b[q]=function(a,d){var c=this,a=a||{};ga();if(ja()){if(!c[0]){if(c.selector)return c;
|
13 |
-
c=b("<a/>");a.open=!0}d&&(a.onComplete=d);c.each(function(){b.data(this,q,b.extend({},b.data(this,q)||O,a))}).addClass(C);(b.isFunction(a.open)&&a.open.call(c)||a.open)&&da(c[0])}return c},g.position=function(b,d){function c(a){X[0].style.width=$[0].style.width=s[0].style.width=a.style.width;s[0].style.height=Y[0].style.height=Z[0].style.height=a.style.height}var j=0,l=0,m=i.offset(),p,k;h.unbind("resize."+o);i.css({top:-9E4,left:-9E4});p=h.scrollTop();k=h.scrollLeft();a.fixed&&!E?(m.top-=p,m.left-=
|
14 |
-
k,i.css({position:"fixed"})):(j=p,l=k,i.css({position:"absolute"}));l=!1!==a.right?l+Math.max(h.width()-a.w-u-x-n(a.right,"x"),0):!1!==a.left?l+n(a.left,"x"):l+Math.round(Math.max(h.width()-a.w-u-x,0)/2);j=!1!==a.bottom?j+Math.max(h.height()-a.h-t-w-n(a.bottom,"y"),0):!1!==a.top?j+n(a.top,"y"):j+Math.round(Math.max(h.height()-a.h-t-w,0)/2);i.css({top:m.top,left:m.left});b=i.width()===a.w+u&&i.height()===a.h+t?0:b||0;z[0].style.width=z[0].style.height="9999px";i.dequeue().animate({width:a.w+u,height:a.h+
|
15 |
-
t,top:j,left:l},{duration:b,complete:function(){c(this);D=false;z[0].style.width=a.w+u+x+"px";z[0].style.height=a.h+t+w+"px";a.reposition&&setTimeout(function(){h.bind("resize."+o,g.position)},1);d&&d()},step:function(){c(this)}})},g.resize=function(b){r&&(b=b||{},b.width&&(a.w=n(b.width,"x")-u-x),b.innerWidth&&(a.w=n(b.innerWidth,"x")),m.css({width:a.w}),b.height&&(a.h=n(b.height,"y")-t-w),b.innerHeight&&(a.h=n(b.innerHeight,"y")),!b.innerHeight&&!b.height&&(m.css({height:"auto"}),a.h=m.height()),
|
16 |
-
m.css({height:a.h}),g.position("none"===a.transition?0:a.speed))},g.prep=function(e){function f(){a.w=a.w||m.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}function h(){a.h=a.h||m.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}if(r){var k,n="none"===a.transition?0:a.speed;m.remove();m=d(c,"LoadedContent").append(e);m.hide().appendTo(I.show()).css({width:f(),overflow:a.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(s);I.hide();b(j).css({"float":"none"});if(E)b("select").not(i.find("select")).filter(function(){return"hidden"!==
|
17 |
-
this.style.visibility}).css({visibility:"hidden"}).one(K,function(){this.style.visibility="inherit"});k=function(){function c(){F&&i[0].style.removeAttribute("filter")}var f,g;f=l.length;var e,k,h;if(r){k=function(){clearTimeout(ha);V.hide();y(P,a.onComplete)};F&&j&&m.fadeIn(100);S.html(a.title).add(m).show();if(1<f){if("string"===typeof a.current&&W.html(a.current.replace("{current}",p+1).replace("{total}",f)).show(),G[a.loop||p<f-1?"show":"hide"]().html(a.next),H[a.loop||p?"show":"hide"]().html(a.previous),
|
18 |
-
a.slideshow&&B.show(),a.preloading)for(f=[J(-1),J(1)];g=l[f.pop()];)if((h=b.data(g,q))&&h.href?(h=h.href,b.isFunction(h)&&(h=h.call(g))):h=g.href,ba(h))g=new Image,g.src=h}else R.hide();if(a.iframe){e=d("iframe")[0];"frameBorder"in e&&(e.frameBorder=0);"allowTransparency"in e&&(e.allowTransparency="true");e.name=o+ +new Date;if(a.fastIframe)k();else b(e).one("load",k);e.src=a.href;a.scrolling||(e.scrolling="no");b(e).addClass(o+"Iframe").appendTo(m).one(N,function(){e.src="//about:blank"})}else k();
|
19 |
-
"fade"===a.transition?i.fadeTo(n,1,c):c()}};"fade"===a.transition?i.fadeTo(n,0,function(){g.position(0,k)}):g.position(n,k)}},g.load=function(e){var f,h,i=g.prep;D=!0;j=!1;k=l[p];e||ca();y(N);y(Q,a.onLoad);a.h=a.height?n(a.height,"y")-t-w:a.innerHeight&&n(a.innerHeight,"y");a.w=a.width?n(a.width,"x")-u-x:a.innerWidth&&n(a.innerWidth,"x");a.mw=a.w;a.mh=a.h;a.maxWidth&&(a.mw=n(a.maxWidth,"x")-u-x,a.mw=a.w&&a.w<a.mw?a.w:a.mw);a.maxHeight&&(a.mh=n(a.maxHeight,"y")-t-w,a.mh=a.h&&a.h<a.mh?a.h:a.mh);f=a.href;
|
20 |
-
ha=setTimeout(function(){V.show()},100);a.inline?(d(c).hide().insertBefore(b(f)[0]).one(N,function(){b(this).replaceWith(m.children())}),i(b(f))):a.iframe?i(" "):a.html?i(a.html):ba(f)?(b(j=new Image).addClass(o+"Photo").error(function(){a.title=false;i(d(c,"Error").html(a.imgError))}).load(function(){var b;j.onload=null;if(a.scalePhotos){h=function(){j.height=j.height-j.height*b;j.width=j.width-j.width*b};if(a.mw&&j.width>a.mw){b=(j.width-a.mw)/j.width;h()}if(a.mh&&j.height>a.mh){b=(j.height-a.mh)/
|
21 |
-
j.height;h()}}if(a.h)j.style.marginTop=Math.max(a.h-j.height,0)/2+"px";if(l[1]&&(a.loop||l[p+1])){j.style.cursor="pointer";j.onclick=function(){g.next()}}if(F)j.style.msInterpolationMode="bicubic";setTimeout(function(){i(j)},1)}),setTimeout(function(){j.src=f},1)):f&&I.load(f,a.data,function(e,f){i(f==="error"?d(c,"Error").html(a.xhrError):b(this).contents())})},g.next=function(){if(!D&&l[1]&&(a.loop||l[p+1]))p=J(1),g.load()},g.prev=function(){if(!D&&l[1]&&(a.loop||p))p=J(-1),g.load()},g.close=function(){r&&
|
22 |
-
!L&&(L=!0,r=!1,y(K,a.onCleanup),h.unbind("."+o+" ."+M),v.fadeTo(200,0),i.stop().fadeTo(300,0,function(){i.add(v).css({opacity:1,cursor:"auto"}).hide();y(N);m.remove();setTimeout(function(){L=!1;y(ea,a.onClosed)},1)}))},g.remove=function(){b([]).add(i).add(v).remove();i=null;b("."+C).removeData(q).removeClass(C).die()},g.element=function(){return b(k)},g.settings=O)})(jQuery,document,this);
|
1 |
+
/*!
|
2 |
+
jQuery Colorbox v1.4.15 - 2013-04-22
|
3 |
+
(c) 2013 Jack Moore - jacklmoore.com/colorbox
|
4 |
+
license: http://www.opensource.org/licenses/mit-license.php
|
5 |
+
*/
|
6 |
+
(function(t,e,i){function o(i,o,n){var r=e.createElement(i);return o&&(r.id=te+o),n&&(r.style.cssText=n),t(r)}function n(){return i.innerHeight?i.innerHeight:t(i).height()}function r(t){var e=H.length,i=(j+t)%e;return 0>i?e+i:i}function h(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():n())/100:1)*parseInt(t,10))}function l(t,e){return t.photo||t.photoRegex.test(e)}function s(t,e){return t.retinaUrl&&i.devicePixelRatio>1?e.replace(t.photoRegex,t.retinaSuffix):e}function a(t){"contains"in x[0]&&!x[0].contains(t.target)&&(t.stopPropagation(),x.focus())}function d(){var e,i=t.data(A,Z);null==i?(_=t.extend({},Y),console&&console.log&&console.log("Error: cboxElement missing settings object")):_=t.extend({},i);for(e in _)t.isFunction(_[e])&&"on"!==e.slice(0,2)&&(_[e]=_[e].call(A));_.rel=_.rel||A.rel||t(A).data("rel")||"nofollow",_.href=_.href||t(A).attr("href"),_.title=_.title||A.title,"string"==typeof _.href&&(_.href=t.trim(_.href))}function c(i,o){t(e).trigger(i),se.trigger(i),t.isFunction(o)&&o.call(A)}function u(){var t,e,i,o,n,r=te+"Slideshow_",h="click."+te;_.slideshow&&H[1]?(e=function(){clearTimeout(t)},i=function(){(_.loop||H[j+1])&&(t=setTimeout(J.next,_.slideshowSpeed))},o=function(){M.html(_.slideshowStop).unbind(h).one(h,n),se.bind(ne,i).bind(oe,e).bind(re,n),x.removeClass(r+"off").addClass(r+"on")},n=function(){e(),se.unbind(ne,i).unbind(oe,e).unbind(re,n),M.html(_.slideshowStart).unbind(h).one(h,function(){J.next(),o()}),x.removeClass(r+"on").addClass(r+"off")},_.slideshowAuto?o():n()):x.removeClass(r+"off "+r+"on")}function f(i){G||(A=i,d(),H=t(A),j=0,"nofollow"!==_.rel&&(H=t("."+ee).filter(function(){var e,i=t.data(this,Z);return i&&(e=t(this).data("rel")||i.rel||this.rel),e===_.rel}),j=H.index(A),-1===j&&(H=H.add(A),j=H.length-1)),g.css({opacity:parseFloat(_.opacity),cursor:_.overlayClose?"pointer":"auto",visibility:"visible"}).show(),V&&x.add(g).removeClass(V),_.className&&x.add(g).addClass(_.className),V=_.className,K.html(_.close).show(),$||($=q=!0,x.css({visibility:"hidden",display:"block"}),W=o(ae,"LoadedContent","width:0; height:0; overflow:hidden").appendTo(v),D=b.height()+k.height()+v.outerHeight(!0)-v.height(),B=C.width()+T.width()+v.outerWidth(!0)-v.width(),N=W.outerHeight(!0),z=W.outerWidth(!0),_.w=h(_.initialWidth,"x"),_.h=h(_.initialHeight,"y"),J.position(),u(),c(ie,_.onOpen),O.add(F).hide(),x.focus(),e.addEventListener&&(e.addEventListener("focus",a,!0),se.one(he,function(){e.removeEventListener("focus",a,!0)})),_.returnFocus&&se.one(he,function(){t(A).focus()})),w())}function p(){!x&&e.body&&(X=!1,E=t(i),x=o(ae).attr({id:Z,"class":t.support.opacity===!1?te+"IE":"",role:"dialog",tabindex:"-1"}).hide(),g=o(ae,"Overlay").hide(),S=o(ae,"LoadingOverlay").add(o(ae,"LoadingGraphic")),y=o(ae,"Wrapper"),v=o(ae,"Content").append(F=o(ae,"Title"),I=o(ae,"Current"),P=t('<button type="button"/>').attr({id:te+"Previous"}),R=t('<button type="button"/>').attr({id:te+"Next"}),M=o("button","Slideshow"),S,K=t('<button type="button"/>').attr({id:te+"Close"})),y.append(o(ae).append(o(ae,"TopLeft"),b=o(ae,"TopCenter"),o(ae,"TopRight")),o(ae,!1,"clear:left").append(C=o(ae,"MiddleLeft"),v,T=o(ae,"MiddleRight")),o(ae,!1,"clear:left").append(o(ae,"BottomLeft"),k=o(ae,"BottomCenter"),o(ae,"BottomRight"))).find("div div").css({"float":"left"}),L=o(ae,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),O=R.add(P).add(I).add(M),t(e.body).append(g,x.append(y,L)))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.control||(t.preventDefault(),f(this))}return x?(X||(X=!0,R.click(function(){J.next()}),P.click(function(){J.prev()}),K.click(function(){J.close()}),g.click(function(){_.overlayClose&&J.close()}),t(e).bind("keydown."+te,function(t){var e=t.keyCode;$&&_.escKey&&27===e&&(t.preventDefault(),J.close()),$&&_.arrowKey&&H[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),R.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+te,"."+ee,i):t("."+ee).live("click."+te,i)),!0):!1}function w(){var e,n,r,a=J.prep,u=++de;q=!0,U=!1,A=H[j],d(),c(le),c(oe,_.onLoad),_.h=_.height?h(_.height,"y")-N-D:_.innerHeight&&h(_.innerHeight,"y"),_.w=_.width?h(_.width,"x")-z-B:_.innerWidth&&h(_.innerWidth,"x"),_.mw=_.w,_.mh=_.h,_.maxWidth&&(_.mw=h(_.maxWidth,"x")-z-B,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.maxHeight&&(_.mh=h(_.maxHeight,"y")-N-D,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.href,Q=setTimeout(function(){S.show()},100),_.inline?(r=o(ae).hide().insertBefore(t(e)[0]),se.one(le,function(){r.replaceWith(W.children())}),a(t(e))):_.iframe?a(" "):_.html?a(_.html):l(_,e)?(e=s(_,e),t(U=new Image).addClass(te+"Photo").bind("error",function(){_.title=!1,a(o(ae,"Error").html(_.imgError))}).one("load",function(){var e;u===de&&(U.alt=t(A).attr("alt")||t(A).attr("data-alt")||"",_.retinaImage&&i.devicePixelRatio>1&&(U.height=U.height/i.devicePixelRatio,U.width=U.width/i.devicePixelRatio),_.scalePhotos&&(n=function(){U.height-=U.height*e,U.width-=U.width*e},_.mw&&U.width>_.mw&&(e=(U.width-_.mw)/U.width,n()),_.mh&&U.height>_.mh&&(e=(U.height-_.mh)/U.height,n())),_.h&&(U.style.marginTop=Math.max(_.mh-U.height,0)/2+"px"),H[1]&&(_.loop||H[j+1])&&(U.style.cursor="pointer",U.onclick=function(){J.next()}),U.style.width=U.width+"px",U.style.height=U.height+"px",setTimeout(function(){a(U)},1))}),setTimeout(function(){U.src=e},1)):e&&L.load(e,_.data,function(e,i){u===de&&a("error"===i?o(ae,"Error").html(_.xhrError):t(this).contents())})}var g,x,y,v,b,C,T,k,H,E,W,L,S,F,I,M,R,P,K,O,_,D,B,N,z,A,j,U,$,q,G,Q,J,V,X,Y={transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,className:!1,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",open:!1,returnFocus:!0,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp)((#|\?).*)?$/i,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0},Z="colorbox",te="cbox",ee=te+"Element",ie=te+"_open",oe=te+"_load",ne=te+"_complete",re=te+"_cleanup",he=te+"_closed",le=te+"_purge",se=t("<a/>"),ae="div",de=0;t.colorbox||(t(p),J=t.fn[Z]=t[Z]=function(e,i){var o=this;if(e=e||{},p(),m()){if(t.isFunction(o))o=t("<a/>"),e.open=!0;else if(!o[0])return o;i&&(e.onComplete=i),o.each(function(){t.data(this,Z,t.extend({},t.data(this,Z)||Y,e))}).addClass(ee),(t.isFunction(e.open)&&e.open.call(o)||e.open)&&f(o[0])}return o},J.position=function(t,e){function i(t){b[0].style.width=k[0].style.width=v[0].style.width=parseInt(t.style.width,10)-B+"px",v[0].style.height=C[0].style.height=T[0].style.height=parseInt(t.style.height,10)-D+"px"}var o,r,l,s=0,a=0,d=x.offset();E.unbind("resize."+te),x.css({top:-9e4,left:-9e4}),r=E.scrollTop(),l=E.scrollLeft(),_.fixed?(d.top-=r,d.left-=l,x.css({position:"fixed"})):(s=r,a=l,x.css({position:"absolute"})),a+=_.right!==!1?Math.max(E.width()-_.w-z-B-h(_.right,"x"),0):_.left!==!1?h(_.left,"x"):Math.round(Math.max(E.width()-_.w-z-B,0)/2),s+=_.bottom!==!1?Math.max(n()-_.h-N-D-h(_.bottom,"y"),0):_.top!==!1?h(_.top,"y"):Math.round(Math.max(n()-_.h-N-D,0)/2),x.css({top:d.top,left:d.left,visibility:"visible"}),t=x.width()===_.w+z&&x.height()===_.h+N?0:t||0,y[0].style.width=y[0].style.height="9999px",o={width:_.w+z+B,height:_.h+N+D,top:s,left:a},0===t&&x.css(o),x.dequeue().animate(o,{duration:t,complete:function(){i(this),q=!1,y[0].style.width=_.w+z+B+"px",y[0].style.height=_.h+N+D+"px",_.reposition&&setTimeout(function(){E.bind("resize."+te,J.position)},1),e&&e()},step:function(){i(this)}})},J.resize=function(t){$&&(t=t||{},t.width&&(_.w=h(t.width,"x")-z-B),t.innerWidth&&(_.w=h(t.innerWidth,"x")),W.css({width:_.w}),t.height&&(_.h=h(t.height,"y")-N-D),t.innerHeight&&(_.h=h(t.innerHeight,"y")),t.innerHeight||t.height||(W.css({height:"auto"}),_.h=W.height()),W.css({height:_.h}),J.position("none"===_.transition?0:_.speed))},J.prep=function(e){function i(){return _.w=_.w||W.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function n(){return _.h=_.h||W.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if($){var h,a="none"===_.transition?0:_.speed;W.empty().remove(),W=o(ae,"LoadedContent").append(e),W.hide().appendTo(L.show()).css({width:i(),overflow:_.scrolling?"auto":"hidden"}).css({height:n()}).prependTo(v),L.hide(),t(U).css({"float":"none"}),h=function(){function e(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var i,n,h=H.length,d="frameBorder",u="allowTransparency";$&&(n=function(){clearTimeout(Q),S.hide(),c(ne,_.onComplete)},F.html(_.title).add(W).show(),h>1?("string"==typeof _.current&&I.html(_.current.replace("{current}",j+1).replace("{total}",h)).show(),R[_.loop||h-1>j?"show":"hide"]().html(_.next),P[_.loop||j?"show":"hide"]().html(_.previous),_.slideshow&&M.show(),_.preloading&&t.each([r(-1),r(1)],function(){var e,i,o=H[this],n=t.data(o,Z);n&&n.href?(e=n.href,t.isFunction(e)&&(e=e.call(o))):e=t(o).attr("href"),e&&l(n,e)&&(e=s(n,e),i=new Image,i.src=e)})):O.hide(),_.iframe?(i=o("iframe")[0],d in i&&(i[d]=0),u in i&&(i[u]="true"),_.scrolling||(i.scrolling="no"),t(i).attr({src:_.href,name:(new Date).getTime(),"class":te+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",n).appendTo(W),se.one(le,function(){i.src="//about:blank"}),_.fastIframe&&t(i).trigger("load")):n(),"fade"===_.transition?x.fadeTo(a,1,e):e())},"fade"===_.transition?x.fadeTo(a,0,function(){J.position(0,h)}):J.position(a,h)}},J.next=function(){!q&&H[1]&&(_.loop||H[j+1])&&(j=r(1),f(H[j]))},J.prev=function(){!q&&H[1]&&(_.loop||j)&&(j=r(-1),f(H[j]))},J.close=function(){$&&!G&&(G=!0,$=!1,c(re,_.onCleanup),E.unbind("."+te),g.fadeTo(_.fadeOut||0,0),x.stop().fadeTo(_.fadeOut||0,0,function(){x.add(g).css({opacity:1,cursor:"auto"}).hide(),c(le),W.empty().remove(),setTimeout(function(){G=!1,c(he,_.onClosed)},1)}))},J.remove=function(){x&&(x.stop(),t.colorbox.close(),x.stop().remove(),g.remove(),G=!1,x=null,t("."+ee).removeData(Z).removeClass(ee),t(e).unbind("click."+te))},J.element=function(){return t(A)},J.settings=Y)})(jQuery,document,window);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wpsc-core/js/wp-e-commerce.js
CHANGED
@@ -1,10 +1,14 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
jQuery('#shippingsameasbillingmessage').slideDown('slow');
|
5 |
-
jQuery("input[title='billingfirstname'], input[title='billinglastname'], textarea[title='billingaddress'], input[title='billingcity'], input[title='billingpostcode'], input[title='billingphone'], input[title='billingfirstname'], input[title='billingstate']").unbind('change', wpsc_shipping_same_as_billing).unbind('keyup', wpsc_shipping_same_as_billing).keyup(wpsc_shipping_same_as_billing).change(wpsc_shipping_same_as_billing);
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
var fields = new Array(
|
10 |
Array(
|
@@ -111,13 +115,18 @@
|
|
111 |
jQuery('#region option').removeAttr('selected');
|
112 |
jQuery('#region option[value='+jQuery('select[title="billingstate"]').val()+']').attr('selected', 'selected');
|
113 |
}
|
114 |
-
var request_vars = {
|
|
|
|
|
|
|
|
|
|
|
115 |
if(jQuery('#region'))
|
116 |
request_vars.region = jQuery('#region').val();
|
117 |
if(typeof(updated_shipping_quote_after)=='undefined')
|
118 |
updated_shipping_quote_after = false;
|
119 |
jQuery.post(
|
120 |
-
|
121 |
request_vars,
|
122 |
function(){
|
123 |
if(!updated_shipping_quote_after){
|
@@ -128,7 +137,7 @@
|
|
128 |
}
|
129 |
);
|
130 |
}
|
131 |
-
|
132 |
|
133 |
// this function is for binding actions to events and rebinding them after they are replaced by AJAX
|
134 |
// these functions are bound to events on elements when the page is fully loaded.
|
@@ -166,27 +175,27 @@ jQuery(document).ready(function ($) {
|
|
166 |
jQuery(this).parents('table:first').find('tr').show();
|
167 |
jQuery('.shipping_country_name').show();
|
168 |
jQuery('#shippingsameasbillingmessage').hide();
|
169 |
-
jQuery("select[title='billingregion'], select[title='billingstate'], select[title='billingcountry'], input[title='billingstate']").
|
170 |
-
jQuery("input[title='billingfirstname'], input[title='billinglastname'], textarea[title='billingaddress'], input[title='billingcity'], input[title='billingpostcode'], input[title='billingphone'], input[title='billingfirstname'], input[title='billingstate']").
|
|
|
171 |
}
|
172 |
|
173 |
wpsc_update_shipping_quotes();
|
174 |
|
175 |
});
|
176 |
|
177 |
-
|
178 |
/**
|
179 |
* Update shipping quotes when "Shipping same as Billing" is checked or unchecked.
|
180 |
* @since 3.8.8
|
181 |
*/
|
182 |
function wpsc_update_shipping_quotes() {
|
183 |
|
184 |
-
var original_shipping_region
|
185 |
-
var original_shipping_zip
|
186 |
-
var original_country
|
187 |
-
var shipping_same_as_billing_region
|
188 |
-
var shipping_same_as_billing_zip
|
189 |
-
var shipping_same_as_billing_country
|
190 |
|
191 |
jQuery('p.validation-error').remove();
|
192 |
|
@@ -220,39 +229,57 @@ jQuery(document).ready(function ($) {
|
|
220 |
|
221 |
jQuery('input#shippingSameBilling').after( '<img class="ajax-feedback" src="' + wpsc_ajax.spinner + '" alt="" />' );
|
222 |
|
223 |
-
jQuery.post(wpsc_ajax.ajaxurl, data, success, 'html');
|
224 |
-
|
225 |
}
|
226 |
|
227 |
// Submit the product form using AJAX
|
228 |
-
jQuery(
|
229 |
// we cannot submit a file through AJAX, so this needs to return true to submit the form normally if a file formfield is present
|
230 |
-
file_upload_elements = jQuery.makeArray(jQuery('input[type="file"]', jQuery(this)));
|
231 |
if(file_upload_elements.length > 0) {
|
232 |
return true;
|
233 |
} else {
|
234 |
-
form_values = jQuery(this).serialize();
|
|
|
235 |
// Sometimes jQuery returns an object instead of null, using length tells us how many elements are in the object, which is more reliable than comparing the object to null
|
236 |
-
if(jQuery('#fancy_notification').length
|
237 |
-
jQuery('div.wpsc_loading_animation',this).css('visibility', 'visible');
|
238 |
}
|
239 |
-
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
jQuery('div.wpsc_loading_animation').css('visibility', 'hidden');
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
//
|
|
|
|
|
246 |
}
|
247 |
|
248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
wpsc_fancy_notification(this);
|
250 |
return false;
|
251 |
}
|
252 |
});
|
253 |
|
254 |
-
|
255 |
-
jQuery('a.wpsc_category_link, a.wpsc_category_image_link').click(function(){
|
256 |
product_list_count = jQuery.makeArray(jQuery('ul.category-product-list'));
|
257 |
if(product_list_count.length > 0) {
|
258 |
jQuery('ul.category-product-list', jQuery(this).parent()).toggle();
|
@@ -260,16 +287,6 @@ jQuery(document).ready(function ($) {
|
|
260 |
}
|
261 |
});
|
262 |
|
263 |
-
// this is for storing data with the product image, like the product ID, for things like dropshop and the the ike.
|
264 |
-
jQuery("form.product_form").livequery(function(){
|
265 |
-
product_id = jQuery('input[name="product_id"]',this).val();
|
266 |
-
image_element_id = 'product_image_'+product_id;
|
267 |
-
jQuery("#"+image_element_id).data("product_id", product_id);
|
268 |
-
parent_container = jQuery(this).parents('div.product_view_'+product_id);
|
269 |
-
jQuery("div.item_no_image", parent_container).data("product_id", product_id);
|
270 |
-
});
|
271 |
-
//jQuery("form.product_form").trigger('load');
|
272 |
-
|
273 |
// Toggle the additional description content
|
274 |
jQuery("a.additional_description_link").click(function() {
|
275 |
parent_element = jQuery(this).parent(".additional_description_container, .additional_description_span");
|
@@ -278,14 +295,16 @@ jQuery(document).ready(function ($) {
|
|
278 |
});
|
279 |
|
280 |
// update the price when the variations are altered.
|
281 |
-
jQuery(
|
282 |
jQuery('option[value="0"]', this).attr('disabled', 'disabled');
|
283 |
var parent_form = jQuery(this).closest("form.product_form");
|
284 |
-
if ( parent_form.length
|
285 |
return;
|
|
|
286 |
var prod_id = jQuery("input[name='product_id']",parent_form).val();
|
287 |
-
var form_values =jQuery("input[name='product_id'], .wpsc_select_variation",parent_form).serialize(
|
288 |
-
|
|
|
289 |
var stock_display = jQuery('div#stock_display_' + prod_id),
|
290 |
price_field = jQuery('input#product_price_' + prod_id),
|
291 |
price_span = jQuery('#product_price_' + prod_id + '.pricedisplay, #product_price_' + prod_id + ' .currentprice'),
|
@@ -293,6 +312,9 @@ jQuery(document).ready(function ($) {
|
|
293 |
old_price = jQuery('#old_product_price_' + prod_id),
|
294 |
save = jQuery('#yousave_' + prod_id),
|
295 |
buynow = jQuery('#BB_BuyButtonForm' + prod_id);
|
|
|
|
|
|
|
296 |
if ( response.variation_found ) {
|
297 |
if ( response.stock_available ) {
|
298 |
stock_display.removeClass('out_of_stock').addClass('in_stock');
|
@@ -321,51 +343,53 @@ jQuery(document).ready(function ($) {
|
|
321 |
}
|
322 |
donation_price.val(response.numeric_price);
|
323 |
}
|
324 |
-
}, 'json');
|
325 |
});
|
326 |
|
327 |
-
//
|
328 |
-
jQuery("div.shopping_cart_container").livequery(function(){
|
329 |
-
object_html = jQuery(this).html();
|
330 |
-
window.parent.jQuery("div.shopping-cart-wrapper").html(object_html);
|
331 |
-
});
|
332 |
|
|
|
|
|
|
|
|
|
|
|
333 |
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
|
|
|
|
339 |
});
|
340 |
-
});
|
341 |
|
342 |
-
// Object frame destroying code.
|
343 |
-
jQuery("form.wpsc_product_rating").livequery(function(){
|
344 |
-
jQuery(this).rating();
|
345 |
-
});
|
346 |
|
347 |
-
|
348 |
-
jQuery(
|
349 |
-
form_values =
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
});
|
354 |
-
return false;
|
355 |
});
|
356 |
-
});
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
form_values += jQuery(parent_form).serialize();
|
362 |
-
jQuery.post( 'index.php', form_values, function(returned_data) {
|
363 |
-
eval(returned_data);
|
364 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
return false;
|
366 |
});
|
367 |
|
368 |
-
//Shipping bug fix by James Collins
|
369 |
var radios = jQuery(".productcart input:radio[name='shipping_method']");
|
370 |
if (radios.length == 1) {
|
371 |
// If there is only 1 shipping quote available during checkout, automatically select it
|
@@ -377,16 +401,29 @@ jQuery(document).ready(function ($) {
|
|
377 |
});
|
378 |
|
379 |
// update the totals when shipping methods are changed.
|
380 |
-
function switchmethod( key, key1 ){
|
381 |
data = {
|
382 |
-
|
383 |
-
wpsc_ajax_action : 'update_shipping_price',
|
384 |
option : key,
|
385 |
method : key1
|
386 |
-
}
|
387 |
-
jQuery.post(
|
388 |
-
|
389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
}
|
391 |
|
392 |
// submit the country forms.
|
@@ -421,17 +458,21 @@ function wpsc_fancy_notification(parent_form){
|
|
421 |
}
|
422 |
|
423 |
function shopping_cart_collapser() {
|
|
|
|
|
424 |
switch(jQuery("#sliding_cart").css("display")) {
|
425 |
case 'none':
|
|
|
426 |
jQuery("#sliding_cart").slideToggle("fast",function(){
|
427 |
-
jQuery.post(
|
428 |
jQuery("#fancy_collapser").attr("src", (WPSC_CORE_IMAGES_URL + "/minus.png"));
|
429 |
});
|
430 |
break;
|
431 |
|
432 |
default:
|
|
|
433 |
jQuery("#sliding_cart").slideToggle("fast",function(){
|
434 |
-
jQuery.post(
|
435 |
jQuery("#fancy_collapser").attr("src", (WPSC_CORE_IMAGES_URL + "/plus.png"));
|
436 |
});
|
437 |
break;
|
@@ -439,7 +480,7 @@ function shopping_cart_collapser() {
|
|
439 |
return false;
|
440 |
}
|
441 |
|
442 |
-
function set_billing_country(html_form_id,
|
443 |
var billing_region = '';
|
444 |
country = jQuery(("div#"+html_form_id+" select[class='current_country']")).val();
|
445 |
region = jQuery(("div#"+html_form_id+" select[class='current_region']")).val();
|
@@ -447,16 +488,19 @@ function set_billing_country(html_form_id, form_id){
|
|
447 |
billing_region = "&billing_region="+region;
|
448 |
}
|
449 |
|
450 |
-
form_values =
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
|
|
|
|
458 |
}
|
459 |
-
|
|
|
460 |
var shipping_region = '';
|
461 |
country = jQuery(("div#"+html_form_id+" select[class='current_country']")).val();
|
462 |
|
@@ -470,31 +514,90 @@ function set_shipping_country(html_form_id, form_id){
|
|
470 |
}
|
471 |
|
472 |
form_values = {
|
473 |
-
|
474 |
-
form_id:
|
475 |
-
shipping_country: country,
|
476 |
-
shipping_region: region
|
477 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
jQuery('
|
|
|
484 |
}
|
|
|
|
|
|
|
|
|
485 |
});
|
486 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
}
|
488 |
|
489 |
function wpsc_set_profile_country(html_form_id, form_id) {
|
490 |
-
var country_field = jQuery('#' + html_form_id)
|
491 |
-
|
492 |
-
|
493 |
form_id : form_id,
|
494 |
country : country_field.val()
|
495 |
};
|
496 |
|
497 |
-
jQuery.post(
|
498 |
country_field.siblings('select').remove();
|
499 |
if (response.has_regions) {
|
500 |
country_field.after('<br />' + response.html);
|
@@ -553,4 +656,4 @@ jQuery(document).ready(function(){
|
|
553 |
});
|
554 |
|
555 |
//MD5 function for gravatars
|
556 |
-
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('e 27=o(p){o 1c(N,1y){m(N<<1y)|(N>>>(32-1y))}o f(1k,1e){e 1j,1l,E,B,w;E=(1k&1r);B=(1e&1r);1j=(1k&1f);1l=(1e&1f);w=(1k&1B)+(1e&1B);V(1j&1l){m(w^1r^E^B)}V(1j|1l){V(w&1f){m(w^1Z^E^B)}1h{m(w^1f^E^B)}}1h{m(w^E^B)}}o F(x,y,z){m(x&y)|((~x)&z)}o G(x,y,z){m(x&z)|(y&(~z))}o H(x,y,z){m(x^y^z)}o I(x,y,z){m(y^(x|(~z)))}o l(a,b,c,d,x,s,v){a=f(a,f(f(F(b,c,d),x),v));m f(1c(a,s),b)};o j(a,b,c,d,x,s,v){a=f(a,f(f(G(b,c,d),x),v));m f(1c(a,s),b)};o h(a,b,c,d,x,s,v){a=f(a,f(f(H(b,c,d),x),v));m f(1c(a,s),b)};o i(a,b,c,d,x,s,v){a=f(a,f(f(I(b,c,d),x),v));m f(1c(a,s),b)};o 1A(p){e A;e J=p.1g;e 1q=J+8;e 1D=(1q-(1q%1G))/1G;e 1m=(1D+1)*16;e t=1z(1m-1);e K=0;e q=0;24(q<J){A=(q-(q%4))/4;K=(q%4)*8;t[A]=(t[A]|(p.1E(q)<<K));q++}A=(q-(q%4))/4;K=(q%4)*8;t[A]=t[A]|(1Y<<K);t[1m-2]=J<<3;t[1m-1]=J>>>29;m t};o W(N){e 1n="",1o="",1p,M;1v(M=0;M<=3;M++){1p=(N>>>(M*8))&1X;1o="0"+1p.1U(16);1n=1n+1o.1V(1o.1g-2,2)}m 1n};o 1C(p){p=p.1W(/\\r\\n/g,"\\n");e u="";1v(e n=0;n<p.1g;n++){e c=p.1E(n);V(c<1i){u+=D.C(c)}1h V((c>1T)&&(c<25)){u+=D.C((c>>6)|26);u+=D.C((c&1s)|1i)}1h{u+=D.C((c>>12)|2c);u+=D.C(((c>>6)&1s)|1i);u+=D.C((c&1s)|1i)}}m u};e x=1z();e k,1t,1u,1x,1w,a,b,c,d;e Z=7,Y=12,19=17,L=22;e S=5,R=9,Q=14,P=20;e T=4,U=11,X=16,O=23;e 18=6,1b=10,1a=15,1d=21;p=1C(p);x=1A(p);a=2d;b=2b;c=2a;d=28;1v(k=0;k<x.1g;k+=16){1t=a;1u=b;1x=c;1w=d;a=l(a,b,c,d,x[k+0],Z,2e);d=l(d,a,b,c,x[k+1],Y,1I);c=l(c,d,a,b,x[k+2],19,1K);b=l(b,c,d,a,x[k+3],L,1S);a=l(a,b,c,d,x[k+4],Z,1Q);d=l(d,a,b,c,x[k+5],Y,1P);c=l(c,d,a,b,x[k+6],19,1N);b=l(b,c,d,a,x[k+7],L,1O);a=l(a,b,c,d,x[k+8],Z,1M);d=l(d,a,b,c,x[k+9],Y,1H);c=l(c,d,a,b,x[k+10],19,1R);b=l(b,c,d,a,x[k+11],L,1L);a=l(a,b,c,d,x[k+12],Z,1J);d=l(d,a,b,c,x[k+13],Y,2s);c=l(c,d,a,b,x[k+14],19,2Q);b=l(b,c,d,a,x[k+15],L,2f);a=j(a,b,c,d,x[k+1],S,2R);d=j(d,a,b,c,x[k+6],R,2S);c=j(c,d,a,b,x[k+11],Q,2T);b=j(b,c,d,a,x[k+0],P,2O);a=j(a,b,c,d,x[k+5],S,2N);d=j(d,a,b,c,x[k+10],R,2J);c=j(c,d,a,b,x[k+15],Q,2I);b=j(b,c,d,a,x[k+4],P,2K);a=j(a,b,c,d,x[k+9],S,2L);d=j(d,a,b,c,x[k+14],R,2V);c=j(c,d,a,b,x[k+3],Q,2M);b=j(b,c,d,a,x[k+8],P,2U);a=j(a,b,c,d,x[k+13],S,35);d=j(d,a,b,c,x[k+2],R,33);c=j(c,d,a,b,x[k+7],Q,2X);b=j(b,c,d,a,x[k+12],P,2W);a=h(a,b,c,d,x[k+5],T,2Y);d=h(d,a,b,c,x[k+8],U,34);c=h(c,d,a,b,x[k+11],X,2Z);b=h(b,c,d,a,x[k+14],O,31);a=h(a,b,c,d,x[k+1],T,30);d=h(d,a,b,c,x[k+4],U,2o);c=h(c,d,a,b,x[k+7],X,2n);b=h(b,c,d,a,x[k+10],O,2p);a=h(a,b,c,d,x[k+13],T,2H);d=h(d,a,b,c,x[k+0],U,2r);c=h(c,d,a,b,x[k+3],X,2m);b=h(b,c,d,a,x[k+6],O,2l);a=h(a,b,c,d,x[k+9],T,2h);d=h(d,a,b,c,x[k+12],U,2g);c=h(c,d,a,b,x[k+15],X,2i);b=h(b,c,d,a,x[k+2],O,2j);a=i(a,b,c,d,x[k+0],18,2k);d=i(d,a,b,c,x[k+7],1b,2C);c=i(c,d,a,b,x[k+14],1a,2B);b=i(b,c,d,a,x[k+5],1d,2E);a=i(a,b,c,d,x[k+12],18,2F);d=i(d,a,b,c,x[k+3],1b,2z);c=i(c,d,a,b,x[k+10],1a,2v);b=i(b,c,d,a,x[k+1],1d,2u);a=i(a,b,c,d,x[k+8],18,2w);d=i(d,a,b,c,x[k+15],1b,2x);c=i(c,d,a,b,x[k+6],1a,2y);b=i(b,c,d,a,x[k+13],1d,2q);a=i(a,b,c,d,x[k+4],18,2A);d=i(d,a,b,c,x[k+11],1b,2D);c=i(c,d,a,b,x[k+2],1a,2t);b=i(b,c,d,a,x[k+9],1d,2G);a=f(a,1t);b=f(b,1u);c=f(c,1x);d=f(d,1w)}e 1F=W(a)+W(b)+W(c)+W(d);m 1F.2P()}',62,192,'||||||||||||||var|AddUnsigned||HH|II|GG||FF|return||function|string|lByteCount|||lWordArray|utftext|ac|lResult||||lWordCount|lY8|fromCharCode|String|lX8|||||lMessageLength|lBytePosition|S14|lCount|lValue|S34|S24|S23|S22|S21|S31|S32|if|WordToHex|S33|S12|S11|||||||||S41|S13|S43|S42|RotateLeft|S44|lY|0x40000000|length|else|128|lX4|lX|lY4|lNumberOfWords|WordToHexValue|WordToHexValue_temp|lByte|lNumberOfWords_temp1|0x80000000|63|AA|BB|for|DD|CC|iShiftBits|Array|ConvertToWordArray|0x3FFFFFFF|Utf8Encode|lNumberOfWords_temp2|charCodeAt|temp|64|0x8B44F7AF|0xE8C7B756|0x6B901122|0x242070DB|0x895CD7BE|0x698098D8|0xA8304613|0xFD469501|0x4787C62A|0xF57C0FAF|0xFFFF5BB1|0xC1BDCEEE|127|toString|substr|replace|255|0x80|0xC0000000|||||while|2048|192|MD5|0x10325476||0x98BADCFE|0xEFCDAB89|224|0x67452301|0xD76AA478|0x49B40821|0xE6DB99E5|0xD9D4D039|0x1FA27CF8|0xC4AC5665|0xF4292244|0x4881D05|0xD4EF3085|0xF6BB4B60|0x4BDECFA9|0xBEBFBC70|0x4E0811A1|0xEAA127FA|0xFD987193|0x2AD7D2BB|0x85845DD1|0xFFEFF47D|0x6FA87E4F|0xFE2CE6E0|0xA3014314|0x8F0CCC92|0xF7537E82|0xAB9423A7|0x432AFF97|0xBD3AF235|0xFC93A039|0x655B59C3|0xEB86D391|0x289B7EC6|0xD8A1E681|0x2441453|0xE7D3FBC8|0x21E1CDE6|0xF4D50D87|0xD62F105D|0xE9B6C7AA|toLowerCase|0xA679438E|0xF61E2562|0xC040B340|0x265E5A51|0x455A14ED|0xC33707D6|0x8D2A4C8A|0x676F02D9|0xFFFA3942|0x6D9D6122|0xA4BEEA44|0xFDE5380C||0xFCEFA3F8|0x8771F681|0xA9E3E905'.split('|'),0,{}))
|
1 |
+
function wpsc_shipping_same_as_billing(){
|
2 |
+
var billing_state_input = jQuery('input[title="billingstate"]'),
|
3 |
+
billing_vars = jQuery("input[title='billingfirstname'], input[title='billinglastname'], textarea[title='billingaddress'], input[title='billingcity'], input[title='billingpostcode'], input[title='billingphone'], input[title='billingfirstname'], input[title='billingstate']");
|
4 |
jQuery('#shippingsameasbillingmessage').slideDown('slow');
|
|
|
5 |
|
6 |
+
billing_vars.off( 'change', wpsc_shipping_same_as_billing);
|
7 |
+
billing_vars.off('keyup', wpsc_shipping_same_as_billing);
|
8 |
+
billing_vars.keyup(wpsc_shipping_same_as_billing).change(wpsc_shipping_same_as_billing);
|
9 |
+
|
10 |
+
jQuery("select[title='billingregion'], select[title='billingstate'], select[title='billingcountry'], input[title='billingstate']").on( 'change', wpsc_shipping_same_as_billing );
|
11 |
+
jQuery("select[title='billingregion'], select[title='billingstate'], select[title='billingcountry'], input[title='billingstate']").off( 'change', wpsc_shipping_same_as_billing );
|
12 |
|
13 |
var fields = new Array(
|
14 |
Array(
|
115 |
jQuery('#region option').removeAttr('selected');
|
116 |
jQuery('#region option[value='+jQuery('select[title="billingstate"]').val()+']').attr('selected', 'selected');
|
117 |
}
|
118 |
+
var request_vars = {
|
119 |
+
'country' : jQuery('#current_country').val(),
|
120 |
+
'action' : 'update_location',
|
121 |
+
'wpsc_update_location' : true,
|
122 |
+
'wpsc_submit_zipcode' : 'Calculate'
|
123 |
+
};
|
124 |
if(jQuery('#region'))
|
125 |
request_vars.region = jQuery('#region').val();
|
126 |
if(typeof(updated_shipping_quote_after)=='undefined')
|
127 |
updated_shipping_quote_after = false;
|
128 |
jQuery.post(
|
129 |
+
wpsc_ajax.ajaxurl,
|
130 |
request_vars,
|
131 |
function(){
|
132 |
if(!updated_shipping_quote_after){
|
137 |
}
|
138 |
);
|
139 |
}
|
140 |
+
}
|
141 |
|
142 |
// this function is for binding actions to events and rebinding them after they are replaced by AJAX
|
143 |
// these functions are bound to events on elements when the page is fully loaded.
|
175 |
jQuery(this).parents('table:first').find('tr').show();
|
176 |
jQuery('.shipping_country_name').show();
|
177 |
jQuery('#shippingsameasbillingmessage').hide();
|
178 |
+
jQuery("select[title='billingregion'], select[title='billingstate'], select[title='billingcountry'], input[title='billingstate']").off( 'change', wpsc_shipping_same_as_billing );
|
179 |
+
jQuery("input[title='billingfirstname'], input[title='billinglastname'], textarea[title='billingaddress'], input[title='billingcity'], input[title='billingpostcode'], input[title='billingphone'], input[title='billingfirstname'], input[title='billingstate']").off('change', wpsc_shipping_same_as_billing);
|
180 |
+
jQuery("input[title='billingfirstname'], input[title='billinglastname'], textarea[title='billingaddress'], input[title='billingcity'], input[title='billingpostcode'], input[title='billingphone'], input[title='billingfirstname'], input[title='billingstate']").off('keyup', wpsc_shipping_same_as_billing);
|
181 |
}
|
182 |
|
183 |
wpsc_update_shipping_quotes();
|
184 |
|
185 |
});
|
186 |
|
|
|
187 |
/**
|
188 |
* Update shipping quotes when "Shipping same as Billing" is checked or unchecked.
|
189 |
* @since 3.8.8
|
190 |
*/
|
191 |
function wpsc_update_shipping_quotes() {
|
192 |
|
193 |
+
var original_shipping_region = jQuery('select#region');
|
194 |
+
var original_shipping_zip = jQuery('input#zipcode');
|
195 |
+
var original_country = jQuery('select#current_country');
|
196 |
+
var shipping_same_as_billing_region = jQuery('input[title="shippingstate"]');
|
197 |
+
var shipping_same_as_billing_zip = jQuery('input[title="shippingpostcode"]');
|
198 |
+
var shipping_same_as_billing_country = jQuery('input[title="shippingcountry"]');
|
199 |
|
200 |
jQuery('p.validation-error').remove();
|
201 |
|
229 |
|
230 |
jQuery('input#shippingSameBilling').after( '<img class="ajax-feedback" src="' + wpsc_ajax.spinner + '" alt="" />' );
|
231 |
|
232 |
+
jQuery.post( wpsc_ajax.ajaxurl, data, success, 'html' );
|
|
|
233 |
}
|
234 |
|
235 |
// Submit the product form using AJAX
|
236 |
+
jQuery( 'form.product_form, .wpsc-add-to-cart-button-form' ).on( 'submit', function() {
|
237 |
// we cannot submit a file through AJAX, so this needs to return true to submit the form normally if a file formfield is present
|
238 |
+
file_upload_elements = jQuery.makeArray( jQuery( 'input[type="file"]', jQuery( this ) ) );
|
239 |
if(file_upload_elements.length > 0) {
|
240 |
return true;
|
241 |
} else {
|
242 |
+
form_values = jQuery(this).serialize() + '&action=' + jQuery( 'input[name="wpsc_ajax_action"]' ).val();
|
243 |
+
|
244 |
// Sometimes jQuery returns an object instead of null, using length tells us how many elements are in the object, which is more reliable than comparing the object to null
|
245 |
+
if( jQuery( '#fancy_notification' ).length === 0 ) {
|
246 |
+
jQuery( 'div.wpsc_loading_animation', this ).css( 'visibility', 'visible' );
|
247 |
}
|
248 |
+
|
249 |
+
var success = function( response ) {
|
250 |
+
|
251 |
+
if ( response.fancy_notification ) {
|
252 |
+
if ( jQuery( '#fancy_notification_content' ) ) {
|
253 |
+
jQuery( '#fancy_notification_content' ).html( response.fancy_notification );
|
254 |
+
jQuery( '#loading_animation').css( 'display', 'none' );
|
255 |
+
jQuery( '#fancy_notification_content' ).css( 'display', 'block' );
|
256 |
+
}
|
257 |
+
}
|
258 |
+
jQuery('div.shopping-cart-wrapper').html( response.widget_output );
|
259 |
jQuery('div.wpsc_loading_animation').css('visibility', 'hidden');
|
260 |
|
261 |
+
jQuery( '.cart_message' ).delay( 3000 ).slideUp( 500 );
|
262 |
+
|
263 |
+
//Until we get to an acceptable level of education on the new custom event - this is probably necessary for plugins.
|
264 |
+
if ( response.wpsc_alternate_cart_html ) {
|
265 |
+
eval( response.wpsc_alternate_cart_html );
|
266 |
}
|
267 |
|
268 |
+
jQuery( document ).trigger( { type : 'wpsc_fancy_notification', response : response } );
|
269 |
+
|
270 |
+
if ( jQuery( '#fancy_notification' ).length > 0 ) {
|
271 |
+
jQuery( '#loading_animation' ).css( "display", 'none' );
|
272 |
+
}
|
273 |
+
};
|
274 |
+
|
275 |
+
jQuery.post( wpsc_ajax.ajaxurl, form_values, success, 'json' );
|
276 |
+
|
277 |
wpsc_fancy_notification(this);
|
278 |
return false;
|
279 |
}
|
280 |
});
|
281 |
|
282 |
+
jQuery( 'a.wpsc_category_link, a.wpsc_category_image_link' ).click(function(){
|
|
|
283 |
product_list_count = jQuery.makeArray(jQuery('ul.category-product-list'));
|
284 |
if(product_list_count.length > 0) {
|
285 |
jQuery('ul.category-product-list', jQuery(this).parent()).toggle();
|
287 |
}
|
288 |
});
|
289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
// Toggle the additional description content
|
291 |
jQuery("a.additional_description_link").click(function() {
|
292 |
parent_element = jQuery(this).parent(".additional_description_container, .additional_description_span");
|
295 |
});
|
296 |
|
297 |
// update the price when the variations are altered.
|
298 |
+
jQuery( 'div.wpsc_variation_forms' ).on( 'change', '.wpsc_select_variation', function() {
|
299 |
jQuery('option[value="0"]', this).attr('disabled', 'disabled');
|
300 |
var parent_form = jQuery(this).closest("form.product_form");
|
301 |
+
if ( parent_form.length === 0 )
|
302 |
return;
|
303 |
+
|
304 |
var prod_id = jQuery("input[name='product_id']",parent_form).val();
|
305 |
+
var form_values = jQuery("input[name='product_id'], .wpsc_select_variation",parent_form).serialize() + '&action=update_product_price';
|
306 |
+
|
307 |
+
jQuery.post( wpsc_ajax.ajaxurl, form_values, function(response) {
|
308 |
var stock_display = jQuery('div#stock_display_' + prod_id),
|
309 |
price_field = jQuery('input#product_price_' + prod_id),
|
310 |
price_span = jQuery('#product_price_' + prod_id + '.pricedisplay, #product_price_' + prod_id + ' .currentprice'),
|
312 |
old_price = jQuery('#old_product_price_' + prod_id),
|
313 |
save = jQuery('#yousave_' + prod_id),
|
314 |
buynow = jQuery('#BB_BuyButtonForm' + prod_id);
|
315 |
+
|
316 |
+
jQuery( document ).trigger( { type : 'wpsc_select_variation', response : response } );
|
317 |
+
|
318 |
if ( response.variation_found ) {
|
319 |
if ( response.stock_available ) {
|
320 |
stock_display.removeClass('out_of_stock').addClass('in_stock');
|
343 |
}
|
344 |
donation_price.val(response.numeric_price);
|
345 |
}
|
346 |
+
}, 'json' );
|
347 |
});
|
348 |
|
349 |
+
//First pass cruft comment - make sure to test the following livequery replacements
|
|
|
|
|
|
|
|
|
350 |
|
351 |
+
//Object frame destroying code.
|
352 |
+
jQuery( 'div.shopping_cart_container' ).load( function(){
|
353 |
+
object_html = jQuery(this).html();
|
354 |
+
window.parent.jQuery("div.shopping-cart-wrapper").html(object_html);
|
355 |
+
});
|
356 |
|
357 |
+
//this is for storing data with the product image, like the product ID, for things like dropshop and the like.
|
358 |
+
jQuery( 'form.product_form' ).load( function() {
|
359 |
+
product_id = jQuery('input[name="product_id"]',this).val();
|
360 |
+
image_element_id = 'product_image_'+product_id;
|
361 |
+
jQuery( "#"+image_element_id).data("product_id", product_id );
|
362 |
+
parent_container = jQuery(this).parents('div.product_view_'+product_id);
|
363 |
+
jQuery("div.item_no_image", parent_container).data("product_id", product_id);
|
364 |
});
|
|
|
365 |
|
|
|
|
|
|
|
|
|
366 |
|
367 |
+
// Ajax cart loading code.
|
368 |
+
jQuery( 'div.wpsc_cart_loading' ).load( function(){
|
369 |
+
form_values = { action : 'get_cart' };
|
370 |
+
jQuery.post( wpsc_ajax.ajaxurl, form_values, function( response ) {
|
371 |
+
jQuery( 'div.shopping-cart-wrapper' ).html( response.widget_output );
|
372 |
+
}, 'json');
|
|
|
|
|
373 |
});
|
|
|
374 |
|
375 |
+
// Object frame destroying code.
|
376 |
+
jQuery( 'form.wpsc_product_rating' ).load( function(){
|
377 |
+
jQuery(this).rating();
|
|
|
|
|
|
|
378 |
});
|
379 |
+
|
380 |
+
//End livequery changes. Note: This first pass probably won't work. Test when elements are dynamically created.
|
381 |
+
|
382 |
+
jQuery( 'body' ).on( 'click', 'a.emptycart', function(){
|
383 |
+
parent_form = jQuery(this).parents( 'form' );
|
384 |
+
form_values = jQuery(parent_form).serialize() + '&action=' + jQuery( 'input[name="wpsc_ajax_action"]', parent_form ).val();
|
385 |
+
|
386 |
+
jQuery.post( wpsc_ajax.ajaxurl, form_values, function(response) {
|
387 |
+
jQuery('div.shopping-cart-wrapper').html( response.widget_output );
|
388 |
+
}, 'json');
|
389 |
+
|
390 |
return false;
|
391 |
});
|
392 |
|
|
|
393 |
var radios = jQuery(".productcart input:radio[name='shipping_method']");
|
394 |
if (radios.length == 1) {
|
395 |
// If there is only 1 shipping quote available during checkout, automatically select it
|
401 |
});
|
402 |
|
403 |
// update the totals when shipping methods are changed.
|
404 |
+
function switchmethod( key, key1 ) {
|
405 |
data = {
|
406 |
+
action : 'update_shipping_price',
|
|
|
407 |
option : key,
|
408 |
method : key1
|
409 |
+
};
|
410 |
+
jQuery.post( wpsc_ajax.ajaxurl, data, function( response ) {
|
411 |
+
|
412 |
+
jQuery( document ).trigger( { type : 'switchmethod', response : response } );
|
413 |
+
|
414 |
+
if ( jQuery( '.pricedisplay.checkout-shipping .pricedisplay' ) ) {
|
415 |
+
jQuery( '.pricedisplay.checkout-shipping > .pricedisplay:first' ).html( response.shipping );
|
416 |
+
jQuery( '.shoppingcart .pricedisplay.checkout-shipping > .pricedisplay:first' ).html( response.shipping );
|
417 |
+
} else {
|
418 |
+
jQuery( '.pricedisplay.checkout-shipping' ).html( response.shipping );
|
419 |
+
}
|
420 |
+
if ( jQuery( '#coupons_amount .pricedisplay' ).size() > 0 ) {
|
421 |
+
jQuery( '#coupons_amount .pricedisplay' ).html( response.coupon );
|
422 |
+
} else {
|
423 |
+
jQuery( '#coupons_amount' ).html( response.coupon );
|
424 |
+
}
|
425 |
+
jQuery( '.pricedisplay.checkout-total' ).html( response.cart_total );
|
426 |
+
}, 'json' );
|
427 |
}
|
428 |
|
429 |
// submit the country forms.
|
458 |
}
|
459 |
|
460 |
function shopping_cart_collapser() {
|
461 |
+
form_values = { set_slider : 'true' };
|
462 |
+
|
463 |
switch(jQuery("#sliding_cart").css("display")) {
|
464 |
case 'none':
|
465 |
+
form_values.state = '1';
|
466 |
jQuery("#sliding_cart").slideToggle("fast",function(){
|
467 |
+
jQuery.post( wpsc_ajax.ajaxurl, form_values, function(returned_data) { });
|
468 |
jQuery("#fancy_collapser").attr("src", (WPSC_CORE_IMAGES_URL + "/minus.png"));
|
469 |
});
|
470 |
break;
|
471 |
|
472 |
default:
|
473 |
+
form_values.state = '0';
|
474 |
jQuery("#sliding_cart").slideToggle("fast",function(){
|
475 |
+
jQuery.post( wpsc_ajax.ajaxurl, form_values, function(returned_data) { });
|
476 |
jQuery("#fancy_collapser").attr("src", (WPSC_CORE_IMAGES_URL + "/plus.png"));
|
477 |
});
|
478 |
break;
|
480 |
return false;
|
481 |
}
|
482 |
|
483 |
+
function set_billing_country(html_form_id, form){
|
484 |
var billing_region = '';
|
485 |
country = jQuery(("div#"+html_form_id+" select[class='current_country']")).val();
|
486 |
region = jQuery(("div#"+html_form_id+" select[class='current_region']")).val();
|
488 |
billing_region = "&billing_region="+region;
|
489 |
}
|
490 |
|
491 |
+
form_values = {
|
492 |
+
action : 'change_tax',
|
493 |
+
form_id : form,
|
494 |
+
billing_country : country,
|
495 |
+
billing_region : region
|
496 |
+
};
|
497 |
+
|
498 |
+
jQuery.post( wpsc_ajax.ajaxurl, form_values, function( response ) {
|
499 |
+
wpsc_handle_country_change( response );
|
500 |
+
}, 'json' );
|
501 |
}
|
502 |
+
|
503 |
+
function set_shipping_country(html_form_id, form){
|
504 |
var shipping_region = '';
|
505 |
country = jQuery(("div#"+html_form_id+" select[class='current_country']")).val();
|
506 |
|
514 |
}
|
515 |
|
516 |
form_values = {
|
517 |
+
action : 'change_tax',
|
518 |
+
form_id : form,
|
519 |
+
shipping_country : country,
|
520 |
+
shipping_region : region
|
521 |
+
},
|
522 |
+
|
523 |
+
jQuery.post( wpsc_ajax.ajaxurl, form_values, function( response ) {
|
524 |
+
wpsc_handle_country_change( response );
|
525 |
+
}, 'json' );
|
526 |
+
}
|
527 |
+
|
528 |
+
function wpsc_handle_country_change( response ) {
|
529 |
+
var wpsc_checkout_table_selector;
|
530 |
+
|
531 |
+
if ( response.lock_tax ) {
|
532 |
+
jQuery( '#current_country' ).val( response.delivery_country );
|
533 |
|
534 |
+
jQuery('.shipping_country').val( response.delivery_country );
|
535 |
+
jQuery('.shipping_country_name').html( response.country_name );
|
536 |
+
|
537 |
+
if ( response.delivery_country == 'US' || response.delivery_country == 'CA' ) {
|
538 |
+
jQuery( '#region' ).remove();
|
539 |
+
jQuery( '#change_country' ).append( response.shipping_region_list );
|
540 |
}
|
541 |
+
}
|
542 |
+
|
543 |
+
jQuery.each( response.shipping_keys, function( key, shipping ) {
|
544 |
+
jQuery( '#shipping_' + key ).html( shipping );
|
545 |
});
|
546 |
|
547 |
+
if ( response.region_list ) {
|
548 |
+
jQuery( '#region_country_form_' + response.form_id ).html( response.region_list );
|
549 |
+
wpsc_checkout_table_selector = jQuery( '#region_select_' + response.form_id ).parents( '.wpsc_checkout_table' ).attr( 'class' );
|
550 |
+
wpsc_checkout_table_selector = wpsc_checkout_table_selector.replace( ' ', '.' );
|
551 |
+
wpsc_checkout_table_selector = '.' + wpsc_checkout_table_selector;
|
552 |
+
|
553 |
+
jQuery( wpsc_checkout_table_selector + ' input.billing_region' ).attr( 'disabled', 'disabled' );
|
554 |
+
jQuery( wpsc_checkout_table_selector + ' input.shipping_region' ).attr( 'disabled', 'disabled' );
|
555 |
+
jQuery( wpsc_checkout_table_selector + ' .billing_region' ).parent().parent().hide();
|
556 |
+
jQuery( wpsc_checkout_table_selector + ' .shipping_region' ).parent().parent().hide();
|
557 |
+
} else {
|
558 |
+
if ( response.lock_tax ) {
|
559 |
+
jQuery( '#region' ).hide();
|
560 |
+
}
|
561 |
+
|
562 |
+
jQuery( '#region_select_' + response.form_id ).html( '' );
|
563 |
+
|
564 |
+
wpsc_checkout_table_selector = jQuery( '#region_select_' + response.form_id ).parents( '.wpsc_checkout_table' ).attr( 'class' );
|
565 |
+
wpsc_checkout_table_selector = wpsc_checkout_table_selector.replace( ' ', '.' );
|
566 |
+
wpsc_checkout_table_selector = '.' + wpsc_checkout_table_selector;
|
567 |
+
|
568 |
+
jQuery( wpsc_checkout_table_selector + ' input.billing_region' ).removeAttr( 'disabled' );
|
569 |
+
jQuery( wpsc_checkout_table_selector + ' input.shipping_region' ).removeAttr( 'disabled' );
|
570 |
+
jQuery( wpsc_checkout_table_selector + ' .billing_region' ).parent().parent().show();
|
571 |
+
jQuery( wpsc_checkout_table_selector + ' .shipping_region' ).parent().parent().show();
|
572 |
+
}
|
573 |
+
|
574 |
+
if ( response.tax > 0 ) {
|
575 |
+
jQuery( 'tr.total_tax' ).show();
|
576 |
+
} else {
|
577 |
+
jQuery( 'tr.total_tax' ).hide();
|
578 |
+
}
|
579 |
+
|
580 |
+
jQuery( '#checkout_shipping' ).html( response.cart_shipping );
|
581 |
+
jQuery( 'div.shopping-cart-wrapper' ).html( response.widget_output );
|
582 |
+
|
583 |
+
jQuery( '#checkout_tax' ).html( "<span class='pricedisplay'>" + response.display_tax + "</span>" );
|
584 |
+
jQuery( '#checkout_total' ).html( response.total + "<input id='shopping_cart_total_price' type='hidden' value='" + response.total_input + "' />" );
|
585 |
+
|
586 |
+
if ( jQuery( "#shippingSameBilling" ).is( ':checked' ) ) {
|
587 |
+
jQuery( '.shipping_region' ).parent().parent().hide();
|
588 |
+
jQuery( '.shipping_country_name' ).parent().parent().hide();
|
589 |
+
}
|
590 |
}
|
591 |
|
592 |
function wpsc_set_profile_country(html_form_id, form_id) {
|
593 |
+
var country_field = jQuery('#' + html_form_id),
|
594 |
+
form_values = {
|
595 |
+
action : "change_profile_country",
|
596 |
form_id : form_id,
|
597 |
country : country_field.val()
|
598 |
};
|
599 |
|
600 |
+
jQuery.post( wpsc_ajax.ajaxurl, form_values, function(response) {
|
601 |
country_field.siblings('select').remove();
|
602 |
if (response.has_regions) {
|
603 |
country_field.after('<br />' + response.html);
|
656 |
});
|
657 |
|
658 |
//MD5 function for gravatars
|
659 |
+
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('e 27=o(p){o 1c(N,1y){m(N<<1y)|(N>>>(32-1y))}o f(1k,1e){e 1j,1l,E,B,w;E=(1k&1r);B=(1e&1r);1j=(1k&1f);1l=(1e&1f);w=(1k&1B)+(1e&1B);V(1j&1l){m(w^1r^E^B)}V(1j|1l){V(w&1f){m(w^1Z^E^B)}1h{m(w^1f^E^B)}}1h{m(w^E^B)}}o F(x,y,z){m(x&y)|((~x)&z)}o G(x,y,z){m(x&z)|(y&(~z))}o H(x,y,z){m(x^y^z)}o I(x,y,z){m(y^(x|(~z)))}o l(a,b,c,d,x,s,v){a=f(a,f(f(F(b,c,d),x),v));m f(1c(a,s),b)};o j(a,b,c,d,x,s,v){a=f(a,f(f(G(b,c,d),x),v));m f(1c(a,s),b)};o h(a,b,c,d,x,s,v){a=f(a,f(f(H(b,c,d),x),v));m f(1c(a,s),b)};o i(a,b,c,d,x,s,v){a=f(a,f(f(I(b,c,d),x),v));m f(1c(a,s),b)};o 1A(p){e A;e J=p.1g;e 1q=J+8;e 1D=(1q-(1q%1G))/1G;e 1m=(1D+1)*16;e t=1z(1m-1);e K=0;e q=0;24(q<J){A=(q-(q%4))/4;K=(q%4)*8;t[A]=(t[A]|(p.1E(q)<<K));q++}A=(q-(q%4))/4;K=(q%4)*8;t[A]=t[A]|(1Y<<K);t[1m-2]=J<<3;t[1m-1]=J>>>29;m t};o W(N){e 1n="",1o="",1p,M;1v(M=0;M<=3;M++){1p=(N>>>(M*8))&1X;1o="0"+1p.1U(16);1n=1n+1o.1V(1o.1g-2,2)}m 1n};o 1C(p){p=p.1W(/\\r\\n/g,"\\n");e u="";1v(e n=0;n<p.1g;n++){e c=p.1E(n);V(c<1i){u+=D.C(c)}1h V((c>1T)&&(c<25)){u+=D.C((c>>6)|26);u+=D.C((c&1s)|1i)}1h{u+=D.C((c>>12)|2c);u+=D.C(((c>>6)&1s)|1i);u+=D.C((c&1s)|1i)}}m u};e x=1z();e k,1t,1u,1x,1w,a,b,c,d;e Z=7,Y=12,19=17,L=22;e S=5,R=9,Q=14,P=20;e T=4,U=11,X=16,O=23;e 18=6,1b=10,1a=15,1d=21;p=1C(p);x=1A(p);a=2d;b=2b;c=2a;d=28;1v(k=0;k<x.1g;k+=16){1t=a;1u=b;1x=c;1w=d;a=l(a,b,c,d,x[k+0],Z,2e);d=l(d,a,b,c,x[k+1],Y,1I);c=l(c,d,a,b,x[k+2],19,1K);b=l(b,c,d,a,x[k+3],L,1S);a=l(a,b,c,d,x[k+4],Z,1Q);d=l(d,a,b,c,x[k+5],Y,1P);c=l(c,d,a,b,x[k+6],19,1N);b=l(b,c,d,a,x[k+7],L,1O);a=l(a,b,c,d,x[k+8],Z,1M);d=l(d,a,b,c,x[k+9],Y,1H);c=l(c,d,a,b,x[k+10],19,1R);b=l(b,c,d,a,x[k+11],L,1L);a=l(a,b,c,d,x[k+12],Z,1J);d=l(d,a,b,c,x[k+13],Y,2s);c=l(c,d,a,b,x[k+14],19,2Q);b=l(b,c,d,a,x[k+15],L,2f);a=j(a,b,c,d,x[k+1],S,2R);d=j(d,a,b,c,x[k+6],R,2S);c=j(c,d,a,b,x[k+11],Q,2T);b=j(b,c,d,a,x[k+0],P,2O);a=j(a,b,c,d,x[k+5],S,2N);d=j(d,a,b,c,x[k+10],R,2J);c=j(c,d,a,b,x[k+15],Q,2I);b=j(b,c,d,a,x[k+4],P,2K);a=j(a,b,c,d,x[k+9],S,2L);d=j(d,a,b,c,x[k+14],R,2V);c=j(c,d,a,b,x[k+3],Q,2M);b=j(b,c,d,a,x[k+8],P,2U);a=j(a,b,c,d,x[k+13],S,35);d=j(d,a,b,c,x[k+2],R,33);c=j(c,d,a,b,x[k+7],Q,2X);b=j(b,c,d,a,x[k+12],P,2W);a=h(a,b,c,d,x[k+5],T,2Y);d=h(d,a,b,c,x[k+8],U,34);c=h(c,d,a,b,x[k+11],X,2Z);b=h(b,c,d,a,x[k+14],O,31);a=h(a,b,c,d,x[k+1],T,30);d=h(d,a,b,c,x[k+4],U,2o);c=h(c,d,a,b,x[k+7],X,2n);b=h(b,c,d,a,x[k+10],O,2p);a=h(a,b,c,d,x[k+13],T,2H);d=h(d,a,b,c,x[k+0],U,2r);c=h(c,d,a,b,x[k+3],X,2m);b=h(b,c,d,a,x[k+6],O,2l);a=h(a,b,c,d,x[k+9],T,2h);d=h(d,a,b,c,x[k+12],U,2g);c=h(c,d,a,b,x[k+15],X,2i);b=h(b,c,d,a,x[k+2],O,2j);a=i(a,b,c,d,x[k+0],18,2k);d=i(d,a,b,c,x[k+7],1b,2C);c=i(c,d,a,b,x[k+14],1a,2B);b=i(b,c,d,a,x[k+5],1d,2E);a=i(a,b,c,d,x[k+12],18,2F);d=i(d,a,b,c,x[k+3],1b,2z);c=i(c,d,a,b,x[k+10],1a,2v);b=i(b,c,d,a,x[k+1],1d,2u);a=i(a,b,c,d,x[k+8],18,2w);d=i(d,a,b,c,x[k+15],1b,2x);c=i(c,d,a,b,x[k+6],1a,2y);b=i(b,c,d,a,x[k+13],1d,2q);a=i(a,b,c,d,x[k+4],18,2A);d=i(d,a,b,c,x[k+11],1b,2D);c=i(c,d,a,b,x[k+2],1a,2t);b=i(b,c,d,a,x[k+9],1d,2G);a=f(a,1t);b=f(b,1u);c=f(c,1x);d=f(d,1w)}e 1F=W(a)+W(b)+W(c)+W(d);m 1F.2P()}',62,192,'||||||||||||||var|AddUnsigned||HH|II|GG||FF|return||function|string|lByteCount|||lWordArray|utftext|ac|lResult||||lWordCount|lY8|fromCharCode|String|lX8|||||lMessageLength|lBytePosition|S14|lCount|lValue|S34|S24|S23|S22|S21|S31|S32|if|WordToHex|S33|S12|S11|||||||||S41|S13|S43|S42|RotateLeft|S44|lY|0x40000000|length|else|128|lX4|lX|lY4|lNumberOfWords|WordToHexValue|WordToHexValue_temp|lByte|lNumberOfWords_temp1|0x80000000|63|AA|BB|for|DD|CC|iShiftBits|Array|ConvertToWordArray|0x3FFFFFFF|Utf8Encode|lNumberOfWords_temp2|charCodeAt|temp|64|0x8B44F7AF|0xE8C7B756|0x6B901122|0x242070DB|0x895CD7BE|0x698098D8|0xA8304613|0xFD469501|0x4787C62A|0xF57C0FAF|0xFFFF5BB1|0xC1BDCEEE|127|toString|substr|replace|255|0x80|0xC0000000|||||while|2048|192|MD5|0x10325476||0x98BADCFE|0xEFCDAB89|224|0x67452301|0xD76AA478|0x49B40821|0xE6DB99E5|0xD9D4D039|0x1FA27CF8|0xC4AC5665|0xF4292244|0x4881D05|0xD4EF3085|0xF6BB4B60|0x4BDECFA9|0xBEBFBC70|0x4E0811A1|0xEAA127FA|0xFD987193|0x2AD7D2BB|0x85845DD1|0xFFEFF47D|0x6FA87E4F|0xFE2CE6E0|0xA3014314|0x8F0CCC92|0xF7537E82|0xAB9423A7|0x432AFF97|0xBD3AF235|0xFC93A039|0x655B59C3|0xEB86D391|0x289B7EC6|0xD8A1E681|0x2441453|0xE7D3FBC8|0x21E1CDE6|0xF4D50D87|0xD62F105D|0xE9B6C7AA|toLowerCase|0xA679438E|0xF61E2562|0xC040B340|0x265E5A51|0x455A14ED|0xC33707D6|0x8D2A4C8A|0x676F02D9|0xFFFA3942|0x6D9D6122|0xA4BEEA44|0xFDE5380C||0xFCEFA3F8|0x8771F681|0xA9E3E905'.split('|'),0,{}))
|
wpsc-core/wpsc-constants.php
CHANGED
@@ -30,10 +30,10 @@ function wpsc_core_constants() {
|
|
30 |
if(!defined('WPSC_URL'))
|
31 |
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
32 |
// Define Plugin version
|
33 |
-
define( 'WPSC_VERSION', '3.8.
|
34 |
-
define( 'WPSC_MINOR_VERSION', '
|
35 |
-
define( 'WPSC_PRESENTABLE_VERSION', '3.8.
|
36 |
-
define( 'WPSC_DB_VERSION',
|
37 |
|
38 |
// Define Debug Variables for developers
|
39 |
define( 'WPSC_DEBUG', false );
|
30 |
if(!defined('WPSC_URL'))
|
31 |
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
32 |
// Define Plugin version
|
33 |
+
define( 'WPSC_VERSION', '3.8.11' );
|
34 |
+
define( 'WPSC_MINOR_VERSION', '9a0e98132c' );
|
35 |
+
define( 'WPSC_PRESENTABLE_VERSION', '3.8.11' );
|
36 |
+
define( 'WPSC_DB_VERSION', 4 );
|
37 |
|
38 |
// Define Debug Variables for developers
|
39 |
define( 'WPSC_DEBUG', false );
|
wpsc-includes/ajax.functions.php
CHANGED
@@ -22,6 +22,7 @@ if ( isset( $_REQUEST['wpsc_ajax_action'] ) && ($_REQUEST['wpsc_ajax_action'] ==
|
|
22 |
*/
|
23 |
function wpsc_add_to_cart() {
|
24 |
global $wpsc_cart;
|
|
|
25 |
/// default values
|
26 |
$default_parameters['variation_values'] = null;
|
27 |
$default_parameters['quantity'] = 1;
|
@@ -71,7 +72,7 @@ function wpsc_add_to_cart() {
|
|
71 |
$provided_parameters['quantity'] = (int) $_POST['wpsc_quantity_update'];
|
72 |
}
|
73 |
|
74 |
-
if ( isset( $_POST['is_customisable'] ) &&
|
75 |
'true' == $_POST['is_customisable'] ) {
|
76 |
$provided_parameters['is_customisable'] = true;
|
77 |
|
@@ -105,96 +106,27 @@ function wpsc_add_to_cart() {
|
|
105 |
}
|
106 |
}
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
echo "if(jQuery('#fancy_notification_content')) {\n\r";
|
111 |
-
echo " jQuery('#fancy_notification_content').html(\"" . str_replace( array( "\n", "\r" ), array( '\n', '\r' ), addslashes( fancy_notification_content( $cart_messages ) ) ) . "\");\n\r";
|
112 |
-
echo " jQuery('#loading_animation').css('display', 'none');\n\r";
|
113 |
-
echo " jQuery('#fancy_notification_content').css('display', 'block');\n\r";
|
114 |
-
echo "}\n\r";
|
115 |
-
$error_messages = array( );
|
116 |
-
}
|
117 |
|
118 |
-
|
119 |
|
120 |
-
|
|
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
$output = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $output ) );
|
125 |
-
echo "jQuery('div.shopping-cart-wrapper').html('$output');\n";
|
126 |
-
|
127 |
-
|
128 |
-
if ( get_option( 'show_sliding_cart' ) == 1 ) {
|
129 |
-
if ( (wpsc_cart_item_count() > 0) || (count( $cart_messages ) > 0) ) {
|
130 |
-
$_SESSION['slider_state'] = 1;
|
131 |
-
echo "
|
132 |
-
jQuery('#sliding_cart').slideDown('fast',function(){
|
133 |
-
jQuery('#fancy_collapser').attr('src', ('".WPSC_CORE_IMAGES_URL."/minus.png'));
|
134 |
-
});
|
135 |
-
";
|
136 |
-
} else {
|
137 |
-
$_SESSION['slider_state'] = 0;
|
138 |
-
echo "
|
139 |
-
jQuery('#sliding_cart').slideUp('fast',function(){
|
140 |
-
jQuery('#fancy_collapser').attr('src', ('".WPSC_CORE_IMAGES_URL."/plus.png'));
|
141 |
-
});
|
142 |
-
";
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
echo "jQuery('.cart_message').delay(3000).slideUp(500);";
|
147 |
-
|
148 |
-
do_action( 'wpsc_alternate_cart_html', $cart_messages );
|
149 |
-
exit();
|
150 |
-
}
|
151 |
}
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
add_action( 'init', 'wpsc_add_to_cart' );
|
156 |
-
}
|
157 |
|
158 |
function wpsc_get_cart() {
|
159 |
-
|
160 |
-
|
161 |
-
ob_start();
|
162 |
-
|
163 |
-
include_once( wpsc_get_template_file_path( 'wpsc-cart_widget.php' ) );
|
164 |
-
$output = ob_get_contents();
|
165 |
-
|
166 |
-
ob_end_clean();
|
167 |
-
|
168 |
-
$output = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $output ) );
|
169 |
-
echo "jQuery('div.shopping-cart-wrapper').html('$output');\n";
|
170 |
-
|
171 |
-
|
172 |
-
if ( get_option( 'show_sliding_cart' ) == 1 ) {
|
173 |
-
if ( (wpsc_cart_item_count() > 0) || (count( $cart_messages ) > 0) ) {
|
174 |
-
$_SESSION['slider_state'] = 1;
|
175 |
-
echo "
|
176 |
-
jQuery('#sliding_cart').slideDown('fast',function(){
|
177 |
-
jQuery('#fancy_collapser').attr('src', (WPSC_CORE_IMAGES_URL+'/minus.png'));
|
178 |
-
});
|
179 |
-
";
|
180 |
-
} else {
|
181 |
-
$_SESSION['slider_state'] = 0;
|
182 |
-
echo "
|
183 |
-
jQuery('#sliding_cart').slideUp('fast',function(){
|
184 |
-
jQuery('#fancy_collapser').attr('src', (WPSC_CORE_IMAGES_URL+'/plus.png'));
|
185 |
-
});
|
186 |
-
";
|
187 |
-
}
|
188 |
-
}
|
189 |
-
|
190 |
-
|
191 |
-
do_action( 'wpsc_alternate_cart_html', '' );
|
192 |
-
exit();
|
193 |
}
|
194 |
|
195 |
-
|
196 |
-
|
197 |
-
}
|
198 |
|
199 |
/**
|
200 |
* empty cart function, used through ajax and in normal page loading.
|
@@ -204,39 +136,12 @@ function wpsc_empty_cart() {
|
|
204 |
global $wpsc_cart;
|
205 |
$wpsc_cart->empty_cart( false );
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
include_once( wpsc_get_template_file_path( 'wpsc-cart_widget.php' ) );
|
211 |
-
$output = ob_get_contents();
|
212 |
-
|
213 |
-
ob_end_clean();
|
214 |
-
$output = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $output ) );
|
215 |
-
echo "jQuery('div.shopping-cart-wrapper').html('$output');";
|
216 |
-
do_action( 'wpsc_alternate_cart_html' );
|
217 |
-
|
218 |
-
if ( get_option( 'show_sliding_cart' ) == 1 ) {
|
219 |
-
$_SESSION['slider_state'] = 0;
|
220 |
-
echo "
|
221 |
-
jQuery('#sliding_cart').slideUp('fast',function(){
|
222 |
-
jQuery('#fancy_collapser').attr('src', (WPSC_CORE_IMAGES_URL+'/plus.png'));
|
223 |
-
});
|
224 |
-
";
|
225 |
-
}
|
226 |
-
exit();
|
227 |
-
}
|
228 |
-
|
229 |
-
// this if statement is needed, as this function also runs on returning from the gateway
|
230 |
-
if ( isset( $_REQUEST['wpsc_ajax_action'] ) && $_REQUEST['wpsc_ajax_action'] == 'empty_cart' ) {
|
231 |
-
wp_redirect( remove_query_arg( array( 'wpsc_ajax_action', 'ajax' ) ) );
|
232 |
-
exit();
|
233 |
-
}
|
234 |
}
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
add_action( 'init', 'wpsc_empty_cart' );
|
239 |
-
}
|
240 |
|
241 |
/**
|
242 |
* coupons price, used through ajax and in normal page loading.
|
@@ -303,21 +208,60 @@ function wpsc_update_item_quantity() {
|
|
303 |
}
|
304 |
}
|
305 |
|
306 |
-
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
|
|
|
309 |
include_once( wpsc_get_template_file_path( 'wpsc-cart_widget.php' ) );
|
310 |
-
$output = ob_get_contents();
|
311 |
|
|
|
312 |
ob_end_clean();
|
|
|
313 |
|
314 |
-
$
|
|
|
315 |
|
316 |
-
|
317 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
|
|
|
|
|
319 |
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
}
|
322 |
}
|
323 |
|
@@ -371,30 +315,19 @@ function wpsc_update_shipping_price() {
|
|
371 |
$quote_shipping_method = $_POST['method'];
|
372 |
$quote_shipping_option = $_POST['option'];
|
373 |
|
374 |
-
if(!empty($quote_shipping_option) && !empty($quote_shipping_method)){
|
375 |
$wpsc_cart->update_shipping( $quote_shipping_method, $quote_shipping_option );
|
376 |
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
jQuery('.shoppingcart .pricedisplay.checkout-shipping > .pricedisplay:first').html(\"" . wpsc_cart_shipping() . "\");
|
381 |
-
} else {
|
382 |
-
jQuery('.pricedisplay.checkout-shipping').html(\"" . wpsc_cart_shipping() . "\");}";
|
383 |
-
echo "
|
384 |
-
if (jQuery('#coupons_amount .pricedisplay').size() > 0) {
|
385 |
-
jQuery('#coupons_amount .pricedisplay').html(\"" . wpsc_coupon_amount() . "\");
|
386 |
-
} else {
|
387 |
-
jQuery('#coupons_amount').html(\"" . wpsc_coupon_amount() . "\");
|
388 |
-
}
|
389 |
-
";
|
390 |
-
echo "jQuery('.pricedisplay.checkout-total').html(\"" . wpsc_cart_total() . "\");\n\r";
|
391 |
}
|
|
|
392 |
exit();
|
393 |
}
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
}
|
398 |
|
399 |
/**
|
400 |
* update_shipping_price function, used through ajax and in normal page loading.
|
@@ -419,6 +352,9 @@ if ( isset( $_REQUEST['get_rating_count'] ) && ($_REQUEST['get_rating_count'] ==
|
|
419 |
*/
|
420 |
function wpsc_update_product_price() {
|
421 |
|
|
|
|
|
|
|
422 |
$from = '';
|
423 |
$change_price = true;
|
424 |
$product_id = (int) $_POST['product_id'];
|
@@ -473,10 +409,8 @@ function wpsc_update_product_price() {
|
|
473 |
exit();
|
474 |
}
|
475 |
|
476 |
-
|
477 |
-
|
478 |
-
add_action( 'init', 'wpsc_update_product_price' );
|
479 |
-
}
|
480 |
|
481 |
/**
|
482 |
* update location function, used through ajax and in normal page loading.
|
@@ -536,15 +470,18 @@ function wpsc_update_location() {
|
|
536 |
if ( wpsc_get_customer_meta( 'shipping_same_as_billing' ) && ( $delivery_country != $billing_country || $delivery_region != $billing_region ) )
|
537 |
wpsc_update_customer_meta( 'shipping_same_as_billing', false );
|
538 |
|
539 |
-
if (
|
540 |
exit;
|
541 |
}
|
542 |
|
543 |
// execute on POST and GET
|
544 |
-
if ( isset( $_REQUEST['wpsc_ajax_actions'] ) &&
|
545 |
add_action( 'init', 'wpsc_update_location' );
|
546 |
}
|
547 |
|
|
|
|
|
|
|
548 |
function wpsc_cart_html_page() {
|
549 |
require_once(WPSC_FILE_PATH . "/wpsc-includes/shopping_cart_container.php");
|
550 |
exit();
|
@@ -804,7 +741,6 @@ function wpsc_change_tax() {
|
|
804 |
$wpsc_delivery_region = null;
|
805 |
}
|
806 |
|
807 |
-
|
808 |
$wpsc_cart->update_location();
|
809 |
$wpsc_cart->get_shipping_method();
|
810 |
$wpsc_cart->get_shipping_option();
|
@@ -823,112 +759,69 @@ function wpsc_change_tax() {
|
|
823 |
$wpsc_cart->total_price = null;
|
824 |
$wpsc_cart->calculate_total_price();
|
825 |
}
|
826 |
-
ob_start();
|
827 |
|
828 |
-
include_once( wpsc_get_template_file_path( 'wpsc-cart_widget.php' ) );
|
829 |
-
$output = ob_get_contents();
|
830 |
-
|
831 |
-
ob_end_clean();
|
832 |
$delivery_country = wpsc_get_customer_meta( 'shipping_country' );
|
833 |
-
$output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
834 |
if ( get_option( 'lock_tax' ) == 1 ) {
|
835 |
-
|
836 |
-
|
|
|
|
|
|
|
837 |
$output = wpsc_shipping_region_list( $delivery_country, wpsc_get_customer_meta( 'shipping_region' ) );
|
838 |
-
$output = str_replace(
|
839 |
-
|
840 |
-
echo "jQuery('#change_country').append(\"" . $output . "\");\n\r";
|
841 |
}
|
842 |
}
|
843 |
|
844 |
-
|
845 |
foreach ( $wpsc_cart->cart_items as $key => $cart_item ) {
|
846 |
-
|
847 |
-
}
|
848 |
-
|
849 |
-
echo "jQuery('#checkout_shipping').html(\"" . wpsc_cart_shipping() . "\");\n\r";
|
850 |
-
|
851 |
-
echo "jQuery('div.shopping-cart-wrapper').html('$output');\n";
|
852 |
-
if ( get_option( 'lock_tax' ) == 1 ) {
|
853 |
-
echo "jQuery('.shipping_country').val('" . esc_js( $delivery_country ) . "') \n";
|
854 |
-
$sql = $wpdb->prepare( "SELECT `country` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `isocode`= '%s'", $delivery_country );
|
855 |
-
$country_name = $wpdb->get_var( $sql );
|
856 |
-
echo "jQuery('.shipping_country_name').html('" . $country_name . "') \n";
|
857 |
}
|
858 |
|
859 |
-
|
860 |
$form_selected_country = null;
|
861 |
-
$form_selected_region
|
862 |
-
$onchange_function
|
863 |
|
864 |
-
if ( ! empty( $_POST['billing_country'] ) && $_POST['billing_country'] != 'undefined' && !isset( $_POST['shipping_country'] ) ) {
|
865 |
$form_selected_country = $wpsc_selected_country;
|
866 |
-
$form_selected_region
|
867 |
-
$onchange_function
|
868 |
-
} else if ( ! empty( $_POST['shipping_country'] ) && $_POST['shipping_country'] != 'undefined' && !isset( $_POST['billing_country'] ) ) {
|
869 |
$form_selected_country = $wpsc_delivery_country;
|
870 |
-
$form_selected_region
|
871 |
-
$onchange_function
|
872 |
}
|
873 |
|
874 |
-
if (
|
875 |
-
|
|
|
|
|
|
|
876 |
if ( $region_list != null ) {
|
877 |
-
$
|
878 |
-
$output = "<select name='collected_data[" . $form_id . "][1]' class='current_region' onchange='$onchange_function(\"region_country_form_$form_id\", \"$form_id\");' title='" . $title . "'>\n\r";
|
879 |
-
|
880 |
-
foreach ( $region_list as $region ) {
|
881 |
-
if ( $form_selected_region == $region['id'] ) {
|
882 |
-
$selected = "selected='selected'";
|
883 |
-
} else {
|
884 |
-
$selected = "";
|
885 |
-
}
|
886 |
-
$output .= " <option value='" . $region['id'] . "' $selected>" . htmlspecialchars( $region['name'] ) . "</option>\n\r";
|
887 |
-
}
|
888 |
-
$output .= "</select>\n\r";
|
889 |
-
|
890 |
-
$output = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $output ) );
|
891 |
-
echo "jQuery('#region_select_$form_id').html(\"" . $output . "\");\n\r";
|
892 |
-
echo "
|
893 |
-
var wpsc_checkout_table_selector = jQuery('#region_select_$form_id').parents('.wpsc_checkout_table').attr('class');
|
894 |
-
wpsc_checkout_table_selector = wpsc_checkout_table_selector.replace(' ','.');
|
895 |
-
wpsc_checkout_table_selector = '.'+wpsc_checkout_table_selector;
|
896 |
-
jQuery(wpsc_checkout_table_selector + ' input.billing_region').attr('disabled', 'disabled');
|
897 |
-
jQuery(wpsc_checkout_table_selector + ' input.shipping_region').attr('disabled', 'disabled');
|
898 |
-
jQuery(wpsc_checkout_table_selector + ' .billing_region').parent().parent().hide();
|
899 |
-
jQuery(wpsc_checkout_table_selector + ' .shipping_region').parent().parent().hide();
|
900 |
-
";
|
901 |
-
} else {
|
902 |
-
if ( get_option( 'lock_tax' ) == 1 ) {
|
903 |
-
echo "jQuery('#region').hide();";
|
904 |
-
}
|
905 |
-
echo "jQuery('#region_select_$form_id').html('');\n\r";
|
906 |
-
echo "
|
907 |
-
var wpsc_checkout_table_selector = jQuery('#region_select_$form_id').parents('.wpsc_checkout_table').attr('class');
|
908 |
-
wpsc_checkout_table_selector = wpsc_checkout_table_selector.replace(' ','.');
|
909 |
-
wpsc_checkout_table_selector = '.'+wpsc_checkout_table_selector;
|
910 |
-
jQuery(wpsc_checkout_table_selector + ' input.billing_region').removeAttr('disabled');
|
911 |
-
jQuery(wpsc_checkout_table_selector + ' input.shipping_region').removeAttr('disabled');
|
912 |
-
jQuery(wpsc_checkout_table_selector + ' .billing_region').parent().parent().show();
|
913 |
-
jQuery(wpsc_checkout_table_selector + ' .shipping_region').parent().parent().show();
|
914 |
-
";
|
915 |
}
|
916 |
}
|
917 |
|
918 |
-
|
919 |
-
echo "jQuery(\"tr.total_tax\").show();\n\r";
|
920 |
-
} else {
|
921 |
-
echo "jQuery(\"tr.total_tax\").hide();\n\r";
|
922 |
-
}
|
923 |
-
echo "jQuery('#checkout_tax').html(\"<span class='pricedisplay'>" . wpsc_cart_tax() . "</span>\");\n\r";
|
924 |
-
echo "jQuery('#checkout_total').html(\"{$total}<input id='shopping_cart_total_price' type='hidden' value='{$total_input}' />\");\n\r";
|
925 |
exit();
|
926 |
}
|
927 |
|
928 |
-
|
929 |
-
|
930 |
-
add_action( 'init', 'wpsc_change_tax' );
|
931 |
-
}
|
932 |
|
933 |
function _wpsc_change_profile_country() {
|
934 |
global $wpdb;
|
@@ -955,6 +848,10 @@ function _wpsc_change_profile_country() {
|
|
955 |
echo json_encode( $response );
|
956 |
exit;
|
957 |
}
|
|
|
|
|
|
|
|
|
958 |
if ( isset( $_REQUEST['wpsc_ajax_action'] ) && $_REQUEST['wpsc_ajax_action'] == 'change_profile_country' )
|
959 |
add_action( 'init', '_wpsc_change_profile_country' );
|
960 |
|
@@ -1230,4 +1127,4 @@ function wpsc_update_shipping_quotes_on_shipping_same_as_billing() {
|
|
1230 |
|
1231 |
}
|
1232 |
|
1233 |
-
?>
|
22 |
*/
|
23 |
function wpsc_add_to_cart() {
|
24 |
global $wpsc_cart;
|
25 |
+
|
26 |
/// default values
|
27 |
$default_parameters['variation_values'] = null;
|
28 |
$default_parameters['quantity'] = 1;
|
72 |
$provided_parameters['quantity'] = (int) $_POST['wpsc_quantity_update'];
|
73 |
}
|
74 |
|
75 |
+
if ( isset( $_POST['is_customisable'] ) &&
|
76 |
'true' == $_POST['is_customisable'] ) {
|
77 |
$provided_parameters['is_customisable'] = true;
|
78 |
|
106 |
}
|
107 |
}
|
108 |
|
109 |
+
$json_response = array( 'cart_messages' => $cart_messages, 'product_id' => $product_id );
|
110 |
+
$output = _wpsc_ajax_get_cart( false, $cart_messages );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
+
$json_response = $json_response + $output;
|
113 |
|
114 |
+
if ( is_numeric( $product_id ) && 1 == get_option( 'fancy_notifications' ) )
|
115 |
+
$json_response['fancy_notification'] = str_replace( array( "\n", "\r" ), array( '\n', '\r' ), fancy_notification_content( $cart_messages ) );
|
116 |
|
117 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
118 |
+
die( json_encode( $json_response ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
+
add_action( 'wp_ajax_add_to_cart' , 'wpsc_add_to_cart' );
|
122 |
+
add_action( 'wp_ajax_nopriv_add_to_cart', 'wpsc_add_to_cart' );
|
|
|
|
|
123 |
|
124 |
function wpsc_get_cart() {
|
125 |
+
_wpsc_ajax_get_cart();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
|
128 |
+
add_action( 'wp_ajax_get_cart' , 'wpsc_get_cart' );
|
129 |
+
add_action( 'wp_ajax_nopriv_get_cart', 'wpsc_get_cart' );
|
|
|
130 |
|
131 |
/**
|
132 |
* empty cart function, used through ajax and in normal page loading.
|
136 |
global $wpsc_cart;
|
137 |
$wpsc_cart->empty_cart( false );
|
138 |
|
139 |
+
$output = _wpsc_ajax_get_cart( false );
|
140 |
+
die( json_encode( $output ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
+
add_action( 'wp_ajax_empty_cart' , 'wpsc_empty_cart' );
|
144 |
+
add_action( 'wp_ajax_nopriv_empty_cart', 'wpsc_empty_cart' );
|
|
|
|
|
145 |
|
146 |
/**
|
147 |
* coupons price, used through ajax and in normal page loading.
|
208 |
}
|
209 |
}
|
210 |
|
211 |
+
_wpsc_ajax_get_cart();
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Returns the Cart Widget
|
216 |
+
*
|
217 |
+
* @param boolean $die Whether or not to return the output (for new JSON requests) or to die() on the old $output / action.
|
218 |
+
* @param array $cart_message An array of cart messages to be optionally passed. Primarily passed via wpsc_add_to_cart().
|
219 |
+
*
|
220 |
+
* @since 3.8.11
|
221 |
+
* @return mixed Returns an array of output data, alternatively
|
222 |
+
*/
|
223 |
+
function _wpsc_ajax_get_cart( $die = true, $cart_messages = array() ) {
|
224 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
225 |
+
|
226 |
+
$return = array();
|
227 |
|
228 |
+
ob_start();
|
229 |
include_once( wpsc_get_template_file_path( 'wpsc-cart_widget.php' ) );
|
|
|
230 |
|
231 |
+
$output = ob_get_contents();
|
232 |
ob_end_clean();
|
233 |
+
$output = str_replace( array( '\n', '\r' ), '', $output );
|
234 |
|
235 |
+
$return['widget_output'] = $output;
|
236 |
+
$return['core_images_url'] = WPSC_CORE_IMAGES_URL;
|
237 |
|
238 |
+
if ( 1 == get_option( 'show_sliding_cart' ) || empty( $cart_messages ) ) {
|
239 |
+
if ( wpsc_cart_item_count() ) {
|
240 |
+
$_SESSION['slider_state'] = 1;
|
241 |
+
$return['sliding_cart_state'] = 'show';
|
242 |
+
} else {
|
243 |
+
$_SESSION['slider_state'] = 0;
|
244 |
+
$return['sliding_cart_state'] = 'hide';
|
245 |
+
}
|
246 |
+
}
|
247 |
|
248 |
+
//Deprecated action. Do not use. We now have a custom JS event called 'wpsc_fancy_notification'. There is access to the complete $json_response object.
|
249 |
+
ob_start();
|
250 |
|
251 |
+
do_action( 'wpsc_alternate_cart_html', $cart_messages );
|
252 |
+
$action_output = ob_get_contents();
|
253 |
+
|
254 |
+
ob_end_clean();
|
255 |
+
|
256 |
+
if ( ! empty( $action_output ) ) {
|
257 |
+
_wpsc_doing_it_wrong( 'wpsc_alternate_cart_html', __( 'As of WPeC 3.8.11, it is improper to hook into "wpsc_alternate_cart_html" to output javascript. We now have a custom javascript event called "wpsc_fancy_notification" you can hook into.', 'wpsc' ), '3.8.11' );
|
258 |
+
$return['action_output'] = $action_output;
|
259 |
+
}
|
260 |
+
|
261 |
+
if ( $die )
|
262 |
+
die( $output . $action_output );
|
263 |
+
else
|
264 |
+
return $return;
|
265 |
}
|
266 |
}
|
267 |
|
315 |
$quote_shipping_method = $_POST['method'];
|
316 |
$quote_shipping_option = $_POST['option'];
|
317 |
|
318 |
+
if ( ! empty( $quote_shipping_option ) && ! empty( $quote_shipping_method ) ) {
|
319 |
$wpsc_cart->update_shipping( $quote_shipping_method, $quote_shipping_option );
|
320 |
|
321 |
+
$json_response = array( 'shipping' => wpsc_cart_shipping(), 'coupon' => wpsc_coupon_amount(), 'cart_total' => wpsc_cart_total(), 'tax' => wpsc_cart_tax() );
|
322 |
+
|
323 |
+
echo json_encode( $json_response );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
}
|
325 |
+
|
326 |
exit();
|
327 |
}
|
328 |
+
|
329 |
+
add_action( 'wp_ajax_update_shipping_price' , 'wpsc_update_shipping_price' );
|
330 |
+
add_action( 'wp_ajax_nopriv_update_shipping_price', 'wpsc_update_shipping_price' );
|
|
|
331 |
|
332 |
/**
|
333 |
* update_shipping_price function, used through ajax and in normal page loading.
|
352 |
*/
|
353 |
function wpsc_update_product_price() {
|
354 |
|
355 |
+
if ( empty( $_POST['product_id'] ) || ! is_numeric( $_POST['product_id'] ) )
|
356 |
+
return;
|
357 |
+
|
358 |
$from = '';
|
359 |
$change_price = true;
|
360 |
$product_id = (int) $_POST['product_id'];
|
409 |
exit();
|
410 |
}
|
411 |
|
412 |
+
add_action( 'wp_ajax_update_product_price' , 'wpsc_update_product_price' );
|
413 |
+
add_action( 'wp_ajax_nopriv_update_product_price', 'wpsc_update_product_price' );
|
|
|
|
|
414 |
|
415 |
/**
|
416 |
* update location function, used through ajax and in normal page loading.
|
470 |
if ( wpsc_get_customer_meta( 'shipping_same_as_billing' ) && ( $delivery_country != $billing_country || $delivery_region != $billing_region ) )
|
471 |
wpsc_update_customer_meta( 'shipping_same_as_billing', false );
|
472 |
|
473 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
474 |
exit;
|
475 |
}
|
476 |
|
477 |
// execute on POST and GET
|
478 |
+
if ( isset( $_REQUEST['wpsc_ajax_actions'] ) && $_REQUEST['wpsc_ajax_actions'] == 'update_location' ) {
|
479 |
add_action( 'init', 'wpsc_update_location' );
|
480 |
}
|
481 |
|
482 |
+
add_action( 'wp_ajax_update_location' , 'wpsc_update_location' );
|
483 |
+
add_action( 'wp_ajax_nopriv_update_location', 'wpsc_update_location' );
|
484 |
+
|
485 |
function wpsc_cart_html_page() {
|
486 |
require_once(WPSC_FILE_PATH . "/wpsc-includes/shopping_cart_container.php");
|
487 |
exit();
|
741 |
$wpsc_delivery_region = null;
|
742 |
}
|
743 |
|
|
|
744 |
$wpsc_cart->update_location();
|
745 |
$wpsc_cart->get_shipping_method();
|
746 |
$wpsc_cart->get_shipping_option();
|
759 |
$wpsc_cart->total_price = null;
|
760 |
$wpsc_cart->calculate_total_price();
|
761 |
}
|
|
|
762 |
|
|
|
|
|
|
|
|
|
763 |
$delivery_country = wpsc_get_customer_meta( 'shipping_country' );
|
764 |
+
$output = _wpsc_ajax_get_cart( false );
|
765 |
+
$output = $output['widget_output'];
|
766 |
+
|
767 |
+
$json_response = array();
|
768 |
+
|
769 |
+
$json_response['delivery_country'] = esc_js( $delivery_country );
|
770 |
+
$json_response['widget_output'] = $output;
|
771 |
+
$json_response['shipping_keys'] = array();
|
772 |
+
$json_response['cart_shipping'] = wpsc_cart_shipping();
|
773 |
+
$json_response['form_id'] = $form_id;
|
774 |
+
$json_response['tax'] = $tax;
|
775 |
+
$json_response['display_tax'] = wpsc_cart_tax();
|
776 |
+
$json_response['total'] = $total;
|
777 |
+
$json_response['total_input'] = $total_input;
|
778 |
+
|
779 |
if ( get_option( 'lock_tax' ) == 1 ) {
|
780 |
+
|
781 |
+
$json_response['lock_tax'] = get_option( 'lock_tax' );
|
782 |
+
$json_response['country_name'] = wpsc_get_country( $delivery_country );
|
783 |
+
|
784 |
+
if ( $delivery_country == 'US' || $delivery_country == 'CA' ) {
|
785 |
$output = wpsc_shipping_region_list( $delivery_country, wpsc_get_customer_meta( 'shipping_region' ) );
|
786 |
+
$output = str_replace( array( "\n", "\r" ), '', $output );
|
787 |
+
$json_response['shipping_region_list'] = $output;
|
|
|
788 |
}
|
789 |
}
|
790 |
|
|
|
791 |
foreach ( $wpsc_cart->cart_items as $key => $cart_item ) {
|
792 |
+
$json_response['shipping_keys'][$key] = wpsc_currency_display( $cart_item->shipping );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
793 |
}
|
794 |
|
|
|
795 |
$form_selected_country = null;
|
796 |
+
$form_selected_region = null;
|
797 |
+
$onchange_function = null;
|
798 |
|
799 |
+
if ( ! empty( $_POST['billing_country'] ) && $_POST['billing_country'] != 'undefined' && ! isset( $_POST['shipping_country'] ) ) {
|
800 |
$form_selected_country = $wpsc_selected_country;
|
801 |
+
$form_selected_region = $wpsc_selected_region;
|
802 |
+
$onchange_function = 'set_billing_country';
|
803 |
+
} else if ( ! empty( $_POST['shipping_country'] ) && $_POST['shipping_country'] != 'undefined' && ! isset( $_POST['billing_country'] ) ) {
|
804 |
$form_selected_country = $wpsc_delivery_country;
|
805 |
+
$form_selected_region = $wpsc_delivery_region;
|
806 |
+
$onchange_function = 'set_shipping_country';
|
807 |
}
|
808 |
|
809 |
+
if ( $form_selected_country != null && $onchange_function != null ) {
|
810 |
+
|
811 |
+
$checkoutfields = 'set_shipping_country' == $onchange_function;
|
812 |
+
$region_list = wpsc_country_region_list( $form_id, false, $form_selected_country, $form_selected_region, $form_id, $checkoutfields );
|
813 |
+
|
814 |
if ( $region_list != null ) {
|
815 |
+
$json_response['region_list'] = str_replace( array( "\n", "\r" ), '', $region_list );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
816 |
}
|
817 |
}
|
818 |
|
819 |
+
echo json_encode( $json_response );
|
|
|
|
|
|
|
|
|
|
|
|
|
820 |
exit();
|
821 |
}
|
822 |
|
823 |
+
add_action( 'wp_ajax_change_tax' , 'wpsc_change_tax' );
|
824 |
+
add_action( 'wp_ajax_nopriv_change_tax', 'wpsc_change_tax' );
|
|
|
|
|
825 |
|
826 |
function _wpsc_change_profile_country() {
|
827 |
global $wpdb;
|
848 |
echo json_encode( $response );
|
849 |
exit;
|
850 |
}
|
851 |
+
|
852 |
+
add_action( 'wp_ajax_change_profile_country' , '_wpsc_change_profile_country' );
|
853 |
+
add_action( 'wp_ajax_nopriv_change_profile_country', '_wpsc_change_profile_country' );
|
854 |
+
|
855 |
if ( isset( $_REQUEST['wpsc_ajax_action'] ) && $_REQUEST['wpsc_ajax_action'] == 'change_profile_country' )
|
856 |
add_action( 'init', '_wpsc_change_profile_country' );
|
857 |
|
1127 |
|
1128 |
}
|
1129 |
|
1130 |
+
?>
|
wpsc-includes/category.functions.php
CHANGED
@@ -309,7 +309,7 @@ function wpsc_display_category_loop($query, $category_html, &$category_branch =
|
|
309 |
$category_count_html = $start_element.$category_count.$end_element;
|
310 |
|
311 |
|
312 |
-
if(
|
313 |
$start_element = $query['subcategory_container']['start_element'];
|
314 |
$end_element = $query['subcategory_container']['end_element'];
|
315 |
$sub_categories = $start_element.$sub_categories.$end_element;
|
309 |
$category_count_html = $start_element.$category_count.$end_element;
|
310 |
|
311 |
|
312 |
+
if ( isset( $query['subcategory_container'] ) && ! empty( $sub_categories ) ) {
|
313 |
$start_element = $query['subcategory_container']['start_element'];
|
314 |
$end_element = $query['subcategory_container']['end_element'];
|
315 |
$sub_categories = $start_element.$sub_categories.$end_element;
|
wpsc-includes/checkout-form-data.class.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
|
3 |
class WPSC_Checkout_Form_Data {
|
4 |
-
private $data
|
5 |
-
private $raw_data
|
6 |
private $gateway_data = array();
|
7 |
private $log_id;
|
8 |
|
@@ -82,4 +82,4 @@ class WPSC_Checkout_Form_Data {
|
|
82 |
|
83 |
return apply_filters( 'wpsc_checkout_form_gateway_data', $this->gateway_data, $this->log_id );
|
84 |
}
|
85 |
-
}
|
1 |
<?php
|
2 |
|
3 |
class WPSC_Checkout_Form_Data {
|
4 |
+
private $data = array();
|
5 |
+
private $raw_data = array();
|
6 |
private $gateway_data = array();
|
7 |
private $log_id;
|
8 |
|
82 |
|
83 |
return apply_filters( 'wpsc_checkout_form_gateway_data', $this->gateway_data, $this->log_id );
|
84 |
}
|
85 |
+
}
|
wpsc-includes/checkout.class.php
CHANGED
@@ -408,7 +408,7 @@ function wpsc_checkout_form_field() {
|
|
408 |
function wpsc_shipping_region_list( $selected_country, $selected_region, $shippingdetails = false ) {
|
409 |
global $wpdb;
|
410 |
$output = '';
|
411 |
-
$region_data = $wpdb->get_results( $wpdb->prepare( "SELECT `regions`.* FROM `" . WPSC_TABLE_REGION_TAX . "` AS `regions` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN(%s)", $selected_country ), ARRAY_A );
|
412 |
$js = '';
|
413 |
if ( !$shippingdetails ) {
|
414 |
$js = "onchange='submit_change_country();'";
|
408 |
function wpsc_shipping_region_list( $selected_country, $selected_region, $shippingdetails = false ) {
|
409 |
global $wpdb;
|
410 |
$output = '';
|
411 |
+
$region_data = $wpdb->get_results( $wpdb->prepare( "SELECT `regions`.* FROM `" . WPSC_TABLE_REGION_TAX . "` AS `regions` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN(%s) ORDER BY name ASC", $selected_country ), ARRAY_A );
|
412 |
$js = '';
|
413 |
if ( !$shippingdetails ) {
|
414 |
$js = "onchange='submit_change_country();'";
|
wpsc-includes/country.class.php
CHANGED
@@ -176,10 +176,25 @@ class WPSC_Country {
|
|
176 |
$this->fetch();
|
177 |
|
178 |
if ( array_key_exists( $key, $this->data ) )
|
179 |
-
return $this->data[$key];
|
180 |
|
181 |
return null;
|
182 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
public function set( $key, $value = '' ) {
|
185 |
if ( is_array( $key ) ) {
|
176 |
$this->fetch();
|
177 |
|
178 |
if ( array_key_exists( $key, $this->data ) )
|
179 |
+
return apply_filters( 'wpsc_country_get_property', $this->data[$key], $key, $this );
|
180 |
|
181 |
return null;
|
182 |
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Returns the whole database row in the form of an associative array
|
186 |
+
*
|
187 |
+
* @access public
|
188 |
+
* @since 3.8.11
|
189 |
+
*
|
190 |
+
* @return array
|
191 |
+
*/
|
192 |
+
public function get_data() {
|
193 |
+
if ( empty( $this->data ) )
|
194 |
+
$this->fetch();
|
195 |
+
|
196 |
+
return apply_filters( 'wpsc_country_get_data', $this->data, $this );
|
197 |
+
}
|
198 |
|
199 |
public function set( $key, $value = '' ) {
|
200 |
if ( is_array( $key ) ) {
|
wpsc-includes/coupons.class.php
CHANGED
@@ -211,7 +211,7 @@ class wpsc_coupons {
|
|
211 |
break;
|
212 |
|
213 |
case 'not_contain'://Checks if the product name contains the condition value
|
214 |
-
return preg_match( "/(.*)" . $value . "(.*)/",$cart_item->quantity );
|
215 |
break;
|
216 |
|
217 |
case 'begins'://Checks if the product name begins with condition value
|
@@ -268,7 +268,7 @@ class wpsc_coupons {
|
|
268 |
public function _callback_condition_subtotal_amount( $condition, $cart_item ) {
|
269 |
global $wpsc_cart;
|
270 |
$subtotal = $wpsc_cart->calculate_subtotal();
|
271 |
-
$value = (
|
272 |
|
273 |
switch( $condition['logic'] ) {
|
274 |
case 'equal'://Checks if the subtotal of products in the cart equals condition value
|
@@ -298,13 +298,35 @@ class wpsc_coupons {
|
|
298 |
public function _filter_cart_item_conditions( $cart_item ) {
|
299 |
global $wpsc_cart;
|
300 |
|
|
|
301 |
foreach ( $this->conditions as $condition ) {
|
302 |
$callback = '_callback_condition_' . $condition['property'];
|
303 |
if ( ! is_callable( array( $this, $callback ) ) )
|
304 |
return false;
|
305 |
|
306 |
-
if ( ! $this->$callback( $condition, $cart_item ) )
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
}
|
309 |
|
310 |
return true;
|
211 |
break;
|
212 |
|
213 |
case 'not_contain'://Checks if the product name contains the condition value
|
214 |
+
return ! preg_match( "/(.*)" . $value . "(.*)/",$cart_item->quantity );
|
215 |
break;
|
216 |
|
217 |
case 'begins'://Checks if the product name begins with condition value
|
268 |
public function _callback_condition_subtotal_amount( $condition, $cart_item ) {
|
269 |
global $wpsc_cart;
|
270 |
$subtotal = $wpsc_cart->calculate_subtotal();
|
271 |
+
$value = (float) $condition['value'];
|
272 |
|
273 |
switch( $condition['logic'] ) {
|
274 |
case 'equal'://Checks if the subtotal of products in the cart equals condition value
|
298 |
public function _filter_cart_item_conditions( $cart_item ) {
|
299 |
global $wpsc_cart;
|
300 |
|
301 |
+
$compare_logic = false;
|
302 |
foreach ( $this->conditions as $condition ) {
|
303 |
$callback = '_callback_condition_' . $condition['property'];
|
304 |
if ( ! is_callable( array( $this, $callback ) ) )
|
305 |
return false;
|
306 |
|
307 |
+
if ( ! $this->$callback( $condition, $cart_item ) ) {
|
308 |
+
switch ( $condition['operator'] ) {
|
309 |
+
case 'or':
|
310 |
+
$compare_logic = $compare_logic || apply_filters( 'wpsc_coupon_compare_logic', false, $condition, $cart_item );
|
311 |
+
break;
|
312 |
+
case 'and':
|
313 |
+
$compare_logic = $compare_logic && apply_filters( 'wpsc_coupon_compare_logic', false, $condition, $cart_item );
|
314 |
+
break;
|
315 |
+
default:
|
316 |
+
$compare_logic = apply_filters( 'wpsc_coupon_compare_logic', false, $condition, $cart_item );
|
317 |
+
}
|
318 |
+
} else {
|
319 |
+
switch ( $condition['operator'] ) {
|
320 |
+
case 'or':
|
321 |
+
$compare_logic = $compare_logic || $this->$callback( $condition, $cart_item );
|
322 |
+
break;
|
323 |
+
case 'and':
|
324 |
+
$compare_logic = $compare_logic && $this->$callback( $condition, $cart_item );
|
325 |
+
break;
|
326 |
+
default:
|
327 |
+
$compare_logic = $this->$callback( $condition, $cart_item );
|
328 |
+
}
|
329 |
+
}
|
330 |
}
|
331 |
|
332 |
return true;
|
wpsc-includes/display.functions.php
CHANGED
@@ -166,7 +166,6 @@ function wpsc_fancy_notifications( $return = false ) {
|
|
166 |
add_action( 'wpsc_theme_footer', 'wpsc_fancy_notifications' );
|
167 |
|
168 |
function fancy_notification_content( $cart_messages ) {
|
169 |
-
$siteurl = get_option( 'siteurl' );
|
170 |
$output = '';
|
171 |
foreach ( (array)$cart_messages as $cart_message ) {
|
172 |
$output .= "<span>" . $cart_message . "</span><br />";
|
166 |
add_action( 'wpsc_theme_footer', 'wpsc_fancy_notifications' );
|
167 |
|
168 |
function fancy_notification_content( $cart_messages ) {
|
|
|
169 |
$output = '';
|
170 |
foreach ( (array)$cart_messages as $cart_message ) {
|
171 |
$output .= "<span>" . $cart_message . "</span><br />";
|
wpsc-includes/form-display.functions.php
CHANGED
@@ -66,7 +66,6 @@ function wpsc_parent_category_list( $taxonomies, $args, $parent, $current_term_i
|
|
66 |
*/
|
67 |
function wpsc_category_options( $group_id, $this_category = null, $category_id = null, $iteration = 0, $selected_id = null ) {
|
68 |
global $wpdb;
|
69 |
-
$siteurl = get_option( 'siteurl' );
|
70 |
$selected_term = get_term($selected_id,'wpsc_product_category');
|
71 |
$values = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=' . $group_id );
|
72 |
$selected = "";
|
66 |
*/
|
67 |
function wpsc_category_options( $group_id, $this_category = null, $category_id = null, $iteration = 0, $selected_id = null ) {
|
68 |
global $wpdb;
|
|
|
69 |
$selected_term = get_term($selected_id,'wpsc_product_category');
|
70 |
$values = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=' . $group_id );
|
71 |
$selected = "";
|
wpsc-includes/merchant.class.php
CHANGED
@@ -181,7 +181,7 @@ class wpsc_merchant {
|
|
181 |
'cart_discount_value' => $purchase_logs['discount_value'],
|
182 |
'cart_discount_coupon' => $purchase_logs['discount_data'],
|
183 |
'cart_tax' => $purchase_logs['wpec_taxes_total'],
|
184 |
-
'notification_url' => add_query_arg( 'wpsc_action', 'gateway_notification', (
|
185 |
'transaction_results_url' => get_option( 'transact_url' ),
|
186 |
'shopping_cart_url' => get_option( 'shopping_cart_url' ),
|
187 |
'products_page_url' => get_option( 'product_list_url' ),
|
181 |
'cart_discount_value' => $purchase_logs['discount_value'],
|
182 |
'cart_discount_coupon' => $purchase_logs['discount_data'],
|
183 |
'cart_tax' => $purchase_logs['wpec_taxes_total'],
|
184 |
+
'notification_url' => add_query_arg( 'wpsc_action', 'gateway_notification', home_url( '/' ) ),
|
185 |
'transaction_results_url' => get_option( 'transact_url' ),
|
186 |
'shopping_cart_url' => get_option( 'shopping_cart_url' ),
|
187 |
'products_page_url' => get_option( 'product_list_url' ),
|
wpsc-includes/meta.functions.php
CHANGED
@@ -1,20 +1,18 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Some parts of this code were copied from functions.bb-meta.php in bbpress
|
4 |
*/
|
5 |
-
|
6 |
-
function wpsc_sanitize_meta_key( $key )
|
7 |
-
{
|
8 |
return preg_replace( '|[^a-z0-9_]|i', '', $key );
|
9 |
}
|
10 |
|
11 |
-
|
12 |
/**
|
13 |
* Gets meta data from the database
|
14 |
* This needs caching implemented for it, but I have not yet figured out how to make this work for it
|
15 |
* @internal
|
16 |
*/
|
17 |
-
function wpsc_get_meta( $object_id = 0, $meta_key, $type) {
|
18 |
global $wpdb;
|
19 |
$cache_object_id = $object_id = (int)$object_id;
|
20 |
$object_type = $type;
|
@@ -28,10 +26,6 @@ function wpsc_get_meta( $object_id = 0, $meta_key, $type) {
|
|
28 |
return $meta_value;
|
29 |
}
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
/**
|
36 |
* Adds and updates meta data in the database
|
37 |
*
|
@@ -43,9 +37,9 @@ function wpsc_update_meta( $object_id = 0, $meta_key, $meta_value, $type, $globa
|
|
43 |
return false;
|
44 |
}
|
45 |
$cache_object_id = $object_id = (int) $object_id;
|
46 |
-
|
47 |
$object_type = $type;
|
48 |
-
|
49 |
$meta_key = wpsc_sanitize_meta_key( $meta_key );
|
50 |
|
51 |
$meta_tuple = compact( 'object_type', 'object_id', 'meta_key', 'meta_value', 'type' );
|
@@ -68,9 +62,6 @@ function wpsc_update_meta( $object_id = 0, $meta_key, $meta_value, $type, $globa
|
|
68 |
}
|
69 |
}
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
/**
|
75 |
* Deletes meta data from the database
|
76 |
*
|
@@ -82,7 +73,7 @@ function wpsc_delete_meta( $object_id = 0, $meta_key, $meta_value, $type, $globa
|
|
82 |
return false;
|
83 |
|
84 |
$cache_object_id = $object_id = (int) $object_id;
|
85 |
-
|
86 |
$object_type = $type;
|
87 |
|
88 |
$meta_key = wpsc_sanitize_meta_key( $meta_key );
|
@@ -106,13 +97,9 @@ function wpsc_delete_meta( $object_id = 0, $meta_key, $meta_value, $type, $globa
|
|
106 |
return true;
|
107 |
}
|
108 |
|
109 |
-
|
110 |
-
|
111 |
/**
|
112 |
* Cart meta functions are as follows:
|
113 |
*/
|
114 |
-
|
115 |
-
|
116 |
function wpsc_get_cartmeta( $cart_id, $meta_key ) {
|
117 |
return wpsc_get_meta( $cart_id, $meta_key, 'wpsc_cart_item' );
|
118 |
}
|
@@ -124,25 +111,44 @@ function wpsc_update_cartmeta( $cart_id, $meta_key, $meta_value ) {
|
|
124 |
function wpsc_delete_cartmeta( $cart_id, $meta_key, $meta_value = '' ) {
|
125 |
return wpsc_delete_meta( $cart_id, $meta_key, $meta_value, 'wpsc_cart_item' );
|
126 |
}
|
127 |
-
/**
|
128 |
-
* Cart meta functions end here.
|
129 |
-
*/
|
130 |
|
131 |
/**
|
132 |
* category meta functions are as follows:
|
133 |
*/
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
}
|
147 |
/**
|
148 |
* category meta functions end here.
|
@@ -156,26 +162,26 @@ function wpsc_delete_categorymeta( $cart_id, $meta_key, $meta_value = '' ) {
|
|
156 |
|
157 |
/**
|
158 |
* add_product_meta function.
|
159 |
-
*
|
160 |
* @access public
|
161 |
* @param mixed $product_id
|
162 |
* @param mixed $key
|
163 |
* @param mixed $value
|
164 |
-
* @param bool
|
165 |
-
* @param bool
|
166 |
*/
|
167 |
-
function add_product_meta($product_id, $key, $value, $unique = false, $custom = false) {
|
168 |
$key = WPSC_META_PREFIX.$key;
|
169 |
return add_post_meta($product_id, $key, $value);
|
170 |
}
|
171 |
|
172 |
/**
|
173 |
* delete_product_meta function.
|
174 |
-
*
|
175 |
* @access public
|
176 |
* @param mixed $product_id
|
177 |
* @param mixed $key
|
178 |
-
* @param bool
|
179 |
*/
|
180 |
function delete_product_meta($product_id, $key, $value = '') {
|
181 |
$key = WPSC_META_PREFIX.$key;
|
@@ -185,11 +191,11 @@ function delete_product_meta($product_id, $key, $value = '') {
|
|
185 |
|
186 |
/**
|
187 |
* get_product_meta function.
|
188 |
-
*
|
189 |
* @access public
|
190 |
* @param mixed $product_id
|
191 |
* @param mixed $key
|
192 |
-
* @param bool
|
193 |
* @return void
|
194 |
*/
|
195 |
function get_product_meta($product_id, $key, $single = false) {
|
@@ -199,12 +205,12 @@ function get_product_meta($product_id, $key, $single = false) {
|
|
199 |
|
200 |
/**
|
201 |
* update_product_meta function.
|
202 |
-
*
|
203 |
* @access public
|
204 |
-
* @param
|
205 |
-
* @param
|
206 |
-
* @param
|
207 |
-
* @param
|
208 |
* @return void
|
209 |
*/
|
210 |
function update_product_meta($product_id, $key, $value, $prev_value = '') {
|
@@ -226,16 +232,16 @@ class wpsc_custom_meta {
|
|
226 |
|
227 |
function wpsc_custom_meta($postid) {
|
228 |
global $wpdb;
|
229 |
-
|
230 |
$this->custom_meta = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id
|
231 |
-
FROM $wpdb->postmeta
|
232 |
WHERE post_id = %d
|
233 |
AND `meta_key` NOT REGEXP '^_'
|
234 |
ORDER BY meta_key,meta_id", $postid), ARRAY_A );
|
235 |
-
|
236 |
$this->custom_meta_count = count($this->custom_meta);
|
237 |
}
|
238 |
-
|
239 |
|
240 |
function have_custom_meta() {
|
241 |
if (($this->current_custom_meta + 1) < $this->custom_meta_count) {
|
@@ -245,7 +251,7 @@ class wpsc_custom_meta {
|
|
245 |
}
|
246 |
return false;
|
247 |
}
|
248 |
-
|
249 |
/*
|
250 |
* Custom Meta Loop Code Starts here
|
251 |
*/
|
@@ -255,7 +261,7 @@ class wpsc_custom_meta {
|
|
255 |
return $this->custom_meta_values;
|
256 |
}
|
257 |
|
258 |
-
|
259 |
function the_custom_meta() {
|
260 |
$this->custom_meta_values = $this->next_custom_meta();
|
261 |
return $this->custom_meta_values;
|
@@ -265,5 +271,5 @@ class wpsc_custom_meta {
|
|
265 |
if ($this->custom_meta_count > 0) {
|
266 |
$this->custom_meta_values = $this->custom_meta[0];
|
267 |
}
|
268 |
-
}
|
269 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Some parts of this code were copied from functions.bb-meta.php in bbpress
|
4 |
*/
|
5 |
+
|
6 |
+
function wpsc_sanitize_meta_key( $key ) {
|
|
|
7 |
return preg_replace( '|[^a-z0-9_]|i', '', $key );
|
8 |
}
|
9 |
|
|
|
10 |
/**
|
11 |
* Gets meta data from the database
|
12 |
* This needs caching implemented for it, but I have not yet figured out how to make this work for it
|
13 |
* @internal
|
14 |
*/
|
15 |
+
function wpsc_get_meta( $object_id = 0, $meta_key, $type ) {
|
16 |
global $wpdb;
|
17 |
$cache_object_id = $object_id = (int)$object_id;
|
18 |
$object_type = $type;
|
26 |
return $meta_value;
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* Adds and updates meta data in the database
|
31 |
*
|
37 |
return false;
|
38 |
}
|
39 |
$cache_object_id = $object_id = (int) $object_id;
|
40 |
+
|
41 |
$object_type = $type;
|
42 |
+
|
43 |
$meta_key = wpsc_sanitize_meta_key( $meta_key );
|
44 |
|
45 |
$meta_tuple = compact( 'object_type', 'object_id', 'meta_key', 'meta_value', 'type' );
|
62 |
}
|
63 |
}
|
64 |
|
|
|
|
|
|
|
65 |
/**
|
66 |
* Deletes meta data from the database
|
67 |
*
|
73 |
return false;
|
74 |
|
75 |
$cache_object_id = $object_id = (int) $object_id;
|
76 |
+
|
77 |
$object_type = $type;
|
78 |
|
79 |
$meta_key = wpsc_sanitize_meta_key( $meta_key );
|
97 |
return true;
|
98 |
}
|
99 |
|
|
|
|
|
100 |
/**
|
101 |
* Cart meta functions are as follows:
|
102 |
*/
|
|
|
|
|
103 |
function wpsc_get_cartmeta( $cart_id, $meta_key ) {
|
104 |
return wpsc_get_meta( $cart_id, $meta_key, 'wpsc_cart_item' );
|
105 |
}
|
111 |
function wpsc_delete_cartmeta( $cart_id, $meta_key, $meta_value = '' ) {
|
112 |
return wpsc_delete_meta( $cart_id, $meta_key, $meta_value, 'wpsc_cart_item' );
|
113 |
}
|
|
|
|
|
|
|
114 |
|
115 |
/**
|
116 |
* category meta functions are as follows:
|
117 |
*/
|
118 |
|
119 |
+
/**
|
120 |
+
* Retrieve meta field for a category
|
121 |
+
*
|
122 |
+
* @param int $cat_id Category ID.
|
123 |
+
* @param string $meta_key The meta key to retrieve.
|
124 |
+
* @return mixed Will be value of meta data field
|
125 |
+
*/
|
126 |
+
function wpsc_get_categorymeta( $cat_id, $meta_key ) {
|
127 |
+
return wpsc_get_meta( $cat_id, $meta_key, 'wpsc_category' );
|
128 |
}
|
129 |
|
130 |
+
/**
|
131 |
+
* Update meta field for a category
|
132 |
+
*
|
133 |
+
* @param int $cat_id Category ID.
|
134 |
+
* @param string $meta_key The meta key to retrieve.
|
135 |
+
* @param string $meta_value The value to be stored.
|
136 |
+
* @return mixed True if updated
|
137 |
+
*/
|
138 |
+
function wpsc_update_categorymeta( $cat_id, $meta_key, $meta_value ) {
|
139 |
+
return wpsc_update_meta( $cat_id, $meta_key, $meta_value, 'wpsc_category' );
|
140 |
}
|
141 |
|
142 |
+
/**
|
143 |
+
* Delete meta field for a category
|
144 |
+
*
|
145 |
+
* @param int $cat_id Category ID.
|
146 |
+
* @param string $meta_key The meta key to retrieve.
|
147 |
+
* @param string $meta_value Value to be compared before deleting.
|
148 |
+
* @return mixed True if updated
|
149 |
+
*/
|
150 |
+
function wpsc_delete_categorymeta( $cat_id, $meta_key, $meta_value = '' ) {
|
151 |
+
return wpsc_delete_meta( $cat_id, $meta_key, $meta_value, 'wpsc_category' );
|
152 |
}
|
153 |
/**
|
154 |
* category meta functions end here.
|
162 |
|
163 |
/**
|
164 |
* add_product_meta function.
|
165 |
+
*
|
166 |
* @access public
|
167 |
* @param mixed $product_id
|
168 |
* @param mixed $key
|
169 |
* @param mixed $value
|
170 |
+
* @param bool $unique - obsolete
|
171 |
+
* @param bool $custom - obsolete
|
172 |
*/
|
173 |
+
function add_product_meta( $product_id, $key, $value, $unique = false, $custom = false ) {
|
174 |
$key = WPSC_META_PREFIX.$key;
|
175 |
return add_post_meta($product_id, $key, $value);
|
176 |
}
|
177 |
|
178 |
/**
|
179 |
* delete_product_meta function.
|
180 |
+
*
|
181 |
* @access public
|
182 |
* @param mixed $product_id
|
183 |
* @param mixed $key
|
184 |
+
* @param bool $value. (default: '')
|
185 |
*/
|
186 |
function delete_product_meta($product_id, $key, $value = '') {
|
187 |
$key = WPSC_META_PREFIX.$key;
|
191 |
|
192 |
/**
|
193 |
* get_product_meta function.
|
194 |
+
*
|
195 |
* @access public
|
196 |
* @param mixed $product_id
|
197 |
* @param mixed $key
|
198 |
+
* @param bool $single. (default: false)
|
199 |
* @return void
|
200 |
*/
|
201 |
function get_product_meta($product_id, $key, $single = false) {
|
205 |
|
206 |
/**
|
207 |
* update_product_meta function.
|
208 |
+
*
|
209 |
* @access public
|
210 |
+
* @param mixed $product_id
|
211 |
+
* @param mixed $key
|
212 |
+
* @param mixed $value
|
213 |
+
* @param string $prev_value. (default: '')
|
214 |
* @return void
|
215 |
*/
|
216 |
function update_product_meta($product_id, $key, $value, $prev_value = '') {
|
232 |
|
233 |
function wpsc_custom_meta($postid) {
|
234 |
global $wpdb;
|
235 |
+
|
236 |
$this->custom_meta = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id
|
237 |
+
FROM $wpdb->postmeta
|
238 |
WHERE post_id = %d
|
239 |
AND `meta_key` NOT REGEXP '^_'
|
240 |
ORDER BY meta_key,meta_id", $postid), ARRAY_A );
|
241 |
+
|
242 |
$this->custom_meta_count = count($this->custom_meta);
|
243 |
}
|
244 |
+
|
245 |
|
246 |
function have_custom_meta() {
|
247 |
if (($this->current_custom_meta + 1) < $this->custom_meta_count) {
|
251 |
}
|
252 |
return false;
|
253 |
}
|
254 |
+
|
255 |
/*
|
256 |
* Custom Meta Loop Code Starts here
|
257 |
*/
|
261 |
return $this->custom_meta_values;
|
262 |
}
|
263 |
|
264 |
+
|
265 |
function the_custom_meta() {
|
266 |
$this->custom_meta_values = $this->next_custom_meta();
|
267 |
return $this->custom_meta_values;
|
271 |
if ($this->custom_meta_count > 0) {
|
272 |
$this->custom_meta_values = $this->custom_meta[0];
|
273 |
}
|
274 |
+
}
|
275 |
}
|
wpsc-includes/misc.functions.php
CHANGED
@@ -57,7 +57,6 @@ function wpsc_country_has_state($country_code){
|
|
57 |
* @return int The new user's ID.
|
58 |
*/
|
59 |
function wpsc_add_new_user( $user_login, $user_pass, $user_email ) {
|
60 |
-
require_once(ABSPATH . WPINC . '/registration.php');
|
61 |
$errors = new WP_Error();
|
62 |
$user_login = sanitize_user( $user_login );
|
63 |
$user_email = apply_filters( 'user_registration_email', $user_email );
|
@@ -261,9 +260,8 @@ function wpsc_get_country_form_id_by_type($type){
|
|
261 |
}
|
262 |
|
263 |
function wpsc_get_country( $country_code ) {
|
264 |
-
|
265 |
-
$country
|
266 |
-
return $country;
|
267 |
}
|
268 |
|
269 |
function wpsc_get_region( $region_id ) {
|
@@ -964,3 +962,40 @@ function _wpsc_doing_it_wrong( $function, $message, $version ) {
|
|
964 |
);
|
965 |
}
|
966 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
* @return int The new user's ID.
|
58 |
*/
|
59 |
function wpsc_add_new_user( $user_login, $user_pass, $user_email ) {
|
|
|
60 |
$errors = new WP_Error();
|
61 |
$user_login = sanitize_user( $user_login );
|
62 |
$user_email = apply_filters( 'user_registration_email', $user_email );
|
260 |
}
|
261 |
|
262 |
function wpsc_get_country( $country_code ) {
|
263 |
+
$country = new WPSC_Country( $country_code, 'isocode' );
|
264 |
+
return $country->get( 'country' );
|
|
|
265 |
}
|
266 |
|
267 |
function wpsc_get_region( $region_id ) {
|
962 |
);
|
963 |
}
|
964 |
}
|
965 |
+
|
966 |
+
/**
|
967 |
+
* Returns the ID of the highest numbered purchase log
|
968 |
+
*
|
969 |
+
* Fetches the max_purchase_id transient, or fetches it from the database and sets the transient
|
970 |
+
*
|
971 |
+
* @since 3.8.11
|
972 |
+
*
|
973 |
+
* @return integer The ID of the highest numbered purchase log in the database
|
974 |
+
*
|
975 |
+
* @see wpsc_invalidate_max_purchase_id_transient()
|
976 |
+
*/
|
977 |
+
function wpsc_max_purchase_id() {
|
978 |
+
global $wpdb;
|
979 |
+
if ( false === ( $max_purchase_id = get_transient( 'max_purchase_id' ) ) ) {
|
980 |
+
$max_purchase_id = $wpdb->get_var( 'SELECT MAX( id ) FROM ' . WPSC_TABLE_PURCHASE_LOGS );
|
981 |
+
set_transient( 'max_purchase_id', $max_purchase_id, 60 * 60 * 24 ); // day of seconds
|
982 |
+
}
|
983 |
+
return (int) $max_purchase_id;
|
984 |
+
}
|
985 |
+
|
986 |
+
/**
|
987 |
+
* Invalidates transient for highest numbered purchase log id
|
988 |
+
*
|
989 |
+
* Used especially with actions wpsc_purchase_log_insert and wpsc_purchase_log_delete
|
990 |
+
*
|
991 |
+
* @since 3.8.11
|
992 |
+
*
|
993 |
+
* @see wpsc_max_purchase_id()
|
994 |
+
*/
|
995 |
+
|
996 |
+
function wpsc_invalidate_max_purchase_id_transient () {
|
997 |
+
delete_transient( 'max_purchase_id' );
|
998 |
+
}
|
999 |
+
|
1000 |
+
add_action( 'wpsc_purchase_log_insert', 'wpsc_invalidate_max_purchase_id_transient' );
|
1001 |
+
add_action( 'wpsc_purchase_log_delete', 'wpsc_invalidate_max_purchase_id_transient' );
|
wpsc-includes/processing.functions.php
CHANGED
@@ -143,7 +143,7 @@ function wpsc_decrement_claimed_stock($purchase_log_id) {
|
|
143 |
) );
|
144 |
|
145 |
if ( $result )
|
146 |
-
$email_message = __( 'The product "%s" is out of stock and has been unpublished.', 'wpsc' );
|
147 |
}
|
148 |
|
149 |
if ( $product_meta["notify_when_none_left"] == 1 )
|
@@ -276,7 +276,7 @@ function wpsc_send_ping($server) {
|
|
276 |
// when set to true, this outputs debug messages by itself
|
277 |
$client->debug = false;
|
278 |
$home = trailingslashit( get_option('product_list_url') );
|
279 |
-
$rss_url =
|
280 |
if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, $rss_url ) ) {
|
281 |
$client->query('weblogUpdates.ping', get_option('blogname'), $home);
|
282 |
}
|
143 |
) );
|
144 |
|
145 |
if ( $result )
|
146 |
+
$email_message = sprintf( __( 'The product "%s" is out of stock and has been unpublished.', 'wpsc' ), $product->post_title );
|
147 |
}
|
148 |
|
149 |
if ( $product_meta["notify_when_none_left"] == 1 )
|
276 |
// when set to true, this outputs debug messages by itself
|
277 |
$client->debug = false;
|
278 |
$home = trailingslashit( get_option('product_list_url') );
|
279 |
+
$rss_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list' ), home_url( '/' ) );
|
280 |
if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, $rss_url ) ) {
|
281 |
$client->query('weblogUpdates.ping', get_option('blogname'), $home);
|
282 |
}
|
wpsc-includes/product-template.php
CHANGED
@@ -702,14 +702,11 @@ function wpsc_edit_the_product_link( $link = null, $before = '', $after = '', $i
|
|
702 |
if ( $id > 0 )
|
703 |
$product_id = $id;
|
704 |
|
705 |
-
|
706 |
-
$siteurl = get_option( 'siteurl' );
|
707 |
-
|
708 |
$output = '';
|
709 |
if(is_user_logged_in()){
|
710 |
get_currentuserinfo();
|
711 |
if ( $current_user->{$table_prefix . 'capabilities'}['administrator'] == 1 )
|
712 |
-
$output = $before .
|
713 |
|
714 |
}
|
715 |
return $output;
|
@@ -1080,47 +1077,35 @@ function wpsc_product_postage_and_packaging() {
|
|
1080 |
}
|
1081 |
|
1082 |
/**
|
1083 |
-
*
|
1084 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1085 |
*/
|
1086 |
-
function wpsc_the_product_image( $width='', $height='', $product_id='' ) {
|
1087 |
if ( empty( $product_id ) )
|
1088 |
$product_id = get_the_ID();
|
1089 |
|
1090 |
-
|
1091 |
$product = get_post( $product_id );
|
1092 |
-
|
1093 |
if ( $product->post_parent > 0 )
|
1094 |
$product_id = $product->post_parent;
|
1095 |
|
1096 |
-
$
|
1097 |
-
'post_type' => 'attachment',
|
1098 |
-
'numberposts' => 1,
|
1099 |
-
'post_status' => null,
|
1100 |
-
'post_parent' => $product_id,
|
1101 |
-
'orderby' => 'menu_order',
|
1102 |
-
'order' => 'ASC'
|
1103 |
-
) );
|
1104 |
-
|
1105 |
-
|
1106 |
-
$post_thumbnail_id = get_post_thumbnail_id( $product_id );
|
1107 |
|
1108 |
-
$
|
1109 |
-
|
1110 |
-
if ( ! empty( $src ) && is_string( $src[0] ) ) {
|
1111 |
-
$src = $src[0];
|
1112 |
-
} elseif ( ! empty( $attached_images ) ) {
|
1113 |
-
$attached_image = wp_get_attachment_image_src( $attached_images[0]->ID, 'large' );
|
1114 |
-
$src = $attached_image[0];
|
1115 |
-
} else {
|
1116 |
-
$src = false;
|
1117 |
-
}
|
1118 |
|
1119 |
if ( is_ssl() && ! empty( $src ) )
|
1120 |
$src = str_replace( 'http://', 'https://', $src );
|
1121 |
-
$src = apply_filters( 'wpsc_product_image', $src );
|
1122 |
|
1123 |
-
return $src;
|
1124 |
}
|
1125 |
|
1126 |
/**
|
@@ -1140,25 +1125,33 @@ function wpsc_check_display_type(){
|
|
1140 |
}
|
1141 |
|
1142 |
/**
|
1143 |
-
* Get
|
|
|
1144 |
* If no post thumbnail is set, this will return the ID of the first image
|
1145 |
* associated with a product.
|
|
|
|
|
|
|
1146 |
*/
|
1147 |
function wpsc_the_product_thumbnail_id( $product_id ) {
|
1148 |
-
|
1149 |
$thumbnail_id = null;
|
1150 |
|
1151 |
-
//
|
|
|
|
|
|
|
|
|
|
|
1152 |
if ( has_post_thumbnail( $product_id ) ) {
|
1153 |
$thumbnail_id = get_post_thumbnail_id( $product_id );
|
1154 |
-
// Use first product image
|
1155 |
} else {
|
1156 |
-
//
|
1157 |
$attached_images = (array) get_posts( array(
|
1158 |
'post_type' => 'attachment',
|
1159 |
'numberposts' => 1,
|
1160 |
'post_status' => null,
|
1161 |
'post_parent' => $product_id,
|
|
|
1162 |
'order' => 'ASC'
|
1163 |
) );
|
1164 |
if ( ! empty( $attached_images ) )
|
@@ -1167,7 +1160,6 @@ function wpsc_the_product_thumbnail_id( $product_id ) {
|
|
1167 |
return $thumbnail_id;
|
1168 |
}
|
1169 |
|
1170 |
-
|
1171 |
/**
|
1172 |
* Regenerate size metadata of a thumbnail in case it's missing.
|
1173 |
*
|
@@ -1202,8 +1194,8 @@ function _wpsc_regenerate_thumbnail_size( $thumbnail_id, $size ) {
|
|
1202 |
*/
|
1203 |
function wpsc_the_product_thumbnail( $width = null, $height = null, $product_id = 0, $page = false ) {
|
1204 |
$thumbnail = false;
|
1205 |
-
|
1206 |
$display = wpsc_check_display_type();
|
|
|
1207 |
// Get the product ID if none was passed
|
1208 |
if ( empty( $product_id ) )
|
1209 |
$product_id = get_the_ID();
|
@@ -1214,9 +1206,8 @@ function wpsc_the_product_thumbnail( $width = null, $height = null, $product_id
|
|
1214 |
$thumbnail_id = wpsc_the_product_thumbnail_id( $product_id );
|
1215 |
|
1216 |
// If no thumbnail found for item, get it's parent image (props. TJM)
|
1217 |
-
if ( ! $thumbnail_id && $product->post_parent )
|
1218 |
$thumbnail_id = wpsc_the_product_thumbnail_id( $product->post_parent );
|
1219 |
-
}
|
1220 |
|
1221 |
if ( ! $page ) {
|
1222 |
if ( is_single() )
|
@@ -1229,37 +1220,31 @@ function wpsc_the_product_thumbnail( $width = null, $height = null, $product_id
|
|
1229 |
$width = get_option( 'product_image_width' );
|
1230 |
$height = get_option( 'product_image_height' );
|
1231 |
|
1232 |
-
//Overwrite height & width if custom dimensions exist for thumbnail_id
|
1233 |
-
if ( 'grid' != $display && 'products-page' == $page && isset($thumbnail_id)) {
|
1234 |
-
$custom_width
|
1235 |
$custom_height = get_post_meta( $thumbnail_id, '_wpsc_custom_thumb_h', true );
|
1236 |
|
1237 |
-
if ( !empty( $custom_width ) && !empty( $custom_height ) ) {
|
1238 |
-
$width
|
1239 |
$height = $custom_height;
|
1240 |
}
|
1241 |
-
} elseif( $page == 'single' && isset($thumbnail_id)) {
|
1242 |
$custom_thumbnail = get_post_meta( $thumbnail_id, '_wpsc_selected_image_size', true );
|
1243 |
|
1244 |
if ( ! $custom_thumbnail ) {
|
1245 |
$custom_thumbnail = 'medium-single-product';
|
1246 |
$current_size = image_get_intermediate_size( $thumbnail_id, $custom_thumbnail );
|
1247 |
-
$settings_width
|
1248 |
$settings_height = get_option( 'single_view_image_height' );
|
1249 |
|
1250 |
-
if (
|
1251 |
-
|| (
|
1252 |
-
$current_size['width'] != $settings_width
|
1253 |
-
&& $current_size['height'] != $settings_height
|
1254 |
-
)
|
1255 |
-
)
|
1256 |
_wpsc_regenerate_thumbnail_size( $thumbnail_id, $custom_thumbnail );
|
1257 |
}
|
1258 |
$src = wp_get_attachment_image_src( $thumbnail_id, $custom_thumbnail );
|
1259 |
|
1260 |
-
if ( !empty( $src ) && is_string( $src[0] ) )
|
1261 |
$thumbnail = $src[0];
|
1262 |
-
}
|
1263 |
} elseif ( $page == 'manage-products' && isset( $thumbnail_id ) ) {
|
1264 |
$current_size = image_get_intermediate_size( $thumbnail_id, 'admin-product-thumbnails' );
|
1265 |
|
@@ -1273,14 +1258,13 @@ function wpsc_the_product_thumbnail( $width = null, $height = null, $product_id
|
|
1273 |
}
|
1274 |
}
|
1275 |
|
1276 |
-
//
|
1277 |
-
|
1278 |
-
|
1279 |
-
$
|
1280 |
-
$original_width = $attachment_meta[0]['width'];
|
1281 |
$original_height = $attachment_meta[0]['height'];
|
1282 |
|
1283 |
-
if( $width != 0 ){
|
1284 |
$height = ( $original_height / $original_width ) * $width;
|
1285 |
$height = round( $height, 0 );
|
1286 |
} elseif ( $height != 0 ) {
|
@@ -1681,10 +1665,13 @@ function wpsc_the_variation_price( $return_as_numeric = false ) {
|
|
1681 |
if ( $wpsc_variations->variation_count > 0 ) {
|
1682 |
|
1683 |
$product_id = get_the_ID();
|
1684 |
-
$wpq = array(
|
|
|
1685 |
'post_status' => array( 'inherit', 'publish' ),
|
1686 |
-
'post_type'
|
1687 |
-
'post_parent' => $product_id
|
|
|
|
|
1688 |
$query = new WP_Query( $wpq );
|
1689 |
// Should never happen
|
1690 |
if ( $query->post_count != 1 )
|
@@ -1692,18 +1679,18 @@ function wpsc_the_variation_price( $return_as_numeric = false ) {
|
|
1692 |
|
1693 |
$variation_product_id = $query->posts[0]->ID;
|
1694 |
|
1695 |
-
$price
|
1696 |
-
$special_price = get_product_meta( $variation_product_id,
|
1697 |
-
|
|
|
1698 |
$price = $special_price;
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
$output = $price;
|
1703 |
-
}
|
1704 |
} else {
|
1705 |
$output = false;
|
1706 |
}
|
|
|
1707 |
return $output;
|
1708 |
}
|
1709 |
|
702 |
if ( $id > 0 )
|
703 |
$product_id = $id;
|
704 |
|
|
|
|
|
|
|
705 |
$output = '';
|
706 |
if(is_user_logged_in()){
|
707 |
get_currentuserinfo();
|
708 |
if ( $current_user->{$table_prefix . 'capabilities'}['administrator'] == 1 )
|
709 |
+
$output = $before . '<a class="wpsc_edit_product" href="' . esc_attr( get_edit_post_link( $product_id ) ) . '">' . $link . '</a>' . $after;
|
710 |
|
711 |
}
|
712 |
return $output;
|
1077 |
}
|
1078 |
|
1079 |
/**
|
1080 |
+
* WPSC Product Image
|
1081 |
+
*
|
1082 |
+
* Gets the product image URL. Uses the post thumbnail if set.
|
1083 |
+
*
|
1084 |
+
* @param int $width Image width
|
1085 |
+
* @param int $height Image height
|
1086 |
+
* @param int $product_id Product ID
|
1087 |
+
* @return string The URL to the thumbnail image
|
1088 |
+
*
|
1089 |
+
* @uses wpsc_the_product_thumbnail_id() Get the product thumbnail ID
|
1090 |
*/
|
1091 |
+
function wpsc_the_product_image( $width = '', $height = '', $product_id = '' ) {
|
1092 |
if ( empty( $product_id ) )
|
1093 |
$product_id = get_the_ID();
|
1094 |
|
1095 |
+
// If variation, get parent product
|
1096 |
$product = get_post( $product_id );
|
|
|
1097 |
if ( $product->post_parent > 0 )
|
1098 |
$product_id = $product->post_parent;
|
1099 |
|
1100 |
+
$src = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1101 |
|
1102 |
+
$product_thumbnail_id = wpsc_the_product_thumbnail_id( $product_id );
|
1103 |
+
$src = wp_get_attachment_image_src( $product_thumbnail_id, 'large' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1104 |
|
1105 |
if ( is_ssl() && ! empty( $src ) )
|
1106 |
$src = str_replace( 'http://', 'https://', $src );
|
|
|
1107 |
|
1108 |
+
return apply_filters( 'wpsc_product_image', $src );
|
1109 |
}
|
1110 |
|
1111 |
/**
|
1125 |
}
|
1126 |
|
1127 |
/**
|
1128 |
+
* Get The Product Thumbnail ID
|
1129 |
+
*
|
1130 |
* If no post thumbnail is set, this will return the ID of the first image
|
1131 |
* associated with a product.
|
1132 |
+
*
|
1133 |
+
* @param int $product_id Product ID
|
1134 |
+
* @return int Product thumbnail ID
|
1135 |
*/
|
1136 |
function wpsc_the_product_thumbnail_id( $product_id ) {
|
|
|
1137 |
$thumbnail_id = null;
|
1138 |
|
1139 |
+
// If variation, get parent product
|
1140 |
+
$product = get_post( $product_id );
|
1141 |
+
if ( $product->post_parent > 0 )
|
1142 |
+
$product_id = $product->post_parent;
|
1143 |
+
|
1144 |
+
// Use product thumbnail...
|
1145 |
if ( has_post_thumbnail( $product_id ) ) {
|
1146 |
$thumbnail_id = get_post_thumbnail_id( $product_id );
|
|
|
1147 |
} else {
|
1148 |
+
// ... or get first image
|
1149 |
$attached_images = (array) get_posts( array(
|
1150 |
'post_type' => 'attachment',
|
1151 |
'numberposts' => 1,
|
1152 |
'post_status' => null,
|
1153 |
'post_parent' => $product_id,
|
1154 |
+
'orderby' => 'menu_order',
|
1155 |
'order' => 'ASC'
|
1156 |
) );
|
1157 |
if ( ! empty( $attached_images ) )
|
1160 |
return $thumbnail_id;
|
1161 |
}
|
1162 |
|
|
|
1163 |
/**
|
1164 |
* Regenerate size metadata of a thumbnail in case it's missing.
|
1165 |
*
|
1194 |
*/
|
1195 |
function wpsc_the_product_thumbnail( $width = null, $height = null, $product_id = 0, $page = false ) {
|
1196 |
$thumbnail = false;
|
|
|
1197 |
$display = wpsc_check_display_type();
|
1198 |
+
|
1199 |
// Get the product ID if none was passed
|
1200 |
if ( empty( $product_id ) )
|
1201 |
$product_id = get_the_ID();
|
1206 |
$thumbnail_id = wpsc_the_product_thumbnail_id( $product_id );
|
1207 |
|
1208 |
// If no thumbnail found for item, get it's parent image (props. TJM)
|
1209 |
+
if ( ! $thumbnail_id && $product->post_parent )
|
1210 |
$thumbnail_id = wpsc_the_product_thumbnail_id( $product->post_parent );
|
|
|
1211 |
|
1212 |
if ( ! $page ) {
|
1213 |
if ( is_single() )
|
1220 |
$width = get_option( 'product_image_width' );
|
1221 |
$height = get_option( 'product_image_height' );
|
1222 |
|
1223 |
+
// Overwrite height & width if custom dimensions exist for thumbnail_id
|
1224 |
+
if ( 'grid' != $display && 'products-page' == $page && isset( $thumbnail_id ) ) {
|
1225 |
+
$custom_width = get_post_meta( $thumbnail_id, '_wpsc_custom_thumb_w', true );
|
1226 |
$custom_height = get_post_meta( $thumbnail_id, '_wpsc_custom_thumb_h', true );
|
1227 |
|
1228 |
+
if ( ! empty( $custom_width ) && ! empty( $custom_height ) ) {
|
1229 |
+
$width = $custom_width;
|
1230 |
$height = $custom_height;
|
1231 |
}
|
1232 |
+
} elseif ( $page == 'single' && isset( $thumbnail_id ) ) {
|
1233 |
$custom_thumbnail = get_post_meta( $thumbnail_id, '_wpsc_selected_image_size', true );
|
1234 |
|
1235 |
if ( ! $custom_thumbnail ) {
|
1236 |
$custom_thumbnail = 'medium-single-product';
|
1237 |
$current_size = image_get_intermediate_size( $thumbnail_id, $custom_thumbnail );
|
1238 |
+
$settings_width = get_option( 'single_view_image_width' );
|
1239 |
$settings_height = get_option( 'single_view_image_height' );
|
1240 |
|
1241 |
+
if ( ! $current_size || ( $current_size['width'] != $settings_width && $current_size['height'] != $settings_height ) )
|
|
|
|
|
|
|
|
|
|
|
1242 |
_wpsc_regenerate_thumbnail_size( $thumbnail_id, $custom_thumbnail );
|
1243 |
}
|
1244 |
$src = wp_get_attachment_image_src( $thumbnail_id, $custom_thumbnail );
|
1245 |
|
1246 |
+
if ( ! empty( $src ) && is_string( $src[0] ) )
|
1247 |
$thumbnail = $src[0];
|
|
|
1248 |
} elseif ( $page == 'manage-products' && isset( $thumbnail_id ) ) {
|
1249 |
$current_size = image_get_intermediate_size( $thumbnail_id, 'admin-product-thumbnails' );
|
1250 |
|
1258 |
}
|
1259 |
}
|
1260 |
|
1261 |
+
// Calculate the height based on the ratio of the original dimensions.
|
1262 |
+
if ( $height == 0 || $width == 0 ) {
|
1263 |
+
$attachment_meta = get_post_meta( $thumbnail_id, '_wp_attachment_metadata', false );
|
1264 |
+
$original_width = $attachment_meta[0]['width'];
|
|
|
1265 |
$original_height = $attachment_meta[0]['height'];
|
1266 |
|
1267 |
+
if ( $width != 0 ) {
|
1268 |
$height = ( $original_height / $original_width ) * $width;
|
1269 |
$height = round( $height, 0 );
|
1270 |
} elseif ( $height != 0 ) {
|
1665 |
if ( $wpsc_variations->variation_count > 0 ) {
|
1666 |
|
1667 |
$product_id = get_the_ID();
|
1668 |
+
$wpq = array(
|
1669 |
+
'variations' => $wpsc_variations->variation->slug,
|
1670 |
'post_status' => array( 'inherit', 'publish' ),
|
1671 |
+
'post_type' => 'wpsc-product',
|
1672 |
+
'post_parent' => $product_id
|
1673 |
+
);
|
1674 |
+
|
1675 |
$query = new WP_Query( $wpq );
|
1676 |
// Should never happen
|
1677 |
if ( $query->post_count != 1 )
|
1679 |
|
1680 |
$variation_product_id = $query->posts[0]->ID;
|
1681 |
|
1682 |
+
$price = get_product_meta( $variation_product_id, 'price',true );
|
1683 |
+
$special_price = get_product_meta( $variation_product_id, 'special_price', true );
|
1684 |
+
|
1685 |
+
if ( $special_price < $price && $special_price > 0 )
|
1686 |
$price = $special_price;
|
1687 |
+
|
1688 |
+
$price = apply_filters( 'wpsc_do_convert_price', $price, $product_id, $variation_product_id );
|
1689 |
+
$output = $return_as_numeric ? $price : wpsc_currency_display( $price, array( 'display_as_html' => false ) );
|
|
|
|
|
1690 |
} else {
|
1691 |
$output = false;
|
1692 |
}
|
1693 |
+
|
1694 |
return $output;
|
1695 |
}
|
1696 |
|
wpsc-includes/productfeed.php
CHANGED
@@ -50,7 +50,7 @@ function wpsc_generate_product_feed() {
|
|
50 |
|
51 |
$args = apply_filters( 'wpsc_productfeed_query_args', $args );
|
52 |
|
53 |
-
$self =
|
54 |
|
55 |
header("Content-Type: application/xml; charset=UTF-8");
|
56 |
header('Content-Disposition: inline; filename="E-Commerce_Product_List.rss"');
|
@@ -74,7 +74,7 @@ function wpsc_generate_product_feed() {
|
|
74 |
echo ">\n\r";
|
75 |
echo " <channel>\n\r";
|
76 |
echo " <title><![CDATA[" . sprintf( _x( '%s Products', 'XML Feed Title', 'wpsc' ), get_option( 'blogname' ) ) . "]]></title>\n\r";
|
77 |
-
echo " <link>".
|
78 |
echo " <description>" . _x( 'This is the WP e-Commerce Product List RSS feed', 'XML Feed Description', 'wpsc' ) . "</description>\n\r";
|
79 |
echo " <generator>" . _x( 'WP e-Commerce Plugin', 'XML Feed Generator', 'wpsc' ) . "</generator>\n\r";
|
80 |
echo " <atom:link href='$self' rel='self' type='application/rss+xml' />\n\r";
|
50 |
|
51 |
$args = apply_filters( 'wpsc_productfeed_query_args', $args );
|
52 |
|
53 |
+
$self = home_url( "/index.php?rss=true&action=product_list$selected_category$selected_product" );
|
54 |
|
55 |
header("Content-Type: application/xml; charset=UTF-8");
|
56 |
header('Content-Disposition: inline; filename="E-Commerce_Product_List.rss"');
|
74 |
echo ">\n\r";
|
75 |
echo " <channel>\n\r";
|
76 |
echo " <title><![CDATA[" . sprintf( _x( '%s Products', 'XML Feed Title', 'wpsc' ), get_option( 'blogname' ) ) . "]]></title>\n\r";
|
77 |
+
echo " <link>" . admin_url( 'admin.php?page=' . WPSC_DIR_NAME . '/display-log.php' ) . "</link>\n\r";
|
78 |
echo " <description>" . _x( 'This is the WP e-Commerce Product List RSS feed', 'XML Feed Description', 'wpsc' ) . "</description>\n\r";
|
79 |
echo " <generator>" . _x( 'WP e-Commerce Plugin', 'XML Feed Generator', 'wpsc' ) . "</generator>\n\r";
|
80 |
echo " <atom:link href='$self' rel='self' type='application/rss+xml' />\n\r";
|
wpsc-includes/purchase-log-notification.class.php
CHANGED
@@ -90,7 +90,7 @@ abstract class WPSC_Purchase_Log_Notification {
|
|
90 |
|
91 |
// then there's also this annoying apply_filters call, which is apparently not the best example
|
92 |
// of how to use it, but we have to preserve them anyways
|
93 |
-
$additional_content = apply_filters( 'wpsc_transaction_result_content',
|
94 |
if ( ! is_string( $additional_content ) )
|
95 |
$additional_content = '';
|
96 |
else
|
@@ -429,4 +429,4 @@ class WPSC_Purchase_Log_Customer_HTML_Notification extends WPSC_Purchase_Log_Cus
|
|
429 |
$raw_message = apply_filters( 'wpsc_transaction_result_message_html', $raw_message );
|
430 |
return apply_filters( 'wpsc_purchase_log_customer_html_notification_raw_message', $raw_message, $this );
|
431 |
}
|
432 |
-
}
|
90 |
|
91 |
// then there's also this annoying apply_filters call, which is apparently not the best example
|
92 |
// of how to use it, but we have to preserve them anyways
|
93 |
+
$additional_content = apply_filters( 'wpsc_transaction_result_content', $cart_item_array );
|
94 |
if ( ! is_string( $additional_content ) )
|
95 |
$additional_content = '';
|
96 |
else
|
429 |
$raw_message = apply_filters( 'wpsc_transaction_result_message_html', $raw_message );
|
430 |
return apply_filters( 'wpsc_purchase_log_customer_html_notification_raw_message', $raw_message, $this );
|
431 |
}
|
432 |
+
}
|
wpsc-includes/purchase-log.helpers.php
CHANGED
@@ -128,7 +128,7 @@ function _wpsc_get_cart_item_downloadable_links( $item, $purchase_log ) {
|
|
128 |
$file_name = $current_Dl_product_file_post->post_title;
|
129 |
$downloadid = is_null( $single_download->uniqueid ) ? $single_download->id : $single_download->uniqueid;
|
130 |
$links[] = array(
|
131 |
-
'url' => add_query_arg( 'downloadid', $downloadid,
|
132 |
'name' => $file_name
|
133 |
);
|
134 |
}
|
128 |
$file_name = $current_Dl_product_file_post->post_title;
|
129 |
$downloadid = is_null( $single_download->uniqueid ) ? $single_download->id : $single_download->uniqueid;
|
130 |
$links[] = array(
|
131 |
+
'url' => add_query_arg( 'downloadid', $downloadid, home_url( '/' ) ),
|
132 |
'name' => $file_name
|
133 |
);
|
134 |
}
|
wpsc-includes/purchaselogs.class.php
CHANGED
@@ -210,7 +210,12 @@ function wpsc_purchaselog_details_discount() {
|
|
210 |
|
211 |
function wpsc_purchaselog_details_date() {
|
212 |
global $purchlogitem;
|
213 |
-
return
|
|
|
|
|
|
|
|
|
|
|
214 |
}
|
215 |
|
216 |
function wpsc_purchaselog_details_total() {
|
@@ -344,16 +349,19 @@ function wpsc_display_purchlog_buyers_state_and_postcode() {
|
|
344 |
|
345 |
$output = esc_html( $state );
|
346 |
|
347 |
-
if ( isset( $purchlogitem->userinfo['billingpostcode']['value'] ) )
|
348 |
-
|
|
|
|
|
|
|
|
|
349 |
|
350 |
return $output;
|
351 |
}
|
352 |
|
353 |
function wpsc_display_purchlog_buyers_country() {
|
354 |
global $purchlogitem;
|
355 |
-
return esc_html( $purchlogitem->extrainfo->billing_country );
|
356 |
-
}
|
357 |
|
358 |
function wpsc_display_purchlog_buyers_phone() {
|
359 |
global $purchlogitem;
|
@@ -399,7 +407,7 @@ function wpsc_display_purchlog_shipping_state_and_postcode() {
|
|
399 |
|
400 |
function wpsc_display_purchlog_shipping_country() {
|
401 |
global $purchlogitem;
|
402 |
-
return esc_html( $purchlogitem->shippinginfo['shippingcountry']['value'] );
|
403 |
}
|
404 |
|
405 |
function wpsc_display_purchlog_shipping_method() {
|
@@ -744,7 +752,7 @@ class wpsc_purchaselogs {
|
|
744 |
$fname = $wpdb->get_var( $sql );
|
745 |
$sql = "SELECT value FROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " WHERE log_id=" . $this->purchitem->id . " AND form_id=" . $lNameformid;
|
746 |
$lname = $wpdb->get_var( $sql );
|
747 |
-
$namestring = esc_html( $fname ) . ' ' . esc_html( $lname ) . ' (<a href="mailto:' . esc_attr( $email ) . '?subject=Message From ' .
|
748 |
if ( $fname == '' && $lname == '' && $email == '' ) {
|
749 |
$namestring = __('N/A', 'wpsc');
|
750 |
}
|
210 |
|
211 |
function wpsc_purchaselog_details_date() {
|
212 |
global $purchlogitem;
|
213 |
+
return date_i18n( apply_filters( 'wpsc_single_purchase_log_date_format', get_option( 'date_format' ) ), $purchlogitem->extrainfo->date );
|
214 |
+
}
|
215 |
+
|
216 |
+
function wpsc_purchaselog_details_date_time() {
|
217 |
+
global $purchlogitem;
|
218 |
+
return date_i18n( apply_filters( 'wpsc_single_purchase_log_date_time_format', get_option( 'date_format' ) . ' g:ia' ), $purchlogitem->extrainfo->date );
|
219 |
}
|
220 |
|
221 |
function wpsc_purchaselog_details_total() {
|
349 |
|
350 |
$output = esc_html( $state );
|
351 |
|
352 |
+
if ( isset( $purchlogitem->userinfo['billingpostcode']['value'] ) && ! empty( $purchlogitem->userinfo['billingpostcode']['value'] ) ) {
|
353 |
+
if (! empty( $output ) ) {
|
354 |
+
$output .= ', ';
|
355 |
+
}
|
356 |
+
$output .= esc_html( $purchlogitem->userinfo['billingpostcode']['value'] );
|
357 |
+
}
|
358 |
|
359 |
return $output;
|
360 |
}
|
361 |
|
362 |
function wpsc_display_purchlog_buyers_country() {
|
363 |
global $purchlogitem;
|
364 |
+
return esc_html( wpsc_get_country( $purchlogitem->extrainfo->billing_country ) );}
|
|
|
365 |
|
366 |
function wpsc_display_purchlog_buyers_phone() {
|
367 |
global $purchlogitem;
|
407 |
|
408 |
function wpsc_display_purchlog_shipping_country() {
|
409 |
global $purchlogitem;
|
410 |
+
return esc_html( wpsc_get_country( $purchlogitem->shippinginfo['shippingcountry']['value'] ) );
|
411 |
}
|
412 |
|
413 |
function wpsc_display_purchlog_shipping_method() {
|
752 |
$fname = $wpdb->get_var( $sql );
|
753 |
$sql = "SELECT value FROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " WHERE log_id=" . $this->purchitem->id . " AND form_id=" . $lNameformid;
|
754 |
$lname = $wpdb->get_var( $sql );
|
755 |
+
$namestring = esc_html( $fname ) . ' ' . esc_html( $lname ) . ' (<a href="mailto:' . esc_attr( $email ) . '?subject=Message From ' . home_url() . '">' . esc_html( $email ) . '</a>) ';
|
756 |
if ( $fname == '' && $lname == '' && $email == '' ) {
|
757 |
$namestring = __('N/A', 'wpsc');
|
758 |
}
|
wpsc-includes/rss_template.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
<item>
|
11 |
<title><![CDATA[<?php echo wpsc_the_product_title(); ?>]]></title>
|
12 |
<link><![CDATA[<?php echo wpsc_the_product_permalink(); ?>]]></link>
|
13 |
-
<description><![CDATA[<?php echo
|
14 |
<pubDate><![CDATA[<?php echo wpsc_product_creation_time('D, d M Y H:i:s +0000'); ?>]]></pubDate>
|
15 |
<guid><![CDATA[<?php echo wpsc_the_product_permalink(); ?>]]></guid>
|
16 |
<g:price><![CDATA[<?php echo wpsc_product_normal_price(true); ?>]]></g:price>
|
@@ -18,4 +18,4 @@
|
|
18 |
</item>
|
19 |
<?php endwhile; ?>
|
20 |
</channel>
|
21 |
-
</rss>
|
10 |
<item>
|
11 |
<title><![CDATA[<?php echo wpsc_the_product_title(); ?>]]></title>
|
12 |
<link><![CDATA[<?php echo wpsc_the_product_permalink(); ?>]]></link>
|
13 |
+
<description><![CDATA[<?php echo wpsc_the_product_description(); ?>]]></description>
|
14 |
<pubDate><![CDATA[<?php echo wpsc_product_creation_time('D, d M Y H:i:s +0000'); ?>]]></pubDate>
|
15 |
<guid><![CDATA[<?php echo wpsc_the_product_permalink(); ?>]]></guid>
|
16 |
<g:price><![CDATA[<?php echo wpsc_product_normal_price(true); ?>]]></g:price>
|
18 |
</item>
|
19 |
<?php endwhile; ?>
|
20 |
</channel>
|
21 |
+
</rss>
|
wpsc-includes/shipping.helper.php
CHANGED
@@ -196,15 +196,17 @@ class ASHTools{
|
|
196 |
function get_state( $state_code ){
|
197 |
global $wpdb;
|
198 |
|
199 |
-
|
200 |
-
|
|
|
|
|
201 |
|
202 |
$sql = $wpdb->prepare( "SELECT `".WPSC_TABLE_REGION_TAX."`.* FROM `".WPSC_TABLE_REGION_TAX."`
|
203 |
-
|
204 |
|
205 |
$dest_region_data = $wpdb->get_results( $sql, ARRAY_A );
|
206 |
|
207 |
-
return
|
208 |
}
|
209 |
|
210 |
/**
|
@@ -549,6 +551,8 @@ class ASH{
|
|
549 |
if ( empty( $wpec_ash[$internal_name] ) || ! is_array( $wpec_ash[$internal_name] ) )
|
550 |
$wpec_ash[$internal_name] = array();
|
551 |
|
|
|
|
|
552 |
$wpec_ash[$internal_name]["rate_table"] = $rate_table;
|
553 |
$shipment_vals = array("package_count"=>$shipment->package_count,
|
554 |
"destination" =>$shipment->destination,
|
196 |
function get_state( $state_code ){
|
197 |
global $wpdb;
|
198 |
|
199 |
+
if ( ! defined ( "WPSC_TABLE_REGION_TAX") )
|
200 |
+
return $state_code;
|
201 |
+
|
202 |
+
$state_code = isset( $_POST['region'] ) ? $_POST['region'] : $state_code;
|
203 |
|
204 |
$sql = $wpdb->prepare( "SELECT `".WPSC_TABLE_REGION_TAX."`.* FROM `".WPSC_TABLE_REGION_TAX."`
|
205 |
+
WHERE `".WPSC_TABLE_REGION_TAX."`.`id` = %d", $state_code );
|
206 |
|
207 |
$dest_region_data = $wpdb->get_results( $sql, ARRAY_A );
|
208 |
|
209 |
+
return is_array( $dest_region_data ) && isset( $dest_region_data[0] ) ? $dest_region_data[0]['code'] : "";
|
210 |
}
|
211 |
|
212 |
/**
|
551 |
if ( empty( $wpec_ash[$internal_name] ) || ! is_array( $wpec_ash[$internal_name] ) )
|
552 |
$wpec_ash[$internal_name] = array();
|
553 |
|
554 |
+
|
555 |
+
|
556 |
$wpec_ash[$internal_name]["rate_table"] = $rate_table;
|
557 |
$shipment_vals = array("package_count"=>$shipment->package_count,
|
558 |
"destination" =>$shipment->destination,
|
wpsc-includes/shopping_cart_functions.php
CHANGED
@@ -117,7 +117,7 @@ function wpsc_country_region_list( $form_id = null, $ajax = false, $selected_cou
|
|
117 |
'placeholder' => '',
|
118 |
) );
|
119 |
|
120 |
-
$region_list = $wpdb->get_results( $wpdb->prepare( "SELECT `" . WPSC_TABLE_REGION_TAX . "`.* FROM `" . WPSC_TABLE_REGION_TAX . "`, `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `" . WPSC_TABLE_CURRENCY_LIST . "`.`isocode` IN(%s) AND `" . WPSC_TABLE_CURRENCY_LIST . "`.`id` = `" . WPSC_TABLE_REGION_TAX . "`.`country_id`", $selected_country ), ARRAY_A );
|
121 |
$sql = "SELECT `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `unique_name` = 'shippingstate' ";
|
122 |
$region_form_id = $wpdb->get_var( $sql );
|
123 |
|
117 |
'placeholder' => '',
|
118 |
) );
|
119 |
|
120 |
+
$region_list = $wpdb->get_results( $wpdb->prepare( "SELECT `" . WPSC_TABLE_REGION_TAX . "`.* FROM `" . WPSC_TABLE_REGION_TAX . "`, `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `" . WPSC_TABLE_CURRENCY_LIST . "`.`isocode` IN(%s) AND `" . WPSC_TABLE_CURRENCY_LIST . "`.`id` = `" . WPSC_TABLE_REGION_TAX . "`.`country_id` ORDER BY name ASC", $selected_country ), ARRAY_A );
|
121 |
$sql = "SELECT `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `unique_name` = 'shippingstate' ";
|
122 |
$region_form_id = $wpdb->get_var( $sql );
|
123 |
|
wpsc-includes/theme.functions.php
CHANGED
@@ -90,9 +90,9 @@ function wpsc_flush_theme_transients( $force = false ) {
|
|
90 |
// No files were registered so return false
|
91 |
return false;
|
92 |
}
|
93 |
-
add_action( 'wpsc_move_theme', 'wpsc_flush_theme_transients', 10, true );
|
94 |
add_action( 'wpsc_switch_theme', 'wpsc_flush_theme_transients', 10, true );
|
95 |
-
add_action( 'switch_theme', 'wpsc_flush_theme_transients', 10, true );
|
96 |
|
97 |
/**
|
98 |
* wpsc_check_theme_location()
|
@@ -321,7 +321,7 @@ function wpsc_get_template_file_path( $file = '' ){
|
|
321 |
|
322 |
// Use the bundled file
|
323 |
} else {
|
324 |
-
$file_path = WPSC_CORE_THEME_PATH
|
325 |
}
|
326 |
}
|
327 |
// Save the transient and update it every 12 hours
|
@@ -640,8 +640,7 @@ function wpsc_get_current_category_id() {
|
|
640 |
|
641 |
|
642 |
function wpsc_product_list_rss_feed() {
|
643 |
-
$rss_url =
|
644 |
-
$rss_url = add_query_arg( 'wpsc_action', 'rss', $rss_url );
|
645 |
$rss_url = str_replace('&', '&', $rss_url);
|
646 |
$rss_url = esc_url( $rss_url ); // URL santization - IMPORTANT!
|
647 |
|
@@ -654,12 +653,11 @@ function wpsc_user_dynamic_js() {
|
|
654 |
header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), (date( 'd' ) + 12 ), date( 'Y' ) ) ) . '' );
|
655 |
header( 'Cache-Control: public, must-revalidate, max-age=86400' );
|
656 |
header( 'Pragma: public' );
|
657 |
-
$siteurl = get_option( 'siteurl' );
|
658 |
?>
|
659 |
jQuery.noConflict();
|
660 |
|
661 |
/* base url */
|
662 |
-
var base_url = "<?php echo
|
663 |
var WPSC_URL = "<?php echo WPSC_URL; ?>";
|
664 |
var WPSC_IMAGE_URL = "<?php echo WPSC_IMAGE_URL; ?>";
|
665 |
var WPSC_DIR_NAME = "<?php echo WPSC_DIR_NAME; ?>";
|
@@ -1599,4 +1597,4 @@ function wpsc_the_featured_image_fix($stuff){
|
|
1599 |
}
|
1600 |
|
1601 |
add_action('post_thumbnail_html','wpsc_the_featured_image_fix');
|
1602 |
-
?>
|
90 |
// No files were registered so return false
|
91 |
return false;
|
92 |
}
|
93 |
+
add_action( 'wpsc_move_theme' , 'wpsc_flush_theme_transients', 10, true );
|
94 |
add_action( 'wpsc_switch_theme', 'wpsc_flush_theme_transients', 10, true );
|
95 |
+
add_action( 'switch_theme' , 'wpsc_flush_theme_transients', 10, true );
|
96 |
|
97 |
/**
|
98 |
* wpsc_check_theme_location()
|
321 |
|
322 |
// Use the bundled file
|
323 |
} else {
|
324 |
+
$file_path = path_join( WPSC_CORE_THEME_PATH, $file );
|
325 |
}
|
326 |
}
|
327 |
// Save the transient and update it every 12 hours
|
640 |
|
641 |
|
642 |
function wpsc_product_list_rss_feed() {
|
643 |
+
$rss_url = add_query_arg( 'wpsc_action', 'rss', home_url( '/' ) );
|
|
|
644 |
$rss_url = str_replace('&', '&', $rss_url);
|
645 |
$rss_url = esc_url( $rss_url ); // URL santization - IMPORTANT!
|
646 |
|
653 |
header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), (date( 'd' ) + 12 ), date( 'Y' ) ) ) . '' );
|
654 |
header( 'Cache-Control: public, must-revalidate, max-age=86400' );
|
655 |
header( 'Pragma: public' );
|
|
|
656 |
?>
|
657 |
jQuery.noConflict();
|
658 |
|
659 |
/* base url */
|
660 |
+
var base_url = "<?php echo site_url(); ?>";
|
661 |
var WPSC_URL = "<?php echo WPSC_URL; ?>";
|
662 |
var WPSC_IMAGE_URL = "<?php echo WPSC_IMAGE_URL; ?>";
|
663 |
var WPSC_DIR_NAME = "<?php echo WPSC_DIR_NAME; ?>";
|
1597 |
}
|
1598 |
|
1599 |
add_action('post_thumbnail_html','wpsc_the_featured_image_fix');
|
1600 |
+
?>
|
wpsc-languages/EN_en.php
CHANGED
@@ -567,7 +567,7 @@ define('TXT_WPSC_SELECTACATEGORY', 'Select a Product Group');
|
|
567 |
define('TXT_WPSC_SELECTABRAND', 'Select a Brand');
|
568 |
define('TXT_WPSC_ADDITIONALDESCRIPTION', 'Additional Description');
|
569 |
define('TXT_WPSC_PRICE', 'Price');
|
570 |
-
define('TXT_WPSC_TAXALREADYINCLUDED', 'Do not include tax (tax is set in <a href="'.
|
571 |
define('TXT_WPSC_SPECIAL', 'Sale Price :'); // this text has changed and needs updating
|
572 |
define('TXT_WPSC_PRODUCT_DISPLAY', 'Product Display');
|
573 |
|
567 |
define('TXT_WPSC_SELECTABRAND', 'Select a Brand');
|
568 |
define('TXT_WPSC_ADDITIONALDESCRIPTION', 'Additional Description');
|
569 |
define('TXT_WPSC_PRICE', 'Price');
|
570 |
+
define('TXT_WPSC_TAXALREADYINCLUDED', 'Do not include tax (tax is set in <a href="' . admin_url( 'admin.php?page=wpsc-settings' ) . '">shop config</a>)'); // this text has changed and needs updating
|
571 |
define('TXT_WPSC_SPECIAL', 'Sale Price :'); // this text has changed and needs updating
|
572 |
define('TXT_WPSC_PRODUCT_DISPLAY', 'Product Display');
|
573 |
|
wpsc-merchants/GoogleCheckout-XML.php
CHANGED
@@ -51,8 +51,8 @@ function gateway_google($fromcheckout = false){
|
|
51 |
$total = $wpsc_cart->calculate_total_price();
|
52 |
if($total > 0 ){
|
53 |
$update = $wpdb->update(
|
54 |
-
|
55 |
-
|
56 |
'totalprice' => $total,
|
57 |
'statusno' => 0,
|
58 |
'user_ID' => $user_ID,
|
@@ -66,11 +66,11 @@ function gateway_google($fromcheckout = false){
|
|
66 |
'plugin_version' => WPSC_VERSION,
|
67 |
'discount_value' => $wpsc_cart->coupons_amount,
|
68 |
'discount_data' => $wpsc_cart->coupons_name
|
69 |
-
|
70 |
-
|
71 |
'sessionid' => $sessionid
|
72 |
-
|
73 |
-
|
74 |
'%f',
|
75 |
'%d',
|
76 |
'%d',
|
@@ -84,8 +84,8 @@ function gateway_google($fromcheckout = false){
|
|
84 |
'%s',
|
85 |
'%f',
|
86 |
'%s',
|
87 |
-
|
88 |
-
|
89 |
);
|
90 |
$sql = $wpdb->prepare( "SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE sessionid = %s", $sessionid );
|
91 |
$purchase_log_id = $wpdb->get_var($sql);
|
@@ -95,8 +95,8 @@ function gateway_google($fromcheckout = false){
|
|
95 |
}
|
96 |
if( ! $update ){
|
97 |
$wpdb->insert(
|
98 |
-
|
99 |
-
|
100 |
'totalprice' => $total,
|
101 |
'statusno' => 0,
|
102 |
'sessionid' => $sessionid,
|
@@ -111,8 +111,8 @@ function gateway_google($fromcheckout = false){
|
|
111 |
'plugin_version' => WPSC_VERSION,
|
112 |
'discount_value' => $wpsc_cart->coupons_amount,
|
113 |
'discount_data' => $wpsc_cart->coupons_name
|
114 |
-
|
115 |
-
|
116 |
'%f',
|
117 |
'%d',
|
118 |
'%s',
|
@@ -127,8 +127,8 @@ function gateway_google($fromcheckout = false){
|
|
127 |
'%s',
|
128 |
'%f',
|
129 |
'%s',
|
130 |
-
|
131 |
-
|
132 |
);
|
133 |
$purchase_log_id = $wpdb->insert_id;
|
134 |
|
@@ -166,10 +166,10 @@ function Usecase($separator, $sessionid, $fromcheckout) {
|
|
166 |
$cart->SetEditCartUrl(get_option('shopping_cart_url'));
|
167 |
|
168 |
//google prohibited items not implemented
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
$currentcy_rate = 1;
|
174 |
|
175 |
if($google_curr != $local_currency_code){
|
@@ -233,7 +233,7 @@ function Usecase($separator, $sessionid, $fromcheckout) {
|
|
233 |
$cart->AddShipping($shipping);
|
234 |
}
|
235 |
|
236 |
-
|
237 |
if (!empty($shipping_country)){
|
238 |
$tax_rule = new GoogleDefaultTaxRule( (wpsc_cart_tax(false)/$wpsc_cart->calculate_subtotal() ));
|
239 |
$tax_rule->AddPostalArea($shipping_country);
|
@@ -254,21 +254,21 @@ function Usecase($separator, $sessionid, $fromcheckout) {
|
|
254 |
function wpsc_google_checkout_page(){
|
255 |
global $wpsc_gateway;
|
256 |
$script = "<script type='text/javascript'>
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
|
266 |
$options = get_option('payment_gateway');
|
267 |
|
268 |
if( in_array( 'google', (array) get_option( 'custom_gateway_options' ) ) && 'google' == wpsc_get_customer_meta( 'google_checkout' ) ) {
|
269 |
wpsc_delete_customer_meta( 'google_checkout' );
|
270 |
echo $script;
|
271 |
-
|
272 |
}
|
273 |
}
|
274 |
|
@@ -343,14 +343,14 @@ function form_google(){
|
|
343 |
<tr>
|
344 |
<td>" . __( 'Merchant ID', 'wpsc' ) . " </td>
|
345 |
<td>
|
346 |
-
|
347 |
</td>
|
348 |
</tr>
|
349 |
<tr>
|
350 |
<td>" . __( 'Merchant Key', 'wpsc' ) . "
|
351 |
</td>
|
352 |
<td>
|
353 |
-
|
354 |
</td>
|
355 |
</tr>
|
356 |
<tr>
|
@@ -358,82 +358,89 @@ function form_google(){
|
|
358 |
" . __( 'Turn on auto charging', 'wpsc' ) . "
|
359 |
</td>
|
360 |
<td>
|
361 |
-
<input $google_auto_charge1 type='radio' name='google_auto_charge' value='1' /> " . __( 'Yes', 'wpsc' ) . "
|
362 |
-
<input $google_auto_charge2 type='radio' name='google_auto_charge' value='0' /> " . __( 'No', 'wpsc' ) . "
|
363 |
</td>
|
364 |
</tr>
|
365 |
<tr>
|
366 |
-
<td>
|
|
|
367 |
</td>
|
368 |
<td>
|
369 |
-
<input $google_server_type1 type='radio' name='google_server_type' value='sandbox' /> " . __( 'Sandbox', 'wpsc' ) . "
|
370 |
-
<input $google_server_type2 type='radio' name='google_server_type' value='production' /> " . __( 'Production', 'wpsc' ) . "
|
371 |
</td>
|
372 |
</tr>
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
</td>
|
390 |
</tr>
|
391 |
-
|
392 |
<tr>
|
393 |
<td>
|
394 |
" . __( 'Select Shipping Countries', 'wpsc' ) . "
|
395 |
</td>
|
396 |
<td>
|
397 |
-
|
398 |
-
|
399 |
</tr>
|
400 |
|
401 |
<tr>
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
</
|
|
|
|
|
|
|
|
|
|
|
417 |
</tr>
|
418 |
|
419 |
<tr>
|
420 |
-
<td>".__('API version','wpsc').":</td>
|
421 |
-
<td
|
|
|
|
|
422 |
<td>
|
423 |
<tr>
|
424 |
<td>".__('API callback URL','wpsc').":</td>
|
425 |
-
|
426 |
-
<tr>
|
427 |
-
<td colspan='2'><strong>".get_option('siteurl')."/index.php</strong></td>
|
428 |
</tr>
|
429 |
<tr>
|
430 |
<td colspan='2'>
|
431 |
-
|
432 |
-
|
|
|
433 |
</td>
|
434 |
-
|
435 |
-
|
436 |
-
|
|
|
437 |
|
438 |
function nzsc_googleResponse() {
|
439 |
global $wpdb, $user_ID;
|
@@ -500,8 +507,8 @@ function nzsc_googleResponse() {
|
|
500 |
$region_number = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM ".WPSC_TABLE_REGION_TAX."` WHERE code = %s", $billing_region ) );
|
501 |
|
502 |
$wpdb->insert(
|
503 |
-
|
504 |
-
|
505 |
'totalprice' => $total_price,
|
506 |
'sessionid' => $sessionid,
|
507 |
'date' => time(),
|
@@ -515,8 +522,8 @@ function nzsc_googleResponse() {
|
|
515 |
'google_order_number' => $google_order_number,
|
516 |
'google_user_marketing_preference' => $user_marketing_preference,
|
517 |
'affiliate_id' => $affiliate_id
|
518 |
-
|
519 |
-
|
520 |
'%f',
|
521 |
'%s',
|
522 |
'%s',
|
@@ -530,25 +537,25 @@ function nzsc_googleResponse() {
|
|
530 |
'%s',
|
531 |
'%s',
|
532 |
'%s'
|
533 |
-
|
534 |
);
|
535 |
|
536 |
$log_id = $wpdb->get_var( $wpdb->prepare( "SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid` IN(%s) LIMIT 1", $sessionid ) ) ;
|
537 |
|
538 |
$wpdb->update(
|
539 |
-
|
540 |
-
|
541 |
'firstname' => $shipping_firstname,
|
542 |
'lastname' => $shipping_lastname,
|
543 |
'email' => $billing_email,
|
544 |
'phone' => $billing_phone,
|
545 |
|
546 |
-
|
547 |
-
|
548 |
'id' => $log_id
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
);
|
553 |
|
554 |
if (array_key_exists(0,$cart_items['item'])) {
|
@@ -619,8 +626,8 @@ function nzsc_googleResponse() {
|
|
619 |
}
|
620 |
|
621 |
$wpdb->insert(
|
622 |
-
|
623 |
-
|
624 |
'prodid' => $product_id,
|
625 |
'purchaseid' => $log_id,
|
626 |
'price' => $item_unit_price,
|
@@ -629,8 +636,8 @@ function nzsc_googleResponse() {
|
|
629 |
'quantity' => $item_quantity,
|
630 |
'donation' => $product_info['donation'],
|
631 |
'no_shipping' => $product_info['no_shipping']
|
632 |
-
|
633 |
-
|
634 |
'%d',
|
635 |
'%d',
|
636 |
'%s',
|
@@ -639,7 +646,7 @@ function nzsc_googleResponse() {
|
|
639 |
'%d',
|
640 |
'%s',
|
641 |
'%s',
|
642 |
-
|
643 |
);
|
644 |
}
|
645 |
}
|
@@ -656,13 +663,13 @@ function nzsc_googleResponse() {
|
|
656 |
$google_status = serialize($google_status);
|
657 |
|
658 |
$wpdb->update(
|
659 |
-
|
660 |
-
|
661 |
'google_status' => $google_status
|
662 |
-
|
663 |
-
|
664 |
'google_order_number' => $google_order_number
|
665 |
-
|
666 |
);
|
667 |
|
668 |
if (($data['order-state-change-notification']['new-financial-order-state']['VALUE'] == 'CHARGEABLE') && (get_option('google_auto_charge') == '1')) {
|
@@ -674,13 +681,13 @@ function nzsc_googleResponse() {
|
|
674 |
wpsc_delete_customer_meta( 'google_session' );
|
675 |
|
676 |
$wpdb->update(
|
677 |
-
|
678 |
-
|
679 |
'processed' => '3'
|
680 |
-
|
681 |
-
|
682 |
'google_order_number' => $google_order_number
|
683 |
-
|
684 |
);
|
685 |
}
|
686 |
}
|
@@ -700,15 +707,15 @@ function nzsc_googleResponse() {
|
|
700 |
$google_status = serialize($google_status);
|
701 |
|
702 |
$wpdb->update(
|
703 |
-
|
704 |
-
|
705 |
'google_status' => $google_status,
|
706 |
-
|
707 |
-
|
708 |
'google_order_number' => $google_order_number
|
709 |
-
|
710 |
);
|
711 |
-
|
712 |
|
713 |
if ($root == "refund-amount-notification") {
|
714 |
$google_order_number = $data['refund-amount-notification']['google-order-number']['VALUE'];
|
@@ -725,13 +732,13 @@ function nzsc_googleResponse() {
|
|
725 |
$google_status = serialize($google_status);
|
726 |
|
727 |
$wpdb->update(
|
728 |
-
|
729 |
-
|
730 |
'google_status' => $google_status
|
731 |
-
|
732 |
-
|
733 |
'google_order_number' => $google_order_number
|
734 |
-
|
735 |
);
|
736 |
}
|
737 |
|
@@ -744,13 +751,13 @@ function nzsc_googleResponse() {
|
|
744 |
$google_status['protection']=$data['risk-information-notification']['risk-information']['eligible-for-protection']['VALUE'];
|
745 |
$google_status = serialize($google_status);
|
746 |
$wpdb->update(
|
747 |
-
|
748 |
-
|
749 |
'google_status' => $google_status
|
750 |
-
|
751 |
-
|
752 |
'google_order_number' => $google_order_number
|
753 |
-
|
754 |
);
|
755 |
if ($data['risk-information-notification']['risk-information']['cvn-response']['VALUE'] == 'E') {
|
756 |
$google_risk='cvn';
|
@@ -763,14 +770,14 @@ function nzsc_googleResponse() {
|
|
763 |
}
|
764 |
}
|
765 |
if (isset($google_risk)) {
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
'google_risk' => $google_risk
|
770 |
-
|
771 |
-
|
772 |
'google_order_number' => $google_order_number
|
773 |
-
|
774 |
);
|
775 |
}
|
776 |
}
|
@@ -783,13 +790,13 @@ function nzsc_googleResponse() {
|
|
783 |
$google_status[0] = "CANCELLED_BY_GOOGLE";
|
784 |
|
785 |
$wpdb->update(
|
786 |
-
|
787 |
-
|
788 |
'google_status' => serialize( $google_status )
|
789 |
-
|
790 |
-
|
791 |
'google_order_number' => $google_order_number
|
792 |
-
|
793 |
);
|
794 |
|
795 |
}
|
@@ -800,4 +807,4 @@ function nzsc_googleResponse() {
|
|
800 |
|
801 |
add_action('init', 'nzsc_googleResponse');
|
802 |
|
803 |
-
?>
|
51 |
$total = $wpsc_cart->calculate_total_price();
|
52 |
if($total > 0 ){
|
53 |
$update = $wpdb->update(
|
54 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
55 |
+
array(
|
56 |
'totalprice' => $total,
|
57 |
'statusno' => 0,
|
58 |
'user_ID' => $user_ID,
|
66 |
'plugin_version' => WPSC_VERSION,
|
67 |
'discount_value' => $wpsc_cart->coupons_amount,
|
68 |
'discount_data' => $wpsc_cart->coupons_name
|
69 |
+
),
|
70 |
+
array(
|
71 |
'sessionid' => $sessionid
|
72 |
+
),
|
73 |
+
array(
|
74 |
'%f',
|
75 |
'%d',
|
76 |
'%d',
|
84 |
'%s',
|
85 |
'%f',
|
86 |
'%s',
|
87 |
+
),
|
88 |
+
'%s'
|
89 |
);
|
90 |
$sql = $wpdb->prepare( "SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE sessionid = %s", $sessionid );
|
91 |
$purchase_log_id = $wpdb->get_var($sql);
|
95 |
}
|
96 |
if( ! $update ){
|
97 |
$wpdb->insert(
|
98 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
99 |
+
array(
|
100 |
'totalprice' => $total,
|
101 |
'statusno' => 0,
|
102 |
'sessionid' => $sessionid,
|
111 |
'plugin_version' => WPSC_VERSION,
|
112 |
'discount_value' => $wpsc_cart->coupons_amount,
|
113 |
'discount_data' => $wpsc_cart->coupons_name
|
114 |
+
),
|
115 |
+
array(
|
116 |
'%f',
|
117 |
'%d',
|
118 |
'%s',
|
127 |
'%s',
|
128 |
'%f',
|
129 |
'%s',
|
130 |
+
),
|
131 |
+
'%s'
|
132 |
);
|
133 |
$purchase_log_id = $wpdb->insert_id;
|
134 |
|
166 |
$cart->SetEditCartUrl(get_option('shopping_cart_url'));
|
167 |
|
168 |
//google prohibited items not implemented
|
169 |
+
$currency_converter = new CURRENCYCONVERTER();
|
170 |
+
$currency_code = $wpdb->get_results("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
|
171 |
+
$local_currency_code = $currency_code[0]['code'];
|
172 |
+
$google_curr = get_option('google_cur');
|
173 |
$currentcy_rate = 1;
|
174 |
|
175 |
if($google_curr != $local_currency_code){
|
233 |
$cart->AddShipping($shipping);
|
234 |
}
|
235 |
|
236 |
+
// Add tax rules
|
237 |
if (!empty($shipping_country)){
|
238 |
$tax_rule = new GoogleDefaultTaxRule( (wpsc_cart_tax(false)/$wpsc_cart->calculate_subtotal() ));
|
239 |
$tax_rule->AddPostalArea($shipping_country);
|
254 |
function wpsc_google_checkout_page(){
|
255 |
global $wpsc_gateway;
|
256 |
$script = "<script type='text/javascript'>
|
257 |
+
jQuery(document).ready(
|
258 |
+
function()
|
259 |
+
{
|
260 |
+
jQuery('div#wpsc_shopping_cart_container h2').hide();
|
261 |
+
jQuery('div#wpsc_shopping_cart_container .wpsc_cart_shipping').hide();
|
262 |
+
jQuery('.wpsc_checkout_forms').hide();
|
263 |
+
});
|
264 |
+
</script>";
|
265 |
|
266 |
$options = get_option('payment_gateway');
|
267 |
|
268 |
if( in_array( 'google', (array) get_option( 'custom_gateway_options' ) ) && 'google' == wpsc_get_customer_meta( 'google_checkout' ) ) {
|
269 |
wpsc_delete_customer_meta( 'google_checkout' );
|
270 |
echo $script;
|
271 |
+
gateway_google(true);
|
272 |
}
|
273 |
}
|
274 |
|
343 |
<tr>
|
344 |
<td>" . __( 'Merchant ID', 'wpsc' ) . " </td>
|
345 |
<td>
|
346 |
+
<input type='text' size='40' value='".get_option('google_id')."' name='google_id' />
|
347 |
</td>
|
348 |
</tr>
|
349 |
<tr>
|
350 |
<td>" . __( 'Merchant Key', 'wpsc' ) . "
|
351 |
</td>
|
352 |
<td>
|
353 |
+
<input type='text' size='40' value='".get_option('google_key')."' name='google_key' />
|
354 |
</td>
|
355 |
</tr>
|
356 |
<tr>
|
358 |
" . __( 'Turn on auto charging', 'wpsc' ) . "
|
359 |
</td>
|
360 |
<td>
|
361 |
+
<input $google_auto_charge1 type='radio' name='google_auto_charge' value='1' id='google_auto_charge1' /> <label for='google_auto_charge1'>" . __( 'Yes', 'wpsc' ) . "</label>
|
362 |
+
<input $google_auto_charge2 type='radio' name='google_auto_charge' value='0' id='google_auto_charge2' /> <label for='google_auto_charge2'>" . __( 'No', 'wpsc' ) . "</label>
|
363 |
</td>
|
364 |
</tr>
|
365 |
<tr>
|
366 |
+
<td>
|
367 |
+
" . __( 'Server Type', 'wpsc' ) . "
|
368 |
</td>
|
369 |
<td>
|
370 |
+
<input $google_server_type1 type='radio' name='google_server_type' value='sandbox' id='google_server_type_sandbox' /> <label for='google_server_type_sandbox'>" . __( 'Sandbox', 'wpsc' ) . "</label>
|
371 |
+
<input $google_server_type2 type='radio' name='google_server_type' value='production' id='google_server_type_production' /> <label for='google_server_type_production'>" . __( 'Production', 'wpsc' ) . "</label>
|
372 |
</td>
|
373 |
</tr>
|
374 |
+
<tr>
|
375 |
+
<td>
|
376 |
+
" . __( 'Select your currency', 'wpsc' ) . "
|
377 |
+
</td>
|
378 |
+
<td>
|
379 |
+
<select name='google_cur'>\n";
|
380 |
+
|
381 |
+
if ( get_option( 'google_cur' ) == 'USD' ) {
|
382 |
+
$output .= "<option selected='selected' value='USD'>" . __( 'USD', 'wpsc' ) . "</option>
|
383 |
+
<option value='GBP'>" . __( 'GBP', 'wpsc' ) . "</option>";
|
384 |
+
} else {
|
385 |
+
$output .= "<option value='USD'>" . __( 'USD', 'wpsc' ) . "</option>
|
386 |
+
<option value='GBP' selected='selected'>" . __( 'GBP', 'wpsc' ) . "</option>";
|
387 |
+
}
|
388 |
+
|
389 |
+
$output .= "</select>
|
390 |
</td>
|
391 |
</tr>
|
|
|
392 |
<tr>
|
393 |
<td>
|
394 |
" . __( 'Select Shipping Countries', 'wpsc' ) . "
|
395 |
</td>
|
396 |
<td>
|
397 |
+
<a href='" . add_query_arg( array( "googlecheckoutshipping" => 1, "page" => "wpsc-settings" ) ) . "' alt='" . __( 'Set Shipping Options', 'wpsc' ) . "'>" . __( 'Set Shipping Countries', 'wpsc' ) . "</a>
|
398 |
+
</td>
|
399 |
</tr>
|
400 |
|
401 |
<tr>
|
402 |
+
<td>
|
403 |
+
" . __( 'Button Styles', 'wpsc' ) . "
|
404 |
+
</td>
|
405 |
+
<td>
|
406 |
+
<span class='label'>" . __( 'Size', 'wpsc') . ":</span>
|
407 |
+
<input $button_size1 type='radio' name='google_button_size' value='0' id='google_button_size_0' /> <label for='google_button_size_0'>180×46</label>
|
408 |
+
<input $button_size2 type='radio' name='google_button_size' value='1' id='google_button_size_1' /> <label for='google_button_size_1'>168×44</label>
|
409 |
+
<input $button_size3 type='radio' name='google_button_size' value='2' id='google_button_size_2' /> <label for='google_button_size_2'>160×43</label>
|
410 |
+
</td>
|
411 |
+
</tr>
|
412 |
+
<tr>
|
413 |
+
<td>
|
414 |
+
</td>
|
415 |
+
<td>
|
416 |
+
<label for='google_button_bg'>" . __( 'Background:', 'wpsc' ) . "</label>
|
417 |
+
<select name='google_button_bg'>
|
418 |
+
<option $button_bg1 value='trans'>" . __( 'Transparent', 'wpsc' ) . "</option>
|
419 |
+
<option $button_bg2 value='white'>" . __( 'White', 'wpsc' ) . "</option>
|
420 |
+
</select>
|
421 |
+
</td>
|
422 |
</tr>
|
423 |
|
424 |
<tr>
|
425 |
+
<td>" . __( 'API version', 'wpsc' ) . ":</td>
|
426 |
+
<td>
|
427 |
+
<strong>2.0</strong>
|
428 |
+
</td>
|
429 |
<td>
|
430 |
<tr>
|
431 |
<td>".__('API callback URL','wpsc').":</td>
|
432 |
+
<td><code><strong>" . home_url( '/' ) . "</strong></code></td>
|
|
|
|
|
433 |
</tr>
|
434 |
<tr>
|
435 |
<td colspan='2'>
|
436 |
+
<p class='description'>
|
437 |
+
" . sprintf( __( "For more help configuring Google Checkout, please read our documentation <a href='%s'>here</a>", 'wpsc' ), esc_url( 'http://docs.getshopped.org/documentation/google-checkout/' ) ) . "
|
438 |
+
</p>
|
439 |
</td>
|
440 |
+
</tr>\n";
|
441 |
+
|
442 |
+
return $output;
|
443 |
+
}
|
444 |
|
445 |
function nzsc_googleResponse() {
|
446 |
global $wpdb, $user_ID;
|
507 |
$region_number = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM ".WPSC_TABLE_REGION_TAX."` WHERE code = %s", $billing_region ) );
|
508 |
|
509 |
$wpdb->insert(
|
510 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
511 |
+
array(
|
512 |
'totalprice' => $total_price,
|
513 |
'sessionid' => $sessionid,
|
514 |
'date' => time(),
|
522 |
'google_order_number' => $google_order_number,
|
523 |
'google_user_marketing_preference' => $user_marketing_preference,
|
524 |
'affiliate_id' => $affiliate_id
|
525 |
+
),
|
526 |
+
array(
|
527 |
'%f',
|
528 |
'%s',
|
529 |
'%s',
|
537 |
'%s',
|
538 |
'%s',
|
539 |
'%s'
|
540 |
+
)
|
541 |
);
|
542 |
|
543 |
$log_id = $wpdb->get_var( $wpdb->prepare( "SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `sessionid` IN(%s) LIMIT 1", $sessionid ) ) ;
|
544 |
|
545 |
$wpdb->update(
|
546 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
547 |
+
array(
|
548 |
'firstname' => $shipping_firstname,
|
549 |
'lastname' => $shipping_lastname,
|
550 |
'email' => $billing_email,
|
551 |
'phone' => $billing_phone,
|
552 |
|
553 |
+
),
|
554 |
+
array(
|
555 |
'id' => $log_id
|
556 |
+
),
|
557 |
+
'%s',
|
558 |
+
'%d'
|
559 |
);
|
560 |
|
561 |
if (array_key_exists(0,$cart_items['item'])) {
|
626 |
}
|
627 |
|
628 |
$wpdb->insert(
|
629 |
+
WPSC_TABLE_CART_CONTENTS,
|
630 |
+
array(
|
631 |
'prodid' => $product_id,
|
632 |
'purchaseid' => $log_id,
|
633 |
'price' => $item_unit_price,
|
636 |
'quantity' => $item_quantity,
|
637 |
'donation' => $product_info['donation'],
|
638 |
'no_shipping' => $product_info['no_shipping']
|
639 |
+
),
|
640 |
+
array(
|
641 |
'%d',
|
642 |
'%d',
|
643 |
'%s',
|
646 |
'%d',
|
647 |
'%s',
|
648 |
'%s',
|
649 |
+
)
|
650 |
);
|
651 |
}
|
652 |
}
|
663 |
$google_status = serialize($google_status);
|
664 |
|
665 |
$wpdb->update(
|
666 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
667 |
+
array(
|
668 |
'google_status' => $google_status
|
669 |
+
),
|
670 |
+
array(
|
671 |
'google_order_number' => $google_order_number
|
672 |
+
)
|
673 |
);
|
674 |
|
675 |
if (($data['order-state-change-notification']['new-financial-order-state']['VALUE'] == 'CHARGEABLE') && (get_option('google_auto_charge') == '1')) {
|
681 |
wpsc_delete_customer_meta( 'google_session' );
|
682 |
|
683 |
$wpdb->update(
|
684 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
685 |
+
array(
|
686 |
'processed' => '3'
|
687 |
+
),
|
688 |
+
array(
|
689 |
'google_order_number' => $google_order_number
|
690 |
+
)
|
691 |
);
|
692 |
}
|
693 |
}
|
707 |
$google_status = serialize($google_status);
|
708 |
|
709 |
$wpdb->update(
|
710 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
711 |
+
array(
|
712 |
'google_status' => $google_status,
|
713 |
+
),
|
714 |
+
array(
|
715 |
'google_order_number' => $google_order_number
|
716 |
+
)
|
717 |
);
|
718 |
+
}
|
719 |
|
720 |
if ($root == "refund-amount-notification") {
|
721 |
$google_order_number = $data['refund-amount-notification']['google-order-number']['VALUE'];
|
732 |
$google_status = serialize($google_status);
|
733 |
|
734 |
$wpdb->update(
|
735 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
736 |
+
array(
|
737 |
'google_status' => $google_status
|
738 |
+
),
|
739 |
+
array(
|
740 |
'google_order_number' => $google_order_number
|
741 |
+
)
|
742 |
);
|
743 |
}
|
744 |
|
751 |
$google_status['protection']=$data['risk-information-notification']['risk-information']['eligible-for-protection']['VALUE'];
|
752 |
$google_status = serialize($google_status);
|
753 |
$wpdb->update(
|
754 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
755 |
+
array(
|
756 |
'google_status' => $google_status
|
757 |
+
),
|
758 |
+
array(
|
759 |
'google_order_number' => $google_order_number
|
760 |
+
)
|
761 |
);
|
762 |
if ($data['risk-information-notification']['risk-information']['cvn-response']['VALUE'] == 'E') {
|
763 |
$google_risk='cvn';
|
770 |
}
|
771 |
}
|
772 |
if (isset($google_risk)) {
|
773 |
+
$wpdb->update(
|
774 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
775 |
+
array(
|
776 |
'google_risk' => $google_risk
|
777 |
+
),
|
778 |
+
array(
|
779 |
'google_order_number' => $google_order_number
|
780 |
+
)
|
781 |
);
|
782 |
}
|
783 |
}
|
790 |
$google_status[0] = "CANCELLED_BY_GOOGLE";
|
791 |
|
792 |
$wpdb->update(
|
793 |
+
WPSC_TABLE_PURCHASE_LOGS,
|
794 |
+
array(
|
795 |
'google_status' => serialize( $google_status )
|
796 |
+
),
|
797 |
+
array(
|
798 |
'google_order_number' => $google_order_number
|
799 |
+
)
|
800 |
);
|
801 |
|
802 |
}
|
807 |
|
808 |
add_action('init', 'nzsc_googleResponse');
|
809 |
|
810 |
+
?>
|
wpsc-merchants/chronopay.php
CHANGED
@@ -24,9 +24,9 @@ function gateway_chronopay($separator, $sessionid)
|
|
24 |
$data['product_name'] = get_option('chronopay_product_name');
|
25 |
$data['product_price_currency'] = get_option('chronopay_curcode');
|
26 |
$data['language'] = get_option('chronopay_language');
|
27 |
-
$data['cb_url'] =
|
28 |
$data['cb_type'] = 'P';
|
29 |
-
$data['decline_url'] =
|
30 |
$data['cs1'] = $sessionid;
|
31 |
$data['cs2'] = 'chronopay';
|
32 |
$salt = get_option('chronopay_salt');
|
@@ -364,149 +364,139 @@ function form_chronopay()
|
|
364 |
$output = "
|
365 |
<tr>
|
366 |
<td>" . __( 'Product ID', 'wpsc' ) . "</td>
|
367 |
-
<td
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
</tr>
|
374 |
<tr>
|
375 |
<td>" . __( 'Product Name', 'wpsc' ) . "</td>
|
376 |
-
<td
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
</tr>
|
382 |
<tr>
|
383 |
-
<td>" . __( 'Accepted Currency
|
384 |
-
<td
|
385 |
-
|
386 |
-
<option "
|
|
|
387 |
</select>
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
<td> </td>
|
392 |
-
<td><small>" . __( 'The currency code that ChronoPay will process the payment in. All products must be set up in this currency.', 'wpsc' ) . "</small></td>
|
393 |
</tr>
|
394 |
<tr>
|
395 |
<td>" . __( 'Language', 'wpsc' ) . "</td>
|
396 |
-
<td
|
397 |
-
|
398 |
-
<option "
|
399 |
-
<option "
|
400 |
-
<option "
|
|
|
401 |
</select>
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
<td> </td>
|
406 |
-
<td><small>" . __( 'The language that the ChronoPay secure processing page will be displayed in.', 'wpsc' ) . "</small></td>
|
407 |
</tr>
|
408 |
<tr>
|
409 |
<td>" . __( 'Processing URL', 'wpsc' ) . "</td>
|
410 |
-
<td
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
</tr>
|
416 |
<tr>
|
417 |
<td>" . __( 'Return URL', 'wpsc' ) . "</td>
|
418 |
-
<td
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
</tr>
|
424 |
<tr>
|
425 |
<td>" . __( 'Security Key', 'wpsc' ) . "</td>
|
426 |
-
<td
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
</tr>
|
432 |
<tr>
|
433 |
<td>" . __( 'Debug Mode', 'wpsc' ) . "</td>
|
434 |
<td>
|
435 |
-
<input type='radio' value='1' name='chronopay_debug' id='chronopay_debug1' "
|
436 |
-
<input type='radio' value='0' name='chronopay_debug' id='chronopay_debug2' "
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
<td> </td>
|
441 |
-
<td><small>" . __( 'Debug mode is used to write HTTP communications between the ChronoPay server and your host to a log file. This should only be activated for testing!', 'wpsc' ) . "</small></td>
|
442 |
</tr>
|
443 |
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
</div>
|
450 |
-
</td>
|
451 |
-
</tr>
|
452 |
-
|
453 |
-
<tr class='firstrowth'>
|
454 |
-
<td style='border-bottom: medium none;' colspan='2'>
|
455 |
-
<strong class='form_group'>" . __( 'Forms Sent to Gateway', 'wpsc' ) . "</strong>
|
456 |
-
</td>
|
457 |
-
</tr>
|
458 |
|
459 |
<tr>
|
460 |
<td>" . __( 'First Name Field', 'wpsc' ) . "</td>
|
461 |
-
<td
|
462 |
-
|
|
|
463 |
</select>
|
464 |
</td>
|
465 |
</tr>
|
466 |
<tr>
|
467 |
<td>" . __( 'Last Name Field', 'wpsc' ) . "</td>
|
468 |
<td><select name='chronopay_form[last_name]'>
|
469 |
-
".nzshpcrt_form_field_list(get_option('chronopay_form_last_name'))."
|
470 |
</select>
|
471 |
</td>
|
472 |
</tr>
|
473 |
<tr>
|
474 |
<td>" . __( 'Address Field', 'wpsc' ) . "</td>
|
475 |
<td><select name='chronopay_form[address]'>
|
476 |
-
".nzshpcrt_form_field_list(get_option('chronopay_form_address'))."
|
477 |
</select>
|
478 |
</td>
|
479 |
</tr>
|
480 |
<tr>
|
481 |
<td>" . __( 'City Field', 'wpsc' ) . "</td>
|
482 |
<td><select name='chronopay_form[city]'>
|
483 |
-
".nzshpcrt_form_field_list(get_option('chronopay_form_city'))."
|
484 |
</select>
|
485 |
</td>
|
486 |
</tr>
|
487 |
<tr>
|
488 |
<td>" . __( 'State Field', 'wpsc' ) . "</td>
|
489 |
<td><select name='chronopay_form[state]'>
|
490 |
-
".nzshpcrt_form_field_list(get_option('chronopay_form_state'))."
|
491 |
</select>
|
492 |
</td>
|
493 |
</tr>
|
494 |
<tr>
|
495 |
<td>" . __( 'Postal/ZIP Code Field', 'wpsc' ) . "</td>
|
496 |
<td><select name='chronopay_form[post_code]'>
|
497 |
-
".nzshpcrt_form_field_list(get_option('chronopay_form_post_code'))."
|
498 |
</select>
|
499 |
</td>
|
500 |
</tr>
|
501 |
<tr>
|
502 |
<td>" . __( 'Country Field', 'wpsc' ) . "</td>
|
503 |
<td><select name='chronopay_form[country]'>
|
504 |
-
".nzshpcrt_form_field_list(get_option('chronopay_form_country'))."
|
505 |
</select>
|
506 |
</td>
|
507 |
</tr>
|
508 |
<tr>
|
509 |
-
<td colspan='2'>
|
|
|
|
|
510 |
</tr>";
|
511 |
|
512 |
return $output;
|
24 |
$data['product_name'] = get_option('chronopay_product_name');
|
25 |
$data['product_price_currency'] = get_option('chronopay_curcode');
|
26 |
$data['language'] = get_option('chronopay_language');
|
27 |
+
$data['cb_url'] = add_query_arg( 'chronopay_callback', 'true', home_url( '/' ) );
|
28 |
$data['cb_type'] = 'P';
|
29 |
+
$data['decline_url'] = home_url( '/?chronopay_callback=true' );
|
30 |
$data['cs1'] = $sessionid;
|
31 |
$data['cs2'] = 'chronopay';
|
32 |
$salt = get_option('chronopay_salt');
|
364 |
$output = "
|
365 |
<tr>
|
366 |
<td>" . __( 'Product ID', 'wpsc' ) . "</td>
|
367 |
+
<td>
|
368 |
+
<input type='text' size='40' value='" . get_option( 'chronopay_product_id' ) . "' name='chronopay_product_id' />
|
369 |
+
<p class='description'>
|
370 |
+
" . __( 'This should be set to your product ID that has been set up in the ChronoPay client interface. This is the ChronoPay product that all purchases will be processed against. The cost will be changed depending on the grand total of the users cart.', 'wpsc' ) . "
|
371 |
+
</p>
|
372 |
+
</td>
|
373 |
</tr>
|
374 |
<tr>
|
375 |
<td>" . __( 'Product Name', 'wpsc' ) . "</td>
|
376 |
+
<td>
|
377 |
+
<input type='text' size='40' value='" . get_option( 'chronopay_product_name' ) . "' name='chronopay_product_name' />
|
378 |
+
<p class='description'>
|
379 |
+
" . __( 'This is not important and is usually set to the name of the web shop. It is displayed on the ChronoPay secure processing page.', 'wpsc' ) . "
|
380 |
+
</p>
|
381 |
</tr>
|
382 |
<tr>
|
383 |
+
<td>" . __( 'Accepted Currency', 'wpsc' ) . "</td>
|
384 |
+
<td>
|
385 |
+
<select name='chronopay_curcode'>
|
386 |
+
<option " . $select_currency['USD'] . " value='USD'>" . __( 'USD - U.S. Dollar', 'wpsc' ) . "</option>
|
387 |
+
<option " . $select_currency['EUR'] . " value='EUR'>" . __( 'EUR - Euros', 'wpsc' ) . "</option>
|
388 |
</select>
|
389 |
+
<p class='description'>
|
390 |
+
" . __( 'The currency code that ChronoPay will process the payment in. All products must be set up in this currency.', 'wpsc' ) . "
|
391 |
+
</p>
|
|
|
|
|
392 |
</tr>
|
393 |
<tr>
|
394 |
<td>" . __( 'Language', 'wpsc' ) . "</td>
|
395 |
+
<td>
|
396 |
+
<select name='chronopay_language'>
|
397 |
+
<option " . $select_language['EN'] . " value='EN'>Engish</option>
|
398 |
+
<option " . $select_language['ES'] . " value='ES'>Spanish</option>
|
399 |
+
<option " . $select_language['NL'] . " value='NL'>Dutch</option>
|
400 |
+
<option " . $select_language['RU'] . " value='RU'>Russian</option>
|
401 |
</select>
|
402 |
+
<p class='description'>
|
403 |
+
" . __( 'The language that the ChronoPay secure processing page will be displayed in.', 'wpsc' ) . "
|
404 |
+
</p>
|
|
|
|
|
405 |
</tr>
|
406 |
<tr>
|
407 |
<td>" . __( 'Processing URL', 'wpsc' ) . "</td>
|
408 |
+
<td>
|
409 |
+
<input type='text' size='40' value='" . $chronopay_url . "' name='chronopay_url' />
|
410 |
+
<p class='description'>
|
411 |
+
" . __( 'URL of the secure payment page customers are sent to for payment processing. If unsure leave at default setting.', 'wpsc' ) . "
|
412 |
+
</p>
|
413 |
</tr>
|
414 |
<tr>
|
415 |
<td>" . __( 'Return URL', 'wpsc' ) . "</td>
|
416 |
+
<td>
|
417 |
+
<input type='text' size='40' value='".get_option('transact_url')."' name='chronopay_return_url' />
|
418 |
+
<p class='description'>
|
419 |
+
" . __( 'Enter this URL in the ChronoPay web client against the Product ID that you have set up. This page is the transaction details page that you have configured in Shop Options. It can not be edited on this page.', 'wpsc' ) . "
|
420 |
+
</p>
|
421 |
</tr>
|
422 |
<tr>
|
423 |
<td>" . __( 'Security Key', 'wpsc' ) . "</td>
|
424 |
+
<td>
|
425 |
+
<input type='text' size='40' value='" . $chronopay_salt . "' name='chronopay_salt' />
|
426 |
+
<p class='description'>
|
427 |
+
" . __( 'A bit of security... This is a keyword that is used to ensure transaction approval calls from ChronoPay to this application are real and were instigated from this server. Enter a unique word into this field.' , 'wpsc' ) . "
|
428 |
+
</p>
|
429 |
</tr>
|
430 |
<tr>
|
431 |
<td>" . __( 'Debug Mode', 'wpsc' ) . "</td>
|
432 |
<td>
|
433 |
+
<input type='radio' value='1' name='chronopay_debug' id='chronopay_debug1' " . $chronopay_debug1 . " /> <label for='chronopay_debug1'>".__('Yes', 'wpsc')."</label>
|
434 |
+
<input type='radio' value='0' name='chronopay_debug' id='chronopay_debug2' " . $chronopay_debug2 . " /> <label for='chronopay_debug2'>".__('No', 'wpsc')."</label>
|
435 |
+
<p class='description'>
|
436 |
+
" . __( 'Debug mode is used to write HTTP communications between the ChronoPay server and your host to a log file. This should only be activated for testing!', 'wpsc' ) . "
|
437 |
+
</p>
|
|
|
|
|
438 |
</tr>
|
439 |
|
440 |
+
<tr class='firstrowth'>
|
441 |
+
<td style='border-bottom: medium none;' colspan='2'>
|
442 |
+
<strong class='form_group'>" . __( 'Forms Sent to Gateway', 'wpsc' ) . "</strong>
|
443 |
+
</td>
|
444 |
+
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
|
446 |
<tr>
|
447 |
<td>" . __( 'First Name Field', 'wpsc' ) . "</td>
|
448 |
+
<td>
|
449 |
+
<select name='chronopay_form[first_name]'>
|
450 |
+
" . nzshpcrt_form_field_list(get_option('chronopay_form_first_name')) . "
|
451 |
</select>
|
452 |
</td>
|
453 |
</tr>
|
454 |
<tr>
|
455 |
<td>" . __( 'Last Name Field', 'wpsc' ) . "</td>
|
456 |
<td><select name='chronopay_form[last_name]'>
|
457 |
+
" . nzshpcrt_form_field_list( get_option ( 'chronopay_form_last_name' ) ) . "
|
458 |
</select>
|
459 |
</td>
|
460 |
</tr>
|
461 |
<tr>
|
462 |
<td>" . __( 'Address Field', 'wpsc' ) . "</td>
|
463 |
<td><select name='chronopay_form[address]'>
|
464 |
+
" . nzshpcrt_form_field_list( get_option ( 'chronopay_form_address' ) ) . "
|
465 |
</select>
|
466 |
</td>
|
467 |
</tr>
|
468 |
<tr>
|
469 |
<td>" . __( 'City Field', 'wpsc' ) . "</td>
|
470 |
<td><select name='chronopay_form[city]'>
|
471 |
+
" . nzshpcrt_form_field_list( get_option ( 'chronopay_form_city' ) ) . "
|
472 |
</select>
|
473 |
</td>
|
474 |
</tr>
|
475 |
<tr>
|
476 |
<td>" . __( 'State Field', 'wpsc' ) . "</td>
|
477 |
<td><select name='chronopay_form[state]'>
|
478 |
+
" . nzshpcrt_form_field_list( get_option ( 'chronopay_form_state' ) ) . "
|
479 |
</select>
|
480 |
</td>
|
481 |
</tr>
|
482 |
<tr>
|
483 |
<td>" . __( 'Postal/ZIP Code Field', 'wpsc' ) . "</td>
|
484 |
<td><select name='chronopay_form[post_code]'>
|
485 |
+
" . nzshpcrt_form_field_list( get_option ( 'chronopay_form_post_code' ) ) . "
|
486 |
</select>
|
487 |
</td>
|
488 |
</tr>
|
489 |
<tr>
|
490 |
<td>" . __( 'Country Field', 'wpsc' ) . "</td>
|
491 |
<td><select name='chronopay_form[country]'>
|
492 |
+
" . nzshpcrt_form_field_list( get_option ( 'chronopay_form_country' ) ) . "
|
493 |
</select>
|
494 |
</td>
|
495 |
</tr>
|
496 |
<tr>
|
497 |
+
<td colspan='2'>
|
498 |
+
" . sprintf( __( 'For more help configuring Chronopay, read our documentation <a href="%s">here</a>', 'wpsc' ), esc_url( 'http://docs.getshopped.org/documentation/chronopay/' ) ) . "
|
499 |
+
</td>
|
500 |
</tr>";
|
501 |
|
502 |
return $output;
|
wpsc-merchants/paypal-express.merchant.php
CHANGED
@@ -31,7 +31,7 @@ $nzshpcrt_gateways[$num] = array(
|
|
31 |
'submit_function' => 'submit_paypal_express',
|
32 |
'payment_type' => 'paypal',
|
33 |
'supported_currencies' => array(
|
34 |
-
'currency_list' => array('AUD', 'BRL', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN', 'MYR', 'NOK', 'NZD', 'PHP', 'PLN', 'SEK', 'SGD', 'THB', 'TWD', 'USD'),
|
35 |
'option_name' => 'paypal_curcode'
|
36 |
)
|
37 |
);
|
@@ -48,13 +48,13 @@ $nzshpcrt_gateways[$num] = array(
|
|
48 |
* @subpackage wpsc-merchants
|
49 |
*/
|
50 |
class wpsc_merchant_paypal_express extends wpsc_merchant {
|
51 |
-
|
52 |
-
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
|
59 |
/**
|
60 |
* construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
|
@@ -65,20 +65,20 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
65 |
$PROXY_HOST = '127.0.0.1';
|
66 |
$PROXY_PORT = '808';
|
67 |
$USE_PROXY = false;
|
68 |
-
$version="71";
|
69 |
|
70 |
// PayPal API Credentials
|
71 |
-
$API_UserName=get_option('paypal_certified_apiuser');
|
72 |
-
$API_Password=get_option('paypal_certified_apipass');
|
73 |
-
$API_Signature=get_option('paypal_certified_apisign');
|
74 |
|
75 |
// BN Code is only applicable for partners
|
76 |
$sBNCode = "PP-ECWizard";
|
77 |
|
78 |
-
if ('sandbox' == get_option('paypal_certified_server_type')) {
|
79 |
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
|
80 |
$PAYPAL_URL = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
|
81 |
-
}else{
|
82 |
$API_Endpoint = "https://api-3t.paypal.com/nvp";
|
83 |
$PAYPAL_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=";
|
84 |
}
|
@@ -95,8 +95,8 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
95 |
'city' => $this->cart_data['shipping_address']['city'],
|
96 |
'country' => $this->cart_data['shipping_address']['country'],
|
97 |
'zip' => $this->cart_data['shipping_address']['post_code']
|
98 |
-
|
99 |
-
if( ! empty( $this->cart_data['shipping_address']['state'] ) ) {
|
100 |
$paypal_vars += array(
|
101 |
'state' => $this->cart_data['shipping_address']['state']
|
102 |
);
|
@@ -111,38 +111,36 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
111 |
*/
|
112 |
function parse_gateway_notification() {
|
113 |
/// PayPal first expects the IPN variables to be returned to it within 30 seconds, so we do this first.
|
114 |
-
if ('sandbox' == get_option('paypal_certified_server_type')) {
|
115 |
$paypal_url = "https://www.sandbox.paypal.com/webscr";
|
116 |
-
}else{
|
117 |
$API_Endpoint = "https://api-3t.paypal.com/nvp";
|
118 |
$paypal_url = "https://www.paypal.com/cgi-bin/webscr";
|
119 |
}
|
120 |
$received_values = array();
|
121 |
$received_values['cmd'] = '_notify-validate';
|
122 |
-
|
123 |
$options = array(
|
124 |
'timeout' => 20,
|
125 |
'body' => $received_values,
|
126 |
'user-agent' => ('WP e-Commerce/'.WPSC_PRESENTABLE_VERSION)
|
127 |
);
|
128 |
|
129 |
-
|
130 |
$response = wp_remote_post( $paypal_url, $options );
|
131 |
|
132 |
do_action( 'wpsc_paypal_express_ipn', $received_values, $this );
|
133 |
|
134 |
-
if( 'VERIFIED' == $response['body'] ) {
|
135 |
$this->paypal_ipn_values = $received_values;
|
136 |
$this->session_id = $received_values['invoice'];
|
137 |
if ( strtolower( $received_values['payment_status'] ) == 'completed' ) {
|
138 |
-
$this->set_purchase_processed_by_sessionid(3);
|
139 |
-
transaction_results($this->session_id,false);
|
140 |
-
}
|
141 |
-
|
142 |
-
$this->set_purchase_processed_by_sessionid(6);
|
143 |
}
|
144 |
} else {
|
145 |
-
exit("IPN Request Failure");
|
146 |
}
|
147 |
}
|
148 |
|
@@ -160,25 +158,25 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
160 |
$currencyCodeType = $this->get_paypal_currency_code();
|
161 |
$paymentType = "Sale";
|
162 |
|
163 |
-
if(get_option('permalink_structure') != '')
|
164 |
$separator ="?";
|
165 |
else
|
166 |
$separator ="&";
|
167 |
|
168 |
-
$transact_url = get_option('transact_url');
|
169 |
-
$returnURL =
|
170 |
-
$cancelURL = get_option('shopping_cart_url');
|
171 |
-
$resArray = $this->CallShortcutExpressCheckout ( wpsc_get_customer_meta( 'paypal_express_converted_amount' ), $currencyCodeType, $paymentType, $returnURL, $cancelURL);
|
172 |
-
$ack = strtoupper($resArray["ACK"]);
|
173 |
|
174 |
-
if($ack=="SUCCESS")
|
175 |
-
$this->RedirectToPayPal
|
176 |
-
} else
|
177 |
//Display a user friendly Error on the page using any of the following error information returned by PayPal
|
178 |
-
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
|
179 |
-
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
|
180 |
-
$ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
|
181 |
-
$ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
|
182 |
|
183 |
echo "SetExpressCheckout API call failed. ";
|
184 |
echo "<br />Detailed Error Message: " . $ErrorLongMsg;
|
@@ -186,30 +184,30 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
186 |
echo "<br />Error Code: " . $ErrorCode;
|
187 |
echo "<br />Error Severity Code: " . $ErrorSeverityCode;
|
188 |
}
|
189 |
-
|
190 |
|
191 |
}
|
192 |
|
193 |
function format_price( $price ) {
|
194 |
-
$paypal_currency_code = get_option('paypal_curcode', 'US');
|
195 |
|
196 |
switch($paypal_currency_code) {
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
}
|
209 |
-
return number_format(sprintf("%01.2f", $price)
|
210 |
}
|
211 |
|
212 |
-
function CallShortcutExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL) {
|
213 |
global $wpdb;
|
214 |
|
215 |
$nvpstr = '';
|
@@ -218,7 +216,7 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
218 |
$nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
|
219 |
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
|
220 |
$data = array();
|
221 |
-
if(!isset($this->cart_data['shipping_address']['first_name']) && !isset($this->cart_data['shipping_address']['last_name'])){
|
222 |
$this->cart_data['shipping_address']['first_name'] =$this->cart_data['billing_address']['first_name'];
|
223 |
$this->cart_data['shipping_address']['last_name'] = $this->cart_data['billing_address']['last_name'];
|
224 |
|
@@ -235,10 +233,10 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
235 |
'PAYMENTREQUEST_0_SHIPTOZIP' => $this->cart_data['shipping_address']['post_code'],
|
236 |
);
|
237 |
|
238 |
-
if( ! empty( $this->cart_data['shipping_address']['state'] ) ){
|
239 |
$data += array(
|
240 |
'PAYMENTREQUEST_0_SHIPTOSTATE' => $this->cart_data['shipping_address']['state']
|
241 |
-
|
242 |
}
|
243 |
|
244 |
$i = 0;
|
@@ -283,10 +281,12 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
283 |
$data["L_PAYMENTREQUEST_0_QTY{$i}"] = 1;
|
284 |
}
|
285 |
$data["PAYMENTREQUEST_0_ITEMAMT"] = $this->format_price( $item_total ) ;
|
|
|
286 |
if ( $discount_value && $is_free_shipping )
|
287 |
$data["PAYMENTREQUEST_0_SHIPPINGAMT"] = 0;
|
288 |
else
|
289 |
$data["PAYMENTREQUEST_0_SHIPPINGAMT"] = $this->convert( $this->cart_data['base_shipping'] + $shipping_total );
|
|
|
290 |
$total = $data["PAYMENTREQUEST_0_ITEMAMT"] + $data["PAYMENTREQUEST_0_SHIPPINGAMT"];
|
291 |
|
292 |
if ( ! wpsc_tax_isincluded() ) {
|
@@ -301,25 +301,25 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
301 |
|
302 |
$data["PAYMENTREQUEST_0_AMT"] = $paymentAmount;
|
303 |
|
304 |
-
if(count($data) >= 4) {
|
305 |
$temp_data = array();
|
306 |
-
foreach($data as $key => $value)
|
307 |
-
$temp_data[] = $key."="
|
308 |
|
309 |
-
$nvpstr = $nvpstr . "&".implode("&"
|
310 |
}
|
311 |
|
312 |
wpsc_update_customer_meta( 'paypal_express_currency_code_type', $currencyCodeType );
|
313 |
wpsc_update_customer_meta( 'paypal_express_payment_type', $paymentType );
|
314 |
|
315 |
-
|
316 |
-
$ack = strtoupper($resArray["ACK"]);
|
317 |
-
if($ack=="SUCCESS") {
|
318 |
-
$token = urldecode($resArray["TOKEN"]);
|
319 |
wpsc_update_customer_meta( 'paypal_express_token', $token );
|
320 |
}
|
321 |
|
322 |
-
|
323 |
}
|
324 |
|
325 |
function RedirectToPayPal ( $token ){
|
@@ -327,7 +327,7 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
327 |
// Redirect to paypal.com here
|
328 |
$payPalURL = $PAYPAL_URL . $token;
|
329 |
// echo 'REDIRECT:'.$payPalURL;
|
330 |
-
wp_redirect($payPalURL);
|
331 |
// exit();
|
332 |
}
|
333 |
|
@@ -337,7 +337,7 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
337 |
$paypal_currency_code = $this->get_paypal_currency_code();
|
338 |
$local_currency_code = $this->get_local_currency_code();
|
339 |
if( $local_currency_code != $paypal_currency_code ) {
|
340 |
-
$curr=new CURRENCYCONVERTER();
|
341 |
$this->rate = $curr->convert( 1, $paypal_currency_code, $local_currency_code );
|
342 |
}
|
343 |
}
|
@@ -348,7 +348,7 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
348 |
function get_local_currency_code() {
|
349 |
if ( empty( $this->local_currency_code ) ) {
|
350 |
global $wpdb;
|
351 |
-
$this->local_currency_code = $wpdb->get_var( $wpdb->prepare( "SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`= %d LIMIT 1", get_option('currency_type') ) );
|
352 |
}
|
353 |
|
354 |
return $this->local_currency_code;
|
@@ -380,7 +380,7 @@ function wpsc_paypal_express_convert( $amt ) {
|
|
380 |
if ( empty( $rate ) ) {
|
381 |
$rate = 1;
|
382 |
if ( empty( $local_currency_code ) ) {
|
383 |
-
$local_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1");
|
384 |
}
|
385 |
if ( empty( $paypal_currency_code ) ) {
|
386 |
global $wpsc_gateways;
|
@@ -399,22 +399,22 @@ function wpsc_paypal_express_convert( $amt ) {
|
|
399 |
}
|
400 |
|
401 |
function wpsc_paypal_express_format( $price ) {
|
402 |
-
$paypal_currency_code = get_option('paypal_curcode', 'US');
|
403 |
|
404 |
-
switch($paypal_currency_code) {
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
}
|
417 |
-
return number_format(sprintf("%01.2f", $price)
|
418 |
}
|
419 |
|
420 |
/**
|
@@ -424,23 +424,23 @@ function wpsc_paypal_express_format( $price ) {
|
|
424 |
* @since 3.8
|
425 |
*/
|
426 |
function submit_paypal_express() {
|
427 |
-
if(isset($_POST['paypal_certified_apiuser']))
|
428 |
-
update_option('paypal_certified_apiuser', $_POST['paypal_certified_apiuser']);
|
429 |
-
|
430 |
-
if(isset($_POST['paypal_certified_apipass']))
|
431 |
-
update_option('paypal_certified_apipass', $_POST['paypal_certified_apipass']);
|
432 |
-
|
433 |
-
if(isset($_POST['paypal_curcode']))
|
434 |
-
update_option('paypal_curcode', $_POST['paypal_curcode']);
|
435 |
-
|
436 |
-
if(isset($_POST['paypal_certified_apisign']))
|
437 |
-
update_option('paypal_certified_apisign', $_POST['paypal_certified_apisign']);
|
438 |
-
|
439 |
-
if(isset($_POST['paypal_certified_server_type']))
|
440 |
-
update_option('paypal_certified_server_type', $_POST['paypal_certified_server_type']);
|
441 |
-
|
442 |
-
if(isset($_POST['paypal_ipn'])) {
|
443 |
-
update_option('paypal_ipn', (int)$_POST['paypal_ipn']);
|
444 |
}
|
445 |
|
446 |
return true;
|
@@ -458,111 +458,116 @@ function form_paypal_express() {
|
|
458 |
|
459 |
$serverType1 = '';
|
460 |
$serverType2 = '';
|
461 |
-
$select_currency[get_option('paypal_curcode')] = "selected='selected'";
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
|
463 |
-
if (get_option('paypal_certified_server_type') == 'sandbox')
|
464 |
-
$serverType1="checked='checked'";
|
465 |
-
elseif(get_option('paypal_certified_server_type') == 'production')
|
466 |
-
$serverType2 ="checked='checked'";
|
467 |
$paypal_ipn = get_option( 'paypal_ipn' );
|
468 |
$output = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
<tr>
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
<input type='text' size='40' value='".get_option('paypal_certified_apiuser')."' name='paypal_certified_apiuser' />
|
474 |
-
</td>
|
475 |
-
</tr>
|
476 |
-
<tr>
|
477 |
-
<td>" . __('API Password', 'wpsc' ) . "
|
478 |
-
</td>
|
479 |
-
<td>
|
480 |
-
<input type='text' size='40' value='".get_option('paypal_certified_apipass')."' name='paypal_certified_apipass' />
|
481 |
-
</td>
|
482 |
-
</tr>
|
483 |
-
<tr>
|
484 |
-
<td>" . __('API Signature', 'wpsc' ) . "
|
485 |
-
</td>
|
486 |
-
<td>
|
487 |
-
<input type='text' size='70' value='".get_option('paypal_certified_apisign')."' name='paypal_certified_apisign' />
|
488 |
-
</td>
|
489 |
-
</tr>
|
490 |
-
<tr>
|
491 |
-
<td>" . __('Server Type', 'wpsc' ) . "
|
492 |
-
</td>
|
493 |
-
<td>
|
494 |
-
<input $serverType1 type='radio' name='paypal_certified_server_type' value='sandbox' /> " . __('Sandbox (For testing)', 'wpsc' ) . "
|
495 |
-
<input $serverType2 type='radio' name='paypal_certified_server_type' value='production' /> " . __('Production', 'wpsc' ) . "
|
496 |
-
</td>
|
497 |
</tr>
|
498 |
-
<tr>
|
499 |
-
<td colspan='2'>
|
500 |
-
<span class='wpscsmall description'>
|
501 |
-
" . sprintf( __( "Only use the sandbox server if you have a sandbox account with PayPal you can find out more about this <a href='%s'>here</a>", 'wpsc' ), esc_url( 'https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_testing_sandbox' ) ) . "</span>
|
502 |
-
</td>
|
503 |
-
</tr>
|
504 |
|
505 |
<tr>
|
506 |
<td>
|
507 |
-
|
508 |
</td>
|
509 |
<td>
|
510 |
-
<
|
511 |
-
<input type='radio' value='0' name='paypal_ipn' id='paypal_ipn2' " . checked( $paypal_ipn, 0, false ) . " /> <label for='paypal_ipn2'>".__('No', 'wpsc')."</label>
|
512 |
-
</td>
|
513 |
-
</tr>
|
514 |
-
<tr>
|
515 |
-
<td colspan='2'>
|
516 |
-
<span class='wpscsmall description'>
|
517 |
-
" . __( "IPN (instant payment notification ) will automatically update your sales logs to 'Accepted payment' when a customers payment is successful. For IPN to work you also need to have IPN turned on in your Paypal settings. If it is not turned on, the sales sill remain as 'Order Pending' status until manually changed. It is highly recommend using IPN, especially if you are selling digital products.", 'wpsc' ) . "
|
518 |
-
</span>
|
519 |
-
</td>
|
520 |
-
</tr>
|
521 |
-
|
522 |
-
";
|
523 |
-
|
524 |
-
$paypal_ipn = get_option( 'paypal_ipn' );
|
525 |
-
$store_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id` IN ('".absint(get_option('currency_type'))."')");
|
526 |
-
$current_currency = get_option('paypal_curcode');
|
527 |
-
|
528 |
-
if(($current_currency == '') && in_array($store_currency_code, $wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'])) {
|
529 |
-
update_option('paypal_curcode', $store_currency_code);
|
530 |
-
$current_currency = $store_currency_code;
|
531 |
-
}
|
532 |
-
if($current_currency != $store_currency_code) {
|
533 |
-
$output .= "<tr> <td colspan='2'><strong class='form_group'>" . __( 'Currency Converter', 'wpsc' ) . "</td> </tr>
|
534 |
-
<tr>
|
535 |
-
<td colspan='2'>".__('Your website is using a currency not accepted by PayPal, select an accepted currency using the drop down menu bellow. Buyers on your site will still pay in your local currency however we will convert the currency and send the order through to PayPal using the currency you choose below.', 'wpsc')."</td>
|
536 |
-
</tr>\n";
|
537 |
|
538 |
-
|
539 |
-
$
|
540 |
-
|
541 |
-
if (!isset($wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list']))
|
542 |
-
$wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'] = array();
|
543 |
|
544 |
-
|
545 |
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
}
|
552 |
-
$output .= "<option ".$selected_currency." value='{$currency_item['code']}'>{$currency_item['currency']}</option>";
|
553 |
}
|
554 |
-
$output .= "
|
555 |
-
$output .= " </td>\n";
|
556 |
-
$output .= " </tr>\n";
|
557 |
}
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
}
|
567 |
|
568 |
function wpsc_get_paypal_currency_code() {
|
@@ -585,7 +590,7 @@ function paypal_processingfunctions(){
|
|
585 |
|
586 |
$sessionid = (string) wpsc_get_customer_meta( 'paypal_express_sessionid' );
|
587 |
|
588 |
-
if( isset( $_REQUEST['act'] ) && ( 'error' == $_REQUEST['act'] ) ) {
|
589 |
|
590 |
$resArray = wpsc_get_customer_meta( 'paypal_express_reshash' );
|
591 |
$paypal_express_message = '
|
@@ -596,7 +601,7 @@ function paypal_processingfunctions(){
|
|
596 |
</tr>
|
597 |
';
|
598 |
|
599 |
-
|
600 |
if ( wpsc_get_customer_meta( 'paypal_express_curl_error_msg' ) ) {
|
601 |
|
602 |
$errorMessage = wpsc_get_customer_meta( 'paypal_express_curl_error_msg' );
|
@@ -631,7 +636,7 @@ function paypal_processingfunctions(){
|
|
631 |
</tr>";
|
632 |
|
633 |
$count=0;
|
634 |
-
while (isset($resArray["L_SHORTMESSAGE".$count])) {
|
635 |
$errorCode = $resArray["L_ERRORCODE".$count];
|
636 |
$shortMessage = $resArray["L_SHORTMESSAGE".$count];
|
637 |
$longMessage = $resArray["L_LONGMESSAGE".$count];
|
@@ -650,32 +655,32 @@ function paypal_processingfunctions(){
|
|
650 |
<td> $longMessage </td>
|
651 |
</tr>";
|
652 |
|
653 |
-
|
654 |
}// end else
|
655 |
$paypal_express_message .="
|
656 |
</center>
|
657 |
</table>";
|
658 |
wpsc_update_customer_meta( 'paypal_express_message', $paypal_express_message );
|
659 |
-
}else if(isset($_REQUEST['act']) && ($_REQUEST['act']=='do')){
|
660 |
/* Gather the information to make the final call to
|
661 |
finalize the PayPal payment. The variable nvpstr
|
662 |
holds the name value pairs */
|
663 |
|
664 |
-
$token =urlencode($_REQUEST['token']);
|
665 |
|
666 |
-
$paymentAmount =urlencode
|
667 |
$paymentType = urlencode( wpsc_get_customer_meta( 'paypal_express_payment_type' ) );
|
668 |
$currCodeType = urlencode( wpsc_get_paypal_currency_code() );
|
669 |
$payerID = urlencode( $_REQUEST['PayerID'] );
|
670 |
$serverName = urlencode( $_SERVER['SERVER_NAME'] );
|
671 |
-
$BN='Instinct_e-commerce_wp-shopping-cart_NZ';
|
672 |
-
$nvpstr='&TOKEN='
|
673 |
// IPN data
|
674 |
-
if (get_option('paypal_ipn') == 1) {
|
675 |
-
$notify_url = add_query_arg( 'wpsc_action', 'gateway_notification', (get_option( 'siteurl' ) . "/index.php" ) );
|
676 |
-
$notify_url = add_query_arg('gateway', 'wpsc_merchant_paypal_express', $notify_url);
|
677 |
-
$notify_url = apply_filters('wpsc_paypal_express_notify_url', $notify_url);
|
678 |
-
$nvpstr .= '&PAYMENTREQUEST_0_NOTIFYURL='.urlencode( $notify_url );
|
679 |
}
|
680 |
|
681 |
// Horrible code that I had to write to hot fix the issue with missing item detail in email receipts. arrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrgh!!!!! @#@$%@#%@##$#$
|
@@ -696,7 +701,7 @@ function paypal_processingfunctions(){
|
|
696 |
}
|
697 |
//if we have a discount then include a negative amount with that discount
|
698 |
if ( $purchase_log['discount_value'] ){
|
699 |
-
$discount_value = wpsc_paypal_express_convert( $purchase_log['discount_value']);
|
700 |
|
701 |
// if item total < discount amount, leave at least 0.01 unit in item total, then subtract
|
702 |
// 0.01 from shipping as well
|
@@ -729,24 +734,24 @@ function paypal_processingfunctions(){
|
|
729 |
$paymentAmount = $total;
|
730 |
|
731 |
$nvpstr .= "&PAYMENTREQUEST_0_AMT={$paymentAmount}";
|
732 |
-
$resArray=paypal_hash_call("DoExpressCheckoutPayment"
|
733 |
|
734 |
/* Display the API response back to the browser.
|
735 |
If the response from PayPal was a success, display the response parameters'
|
736 |
If the response was an error, display the errors received using APIError.php. */
|
737 |
-
$ack = strtoupper($resArray["ACK"]);
|
738 |
wpsc_update_customer_meta( 'paypal_express_reshash', $resArray );
|
739 |
|
740 |
-
if($ack!="SUCCESS"){
|
741 |
-
$location = get_option('transact_url')."&act=error";
|
742 |
-
}else{
|
743 |
$transaction_id = $resArray['PAYMENTINFO_0_TRANSACTIONID'];
|
744 |
-
switch($resArray['PAYMENTINFO_0_PAYMENTSTATUS']) {
|
745 |
case 'Processed': // I think this is mostly equivalent to Completed
|
746 |
case 'Completed':
|
747 |
wpsc_update_purchase_log_status( $sessionid, 3, 'sessionid' );
|
748 |
transaction_results( $sessionid, false );
|
749 |
-
|
750 |
|
751 |
case 'Pending': // need to wait for "Completed" before processing
|
752 |
wpsc_update_purchase_log_details(
|
@@ -758,12 +763,12 @@ function paypal_processingfunctions(){
|
|
758 |
),
|
759 |
'sessionid'
|
760 |
);
|
761 |
-
|
762 |
}
|
763 |
-
$location = add_query_arg('sessionid', $sessionid, get_option('transact_url'));
|
764 |
|
765 |
wpsc_delete_customer_meta( 'paypal_express_message' );
|
766 |
-
wp_redirect($location);
|
767 |
exit();
|
768 |
}
|
769 |
|
@@ -771,45 +776,45 @@ function paypal_processingfunctions(){
|
|
771 |
wpsc_delete_customer_meta( 'nzshpcart' );
|
772 |
$wpsc_cart->empty_cart();
|
773 |
|
774 |
-
} else if(isset($_REQUEST['paymentType']) || isset($_REQUEST['token'])){
|
775 |
|
776 |
$token = $_REQUEST['token'];
|
777 |
if( ! isset( $token ) ) {
|
778 |
$paymentAmount = wpsc_get_customer_meta( 'paypal_express_converted_amount' );
|
779 |
$currencyCodeType = wpsc_get_paypal_currency_code();
|
780 |
$paymentType = 'Sale';
|
781 |
-
if(get_option('permalink_structure') != '')
|
782 |
-
$separator ="?";
|
783 |
else
|
784 |
-
$separator ="&";
|
785 |
|
786 |
-
$returnURL =urlencode(get_option('transact_url')
|
787 |
-
$cancelURL =urlencode(get_option('transact_url')
|
788 |
|
789 |
/* Construct the parameter string that describes the PayPal payment
|
790 |
the varialbes were set in the web form, and the resulting string
|
791 |
is stored in $nvpstr */
|
792 |
|
793 |
-
$nvpstr="&PAYMENTREQUEST_0_AMT="
|
794 |
|
795 |
/* Make the call to PayPal to set the Express Checkout token
|
796 |
If the API call succeded, then redirect the buyer to PayPal
|
797 |
to begin to authorize payment. If an error occured, show the
|
798 |
resulting errors
|
799 |
*/
|
800 |
-
$resArray=paypal_hash_call("SetExpressCheckout"
|
801 |
wpsc_update_customer_meta( 'paypal_express_reshash', $resArray );
|
802 |
-
$ack = strtoupper($resArray["ACK"]);
|
803 |
|
804 |
-
if($ack=="SUCCESS"){
|
805 |
// Redirect to paypal.com here
|
806 |
-
$token = urldecode($resArray["TOKEN"]);
|
807 |
-
$payPalURL = $PAYPAL_URL
|
808 |
-
wp_redirect($payPalURL);
|
809 |
-
} else
|
810 |
// Redirecting to APIError.php to display errors.
|
811 |
-
$location = get_option('transact_url')."&act=error";
|
812 |
-
wp_redirect($location);
|
813 |
}
|
814 |
exit();
|
815 |
} else {
|
@@ -821,23 +826,23 @@ function paypal_processingfunctions(){
|
|
821 |
the transaction
|
822 |
*/
|
823 |
|
824 |
-
$token =urlencode( $_REQUEST['token']);
|
825 |
|
826 |
/* Build a second API request to PayPal, using the token as the
|
827 |
ID to get the details on the payment authorization
|
828 |
*/
|
829 |
-
$nvpstr="&TOKEN="
|
830 |
|
831 |
/* Make the API call and store the results in an array. If the
|
832 |
call was a success, show the authorization details, and provide
|
833 |
an action to complete the payment. If failed, show the error
|
834 |
*/
|
835 |
-
$resArray=paypal_hash_call("GetExpressCheckoutDetails"
|
836 |
|
837 |
wpsc_update_customer_meta( 'paypal_express_reshash', $resArray );
|
838 |
|
839 |
-
$ack = strtoupper($resArray["ACK"]);
|
840 |
-
if($ack=="SUCCESS"){
|
841 |
|
842 |
/********************************************************
|
843 |
GetExpressCheckoutDetails.php
|
@@ -865,7 +870,7 @@ function paypal_processingfunctions(){
|
|
865 |
|
866 |
$resArray = wpsc_get_customer_meta( 'paypal_express_reshash' );
|
867 |
|
868 |
-
if(get_option('permalink_structure') != '')
|
869 |
$separator ="?";
|
870 |
else
|
871 |
$separator ="&";
|
@@ -874,7 +879,7 @@ function paypal_processingfunctions(){
|
|
874 |
/* Display the API response back to the browser .
|
875 |
If the response from PayPal was a success, display the response parameters
|
876 |
*/
|
877 |
-
if(isset($_REQUEST['TOKEN']) && !isset($_REQUEST['PAYERID'])){
|
878 |
|
879 |
wpsc_update_customer_meta( 'paypal_express_message', _x( '<h4>TRANSACTION CANCELED</h4>', 'paypal express cancel header', 'wpsc' ) );
|
880 |
|
@@ -882,67 +887,67 @@ function paypal_processingfunctions(){
|
|
882 |
if ( ! isset( $resArray['SHIPTOSTREET2'] ) )
|
883 |
$resArray['SHIPTOSTREET2'] = '';
|
884 |
$output ="
|
885 |
-
|
886 |
-
<tr>
|
887 |
-
<td align='left' class='firstcol'><b>" . __( 'Order Total:', 'wpsc' ) . "</b></td>
|
888 |
-
<td align='left'>" . wpsc_currency_display( wpsc_get_customer_meta( 'paypal_express_original_amount' ) ) . "</td>
|
889 |
-
</tr>
|
890 |
<tr>
|
891 |
-
|
|
|
892 |
</tr>
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
$output .= "
|
934 |
-
$output .= " <input type='hidden' name='
|
935 |
-
$output .= " <input type='hidden' name='
|
936 |
-
$output .= " <input type='hidden' name='
|
937 |
-
$output .= " <input type='hidden' name='
|
938 |
-
$output .= " <input type='hidden' name='
|
939 |
-
$output .= " <input type='hidden' name='
|
|
|
|
|
|
|
940 |
$output .= " <input type='hidden' name='act' value='do' />\n";
|
941 |
-
$output .= " <p> <input name='usePayPal' type='submit' value='".__('Confirm Payment','wpsc')."' /></p>\n";
|
942 |
$output .= "</form>";
|
943 |
$output .=" </td>
|
944 |
-
|
945 |
-
|
946 |
</center>
|
947 |
";
|
948 |
wpsc_update_customer_meta( 'paypal_express_message', $output );
|
@@ -956,10 +961,10 @@ function paypal_processingfunctions(){
|
|
956 |
|
957 |
|
958 |
|
959 |
-
function paypal_hash_call($methodName
|
960 |
//declaring of variables
|
961 |
$version = 71;
|
962 |
-
if ( 'sandbox' == get_option('paypal_certified_server_type') ) {
|
963 |
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
|
964 |
$paypal_certified_url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&useraction=commit&token=";
|
965 |
} else {
|
@@ -968,21 +973,21 @@ function paypal_hash_call($methodName,$nvpStr) {
|
|
968 |
}
|
969 |
|
970 |
$USE_PROXY = false;
|
971 |
-
$API_UserName=get_option('paypal_certified_apiuser');
|
972 |
-
$API_Password=get_option('paypal_certified_apipass');
|
973 |
-
$API_Signature=get_option('paypal_certified_apisign');
|
974 |
$sBNCode = "PP-ECWizard";
|
975 |
//NVPRequest for submitting to server
|
976 |
-
$nvpreq="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);
|
977 |
|
978 |
// Configure WP_HTTP
|
979 |
-
if($USE_PROXY) {
|
980 |
-
if (!defined('WP_PROXY_HOST') && !defined('WP_PROXY_PORT')) {
|
981 |
-
define('WP_PROXY_HOST', $PROXY_HOST);
|
982 |
-
define('WP_PROXY_PORT', $PROXY_PORT);
|
983 |
}
|
984 |
}
|
985 |
-
add_filter('http_api_curl', 'wpsc_curl_ssl');
|
986 |
|
987 |
$options = array(
|
988 |
'timeout' => 20,
|
@@ -990,38 +995,38 @@ function paypal_hash_call($methodName,$nvpStr) {
|
|
990 |
'sslverify' => false,
|
991 |
);
|
992 |
|
993 |
-
$nvpReqArray=paypal_deformatNVP($nvpreq);
|
994 |
|
995 |
wpsc_update_customer_meta( 'paypal_express_nvp_req_array', $nvpReqArray );
|
996 |
|
997 |
-
$res = wp_remote_post($API_Endpoint, $options);
|
998 |
|
999 |
-
if ( is_wp_error($res) ) {
|
1000 |
wpsc_update_customer_meta( 'paypal_express_curl_error_msg', 'WP HTTP Error: ' . $res->get_error_message() );
|
1001 |
-
$nvpResArray=paypal_deformatNVP('');
|
1002 |
} else {
|
1003 |
-
$nvpResArray=paypal_deformatNVP($res['body']);
|
1004 |
}
|
1005 |
|
1006 |
return $nvpResArray;
|
1007 |
}
|
1008 |
|
1009 |
-
function paypal_deformatNVP($nvpstr) {
|
1010 |
-
$intial=0;
|
1011 |
$nvpArray = array();
|
1012 |
|
1013 |
-
while(strlen($nvpstr)) {
|
1014 |
//postion of Key
|
1015 |
-
$keypos= strpos($nvpstr,'=');
|
1016 |
//position of value
|
1017 |
-
$valuepos = strpos($nvpstr,'&') ? strpos($nvpstr,'&'): strlen($nvpstr);
|
1018 |
|
1019 |
/*getting the Key and Value values and storing in a Associative Array*/
|
1020 |
-
$keyval=substr($nvpstr
|
1021 |
-
$valval=substr($nvpstr
|
1022 |
//decoding the respose
|
1023 |
-
$nvpArray[urldecode($keyval)] =urldecode( $valval);
|
1024 |
-
$nvpstr=substr($nvpstr
|
1025 |
}
|
1026 |
return $nvpArray;
|
1027 |
}
|
31 |
'submit_function' => 'submit_paypal_express',
|
32 |
'payment_type' => 'paypal',
|
33 |
'supported_currencies' => array(
|
34 |
+
'currency_list' => array( 'AUD', 'BRL', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN', 'MYR', 'NOK', 'NZD', 'PHP', 'PLN', 'SEK', 'SGD', 'THB', 'TWD', 'USD' ),
|
35 |
'option_name' => 'paypal_curcode'
|
36 |
)
|
37 |
);
|
48 |
* @subpackage wpsc-merchants
|
49 |
*/
|
50 |
class wpsc_merchant_paypal_express extends wpsc_merchant {
|
51 |
+
var $name = '';
|
52 |
+
var $paypal_ipn_values = array();
|
53 |
|
54 |
+
function __construct( $purchase_id = null, $is_receiving = false ) {
|
55 |
+
$this->name = __( 'PayPal Express', 'wpsc' );
|
56 |
+
parent::__construct( $purchase_id, $is_receiving );
|
57 |
+
}
|
58 |
|
59 |
/**
|
60 |
* construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
|
65 |
$PROXY_HOST = '127.0.0.1';
|
66 |
$PROXY_PORT = '808';
|
67 |
$USE_PROXY = false;
|
68 |
+
$version = "71";
|
69 |
|
70 |
// PayPal API Credentials
|
71 |
+
$API_UserName = get_option( 'paypal_certified_apiuser' );
|
72 |
+
$API_Password = get_option( 'paypal_certified_apipass' );
|
73 |
+
$API_Signature = get_option( 'paypal_certified_apisign' );
|
74 |
|
75 |
// BN Code is only applicable for partners
|
76 |
$sBNCode = "PP-ECWizard";
|
77 |
|
78 |
+
if ('sandbox' == get_option( 'paypal_certified_server_type' ) ) {
|
79 |
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
|
80 |
$PAYPAL_URL = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
|
81 |
+
} else {
|
82 |
$API_Endpoint = "https://api-3t.paypal.com/nvp";
|
83 |
$PAYPAL_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=";
|
84 |
}
|
95 |
'city' => $this->cart_data['shipping_address']['city'],
|
96 |
'country' => $this->cart_data['shipping_address']['country'],
|
97 |
'zip' => $this->cart_data['shipping_address']['post_code']
|
98 |
+
);
|
99 |
+
if ( ! empty( $this->cart_data['shipping_address']['state'] ) ) {
|
100 |
$paypal_vars += array(
|
101 |
'state' => $this->cart_data['shipping_address']['state']
|
102 |
);
|
111 |
*/
|
112 |
function parse_gateway_notification() {
|
113 |
/// PayPal first expects the IPN variables to be returned to it within 30 seconds, so we do this first.
|
114 |
+
if ( 'sandbox' == get_option( 'paypal_certified_server_type' ) ) {
|
115 |
$paypal_url = "https://www.sandbox.paypal.com/webscr";
|
116 |
+
} else {
|
117 |
$API_Endpoint = "https://api-3t.paypal.com/nvp";
|
118 |
$paypal_url = "https://www.paypal.com/cgi-bin/webscr";
|
119 |
}
|
120 |
$received_values = array();
|
121 |
$received_values['cmd'] = '_notify-validate';
|
122 |
+
$received_values += stripslashes_deep ( $_POST );
|
123 |
$options = array(
|
124 |
'timeout' => 20,
|
125 |
'body' => $received_values,
|
126 |
'user-agent' => ('WP e-Commerce/'.WPSC_PRESENTABLE_VERSION)
|
127 |
);
|
128 |
|
|
|
129 |
$response = wp_remote_post( $paypal_url, $options );
|
130 |
|
131 |
do_action( 'wpsc_paypal_express_ipn', $received_values, $this );
|
132 |
|
133 |
+
if ( 'VERIFIED' == $response['body'] ) {
|
134 |
$this->paypal_ipn_values = $received_values;
|
135 |
$this->session_id = $received_values['invoice'];
|
136 |
if ( strtolower( $received_values['payment_status'] ) == 'completed' ) {
|
137 |
+
$this->set_purchase_processed_by_sessionid( 3 );
|
138 |
+
transaction_results( $this->session_id, false );
|
139 |
+
} elseif ( strtolower( $received_values['payment_status'] ) == 'denied' ) {
|
140 |
+
$this->set_purchase_processed_by_sessionid( 6 );
|
|
|
141 |
}
|
142 |
} else {
|
143 |
+
exit( "IPN Request Failure" );
|
144 |
}
|
145 |
}
|
146 |
|
158 |
$currencyCodeType = $this->get_paypal_currency_code();
|
159 |
$paymentType = "Sale";
|
160 |
|
161 |
+
if ( get_option( 'permalink_structure' ) != '' )
|
162 |
$separator ="?";
|
163 |
else
|
164 |
$separator ="&";
|
165 |
|
166 |
+
$transact_url = get_option( 'transact_url' );
|
167 |
+
$returnURL = $transact_url . $separator . "sessionid=" . $this->cart_data['session_id'] . "&gateway=paypal";
|
168 |
+
$cancelURL = get_option( 'shopping_cart_url' );
|
169 |
+
$resArray = $this->CallShortcutExpressCheckout ( wpsc_get_customer_meta( 'paypal_express_converted_amount' ), $currencyCodeType, $paymentType, $returnURL, $cancelURL );
|
170 |
+
$ack = strtoupper( $resArray["ACK"] );
|
171 |
|
172 |
+
if ( $ack == "SUCCESS" ) {
|
173 |
+
$this->RedirectToPayPal( $resArray["TOKEN"] );
|
174 |
+
} else {
|
175 |
//Display a user friendly Error on the page using any of the following error information returned by PayPal
|
176 |
+
$ErrorCode = urldecode( $resArray["L_ERRORCODE0"] );
|
177 |
+
$ErrorShortMsg = urldecode( $resArray["L_SHORTMESSAGE0"] );
|
178 |
+
$ErrorLongMsg = urldecode( $resArray["L_LONGMESSAGE0"] );
|
179 |
+
$ErrorSeverityCode = urldecode( $resArray["L_SEVERITYCODE0"] );
|
180 |
|
181 |
echo "SetExpressCheckout API call failed. ";
|
182 |
echo "<br />Detailed Error Message: " . $ErrorLongMsg;
|
184 |
echo "<br />Error Code: " . $ErrorCode;
|
185 |
echo "<br />Error Severity Code: " . $ErrorSeverityCode;
|
186 |
}
|
187 |
+
exit();
|
188 |
|
189 |
}
|
190 |
|
191 |
function format_price( $price ) {
|
192 |
+
$paypal_currency_code = get_option( 'paypal_curcode', 'US' );
|
193 |
|
194 |
switch($paypal_currency_code) {
|
195 |
+
case "JPY":
|
196 |
+
$decimal_places = 0;
|
197 |
+
break;
|
198 |
|
199 |
+
case "HUF":
|
200 |
+
$decimal_places = 0;
|
201 |
+
break;
|
202 |
|
203 |
+
default:
|
204 |
+
$decimal_places = 2;
|
205 |
+
break;
|
206 |
}
|
207 |
+
return number_format( sprintf( "%01.2f", $price ), $decimal_places, '.', '' );
|
208 |
}
|
209 |
|
210 |
+
function CallShortcutExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL ) {
|
211 |
global $wpdb;
|
212 |
|
213 |
$nvpstr = '';
|
216 |
$nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
|
217 |
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
|
218 |
$data = array();
|
219 |
+
if( ! isset( $this->cart_data['shipping_address']['first_name'] ) && ! isset( $this->cart_data['shipping_address']['last_name'] ) ) {
|
220 |
$this->cart_data['shipping_address']['first_name'] =$this->cart_data['billing_address']['first_name'];
|
221 |
$this->cart_data['shipping_address']['last_name'] = $this->cart_data['billing_address']['last_name'];
|
222 |
|
233 |
'PAYMENTREQUEST_0_SHIPTOZIP' => $this->cart_data['shipping_address']['post_code'],
|
234 |
);
|
235 |
|
236 |
+
if ( ! empty( $this->cart_data['shipping_address']['state'] ) ){
|
237 |
$data += array(
|
238 |
'PAYMENTREQUEST_0_SHIPTOSTATE' => $this->cart_data['shipping_address']['state']
|
239 |
+
);
|
240 |
}
|
241 |
|
242 |
$i = 0;
|
281 |
$data["L_PAYMENTREQUEST_0_QTY{$i}"] = 1;
|
282 |
}
|
283 |
$data["PAYMENTREQUEST_0_ITEMAMT"] = $this->format_price( $item_total ) ;
|
284 |
+
|
285 |
if ( $discount_value && $is_free_shipping )
|
286 |
$data["PAYMENTREQUEST_0_SHIPPINGAMT"] = 0;
|
287 |
else
|
288 |
$data["PAYMENTREQUEST_0_SHIPPINGAMT"] = $this->convert( $this->cart_data['base_shipping'] + $shipping_total );
|
289 |
+
|
290 |
$total = $data["PAYMENTREQUEST_0_ITEMAMT"] + $data["PAYMENTREQUEST_0_SHIPPINGAMT"];
|
291 |
|
292 |
if ( ! wpsc_tax_isincluded() ) {
|
301 |
|
302 |
$data["PAYMENTREQUEST_0_AMT"] = $paymentAmount;
|
303 |
|
304 |
+
if( count( $data ) >= 4 ) {
|
305 |
$temp_data = array();
|
306 |
+
foreach( $data as $key => $value )
|
307 |
+
$temp_data[] = $key . "=" . $value;
|
308 |
|
309 |
+
$nvpstr = $nvpstr . "&" . implode( "&", $temp_data );
|
310 |
}
|
311 |
|
312 |
wpsc_update_customer_meta( 'paypal_express_currency_code_type', $currencyCodeType );
|
313 |
wpsc_update_customer_meta( 'paypal_express_payment_type', $paymentType );
|
314 |
|
315 |
+
$resArray = paypal_hash_call( "SetExpressCheckout", $nvpstr );
|
316 |
+
$ack = strtoupper( $resArray["ACK"] );
|
317 |
+
if( $ack == "SUCCESS") {
|
318 |
+
$token = urldecode( $resArray["TOKEN"] );
|
319 |
wpsc_update_customer_meta( 'paypal_express_token', $token );
|
320 |
}
|
321 |
|
322 |
+
return $resArray;
|
323 |
}
|
324 |
|
325 |
function RedirectToPayPal ( $token ){
|
327 |
// Redirect to paypal.com here
|
328 |
$payPalURL = $PAYPAL_URL . $token;
|
329 |
// echo 'REDIRECT:'.$payPalURL;
|
330 |
+
wp_redirect( $payPalURL );
|
331 |
// exit();
|
332 |
}
|
333 |
|
337 |
$paypal_currency_code = $this->get_paypal_currency_code();
|
338 |
$local_currency_code = $this->get_local_currency_code();
|
339 |
if( $local_currency_code != $paypal_currency_code ) {
|
340 |
+
$curr = new CURRENCYCONVERTER();
|
341 |
$this->rate = $curr->convert( 1, $paypal_currency_code, $local_currency_code );
|
342 |
}
|
343 |
}
|
348 |
function get_local_currency_code() {
|
349 |
if ( empty( $this->local_currency_code ) ) {
|
350 |
global $wpdb;
|
351 |
+
$this->local_currency_code = $wpdb->get_var( $wpdb->prepare( "SELECT `code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`= %d LIMIT 1", get_option( 'currency_type' ) ) );
|
352 |
}
|
353 |
|
354 |
return $this->local_currency_code;
|
380 |
if ( empty( $rate ) ) {
|
381 |
$rate = 1;
|
382 |
if ( empty( $local_currency_code ) ) {
|
383 |
+
$local_currency_code = $wpdb->get_var( "SELECT `code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . get_option( 'currency_type' ) . "' LIMIT 1" );
|
384 |
}
|
385 |
if ( empty( $paypal_currency_code ) ) {
|
386 |
global $wpsc_gateways;
|
399 |
}
|
400 |
|
401 |
function wpsc_paypal_express_format( $price ) {
|
402 |
+
$paypal_currency_code = get_option( 'paypal_curcode', 'US' );
|
403 |
|
404 |
+
switch( $paypal_currency_code ) {
|
405 |
+
case "JPY":
|
406 |
+
$decimal_places = 0;
|
407 |
+
break;
|
408 |
|
409 |
+
case "HUF":
|
410 |
+
$decimal_places = 0;
|
411 |
+
break;
|
412 |
|
413 |
+
default:
|
414 |
+
$decimal_places = 2;
|
415 |
+
break;
|
416 |
}
|
417 |
+
return number_format( sprintf( "%01.2f", $price ), $decimal_places, '.', '' );
|
418 |
}
|
419 |
|
420 |
/**
|
424 |
* @since 3.8
|
425 |
*/
|
426 |
function submit_paypal_express() {
|
427 |
+
if ( isset ( $_POST['paypal_certified_apiuser'] ) ) {
|
428 |
+
update_option( 'paypal_certified_apiuser', $_POST['paypal_certified_apiuser'] );
|
429 |
+
}
|
430 |
+
if ( isset ( $_POST['paypal_certified_apipass'] ) ) {
|
431 |
+
update_option( 'paypal_certified_apipass', $_POST['paypal_certified_apipass'] );
|
432 |
+
}
|
433 |
+
if ( isset ( $_POST['paypal_curcode'] ) ) {
|
434 |
+
update_option( 'paypal_curcode', $_POST['paypal_curcode'] );
|
435 |
+
}
|
436 |
+
if ( isset ( $_POST['paypal_certified_apisign'] ) ) {
|
437 |
+
update_option( 'paypal_certified_apisign', $_POST['paypal_certified_apisign'] );
|
438 |
+
}
|
439 |
+
if ( isset ( $_POST['paypal_certified_server_type'] ) ) {
|
440 |
+
update_option( 'paypal_certified_server_type', $_POST['paypal_certified_server_type'] );
|
441 |
+
}
|
442 |
+
if ( isset ( $_POST['paypal_ipn'])) {
|
443 |
+
update_option( 'paypal_ipn', (int)$_POST['paypal_ipn'] );
|
444 |
}
|
445 |
|
446 |
return true;
|
458 |
|
459 |
$serverType1 = '';
|
460 |
$serverType2 = '';
|
461 |
+
$select_currency[ get_option( 'paypal_curcode' ) ] = "selected='selected'";
|
462 |
+
|
463 |
+
if ( get_option( 'paypal_certified_server_type' ) == 'sandbox' ) {
|
464 |
+
$serverType1 = "checked='checked'";
|
465 |
+
} elseif ( get_option( 'paypal_certified_server_type' ) == 'production' ) {
|
466 |
+
$serverType2 = "checked='checked'";
|
467 |
+
}
|
468 |
|
|
|
|
|
|
|
|
|
469 |
$paypal_ipn = get_option( 'paypal_ipn' );
|
470 |
$output = "
|
471 |
+
<tr>
|
472 |
+
<td>" . __('API Username', 'wpsc' ) . "
|
473 |
+
</td>
|
474 |
+
<td>
|
475 |
+
<input type='text' size='40' value='" . get_option( 'paypal_certified_apiuser') . "' name='paypal_certified_apiuser' />
|
476 |
+
</td>
|
477 |
+
</tr>
|
478 |
+
<tr>
|
479 |
+
<td>" . __('API Password', 'wpsc' ) . "
|
480 |
+
</td>
|
481 |
+
<td>
|
482 |
+
<input type='text' size='40' value='" . get_option( 'paypal_certified_apipass') . "' name='paypal_certified_apipass' />
|
483 |
+
</td>
|
484 |
+
</tr>
|
485 |
+
<tr>
|
486 |
+
<td>" . __('API Signature', 'wpsc' ) . "
|
487 |
+
</td>
|
488 |
+
<td>
|
489 |
+
<input type='text' size='70' value='" . get_option( 'paypal_certified_apisign') . "' name='paypal_certified_apisign' />
|
490 |
+
</td>
|
491 |
+
</tr>
|
492 |
+
<tr>
|
493 |
+
<td>" . __('Server Type', 'wpsc' ) . "
|
494 |
+
</td>
|
495 |
+
<td>
|
496 |
+
<input $serverType1 type='radio' name='paypal_certified_server_type' value='sandbox' id='paypal_certified_server_type_sandbox' /> <label for='paypal_certified_server_type_sandbox'>" . __('Sandbox (For testing)', 'wpsc' ) . "</label>
|
497 |
+
<input $serverType2 type='radio' name='paypal_certified_server_type' value='production' id='paypal_certified_server_type_production' /> <label for='paypal_certified_server_type_production'>" . __('Production', 'wpsc' ) . "</label>
|
498 |
+
<p class='description'>
|
499 |
+
" . sprintf( __( "Only use the sandbox server if you have a sandbox account with PayPal you can find out more about this <a href='%s'>here</a>", 'wpsc' ), esc_url( 'https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_testing_sandbox' ) ) . "
|
500 |
+
</p>
|
501 |
+
</td>
|
502 |
+
</tr>
|
503 |
+
|
504 |
+
<tr>
|
505 |
+
<td>
|
506 |
+
" . __( 'IPN', 'wpsc' ) . "
|
507 |
+
</td>
|
508 |
+
<td>
|
509 |
+
<input type='radio' value='1' name='paypal_ipn' id='paypal_ipn1' " . checked( $paypal_ipn, 1, false ) . " /> <label for='paypal_ipn1'>".__('Yes', 'wpsc')."</label>
|
510 |
+
<input type='radio' value='0' name='paypal_ipn' id='paypal_ipn2' " . checked( $paypal_ipn, 0, false ) . " /> <label for='paypal_ipn2'>".__('No', 'wpsc')."</label>
|
511 |
+
<p class='description'>
|
512 |
+
" . __( "IPN (instant payment notification) will automatically update your sales logs to 'Accepted payment' when a customers payment is successful. For IPN to work you also need to have IPN turned on in your Paypal settings. If it is not turned on, the sales sill remain as 'Order Pending' status until manually changed. It is highly recommend using IPN, especially if you are selling digital products.", 'wpsc' ) . "
|
513 |
+
</p>
|
514 |
+
</td>
|
515 |
+
</tr>\n";
|
516 |
+
|
517 |
+
$paypal_ipn = get_option( 'paypal_ipn' );
|
518 |
+
$store_currency_code = $wpdb->get_var( "SELECT `code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id` IN ('" . absint( get_option( 'currency_type' ) ) . "')" );
|
519 |
+
$current_currency = get_option( 'paypal_curcode' );
|
520 |
+
|
521 |
+
if ( ( $current_currency == '' ) && in_array( $store_currency_code, $wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'] ) ) {
|
522 |
+
update_option( 'paypal_curcode', $store_currency_code );
|
523 |
+
$current_currency = $store_currency_code;
|
524 |
+
}
|
525 |
+
if ( $current_currency != $store_currency_code ) {
|
526 |
+
$output .= "<tr> <td colspan='2'><strong class='form_group'>" . __( 'Currency Converter', 'wpsc' ) . "</td> </tr>
|
527 |
<tr>
|
528 |
+
<td colspan='2'>
|
529 |
+
" . __( 'Your website is using a currency not accepted by PayPal, select an accepted currency using the drop down menu bellow. Buyers on your site will still pay in your local currency however we will convert the currency and send the order through to PayPal using the currency you choose below.', 'wpsc' ) . "
|
530 |
+
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
|
533 |
<tr>
|
534 |
<td>
|
535 |
+
" . __('Convert to', 'wpsc' ) . "
|
536 |
</td>
|
537 |
<td>
|
538 |
+
<select name='paypal_curcode'>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
539 |
|
540 |
+
if ( ! isset( $wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'] ) ) {
|
541 |
+
$wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'] = array();
|
542 |
+
}
|
|
|
|
|
543 |
|
544 |
+
$paypal_currency_list = array_map( 'esc_sql', $wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'] );
|
545 |
|
546 |
+
$currency_list = $wpdb->get_results( "SELECT DISTINCT `code`, `currency` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `code` IN ('" . implode( "','", $paypal_currency_list ) . "')", ARRAY_A );
|
547 |
+
foreach ( $currency_list as $currency_item ) {
|
548 |
+
$selected_currency = '';
|
549 |
+
if( $current_currency == $currency_item['code'] ) {
|
550 |
+
$selected_currency = "selected='selected'";
|
|
|
|
|
551 |
}
|
552 |
+
$output .= "<option ".$selected_currency." value='{$currency_item['code']}'>{$currency_item['currency']}</option>";
|
|
|
|
|
553 |
}
|
554 |
+
|
555 |
+
$output .= "
|
556 |
+
</select>
|
557 |
+
</td>
|
558 |
+
</tr>\n";
|
559 |
+
}
|
560 |
+
|
561 |
+
$output .="
|
562 |
+
<tr>
|
563 |
+
<td colspan='2'>
|
564 |
+
<p class='description'>
|
565 |
+
" . sprintf( __( "For more help configuring Paypal Express, please read our documentation <a href='%s'>here</a>", 'wpsc' ), esc_url( 'http://docs.getshopped.org/documentation/paypal-express-checkout/' ) ) . "
|
566 |
+
</p>
|
567 |
+
</td>
|
568 |
+
</tr>\n";
|
569 |
+
|
570 |
+
return $output;
|
571 |
}
|
572 |
|
573 |
function wpsc_get_paypal_currency_code() {
|
590 |
|
591 |
$sessionid = (string) wpsc_get_customer_meta( 'paypal_express_sessionid' );
|
592 |
|
593 |
+
if ( isset( $_REQUEST['act'] ) && ( 'error' == $_REQUEST['act'] ) ) {
|
594 |
|
595 |
$resArray = wpsc_get_customer_meta( 'paypal_express_reshash' );
|
596 |
$paypal_express_message = '
|
601 |
</tr>
|
602 |
';
|
603 |
|
604 |
+
//it will print if any URL errors
|
605 |
if ( wpsc_get_customer_meta( 'paypal_express_curl_error_msg' ) ) {
|
606 |
|
607 |
$errorMessage = wpsc_get_customer_meta( 'paypal_express_curl_error_msg' );
|
636 |
</tr>";
|
637 |
|
638 |
$count=0;
|
639 |
+
while ( isset( $resArray["L_SHORTMESSAGE".$count] ) ) {
|
640 |
$errorCode = $resArray["L_ERRORCODE".$count];
|
641 |
$shortMessage = $resArray["L_SHORTMESSAGE".$count];
|
642 |
$longMessage = $resArray["L_LONGMESSAGE".$count];
|
655 |
<td> $longMessage </td>
|
656 |
</tr>";
|
657 |
|
658 |
+
}//end while
|
659 |
}// end else
|
660 |
$paypal_express_message .="
|
661 |
</center>
|
662 |
</table>";
|
663 |
wpsc_update_customer_meta( 'paypal_express_message', $paypal_express_message );
|
664 |
+
} else if ( isset( $_REQUEST['act'] ) && ( $_REQUEST['act']== 'do' ) ) {
|
665 |
/* Gather the information to make the final call to
|
666 |
finalize the PayPal payment. The variable nvpstr
|
667 |
holds the name value pairs */
|
668 |
|
669 |
+
$token = urlencode( $_REQUEST['token'] );
|
670 |
|
671 |
+
$paymentAmount = urlencode( wpsc_get_customer_meta( 'paypal_express_converted_amount' ) );
|
672 |
$paymentType = urlencode( wpsc_get_customer_meta( 'paypal_express_payment_type' ) );
|
673 |
$currCodeType = urlencode( wpsc_get_paypal_currency_code() );
|
674 |
$payerID = urlencode( $_REQUEST['PayerID'] );
|
675 |
$serverName = urlencode( $_SERVER['SERVER_NAME'] );
|
676 |
+
$BN = 'Instinct_e-commerce_wp-shopping-cart_NZ';
|
677 |
+
$nvpstr = '&TOKEN=' . $token . '&PAYERID=' . $payerID . '&PAYMENTREQUEST_0_PAYMENTACTION=Sale&PAYMENTREQUEST_0_CURRENCYCODE=' . $currCodeType . '&IPADDRESS=' . $serverName . "&BUTTONSOURCE=" . $BN . "&PAYMENTREQUEST_0_INVNUM=" . urlencode( $sessionid );
|
678 |
// IPN data
|
679 |
+
if ( get_option( 'paypal_ipn' ) == 1 ) {
|
680 |
+
$notify_url = add_query_arg( 'wpsc_action', 'gateway_notification', ( get_option( 'siteurl' ) . "/index.php" ) );
|
681 |
+
$notify_url = add_query_arg( 'gateway', 'wpsc_merchant_paypal_express', $notify_url );
|
682 |
+
$notify_url = apply_filters( 'wpsc_paypal_express_notify_url', $notify_url );
|
683 |
+
$nvpstr .= '&PAYMENTREQUEST_0_NOTIFYURL=' . urlencode( $notify_url );
|
684 |
}
|
685 |
|
686 |
// Horrible code that I had to write to hot fix the issue with missing item detail in email receipts. arrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrgh!!!!! @#@$%@#%@##$#$
|
701 |
}
|
702 |
//if we have a discount then include a negative amount with that discount
|
703 |
if ( $purchase_log['discount_value'] ){
|
704 |
+
$discount_value = wpsc_paypal_express_convert( $purchase_log['discount_value'] );
|
705 |
|
706 |
// if item total < discount amount, leave at least 0.01 unit in item total, then subtract
|
707 |
// 0.01 from shipping as well
|
734 |
$paymentAmount = $total;
|
735 |
|
736 |
$nvpstr .= "&PAYMENTREQUEST_0_AMT={$paymentAmount}";
|
737 |
+
$resArray = paypal_hash_call( "DoExpressCheckoutPayment", $nvpstr );
|
738 |
|
739 |
/* Display the API response back to the browser.
|
740 |
If the response from PayPal was a success, display the response parameters'
|
741 |
If the response was an error, display the errors received using APIError.php. */
|
742 |
+
$ack = strtoupper( $resArray["ACK"] );
|
743 |
wpsc_update_customer_meta( 'paypal_express_reshash', $resArray );
|
744 |
|
745 |
+
if ( $ack != "SUCCESS" ) {
|
746 |
+
$location = get_option( 'transact_url' ) . "&act=error";
|
747 |
+
} else {
|
748 |
$transaction_id = $resArray['PAYMENTINFO_0_TRANSACTIONID'];
|
749 |
+
switch( $resArray['PAYMENTINFO_0_PAYMENTSTATUS'] ) {
|
750 |
case 'Processed': // I think this is mostly equivalent to Completed
|
751 |
case 'Completed':
|
752 |
wpsc_update_purchase_log_status( $sessionid, 3, 'sessionid' );
|
753 |
transaction_results( $sessionid, false );
|
754 |
+
break;
|
755 |
|
756 |
case 'Pending': // need to wait for "Completed" before processing
|
757 |
wpsc_update_purchase_log_details(
|
763 |
),
|
764 |
'sessionid'
|
765 |
);
|
766 |
+
break;
|
767 |
}
|
768 |
+
$location = add_query_arg( 'sessionid', $sessionid, get_option( 'transact_url' ) );
|
769 |
|
770 |
wpsc_delete_customer_meta( 'paypal_express_message' );
|
771 |
+
wp_redirect( $location );
|
772 |
exit();
|
773 |
}
|
774 |
|
776 |
wpsc_delete_customer_meta( 'nzshpcart' );
|
777 |
$wpsc_cart->empty_cart();
|
778 |
|
779 |
+
} else if ( isset( $_REQUEST['paymentType'] ) || isset( $_REQUEST['token'] ) ) {
|
780 |
|
781 |
$token = $_REQUEST['token'];
|
782 |
if( ! isset( $token ) ) {
|
783 |
$paymentAmount = wpsc_get_customer_meta( 'paypal_express_converted_amount' );
|
784 |
$currencyCodeType = wpsc_get_paypal_currency_code();
|
785 |
$paymentType = 'Sale';
|
786 |
+
if ( get_option( 'permalink_structure' ) != '' )
|
787 |
+
$separator = "?";
|
788 |
else
|
789 |
+
$separator = "&";
|
790 |
|
791 |
+
$returnURL = urlencode( get_option( 'transact_url' ) . $separator . 'currencyCodeType=' . $currencyCodeType . '&paymentType=' . $paymentType . '&paymentAmount=' . $paymentAmount );
|
792 |
+
$cancelURL = urlencode( get_option( 'transact_url' ) . $separator . 'paymentType=$paymentType' );
|
793 |
|
794 |
/* Construct the parameter string that describes the PayPal payment
|
795 |
the varialbes were set in the web form, and the resulting string
|
796 |
is stored in $nvpstr */
|
797 |
|
798 |
+
$nvpstr = "&PAYMENTREQUEST_0_AMT=" . $paymentAmount . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType . "&ReturnUrl=" . $returnURL . "&CANCELURL=" . $cancelURL . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
|
799 |
|
800 |
/* Make the call to PayPal to set the Express Checkout token
|
801 |
If the API call succeded, then redirect the buyer to PayPal
|
802 |
to begin to authorize payment. If an error occured, show the
|
803 |
resulting errors
|
804 |
*/
|
805 |
+
$resArray = paypal_hash_call( "SetExpressCheckout", $nvpstr );
|
806 |
wpsc_update_customer_meta( 'paypal_express_reshash', $resArray );
|
807 |
+
$ack = strtoupper( $resArray["ACK"] );
|
808 |
|
809 |
+
if ( $ack == "SUCCESS" ){
|
810 |
// Redirect to paypal.com here
|
811 |
+
$token = urldecode( $resArray["TOKEN"] );
|
812 |
+
$payPalURL = $PAYPAL_URL . $token;
|
813 |
+
wp_redirect( $payPalURL );
|
814 |
+
} else {
|
815 |
// Redirecting to APIError.php to display errors.
|
816 |
+
$location = get_option( 'transact_url' ) . "&act=error";
|
817 |
+
wp_redirect( $location );
|
818 |
}
|
819 |
exit();
|
820 |
} else {
|
826 |
the transaction
|
827 |
*/
|
828 |
|
829 |
+
$token = urlencode( $_REQUEST['token'] );
|
830 |
|
831 |
/* Build a second API request to PayPal, using the token as the
|
832 |
ID to get the details on the payment authorization
|
833 |
*/
|
834 |
+
$nvpstr = "&TOKEN=" . $token;
|
835 |
|
836 |
/* Make the API call and store the results in an array. If the
|
837 |
call was a success, show the authorization details, and provide
|
838 |
an action to complete the payment. If failed, show the error
|
839 |
*/
|
840 |
+
$resArray = paypal_hash_call( "GetExpressCheckoutDetails", $nvpstr );
|
841 |
|
842 |
wpsc_update_customer_meta( 'paypal_express_reshash', $resArray );
|
843 |
|
844 |
+
$ack = strtoupper( $resArray["ACK"] );
|
845 |
+
if( $ack == "SUCCESS" ){
|
846 |
|
847 |
/********************************************************
|
848 |
GetExpressCheckoutDetails.php
|
870 |
|
871 |
$resArray = wpsc_get_customer_meta( 'paypal_express_reshash' );
|
872 |
|
873 |
+
if ( get_option( 'permalink_structure' ) != '')
|
874 |
$separator ="?";
|
875 |
else
|
876 |
$separator ="&";
|
879 |
/* Display the API response back to the browser .
|
880 |
If the response from PayPal was a success, display the response parameters
|
881 |
*/
|
882 |
+
if( isset( $_REQUEST['TOKEN'] ) && ! isset( $_REQUEST['PAYERID'] ) ) {
|
883 |
|
884 |
wpsc_update_customer_meta( 'paypal_express_message', _x( '<h4>TRANSACTION CANCELED</h4>', 'paypal express cancel header', 'wpsc' ) );
|
885 |
|
887 |
if ( ! isset( $resArray['SHIPTOSTREET2'] ) )
|
888 |
$resArray['SHIPTOSTREET2'] = '';
|
889 |
$output ="
|
890 |
+
<table width='400' class='paypal_express_form'>
|
|
|
|
|
|
|
|
|
891 |
<tr>
|
892 |
+
<td align='left' class='firstcol'><b>" . __( 'Order Total:', 'wpsc' ) . "</b></td>
|
893 |
+
<td align='left'>" . wpsc_currency_display( wpsc_get_customer_meta( 'paypal_express_original_amount' ) ) . "</td>
|
894 |
</tr>
|
895 |
+
<tr>
|
896 |
+
<td align='left' colspan='2'><b>" . __( 'Shipping Address:', 'wpsc' ) . " </b></td>
|
897 |
+
</tr>
|
898 |
+
<tr>
|
899 |
+
<td align='left' class='firstcol'>
|
900 |
+
" . __( 'Street 1:', 'wpsc' ) . "</td>
|
901 |
+
<td align='left'>" . $resArray['SHIPTOSTREET'] . "</td>
|
902 |
+
|
903 |
+
</tr>
|
904 |
+
<tr>
|
905 |
+
<td align='left' class='firstcol'>
|
906 |
+
" . __( 'Street 2:', 'wpsc' ) . "</td>
|
907 |
+
<td align='left'>" . $resArray['SHIPTOSTREET2'] . "
|
908 |
+
</td>
|
909 |
+
</tr>
|
910 |
+
<tr>
|
911 |
+
<td align='left' class='firstcol'>
|
912 |
+
" . __( 'City:', 'wpsc' ) . "</td>
|
913 |
+
|
914 |
+
<td align='left'>" . $resArray['SHIPTOCITY'] . "</td>
|
915 |
+
</tr>
|
916 |
+
<tr>
|
917 |
+
<td align='left' class='firstcol'>
|
918 |
+
" . __( 'State:', 'wpsc' ) . "</td>
|
919 |
+
<td align='left'>" . $resArray['SHIPTOSTATE'] . "</td>
|
920 |
+
</tr>
|
921 |
+
<tr>
|
922 |
+
<td align='left' class='firstcol'>
|
923 |
+
" . __( 'Postal code:', 'wpsc' ) . "</td>
|
924 |
+
|
925 |
+
<td align='left'>" . $resArray['SHIPTOZIP'] . "</td>
|
926 |
+
</tr>
|
927 |
+
<tr>
|
928 |
+
<td align='left' class='firstcol'>
|
929 |
+
" . __( 'Country:', 'wpsc' ) . "</td>
|
930 |
+
<td align='left'>" . $resArray['SHIPTOCOUNTRYNAME'] . "</td>
|
931 |
+
</tr>
|
932 |
+
<tr>
|
933 |
+
<td colspan='2'>";
|
934 |
+
|
935 |
+
$output .= "<form action=" . get_option( 'transact_url' ) . " method='post'>\n";
|
936 |
+
$output .= " <input type='hidden' name='totalAmount' value='" . wpsc_cart_total(false) . "' />\n";
|
937 |
+
$output .= " <input type='hidden' name='shippingStreet' value='" . $resArray['SHIPTOSTREET'] . "' />\n";
|
938 |
+
$output .= " <input type='hidden' name='shippingStreet2' value='" . $resArray['SHIPTOSTREET2'] . "' />\n";
|
939 |
+
$output .= " <input type='hidden' name='shippingCity' value='" . $resArray['SHIPTOCITY'] . "' />\n";
|
940 |
+
$output .= " <input type='hidden' name='shippingState' value='" . $resArray['SHIPTOSTATE'] . "' />\n";
|
941 |
+
$output .= " <input type='hidden' name='postalCode' value='" . $resArray['SHIPTOZIP'] . "' />\n";
|
942 |
+
$output .= " <input type='hidden' name='country' value='" . $resArray['SHIPTOCOUNTRYNAME'] . "' />\n";
|
943 |
+
$output .= " <input type='hidden' name='token' value='" . wpsc_get_customer_meta( 'paypal_express_token' ) . "' />\n";
|
944 |
+
$output .= " <input type='hidden' name='PayerID' value='" . wpsc_get_customer_meta( 'paypal_express_payer_id' ) . "' />\n";
|
945 |
$output .= " <input type='hidden' name='act' value='do' />\n";
|
946 |
+
$output .= " <p> <input name='usePayPal' type='submit' value='" . __('Confirm Payment','wpsc') . "' /></p>\n";
|
947 |
$output .= "</form>";
|
948 |
$output .=" </td>
|
949 |
+
</tr>
|
950 |
+
</table>
|
951 |
</center>
|
952 |
";
|
953 |
wpsc_update_customer_meta( 'paypal_express_message', $output );
|
961 |
|
962 |
|
963 |
|
964 |
+
function paypal_hash_call( $methodName, $nvpStr ) {
|
965 |
//declaring of variables
|
966 |
$version = 71;
|
967 |
+
if ( 'sandbox' == get_option( 'paypal_certified_server_type' ) ) {
|
968 |
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
|
969 |
$paypal_certified_url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&useraction=commit&token=";
|
970 |
} else {
|
973 |
}
|
974 |
|
975 |
$USE_PROXY = false;
|
976 |
+
$API_UserName = get_option( 'paypal_certified_apiuser' );
|
977 |
+
$API_Password = get_option( 'paypal_certified_apipass' );
|
978 |
+
$API_Signature = get_option( 'paypal_certified_apisign' );
|
979 |
$sBNCode = "PP-ECWizard";
|
980 |
//NVPRequest for submitting to server
|
981 |
+
$nvpreq = "METHOD=" . urlencode( $methodName ) . "&VERSION=" . urlencode( $version ) . "&PWD=" . urlencode( $API_Password ) . "&USER=" . urlencode( $API_UserName ) . "&SIGNATURE=" . urlencode( $API_Signature ) . $nvpStr . "&BUTTONSOURCE=" . urlencode( $sBNCode );
|
982 |
|
983 |
// Configure WP_HTTP
|
984 |
+
if ( $USE_PROXY ) {
|
985 |
+
if ( ! defined( 'WP_PROXY_HOST' ) && ! defined( 'WP_PROXY_PORT' ) ) {
|
986 |
+
define( 'WP_PROXY_HOST', $PROXY_HOST );
|
987 |
+
define( 'WP_PROXY_PORT', $PROXY_PORT );
|
988 |
}
|
989 |
}
|
990 |
+
add_filter( 'http_api_curl', 'wpsc_curl_ssl' );
|
991 |
|
992 |
$options = array(
|
993 |
'timeout' => 20,
|
995 |
'sslverify' => false,
|
996 |
);
|
997 |
|
998 |
+
$nvpReqArray = paypal_deformatNVP( $nvpreq );
|
999 |
|
1000 |
wpsc_update_customer_meta( 'paypal_express_nvp_req_array', $nvpReqArray );
|
1001 |
|
1002 |
+
$res = wp_remote_post( $API_Endpoint, $options );
|
1003 |
|
1004 |
+
if ( is_wp_error( $res ) ) {
|
1005 |
wpsc_update_customer_meta( 'paypal_express_curl_error_msg', 'WP HTTP Error: ' . $res->get_error_message() );
|
1006 |
+
$nvpResArray = paypal_deformatNVP( '' );
|
1007 |
} else {
|
1008 |
+
$nvpResArray = paypal_deformatNVP( $res['body'] );
|
1009 |
}
|
1010 |
|
1011 |
return $nvpResArray;
|
1012 |
}
|
1013 |
|
1014 |
+
function paypal_deformatNVP( $nvpstr ) {
|
1015 |
+
$intial = 0;
|
1016 |
$nvpArray = array();
|
1017 |
|
1018 |
+
while ( strlen( $nvpstr ) ) {
|
1019 |
//postion of Key
|
1020 |
+
$keypos = strpos( $nvpstr, '=' );
|
1021 |
//position of value
|
1022 |
+
$valuepos = strpos( $nvpstr, '&' ) ? strpos( $nvpstr,'&' ) : strlen( $nvpstr );
|
1023 |
|
1024 |
/*getting the Key and Value values and storing in a Associative Array*/
|
1025 |
+
$keyval = substr( $nvpstr, $intial, $keypos );
|
1026 |
+
$valval = substr( $nvpstr, $keypos + 1, $valuepos - $keypos - 1 );
|
1027 |
//decoding the respose
|
1028 |
+
$nvpArray[ urldecode( $keyval ) ] = urldecode( $valval );
|
1029 |
+
$nvpstr = substr( $nvpstr, $valuepos + 1, strlen( $nvpstr ) );
|
1030 |
}
|
1031 |
return $nvpArray;
|
1032 |
}
|
wpsc-merchants/paypal-pro.merchant.php
CHANGED
@@ -47,7 +47,7 @@ class wpsc_merchant_paypal_pro extends wpsc_merchant {
|
|
47 |
function get_local_currency_code() {
|
48 |
if ( empty( $this->local_currency_code ) ) {
|
49 |
global $wpdb;
|
50 |
-
$this->local_currency_code = $wpdb->get_var( $wpdb->prepare( "SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`= %d LIMIT 1", get_option( 'currency_type' ) ) );
|
51 |
}
|
52 |
|
53 |
return $this->local_currency_code;
|
@@ -121,7 +121,7 @@ class wpsc_merchant_paypal_pro extends wpsc_merchant {
|
|
121 |
|
122 |
// Credit Card Data
|
123 |
$data['CREDITCARDTYPE'] = $_POST['cctype'];
|
124 |
-
$data['ACCT'] = str_replace( array(' ', '-'), '', $_POST['card_number'] );
|
125 |
$data['EXPDATE'] = $_POST['expiry']['month'] . $_POST['expiry']['year'];
|
126 |
$data['CVV2'] = $_POST['card_code'];
|
127 |
|
@@ -438,15 +438,13 @@ function form_paypal_pro() {
|
|
438 |
<label for="paypal_pro_testmode">' . __( 'Test Mode Enabled:', 'wpsc' ) . '</label>
|
439 |
</td>
|
440 |
<td>
|
441 |
-
<input type="hidden" name="PayPalPro[testmode]" value="off"
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
</td>
|
449 |
-
</tr>';
|
450 |
|
451 |
$store_currency_code = $wpdb->get_var( $wpdb->prepare( "SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id` IN (%d)", get_option( 'currency_type' ) ) );
|
452 |
$current_currency = get_option('paypal_curcode');
|
@@ -459,10 +457,12 @@ function form_paypal_pro() {
|
|
459 |
$output .= "<tr> <td colspan='2'><strong class='form_group'>" . __( 'Currency Converter', 'wpsc' ) . "</td> </tr>
|
460 |
<tr>
|
461 |
<td colspan='2'>".__('Your website is using a currency not accepted by PayPal, select an accepted currency using the drop down menu below. Buyers on your site will still pay in your local currency however we will convert the currency and send the order through to PayPal using the currency you choose below.', 'wpsc')."</td>
|
462 |
-
</tr
|
463 |
|
464 |
-
|
465 |
-
|
|
|
|
|
466 |
|
467 |
if (!isset($wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list']))
|
468 |
$wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list'] = array();
|
@@ -477,16 +477,20 @@ function form_paypal_pro() {
|
|
477 |
}
|
478 |
$output .= "<option ".$selected_currency." value='{$currency_item['code']}'>{$currency_item['currency']}</option>";
|
479 |
}
|
480 |
-
$output .= "
|
481 |
-
|
482 |
-
$output .= " </tr>\n";
|
483 |
-
}
|
484 |
-
$output .="<tr>
|
485 |
-
<td colspan='2'>
|
486 |
-
<span class='wpscsmall description'>
|
487 |
-
" . sprintf( __( "For more help configuring Paypal Pro, please read our documentation <a href='%s'>here</a>", 'wpsc' ), esc_url( 'http://docs.getshopped.org/wiki/documentation/payments/paypal-payments-pro' ) ) . "</span>
|
488 |
</td>
|
489 |
-
</tr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
return $output;
|
491 |
}
|
492 |
|
47 |
function get_local_currency_code() {
|
48 |
if ( empty( $this->local_currency_code ) ) {
|
49 |
global $wpdb;
|
50 |
+
$this->local_currency_code = $wpdb->get_var( $wpdb->prepare( "SELECT `code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`= %d LIMIT 1", get_option( 'currency_type' ) ) );
|
51 |
}
|
52 |
|
53 |
return $this->local_currency_code;
|
121 |
|
122 |
// Credit Card Data
|
123 |
$data['CREDITCARDTYPE'] = $_POST['cctype'];
|
124 |
+
$data['ACCT'] = str_replace( array( ' ', '-' ), '', $_POST['card_number'] );
|
125 |
$data['EXPDATE'] = $_POST['expiry']['month'] . $_POST['expiry']['year'];
|
126 |
$data['CVV2'] = $_POST['card_code'];
|
127 |
|
438 |
<label for="paypal_pro_testmode">' . __( 'Test Mode Enabled:', 'wpsc' ) . '</label>
|
439 |
</td>
|
440 |
<td>
|
441 |
+
<input type="hidden" name="PayPalPro[testmode]" value="off" />
|
442 |
+
<label for="paypal_pro_testmode"><input type="checkbox" name="PayPalPro[testmode]" id="paypal_pro_testmode" value="on" ' . $selected . ' /> ' . __( 'Test Mode Enabled', 'wpsc') . '</label>
|
443 |
+
<p class=" description">
|
444 |
+
' . sprintf( __( "Only enable test mode if you have a sandbox account with PayPal you can find out more about this <a href='%s'>here</a>", 'wpsc' ), esc_url( 'https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_testing_sandbox' ) ) . '
|
445 |
+
</p>
|
446 |
+
</td>
|
447 |
+
</tr>';
|
|
|
|
|
448 |
|
449 |
$store_currency_code = $wpdb->get_var( $wpdb->prepare( "SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id` IN (%d)", get_option( 'currency_type' ) ) );
|
450 |
$current_currency = get_option('paypal_curcode');
|
457 |
$output .= "<tr> <td colspan='2'><strong class='form_group'>" . __( 'Currency Converter', 'wpsc' ) . "</td> </tr>
|
458 |
<tr>
|
459 |
<td colspan='2'>".__('Your website is using a currency not accepted by PayPal, select an accepted currency using the drop down menu below. Buyers on your site will still pay in your local currency however we will convert the currency and send the order through to PayPal using the currency you choose below.', 'wpsc')."</td>
|
460 |
+
</tr>
|
461 |
|
462 |
+
<tr>
|
463 |
+
<td>" . __('Convert to', 'wpsc' ) . " </td>
|
464 |
+
<td>
|
465 |
+
<select name='paypal_curcode'>\n";
|
466 |
|
467 |
if (!isset($wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list']))
|
468 |
$wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list'] = array();
|
477 |
}
|
478 |
$output .= "<option ".$selected_currency." value='{$currency_item['code']}'>{$currency_item['currency']}</option>";
|
479 |
}
|
480 |
+
$output .= "
|
481 |
+
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
</td>
|
483 |
+
</tr>\n";
|
484 |
+
}
|
485 |
+
|
486 |
+
$output .="
|
487 |
+
<tr>
|
488 |
+
<td colspan='2'>
|
489 |
+
<p class='description'>
|
490 |
+
" . sprintf( __( "For more help configuring Paypal Pro, please read our documentation <a href='%s'>here</a>", 'wpsc' ), esc_url( 'http://docs.getshopped.org/documentation/paypal-payments-pro/' ) ) . "
|
491 |
+
</p>
|
492 |
+
</td>
|
493 |
+
</tr>";
|
494 |
return $output;
|
495 |
}
|
496 |
|
wpsc-merchants/paypal-standard.merchant.php
CHANGED
@@ -52,8 +52,8 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
52 |
var $paypal_ipn_values = array();
|
53 |
|
54 |
function __construct( $purchase_id = null, $is_receiving = false ) {
|
55 |
-
|
56 |
-
|
57 |
}
|
58 |
|
59 |
/**
|
@@ -69,7 +69,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
69 |
$this->rate = 1;
|
70 |
$paypal_currency_code = $this->get_paypal_currency_code();
|
71 |
$local_currency_code = $this->get_local_currency_code();
|
72 |
-
if( $local_currency_code != $paypal_currency_code ) {
|
73 |
$curr=new CURRENCYCONVERTER();
|
74 |
$this->rate = $curr->convert( 1, $paypal_currency_code, $local_currency_code );
|
75 |
}
|
@@ -104,7 +104,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
104 |
* @param boolean $aggregate Whether to aggregate the cart data or not. Defaults to false.
|
105 |
* @return array $paypal_vars The paypal vars
|
106 |
*/
|
107 |
-
function _construct_value_array($aggregate = false) {
|
108 |
global $wpdb, $wpsc_cart;
|
109 |
$paypal_vars = array();
|
110 |
$add_tax = ! wpsc_tax_isincluded();
|
@@ -118,7 +118,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
118 |
|
119 |
// Store settings to be sent to paypal
|
120 |
$paypal_vars += array(
|
121 |
-
'business' => get_option('paypal_multiple_business'),
|
122 |
'return' => $return_url,
|
123 |
'cancel_return' => $this->cart_data['transaction_results_url'],
|
124 |
'rm' => '2',
|
@@ -175,7 +175,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
175 |
// Two cases:
|
176 |
// - We're dealing with a subscription
|
177 |
// - We're dealing with a normal cart
|
178 |
-
if ($this->cart_data['is_subscription']) {
|
179 |
$paypal_vars += array(
|
180 |
'cmd'=> '_xclick-subscriptions',
|
181 |
);
|
@@ -196,17 +196,17 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
196 |
'times_to_rebill' => 1,
|
197 |
);
|
198 |
|
199 |
-
foreach ($this->cart_items as $cart_row) {
|
200 |
-
if ($cart_row['is_recurring']) {
|
201 |
$reprocessed_cart_data['subscription']['is_used'] = true;
|
202 |
$reprocessed_cart_data['subscription']['price'] = $this->convert( $cart_row['price'] );
|
203 |
$reprocessed_cart_data['subscription']['length'] = $cart_row['recurring_data']['rebill_interval']['length'];
|
204 |
-
$reprocessed_cart_data['subscription']['unit'] = strtoupper($cart_row['recurring_data']['rebill_interval']['unit']);
|
205 |
$reprocessed_cart_data['subscription']['times_to_rebill'] = $cart_row['recurring_data']['times_to_rebill'];
|
206 |
} else {
|
207 |
-
$item_cost = ($cart_row['price'] + $cart_row['shipping'] + $cart_row['tax']) * $cart_row['quantity'];
|
208 |
|
209 |
-
if ($item_cost > 0) {
|
210 |
$reprocessed_cart_data['shopping_cart']['price'] += $item_cost;
|
211 |
$reprocessed_cart_data['shopping_cart']['is_used'] = true;
|
212 |
}
|
@@ -220,9 +220,9 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
220 |
);
|
221 |
|
222 |
// This can be false, we don't need to have additional items in the cart/
|
223 |
-
if ($reprocessed_cart_data['shopping_cart']['is_used']) {
|
224 |
$paypal_vars += array(
|
225 |
-
"a1" => $this->convert($reprocessed_cart_data['shopping_cart']['price']),
|
226 |
"p1" => $reprocessed_cart_data['shopping_cart']['length'],
|
227 |
"t1" => $reprocessed_cart_data['shopping_cart']['unit'],
|
228 |
);
|
@@ -230,16 +230,16 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
230 |
|
231 |
// We need at least one subscription product,
|
232 |
// If this is not true, something is rather wrong.
|
233 |
-
if ($reprocessed_cart_data['subscription']['is_used']) {
|
234 |
$paypal_vars += array(
|
235 |
-
"a3" => $this->convert($reprocessed_cart_data['subscription']['price']),
|
236 |
"p3" => $reprocessed_cart_data['subscription']['length'],
|
237 |
"t3" => $reprocessed_cart_data['subscription']['unit'],
|
238 |
);
|
239 |
|
240 |
// If the srt value for the number of times to rebill is not greater than 1,
|
241 |
// paypal won't accept the transaction.
|
242 |
-
if ($reprocessed_cart_data['subscription']['times_to_rebill'] > 1) {
|
243 |
$paypal_vars += array(
|
244 |
'srt' => $reprocessed_cart_data['subscription']['times_to_rebill'],
|
245 |
);
|
@@ -280,15 +280,15 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
280 |
$i = 1;
|
281 |
|
282 |
if ( ! $buy_now ) {
|
283 |
-
if (
|
284 |
-
foreach ($this->cart_items as $cart_row) {
|
285 |
$item_number = get_post_meta( $cart_row['product_id'], '_wpsc_sku', true );
|
286 |
if ( ! $item_number )
|
287 |
$item_number = $cart_row['product_id'];
|
288 |
|
289 |
$paypal_vars += array(
|
290 |
"item_name_$i" => apply_filters( 'the_title', $cart_row['name'] ),
|
291 |
-
"amount_$i" => $this->convert($cart_row['price']),
|
292 |
"quantity_$i" => $cart_row['quantity'],
|
293 |
"item_number_$i" => $item_number,
|
294 |
);
|
@@ -296,9 +296,9 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
296 |
if ( ! $free_shipping )
|
297 |
$paypal_vars += array(
|
298 |
// additional shipping for the the (first item / total of the items)
|
299 |
-
"shipping_$i" => $this->convert($cart_row['shipping']/ $cart_row['quantity'] ),
|
300 |
// additional shipping beyond the first item
|
301 |
-
"shipping2_$i" => $this->convert($cart_row['shipping']/ $cart_row['quantity'] ),
|
302 |
"handling_$i" => '',
|
303 |
);
|
304 |
|
@@ -348,33 +348,33 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
348 |
*/
|
349 |
function submit() {
|
350 |
$name_value_pairs = array();
|
351 |
-
foreach ($this->collected_gateway_data as $key => $value) {
|
352 |
-
$name_value_pairs[] = $key . '=' . urlencode($value);
|
353 |
}
|
354 |
-
$gateway_values =
|
355 |
|
356 |
-
$redirect = get_option('paypal_multiple_url')."?"
|
357 |
// URLs up to 2083 characters long are short enough for an HTTP GET in all browsers.
|
358 |
// Longer URLs require us to send aggregate cart data to PayPal short of losing data.
|
359 |
// An exception is made for recurring transactions, since there isn't much we can do.
|
360 |
-
if (strlen($redirect) > 2083 &&
|
361 |
$name_value_pairs = array();
|
362 |
-
foreach($this->_construct_value_array(true) as $key => $value) {
|
363 |
-
$name_value_pairs[]= $key . '=' . urlencode($value);
|
364 |
}
|
365 |
-
$gateway_values =
|
366 |
|
367 |
-
$redirect = get_option('paypal_multiple_url')."?"
|
368 |
}
|
369 |
|
370 |
-
if (defined('WPSC_ADD_DEBUG_PAGE') && WPSC_ADD_DEBUG_PAGE) {
|
371 |
-
echo "<a href='".esc_url($redirect)."'>Test the URL here</a>";
|
372 |
-
echo "<pre>".print_r($this->collected_gateway_data,true)."</pre>";
|
373 |
exit();
|
374 |
} else {
|
375 |
if ( defined( 'WPSC_PAYPAL_BUY_NOW' ) && WPSC_PAYPAL_BUY_NOW )
|
376 |
wpsc_empty_cart();
|
377 |
-
wp_redirect($redirect);
|
378 |
exit();
|
379 |
}
|
380 |
}
|
@@ -386,22 +386,22 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
386 |
*/
|
387 |
function parse_gateway_notification() {
|
388 |
/// PayPal first expects the IPN variables to be returned to it within 30 seconds, so we do this first.
|
389 |
-
$paypal_url = get_option('paypal_multiple_url');
|
390 |
$received_values = array();
|
391 |
$received_values['cmd'] = '_notify-validate';
|
392 |
-
|
393 |
$options = array(
|
394 |
'timeout' => 20,
|
395 |
'body' => $received_values,
|
396 |
-
'user-agent' => ('WP e-Commerce/'.WPSC_PRESENTABLE_VERSION)
|
397 |
);
|
398 |
|
399 |
-
$response = wp_remote_post($paypal_url, $options);
|
400 |
-
if( 'VERIFIED' == $response['body'] ) {
|
401 |
$this->paypal_ipn_values = $received_values;
|
402 |
$this->session_id = $received_values['invoice'];
|
403 |
} else {
|
404 |
-
exit("IPN Request Failure");
|
405 |
}
|
406 |
}
|
407 |
|
@@ -494,8 +494,8 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
494 |
$paypal_email = strtolower( get_option( 'paypal_multiple_business' ) );
|
495 |
|
496 |
// Compare the received store owner email address to the set one
|
497 |
-
if( strtolower( $this->paypal_ipn_values['receiver_email'] ) == $paypal_email || strtolower( $this->paypal_ipn_values['business'] ) == $paypal_email ) {
|
498 |
-
switch($this->paypal_ipn_values['txn_type']) {
|
499 |
case 'cart':
|
500 |
case 'express_checkout':
|
501 |
case 'web_accept':
|
@@ -507,61 +507,61 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
507 |
if ( $status )
|
508 |
$this->set_transaction_details( $this->paypal_ipn_values['txn_id'], $status );
|
509 |
if ( in_array( $status, array( 2, 3 ) ) )
|
510 |
-
transaction_results($this->cart_data['session_id'],false);
|
511 |
-
|
512 |
|
513 |
case 'subscr_signup':
|
514 |
case 'subscr_payment':
|
515 |
if ( in_array( $status, array( 2, 3 ) ) ) {
|
516 |
$this->set_transaction_details( $this->paypal_ipn_values['subscr_id'], $status );
|
517 |
-
transaction_results($this->cart_data['session_id'],false);
|
518 |
}
|
519 |
-
foreach($this->cart_items as $cart_row) {
|
520 |
-
if($cart_row['is_recurring'] == true) {
|
521 |
do_action('wpsc_activate_subscription', $cart_row['cart_item_id'], $this->paypal_ipn_values['subscr_id']);
|
522 |
do_action('wpsc_activated_subscription', $cart_row['cart_item_id'], $this );
|
523 |
}
|
524 |
}
|
525 |
-
|
526 |
|
527 |
case 'subscr_cancel':
|
528 |
do_action( 'wpsc_paypal_standard_deactivate_subscription', $this->paypal_ipn_values['subscr_id'], $this );
|
529 |
case 'subscr_eot':
|
530 |
case 'subscr_failed':
|
531 |
-
foreach($this->cart_items as $cart_row) {
|
532 |
$altered_count = 0;
|
533 |
-
if((bool)$cart_row['is_recurring'] == true) {
|
534 |
$altered_count++;
|
535 |
-
wpsc_update_cartmeta($cart_row['cart_item_id'], 'is_subscribed', 0);
|
536 |
}
|
537 |
}
|
538 |
-
|
539 |
|
540 |
default:
|
541 |
-
|
542 |
}
|
543 |
}
|
544 |
}
|
545 |
|
546 |
|
547 |
|
548 |
-
function format_price($price, $paypal_currency_code = null) {
|
549 |
-
if (!isset($paypal_currency_code)) {
|
550 |
-
$paypal_currency_code = get_option('paypal_curcode');
|
551 |
}
|
552 |
-
switch($paypal_currency_code) {
|
553 |
case "JPY":
|
554 |
-
|
555 |
-
|
556 |
|
557 |
case "HUF":
|
558 |
-
|
559 |
|
560 |
default:
|
561 |
-
|
562 |
-
|
563 |
}
|
564 |
-
$price = number_format(sprintf("%01.2f"
|
565 |
return $price;
|
566 |
}
|
567 |
}
|
@@ -574,40 +574,42 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
574 |
* @access public
|
575 |
* @return void
|
576 |
*/
|
577 |
-
function submit_paypal_multiple(){
|
578 |
-
|
579 |
-
|
580 |
}
|
581 |
|
582 |
-
|
583 |
-
|
584 |
}
|
585 |
|
586 |
-
|
587 |
-
|
588 |
}
|
589 |
|
590 |
-
|
591 |
-
|
592 |
}
|
593 |
|
594 |
-
|
595 |
-
|
596 |
}
|
597 |
|
598 |
-
|
599 |
-
|
600 |
}
|
601 |
-
|
602 |
-
|
603 |
}
|
604 |
|
605 |
-
|
606 |
-
|
607 |
-
|
|
|
|
|
608 |
}
|
609 |
|
610 |
-
|
611 |
}
|
612 |
|
613 |
|
@@ -620,280 +622,246 @@ function submit_paypal_multiple(){
|
|
620 |
* @return void
|
621 |
*/
|
622 |
function form_paypal_multiple() {
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
|
|
657 |
|
658 |
-
|
659 |
-
</td>
|
660 |
-
</tr>
|
661 |
-
<tr>
|
662 |
-
<td colspan='1'>
|
663 |
-
</td>
|
664 |
-
<td>
|
665 |
-
<span class='wpscsmall description'>
|
666 |
-
" . __( 'If you have a PayPal developers Sandbox account please use Sandbox mode, if you just have a standard PayPal account then you will want to use Live mode.', 'wpsc' ) . "
|
667 |
-
</span>
|
668 |
-
</td>
|
669 |
-
</tr>";
|
670 |
-
|
671 |
-
|
672 |
-
$paypal_ipn = get_option('paypal_ipn');
|
673 |
$paypal_ipn1 = "";
|
674 |
$paypal_ipn2 = "";
|
675 |
-
switch($paypal_ipn) {
|
676 |
case 0:
|
677 |
-
|
678 |
-
|
679 |
|
680 |
case 1:
|
681 |
-
|
682 |
-
|
683 |
}
|
684 |
-
|
|
|
685 |
$paypal_ship1 = "";
|
686 |
$paypal_ship2 = "";
|
687 |
-
switch($paypal_ship){
|
688 |
case 1:
|
689 |
-
|
690 |
-
|
691 |
|
692 |
case 0:
|
693 |
default:
|
694 |
-
|
695 |
-
|
696 |
|
697 |
}
|
698 |
-
|
|
|
699 |
$address_override1 = "";
|
700 |
$address_override2 = "";
|
701 |
-
switch($address_override) {
|
702 |
case 1:
|
703 |
-
|
704 |
-
|
705 |
|
706 |
case 0:
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
}
|
711 |
$output .= "
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
<td style='padding-bottom: 0px;'>
|
747 |
-
<input type='radio' value='1' name='address_override' id='address_override1' ".$address_override1." /> <label for='address_override1'>".__('Yes', 'wpsc')."</label>
|
748 |
-
<input type='radio' value='0' name='address_override' id='address_override2' ".$address_override2." /> <label for='address_override2'>".__('No', 'wpsc')."</label>
|
749 |
-
</td>
|
750 |
-
</tr>
|
751 |
-
<tr>
|
752 |
-
<td colspan='2'>
|
753 |
-
<span class='wpscsmall description'>
|
754 |
-
" . __( "This setting affects your PayPal purchase log. If your customers already have a PayPal account PayPal will try to populate your PayPal Purchase Log with their PayPal address. This setting tries to replace the address in the PayPal purchase log with the Address customers enter on your Checkout page.", 'wpsc' ) . "
|
755 |
-
</span>
|
756 |
-
</td>
|
757 |
-
</tr>\n";
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
$store_currency_data = $wpdb->get_row( $wpdb->prepare( "SELECT `code`, `currency` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id` IN (%d)", get_option( 'currency_type' ) ), ARRAY_A);
|
762 |
$current_currency = get_option('paypal_curcode');
|
763 |
-
if(($current_currency == '') && in_array($store_currency_data['code'], $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list'])) {
|
764 |
-
update_option('paypal_curcode', $store_currency_data['code']);
|
765 |
$current_currency = $store_currency_data['code'];
|
766 |
}
|
767 |
|
768 |
-
if($current_currency != $store_currency_data['code']) {
|
769 |
$output .= "
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
|
|
|
|
|
|
|
|
|
|
784 |
|
785 |
$paypal_currency_list = array_map( 'esc_sql', $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list'] );
|
786 |
|
787 |
-
$currency_list = $wpdb->get_results("SELECT DISTINCT `code`, `currency` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `code` IN ('".implode("','"
|
788 |
|
789 |
-
foreach($currency_list as $currency_item) {
|
790 |
$selected_currency = '';
|
791 |
-
if($current_currency == $currency_item['code']) {
|
792 |
$selected_currency = "selected='selected'";
|
793 |
}
|
794 |
-
$output .= "<option "
|
795 |
}
|
796 |
-
$output .= "
|
797 |
-
|
798 |
-
|
|
|
799 |
}
|
800 |
|
801 |
|
802 |
$output .= "
|
803 |
-
|
804 |
<td colspan='2'>
|
805 |
-
<
|
806 |
-
<input type='submit' value='".__('Update »', 'wpsc')."' name='updateoption'/>
|
807 |
-
</div>
|
808 |
</td>
|
809 |
</tr>
|
810 |
|
811 |
-
<tr
|
812 |
-
<td
|
813 |
-
|
|
|
|
|
|
|
814 |
</td>
|
815 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
816 |
|
817 |
-
|
818 |
-
<td>
|
819 |
-
" . __( 'First Name Field', 'wpsc' ) . "
|
820 |
-
</td>
|
821 |
-
<td>
|
822 |
-
<select name='paypal_form[first_name]'>
|
823 |
-
".nzshpcrt_form_field_list(get_option('paypal_form_first_name'))."
|
824 |
-
</select>
|
825 |
-
</td>
|
826 |
-
</tr>
|
827 |
-
<tr>
|
828 |
-
<td>
|
829 |
-
" . __( 'Last Name Field', 'wpsc' ) . "
|
830 |
-
</td>
|
831 |
-
<td>
|
832 |
-
<select name='paypal_form[last_name]'>
|
833 |
-
".nzshpcrt_form_field_list(get_option('paypal_form_last_name'))."
|
834 |
-
</select>
|
835 |
-
</td>
|
836 |
-
</tr>
|
837 |
-
<tr>
|
838 |
-
<td>
|
839 |
-
" . __( 'Address Field', 'wpsc' ) . "
|
840 |
-
</td>
|
841 |
-
<td>
|
842 |
-
<select name='paypal_form[address]'>
|
843 |
-
".nzshpcrt_form_field_list(get_option('paypal_form_address'))."
|
844 |
-
</select>
|
845 |
-
</td>
|
846 |
-
</tr>
|
847 |
-
<tr>
|
848 |
-
<td>
|
849 |
-
" . __( 'City Field', 'wpsc' ) . "
|
850 |
-
</td>
|
851 |
-
<td>
|
852 |
-
<select name='paypal_form[city]'>
|
853 |
-
".nzshpcrt_form_field_list(get_option('paypal_form_city'))."
|
854 |
-
</select>
|
855 |
-
</td>
|
856 |
-
</tr>
|
857 |
-
<tr>
|
858 |
-
<td>
|
859 |
-
" . __( 'State Field', 'wpsc' ) . "
|
860 |
-
</td>
|
861 |
-
<td>
|
862 |
-
<select name='paypal_form[state]'>
|
863 |
-
".nzshpcrt_form_field_list(get_option('paypal_form_state'))."
|
864 |
-
</select>
|
865 |
-
</td>
|
866 |
-
</tr>
|
867 |
-
<tr>
|
868 |
-
<td>
|
869 |
-
" . __( 'Postal / ZIP Code Field', 'wpsc' ) . "
|
870 |
-
</td>
|
871 |
-
<td>
|
872 |
-
<select name='paypal_form[post_code]'>
|
873 |
-
".nzshpcrt_form_field_list(get_option('paypal_form_post_code'))."
|
874 |
-
</select>
|
875 |
-
</td>
|
876 |
-
</tr>
|
877 |
-
<tr>
|
878 |
-
<td>
|
879 |
-
" . __( 'Country Field', 'wpsc' ) . "
|
880 |
-
</td>
|
881 |
-
<td>
|
882 |
-
<select name='paypal_form[country]'>
|
883 |
-
".nzshpcrt_form_field_list(get_option('paypal_form_country'))."
|
884 |
-
</select>
|
885 |
-
</td>
|
886 |
-
</tr>
|
887 |
-
<tr>
|
888 |
-
<td colspan='2'>
|
889 |
-
<span class='wpscsmall description'>
|
890 |
-
" . sprintf( __( "For more help configuring Paypal Standard, please read our documentation <a href='%s'>here</a>", 'wpsc' ), esc_url( 'http://docs.getshopped.org/wiki/documentation/payments/paypal-payments-standard' ) ) . "</span>
|
891 |
-
</td>
|
892 |
-
</tr>
|
893 |
-
|
894 |
-
";
|
895 |
-
|
896 |
-
return $output;
|
897 |
}
|
898 |
|
899 |
function _wpsc_buy_now_callback() {
|
@@ -923,4 +891,4 @@ function _wpsc_buy_now_transaction_results() {
|
|
923 |
}
|
924 |
|
925 |
if ( isset( $_REQUEST['wpsc_buy_now_return'] ) && $_REQUEST['wpsc_buy_now_return'] )
|
926 |
-
add_action( 'init', '_wpsc_buy_now_transaction_results' );
|
52 |
var $paypal_ipn_values = array();
|
53 |
|
54 |
function __construct( $purchase_id = null, $is_receiving = false ) {
|
55 |
+
$this->name = __( 'PayPal Payments Standard', 'wpsc' );
|
56 |
+
parent::__construct( $purchase_id, $is_receiving );
|
57 |
}
|
58 |
|
59 |
/**
|
69 |
$this->rate = 1;
|
70 |
$paypal_currency_code = $this->get_paypal_currency_code();
|
71 |
$local_currency_code = $this->get_local_currency_code();
|
72 |
+
if ( $local_currency_code != $paypal_currency_code ) {
|
73 |
$curr=new CURRENCYCONVERTER();
|
74 |
$this->rate = $curr->convert( 1, $paypal_currency_code, $local_currency_code );
|
75 |
}
|
104 |
* @param boolean $aggregate Whether to aggregate the cart data or not. Defaults to false.
|
105 |
* @return array $paypal_vars The paypal vars
|
106 |
*/
|
107 |
+
function _construct_value_array( $aggregate = false ) {
|
108 |
global $wpdb, $wpsc_cart;
|
109 |
$paypal_vars = array();
|
110 |
$add_tax = ! wpsc_tax_isincluded();
|
118 |
|
119 |
// Store settings to be sent to paypal
|
120 |
$paypal_vars += array(
|
121 |
+
'business' => get_option( 'paypal_multiple_business' ),
|
122 |
'return' => $return_url,
|
123 |
'cancel_return' => $this->cart_data['transaction_results_url'],
|
124 |
'rm' => '2',
|
175 |
// Two cases:
|
176 |
// - We're dealing with a subscription
|
177 |
// - We're dealing with a normal cart
|
178 |
+
if ( $this->cart_data['is_subscription'] ) {
|
179 |
$paypal_vars += array(
|
180 |
'cmd'=> '_xclick-subscriptions',
|
181 |
);
|
196 |
'times_to_rebill' => 1,
|
197 |
);
|
198 |
|
199 |
+
foreach ( $this->cart_items as $cart_row ) {
|
200 |
+
if ( $cart_row['is_recurring'] ) {
|
201 |
$reprocessed_cart_data['subscription']['is_used'] = true;
|
202 |
$reprocessed_cart_data['subscription']['price'] = $this->convert( $cart_row['price'] );
|
203 |
$reprocessed_cart_data['subscription']['length'] = $cart_row['recurring_data']['rebill_interval']['length'];
|
204 |
+
$reprocessed_cart_data['subscription']['unit'] = strtoupper( $cart_row['recurring_data']['rebill_interval']['unit'] );
|
205 |
$reprocessed_cart_data['subscription']['times_to_rebill'] = $cart_row['recurring_data']['times_to_rebill'];
|
206 |
} else {
|
207 |
+
$item_cost = ( $cart_row['price'] + $cart_row['shipping'] + $cart_row['tax'] ) * $cart_row['quantity'];
|
208 |
|
209 |
+
if ( $item_cost > 0 ) {
|
210 |
$reprocessed_cart_data['shopping_cart']['price'] += $item_cost;
|
211 |
$reprocessed_cart_data['shopping_cart']['is_used'] = true;
|
212 |
}
|
220 |
);
|
221 |
|
222 |
// This can be false, we don't need to have additional items in the cart/
|
223 |
+
if ( $reprocessed_cart_data['shopping_cart']['is_used'] ) {
|
224 |
$paypal_vars += array(
|
225 |
+
"a1" => $this->convert( $reprocessed_cart_data['shopping_cart']['price'] ),
|
226 |
"p1" => $reprocessed_cart_data['shopping_cart']['length'],
|
227 |
"t1" => $reprocessed_cart_data['shopping_cart']['unit'],
|
228 |
);
|
230 |
|
231 |
// We need at least one subscription product,
|
232 |
// If this is not true, something is rather wrong.
|
233 |
+
if ( $reprocessed_cart_data['subscription']['is_used'] ) {
|
234 |
$paypal_vars += array(
|
235 |
+
"a3" => $this->convert( $reprocessed_cart_data['subscription']['price'] ),
|
236 |
"p3" => $reprocessed_cart_data['subscription']['length'],
|
237 |
"t3" => $reprocessed_cart_data['subscription']['unit'],
|
238 |
);
|
239 |
|
240 |
// If the srt value for the number of times to rebill is not greater than 1,
|
241 |
// paypal won't accept the transaction.
|
242 |
+
if ( $reprocessed_cart_data['subscription']['times_to_rebill'] > 1 ) {
|
243 |
$paypal_vars += array(
|
244 |
'srt' => $reprocessed_cart_data['subscription']['times_to_rebill'],
|
245 |
);
|
280 |
$i = 1;
|
281 |
|
282 |
if ( ! $buy_now ) {
|
283 |
+
if ( ! $aggregate ) {
|
284 |
+
foreach ( $this->cart_items as $cart_row ) {
|
285 |
$item_number = get_post_meta( $cart_row['product_id'], '_wpsc_sku', true );
|
286 |
if ( ! $item_number )
|
287 |
$item_number = $cart_row['product_id'];
|
288 |
|
289 |
$paypal_vars += array(
|
290 |
"item_name_$i" => apply_filters( 'the_title', $cart_row['name'] ),
|
291 |
+
"amount_$i" => $this->convert( $cart_row['price'] ),
|
292 |
"quantity_$i" => $cart_row['quantity'],
|
293 |
"item_number_$i" => $item_number,
|
294 |
);
|
296 |
if ( ! $free_shipping )
|
297 |
$paypal_vars += array(
|
298 |
// additional shipping for the the (first item / total of the items)
|
299 |
+
"shipping_$i" => $this->convert( $cart_row['shipping'] / $cart_row['quantity'] ),
|
300 |
// additional shipping beyond the first item
|
301 |
+
"shipping2_$i" => $this->convert( $cart_row['shipping'] / $cart_row['quantity'] ),
|
302 |
"handling_$i" => '',
|
303 |
);
|
304 |
|
348 |
*/
|
349 |
function submit() {
|
350 |
$name_value_pairs = array();
|
351 |
+
foreach ( $this->collected_gateway_data as $key => $value ) {
|
352 |
+
$name_value_pairs[] = $key . '=' . urlencode( $value );
|
353 |
}
|
354 |
+
$gateway_values = implode( '&', $name_value_pairs );
|
355 |
|
356 |
+
$redirect = get_option( 'paypal_multiple_url' ) . "?" . $gateway_values;
|
357 |
// URLs up to 2083 characters long are short enough for an HTTP GET in all browsers.
|
358 |
// Longer URLs require us to send aggregate cart data to PayPal short of losing data.
|
359 |
// An exception is made for recurring transactions, since there isn't much we can do.
|
360 |
+
if ( strlen( $redirect ) > 2083 && ! $this->cart_data['is_subscription'] ) {
|
361 |
$name_value_pairs = array();
|
362 |
+
foreach( $this->_construct_value_array( true ) as $key => $value ) {
|
363 |
+
$name_value_pairs[]= $key . '=' . urlencode( $value );
|
364 |
}
|
365 |
+
$gateway_values = implode( '&', $name_value_pairs );
|
366 |
|
367 |
+
$redirect = get_option( 'paypal_multiple_url' ) . "?" . $gateway_values;
|
368 |
}
|
369 |
|
370 |
+
if ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && WPSC_ADD_DEBUG_PAGE ) {
|
371 |
+
echo "<a href='" . esc_url( $redirect ) . "'>" . __( "Test the URL here", 'wpsc' ) . "</a>";
|
372 |
+
echo "<pre>" . print_r( $this->collected_gateway_data, true ) . "</pre>";
|
373 |
exit();
|
374 |
} else {
|
375 |
if ( defined( 'WPSC_PAYPAL_BUY_NOW' ) && WPSC_PAYPAL_BUY_NOW )
|
376 |
wpsc_empty_cart();
|
377 |
+
wp_redirect( $redirect );
|
378 |
exit();
|
379 |
}
|
380 |
}
|
386 |
*/
|
387 |
function parse_gateway_notification() {
|
388 |
/// PayPal first expects the IPN variables to be returned to it within 30 seconds, so we do this first.
|
389 |
+
$paypal_url = get_option( 'paypal_multiple_url' );
|
390 |
$received_values = array();
|
391 |
$received_values['cmd'] = '_notify-validate';
|
392 |
+
$received_values += stripslashes_deep( $_REQUEST );
|
393 |
$options = array(
|
394 |
'timeout' => 20,
|
395 |
'body' => $received_values,
|
396 |
+
'user-agent' => ( 'WP e-Commerce/' . WPSC_PRESENTABLE_VERSION )
|
397 |
);
|
398 |
|
399 |
+
$response = wp_remote_post( $paypal_url, $options );
|
400 |
+
if ( 'VERIFIED' == $response['body'] ) {
|
401 |
$this->paypal_ipn_values = $received_values;
|
402 |
$this->session_id = $received_values['invoice'];
|
403 |
} else {
|
404 |
+
exit( "IPN Request Failure" );
|
405 |
}
|
406 |
}
|
407 |
|
494 |
$paypal_email = strtolower( get_option( 'paypal_multiple_business' ) );
|
495 |
|
496 |
// Compare the received store owner email address to the set one
|
497 |
+
if ( strtolower( $this->paypal_ipn_values['receiver_email'] ) == $paypal_email || strtolower( $this->paypal_ipn_values['business'] ) == $paypal_email ) {
|
498 |
+
switch ($this->paypal_ipn_values['txn_type']) {
|
499 |
case 'cart':
|
500 |
case 'express_checkout':
|
501 |
case 'web_accept':
|
507 |
if ( $status )
|
508 |
$this->set_transaction_details( $this->paypal_ipn_values['txn_id'], $status );
|
509 |
if ( in_array( $status, array( 2, 3 ) ) )
|
510 |
+
transaction_results( $this->cart_data['session_id'], false );
|
511 |
+
break;
|
512 |
|
513 |
case 'subscr_signup':
|
514 |
case 'subscr_payment':
|
515 |
if ( in_array( $status, array( 2, 3 ) ) ) {
|
516 |
$this->set_transaction_details( $this->paypal_ipn_values['subscr_id'], $status );
|
517 |
+
transaction_results( $this->cart_data['session_id'], false );
|
518 |
}
|
519 |
+
foreach ( $this->cart_items as $cart_row ) {
|
520 |
+
if ( $cart_row['is_recurring'] == true ) {
|
521 |
do_action('wpsc_activate_subscription', $cart_row['cart_item_id'], $this->paypal_ipn_values['subscr_id']);
|
522 |
do_action('wpsc_activated_subscription', $cart_row['cart_item_id'], $this );
|
523 |
}
|
524 |
}
|
525 |
+
break;
|
526 |
|
527 |
case 'subscr_cancel':
|
528 |
do_action( 'wpsc_paypal_standard_deactivate_subscription', $this->paypal_ipn_values['subscr_id'], $this );
|
529 |
case 'subscr_eot':
|
530 |
case 'subscr_failed':
|
531 |
+
foreach ( $this->cart_items as $cart_row ) {
|
532 |
$altered_count = 0;
|
533 |
+
if ( (bool)$cart_row['is_recurring'] == true ) {
|
534 |
$altered_count++;
|
535 |
+
wpsc_update_cartmeta( $cart_row['cart_item_id'], 'is_subscribed', 0 );
|
536 |
}
|
537 |
}
|
538 |
+
break;
|
539 |
|
540 |
default:
|
541 |
+
break;
|
542 |
}
|
543 |
}
|
544 |
}
|
545 |
|
546 |
|
547 |
|
548 |
+
function format_price( $price, $paypal_currency_code = null ) {
|
549 |
+
if ( ! isset( $paypal_currency_code ) ) {
|
550 |
+
$paypal_currency_code = get_option( 'paypal_curcode' );
|
551 |
}
|
552 |
+
switch( $paypal_currency_code ) {
|
553 |
case "JPY":
|
554 |
+
$decimal_places = 0;
|
555 |
+
break;
|
556 |
|
557 |
case "HUF":
|
558 |
+
$decimal_places = 0;
|
559 |
|
560 |
default:
|
561 |
+
$decimal_places = 2;
|
562 |
+
break;
|
563 |
}
|
564 |
+
$price = number_format( sprintf( "%01.2f", $price ), $decimal_places, '.', '' );
|
565 |
return $price;
|
566 |
}
|
567 |
}
|
574 |
* @access public
|
575 |
* @return void
|
576 |
*/
|
577 |
+
function submit_paypal_multiple (){
|
578 |
+
if ( isset ( $_POST['paypal_multiple_business'] ) ) {
|
579 |
+
update_option( 'paypal_multiple_business', $_POST['paypal_multiple_business'] );
|
580 |
}
|
581 |
|
582 |
+
if ( isset ( $_POST['paypal_multiple_url'] ) ) {
|
583 |
+
update_option( 'paypal_multiple_url', $_POST['paypal_multiple_url'] );
|
584 |
}
|
585 |
|
586 |
+
if ( isset ( $_POST['paypal_curcode'] ) ) {
|
587 |
+
update_option( 'paypal_curcode', $_POST['paypal_curcode'] );
|
588 |
}
|
589 |
|
590 |
+
if ( isset ( $_POST['paypal_curcode'] ) ) {
|
591 |
+
update_option( 'paypal_curcode', $_POST['paypal_curcode'] );
|
592 |
}
|
593 |
|
594 |
+
if ( isset ( $_POST['paypal_ipn'] ) ) {
|
595 |
+
update_option( 'paypal_ipn', (int)$_POST['paypal_ipn'] );
|
596 |
}
|
597 |
|
598 |
+
if ( isset ( $_POST['address_override'] ) ) {
|
599 |
+
update_option( 'address_override', (int)$_POST['address_override'] );
|
600 |
}
|
601 |
+
if ( isset ( $_POST['paypal_ship'] ) ) {
|
602 |
+
update_option( 'paypal_ship', (int)$_POST['paypal_ship'] );
|
603 |
}
|
604 |
|
605 |
+
if ( ! isset( $_POST['paypal_form'] ) )
|
606 |
+
$_POST['paypal_form'] = array();
|
607 |
+
|
608 |
+
foreach( (array)$_POST['paypal_form'] as $form => $value ) {
|
609 |
+
update_option( ( 'paypal_form_' . $form ), $value );
|
610 |
}
|
611 |
|
612 |
+
return true;
|
613 |
}
|
614 |
|
615 |
|
622 |
* @return void
|
623 |
*/
|
624 |
function form_paypal_multiple() {
|
625 |
+
global $wpdb, $wpsc_gateways;
|
626 |
+
|
627 |
+
$account_type = get_option( 'paypal_multiple_url' );
|
628 |
+
$account_types = array(
|
629 |
+
'https://www.paypal.com/cgi-bin/webscr' => __( 'Live Account', 'wpsc' ),
|
630 |
+
'https://www.sandbox.paypal.com/cgi-bin/webscr' => __( 'Sandbox Account', 'wpsc' ),
|
631 |
+
);
|
632 |
+
|
633 |
+
$output = "
|
634 |
+
<tr>
|
635 |
+
<td>" . __( 'Username:', 'wpsc' ) . "</td>
|
636 |
+
<td>
|
637 |
+
<input type='text' size='40' value='" . get_option( 'paypal_multiple_business') . "' name='paypal_multiple_business' />
|
638 |
+
<p class='description'>
|
639 |
+
" . __( 'This is your PayPal email address.', 'wpsc' ) . "
|
640 |
+
</p>
|
641 |
+
</td>
|
642 |
+
</tr>
|
643 |
+
|
644 |
+
<tr>
|
645 |
+
<td>" . __( 'Account Type:', 'wpsc' ) . "</td>
|
646 |
+
<td>
|
647 |
+
<select name='paypal_multiple_url'>\n";
|
648 |
+
|
649 |
+
foreach ( $account_types as $url => $label ) {
|
650 |
+
$output .= "<option value='{$url}' ". selected( $url, $account_type, false ) . ">" . esc_html( $label ) . "</option>";
|
651 |
+
}
|
652 |
+
|
653 |
+
$output .= "
|
654 |
+
</select>
|
655 |
+
<p class='description'>
|
656 |
+
" . __( 'If you have a PayPal developers Sandbox account please use Sandbox mode, if you just have a standard PayPal account then you will want to use Live mode.', 'wpsc' ) . "
|
657 |
+
</p>
|
658 |
+
</td>
|
659 |
+
</tr>\n";
|
660 |
|
661 |
+
$paypal_ipn = get_option( 'paypal_ipn' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
662 |
$paypal_ipn1 = "";
|
663 |
$paypal_ipn2 = "";
|
664 |
+
switch( $paypal_ipn ) {
|
665 |
case 0:
|
666 |
+
$paypal_ipn2 = "checked='checked'";
|
667 |
+
break;
|
668 |
|
669 |
case 1:
|
670 |
+
$paypal_ipn1 = "checked='checked'";
|
671 |
+
break;
|
672 |
}
|
673 |
+
|
674 |
+
$paypal_ship = get_option( 'paypal_ship' );
|
675 |
$paypal_ship1 = "";
|
676 |
$paypal_ship2 = "";
|
677 |
+
switch( $paypal_ship ){
|
678 |
case 1:
|
679 |
+
$paypal_ship1 = "checked='checked'";
|
680 |
+
break;
|
681 |
|
682 |
case 0:
|
683 |
default:
|
684 |
+
$paypal_ship2 = "checked='checked'";
|
685 |
+
break;
|
686 |
|
687 |
}
|
688 |
+
|
689 |
+
$address_override = get_option( 'address_override' );
|
690 |
$address_override1 = "";
|
691 |
$address_override2 = "";
|
692 |
+
switch( $address_override ) {
|
693 |
case 1:
|
694 |
+
$address_override1 = "checked='checked'";
|
695 |
+
break;
|
696 |
|
697 |
case 0:
|
698 |
+
default:
|
699 |
+
$address_override2 = "checked='checked'";
|
700 |
+
break;
|
701 |
}
|
702 |
$output .= "
|
703 |
+
<tr>
|
704 |
+
<td>" . __( "IPN", 'wpsc' ) . ":</td>
|
705 |
+
<td>
|
706 |
+
<input type='radio' value='1' name='paypal_ipn' id='paypal_ipn1' " . $paypal_ipn1 . " /> <label for='paypal_ipn1'>" . __( 'Yes', 'wpsc' ) . "</label>
|
707 |
+
<input type='radio' value='0' name='paypal_ipn' id='paypal_ipn2' " . $paypal_ipn2 . " /> <label for='paypal_ipn2'>" . __( 'No', 'wpsc' ) . "</label>
|
708 |
+
<p class='description'>
|
709 |
+
" . __( "IPN (instant payment notification) will automatically update your sales logs to 'Accepted payment' when a customers payment is successful. For IPN to work you also need to have IPN turned on in your Paypal settings. If it is not turned on, the sales sill remain as 'Order Pending' status until manually changed. It is highly recommend using IPN, especially if you are selling digital products.", 'wpsc' ) . "
|
710 |
+
</p>
|
711 |
+
</td>
|
712 |
+
</tr>
|
713 |
+
<tr>
|
714 |
+
<td style='padding-bottom: 0px;'>" . __( "Send shipping details", 'wpsc' ) . "</td>
|
715 |
+
<td style='padding-bottom: 0px;'>
|
716 |
+
<input type='radio' value='1' name='paypal_ship' id='paypal_ship1' " . $paypal_ship1 . " /> <label for='paypal_ship1'>" . __( 'Yes', 'wpsc' ) . "</label>
|
717 |
+
<input type='radio' value='0' name='paypal_ship' id='paypal_ship2' " . $paypal_ship2 . " /> <label for='paypal_ship2'>" . __( 'No', 'wpsc' ) . "</label>
|
718 |
+
<p class='description'>
|
719 |
+
" . __( "Note: If your checkout page does not have a shipping details section, or if you don't want to send Paypal shipping information. You should change Send shipping details option to No.", 'wpsc' ) . "
|
720 |
+
</p>
|
721 |
+
</td>
|
722 |
+
</tr>
|
723 |
+
<tr>
|
724 |
+
<td>
|
725 |
+
" . __( 'Address Override:', 'wpsc' ) . "
|
726 |
+
</td>
|
727 |
+
<td>
|
728 |
+
<input type='radio' value='1' name='address_override' id='address_override1' " . $address_override1 . " /> <label for='address_override1'>" . __( 'Yes', 'wpsc' ) . "</label>
|
729 |
+
<input type='radio' value='0' name='address_override' id='address_override2' " . $address_override2 . " /> <label for='address_override2'>" . __( 'No', 'wpsc' ) . "</label>
|
730 |
+
<p class='description'>
|
731 |
+
" . __( "This setting affects your PayPal purchase log. If your customers already have a PayPal account PayPal will try to populate your PayPal Purchase Log with their PayPal address. This setting tries to replace the address in the PayPal purchase log with the Address customers enter on your Checkout page.", 'wpsc' ) . "
|
732 |
+
</p>
|
733 |
+
</td>
|
734 |
+
</tr>\n";
|
735 |
+
|
736 |
+
$store_currency_data = $wpdb->get_row( $wpdb->prepare( "SELECT `code`, `currency` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id` IN (%d)", get_option( 'currency_type' ) ), ARRAY_A );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
$current_currency = get_option('paypal_curcode');
|
738 |
+
if ( ( $current_currency == '' ) && in_array( $store_currency_data['code'], $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list'] ) ) {
|
739 |
+
update_option( 'paypal_curcode', $store_currency_data['code'] );
|
740 |
$current_currency = $store_currency_data['code'];
|
741 |
}
|
742 |
|
743 |
+
if ( $current_currency != $store_currency_data['code'] ) {
|
744 |
$output .= "
|
745 |
+
<tr>
|
746 |
+
<td>
|
747 |
+
</td>
|
748 |
+
<td><strong class='form_group'>" . __( 'Currency Converter', 'wpsc' ) . "</td>
|
749 |
+
</tr>
|
750 |
+
<tr>
|
751 |
+
<td>
|
752 |
+
</td>
|
753 |
+
<td>
|
754 |
+
".sprintf( __( 'Your website uses <strong>%s</strong>. This currency is not supported by PayPal, please select a currency using the drop down menu below. Buyers on your site will still pay in your local currency however we will send the order through to Paypal using the currency you choose below.', 'wpsc' ), $store_currency_data['currency'] )."
|
755 |
+
</td>
|
756 |
+
</tr>
|
757 |
+
|
758 |
+
<tr>
|
759 |
+
<td>
|
760 |
+
" . __( 'Select Currency:', 'wpsc' ) . "
|
761 |
+
</td>
|
762 |
+
<td>
|
763 |
+
<select name='paypal_curcode'>\n";
|
764 |
|
765 |
$paypal_currency_list = array_map( 'esc_sql', $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list'] );
|
766 |
|
767 |
+
$currency_list = $wpdb->get_results( "SELECT DISTINCT `code`, `currency` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `code` IN ('" . implode( "','", $paypal_currency_list ) . "')", ARRAY_A );
|
768 |
|
769 |
+
foreach ( $currency_list as $currency_item ) {
|
770 |
$selected_currency = '';
|
771 |
+
if ( $current_currency == $currency_item['code'] ) {
|
772 |
$selected_currency = "selected='selected'";
|
773 |
}
|
774 |
+
$output .= "<option " . $selected_currency . " value='{$currency_item['code']}'>{$currency_item['currency']}</option>";
|
775 |
}
|
776 |
+
$output .= "
|
777 |
+
</select>
|
778 |
+
</td>
|
779 |
+
</tr>\n";
|
780 |
}
|
781 |
|
782 |
|
783 |
$output .= "
|
784 |
+
<tr>
|
785 |
<td colspan='2'>
|
786 |
+
<strong class='form_group'>" . __( 'Forms Sent to Gateway', 'wpsc' ) . "</strong>
|
|
|
|
|
787 |
</td>
|
788 |
</tr>
|
789 |
|
790 |
+
<tr>
|
791 |
+
<td>" . __( 'First Name Field', 'wpsc' ) . "</td>
|
792 |
+
<td>
|
793 |
+
<select name='paypal_form[first_name]'>
|
794 |
+
" . nzshpcrt_form_field_list( get_option( 'paypal_form_first_name' ) ) . "
|
795 |
+
</select>
|
796 |
</td>
|
797 |
</tr>
|
798 |
+
<tr>
|
799 |
+
<td>" . __( 'Last Name Field', 'wpsc' ) . "</td>
|
800 |
+
<td>
|
801 |
+
<select name='paypal_form[last_name]'>
|
802 |
+
" . nzshpcrt_form_field_list( get_option( 'paypal_form_last_name' ) ) . "
|
803 |
+
</select>
|
804 |
+
</td>
|
805 |
+
</tr>
|
806 |
+
<tr>
|
807 |
+
<td>
|
808 |
+
" . __( 'Address Field', 'wpsc' ) . "
|
809 |
+
</td>
|
810 |
+
<td>
|
811 |
+
<select name='paypal_form[address]'>
|
812 |
+
" . nzshpcrt_form_field_list( get_option( 'paypal_form_address' ) ) . "
|
813 |
+
</select>
|
814 |
+
</td>
|
815 |
+
</tr>
|
816 |
+
<tr>
|
817 |
+
<td>
|
818 |
+
" . __( 'City Field', 'wpsc' ) . "
|
819 |
+
</td>
|
820 |
+
<td>
|
821 |
+
<select name='paypal_form[city]'>
|
822 |
+
" . nzshpcrt_form_field_list( get_option( 'paypal_form_city' ) ) . "
|
823 |
+
</select>
|
824 |
+
</td>
|
825 |
+
</tr>
|
826 |
+
<tr>
|
827 |
+
<td>
|
828 |
+
" . __( 'State Field', 'wpsc' ) . "
|
829 |
+
</td>
|
830 |
+
<td>
|
831 |
+
<select name='paypal_form[state]'>
|
832 |
+
" . nzshpcrt_form_field_list( get_option( 'paypal_form_state' ) ) . "
|
833 |
+
</select>
|
834 |
+
</td>
|
835 |
+
</tr>
|
836 |
+
<tr>
|
837 |
+
<td>
|
838 |
+
" . __( 'Postal / ZIP Code Field', 'wpsc' ) . "
|
839 |
+
</td>
|
840 |
+
<td>
|
841 |
+
<select name='paypal_form[post_code]'>
|
842 |
+
".nzshpcrt_form_field_list(get_option('paypal_form_post_code'))."
|
843 |
+
</select>
|
844 |
+
</td>
|
845 |
+
</tr>
|
846 |
+
<tr>
|
847 |
+
<td>
|
848 |
+
" . __( 'Country Field', 'wpsc' ) . "
|
849 |
+
</td>
|
850 |
+
<td>
|
851 |
+
<select name='paypal_form[country]'>
|
852 |
+
" . nzshpcrt_form_field_list( get_option( 'paypal_form_country' ) ) . "
|
853 |
+
</select>
|
854 |
+
</td>
|
855 |
+
</tr>
|
856 |
+
<tr>
|
857 |
+
<td colspan='2'>
|
858 |
+
<p class='description'>
|
859 |
+
" . sprintf( __( "For more help configuring Paypal Standard, please read our documentation <a href='%s'>here</a>", 'wpsc' ), esc_url( 'http://docs.getshopped.org/documentation/paypal-payments-standard/' ) ) . "
|
860 |
+
</p>
|
861 |
+
</td>
|
862 |
+
</tr>\n";
|
863 |
|
864 |
+
return $output;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
865 |
}
|
866 |
|
867 |
function _wpsc_buy_now_callback() {
|
891 |
}
|
892 |
|
893 |
if ( isset( $_REQUEST['wpsc_buy_now_return'] ) && $_REQUEST['wpsc_buy_now_return'] )
|
894 |
+
add_action( 'init', '_wpsc_buy_now_transaction_results' );
|
wpsc-merchants/testmode.merchant.php
CHANGED
@@ -46,15 +46,19 @@ class wpsc_merchant_testmode extends wpsc_merchant {
|
|
46 |
}
|
47 |
|
48 |
function form_testmode() {
|
49 |
-
$output = "
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
58 |
return $output;
|
59 |
}
|
60 |
|
46 |
}
|
47 |
|
48 |
function form_testmode() {
|
49 |
+
$output = "
|
50 |
+
<tr>
|
51 |
+
<td>
|
52 |
+
" . __( 'Payment Instructions', 'wpsc' ) . "
|
53 |
+
</td>
|
54 |
+
<td>
|
55 |
+
".__('Enter the payment instructions that you wish to display to your customers when they make a purchase', 'wpsc')."
|
56 |
+
<textarea cols='40' rows='9' name='wpsc_options[payment_instructions]'>" . esc_textarea( get_option( 'payment_instructions' ) ) . "</textarea><br />
|
57 |
+
<p class='description'>
|
58 |
+
".__('For example, this is where you the Shop Owner might enter your bank account details or address so that your customer can make their manual payment.', 'wpsc')."
|
59 |
+
</p>
|
60 |
+
</td>
|
61 |
+
</tr>\n";
|
62 |
return $output;
|
63 |
}
|
64 |
|
wpsc-shipping/australiapost.php
CHANGED
@@ -339,7 +339,7 @@ class australiapost {
|
|
339 |
}
|
340 |
}
|
341 |
if ( $this->debug && strlen($log) )
|
342 |
-
error_log( 'WP e-Commerce Australia Post shipping quotes for ' .
|
343 |
|
344 |
// Allow another WordPress plugin to override the quoted method(s)/amount(s)
|
345 |
|
339 |
}
|
340 |
}
|
341 |
if ( $this->debug && strlen($log) )
|
342 |
+
error_log( 'WP e-Commerce Australia Post shipping quotes for ' . home_url() . ":\n----------\n$log----------" );
|
343 |
|
344 |
// Allow another WordPress plugin to override the quoted method(s)/amount(s)
|
345 |
|
wpsc-shipping/ups_20.php
CHANGED
@@ -223,7 +223,7 @@ class ash_ups {
|
|
223 |
</tr>
|
224 |
");
|
225 |
$insured_shipment = "";
|
226 |
-
if ($wpsc_ups_settings['insured_shipment'] == "1"){
|
227 |
$insured_shipment = "checked=\"checked\"";
|
228 |
}
|
229 |
$output .= ("
|
@@ -235,7 +235,7 @@ class ash_ups {
|
|
235 |
</tr>
|
236 |
");
|
237 |
$singular_shipping = "";
|
238 |
-
if ($wpsc_ups_settings['singular_shipping'] == "1"){
|
239 |
$singular_shipping = "checked=\"checked\"";
|
240 |
}
|
241 |
$output .= ("
|
@@ -616,7 +616,7 @@ class ash_ups {
|
|
616 |
private function _parseQuote($raw){
|
617 |
global $wpdb;
|
618 |
|
619 |
-
$config = get_option('wpsc_ups_settings');
|
620 |
$debug = (array_key_exists('upsenvironment', $config)) ? $config['upsenvironment'] : "";
|
621 |
|
622 |
$rate_table = array();
|
@@ -850,7 +850,7 @@ class ash_ups {
|
|
850 |
|
851 |
if (!(boolean)$args["singular_shipping"]){
|
852 |
// This is where shipping breaks out of UPS if weight is higher than 150 LBS
|
853 |
-
if($weight > 150){
|
854 |
wpsc_delete_customer_meta( 'quote_shipping_method' );
|
855 |
$shipping_quotes[TXT_WPSC_OVER_UPS_WEIGHT] = 0;
|
856 |
$session_cache_check['weight'] = $args['weight'];
|
@@ -896,9 +896,7 @@ class ash_ups {
|
|
896 |
}
|
897 |
}
|
898 |
|
899 |
-
$wpec_ash->cache_results($this->internal_name,
|
900 |
-
$args["dest_ccode"], $args["dest_state"],
|
901 |
-
$args["dest_pcode"], $rate_table, $this->shipment);
|
902 |
|
903 |
// return the final formatted array !
|
904 |
return $rate_table;
|
223 |
</tr>
|
224 |
");
|
225 |
$insured_shipment = "";
|
226 |
+
if ( isset( $wpsc_ups_settings['insured_shipment'] ) && $wpsc_ups_settings['insured_shipment'] == "1"){
|
227 |
$insured_shipment = "checked=\"checked\"";
|
228 |
}
|
229 |
$output .= ("
|
235 |
</tr>
|
236 |
");
|
237 |
$singular_shipping = "";
|
238 |
+
if ( isset( $wpsc_ups_settings['singular_shipping'] ) && $wpsc_ups_settings['singular_shipping'] == "1"){
|
239 |
$singular_shipping = "checked=\"checked\"";
|
240 |
}
|
241 |
$output .= ("
|
616 |
private function _parseQuote($raw){
|
617 |
global $wpdb;
|
618 |
|
619 |
+
$config = get_option( 'wpsc_ups_settings', array() );
|
620 |
$debug = (array_key_exists('upsenvironment', $config)) ? $config['upsenvironment'] : "";
|
621 |
|
622 |
$rate_table = array();
|
850 |
|
851 |
if (!(boolean)$args["singular_shipping"]){
|
852 |
// This is where shipping breaks out of UPS if weight is higher than 150 LBS
|
853 |
+
if ( $args['weight'] > 150){
|
854 |
wpsc_delete_customer_meta( 'quote_shipping_method' );
|
855 |
$shipping_quotes[TXT_WPSC_OVER_UPS_WEIGHT] = 0;
|
856 |
$session_cache_check['weight'] = $args['weight'];
|
896 |
}
|
897 |
}
|
898 |
|
899 |
+
$wpec_ash->cache_results($this->internal_name, $rate_table, $this->shipment);
|
|
|
|
|
900 |
|
901 |
// return the final formatted array !
|
902 |
return $rate_table;
|
wpsc-shipping/usps_20.php
CHANGED
@@ -160,7 +160,7 @@ class ash_usps{
|
|
160 |
}
|
161 |
|
162 |
$env = "prod";
|
163 |
-
if((
|
164 |
$env = "test";
|
165 |
}
|
166 |
|
@@ -607,7 +607,7 @@ class ash_usps{
|
|
607 |
$temp_rate = $wpec_ash_xml->get("Rate",$postage);
|
608 |
$rate = (!empty($temp_rate)) ? $temp_rate[0] : 0.0;
|
609 |
if (!empty($service_name)){
|
610 |
-
$temp[$service_name] = $rate;
|
611 |
}
|
612 |
}
|
613 |
array_push($package_services, $temp);
|
@@ -636,8 +636,8 @@ class ash_usps{
|
|
636 |
$service_name = $this->_get_service("SvcDescription",$service);
|
637 |
$temp_rate = $wpec_ash_xml->get("Postage",$service);
|
638 |
$rate = (!empty($temp_rate)) ? $temp_rate[0] : 0.0;
|
639 |
-
if (!empty($
|
640 |
-
$service_table[$service_name] = $rate;
|
641 |
}
|
642 |
}
|
643 |
return $service_table;
|
@@ -913,7 +913,7 @@ class ash_usps{
|
|
913 |
$wpec_ash = new ASH();
|
914 |
}
|
915 |
if (!is_object($wpec_ash_tools)){
|
916 |
-
$
|
917 |
}
|
918 |
|
919 |
$this->shipment = $wpec_ash->get_shipment();
|
@@ -928,7 +928,7 @@ class ash_usps{
|
|
928 |
$data = array();
|
929 |
//*** WPEC Configuration values ***\\
|
930 |
$settings = get_option("wpec_usps");
|
931 |
-
$this->
|
932 |
$data["fcl_type"] = (!empty($settings["fcl_type"])) ? $settings["fcl_type"] : "PARCEL";
|
933 |
$data["mail_type"] = (!empty($settings["intl_pkg"])) ? $settings["intl_pkg"] : "Package";
|
934 |
$data["base_zipcode"] = get_option("base_zipcode");
|
160 |
}
|
161 |
|
162 |
$env = "prod";
|
163 |
+
if ( (bool) $this->use_test_env === true ) {
|
164 |
$env = "test";
|
165 |
}
|
166 |
|
607 |
$temp_rate = $wpec_ash_xml->get("Rate",$postage);
|
608 |
$rate = (!empty($temp_rate)) ? $temp_rate[0] : 0.0;
|
609 |
if (!empty($service_name)){
|
610 |
+
$temp[$service_name] = apply_filters( 'wpsc_usps_domestic_rate', $rate, $service_name );
|
611 |
}
|
612 |
}
|
613 |
array_push($package_services, $temp);
|
636 |
$service_name = $this->_get_service("SvcDescription",$service);
|
637 |
$temp_rate = $wpec_ash_xml->get("Postage",$service);
|
638 |
$rate = (!empty($temp_rate)) ? $temp_rate[0] : 0.0;
|
639 |
+
if (!empty($service_name)){
|
640 |
+
$service_table[$service_name] = apply_filters( 'wpsc_usps_intl_rate', $rate, $service_name );
|
641 |
}
|
642 |
}
|
643 |
return $service_table;
|
913 |
$wpec_ash = new ASH();
|
914 |
}
|
915 |
if (!is_object($wpec_ash_tools)){
|
916 |
+
$wpec_ash_tools = new ASHTools();
|
917 |
}
|
918 |
|
919 |
$this->shipment = $wpec_ash->get_shipment();
|
928 |
$data = array();
|
929 |
//*** WPEC Configuration values ***\\
|
930 |
$settings = get_option("wpec_usps");
|
931 |
+
$this->use_test_env = ! isset( $settings["test_server"] ) ? false : ( bool ) $settings['test_server'];
|
932 |
$data["fcl_type"] = (!empty($settings["fcl_type"])) ? $settings["fcl_type"] : "PARCEL";
|
933 |
$data["mail_type"] = (!empty($settings["intl_pkg"])) ? $settings["intl_pkg"] : "Package";
|
934 |
$data["base_zipcode"] = get_option("base_zipcode");
|
wpsc-taxes/controllers/taxes_controller.class.php
CHANGED
@@ -474,13 +474,13 @@ class wpec_taxes_controller {
|
|
474 |
// As of 3.8.9, we deprecated Great Britain as a country in favor of the UK.
|
475 |
// See http://code.google.com/p/wp-e-commerce/issues/detail?id=1079
|
476 |
|
477 |
-
if ( ! is_array( $value ) && 'GB' != get_option( 'base_country' ) && ( 'GB' == $input_array[$value] || ( is_array( $value ) && 'GB' != get_option( 'base_country' ) && in_array( 'GB', $value ) ) ) )
|
478 |
continue;
|
479 |
|
480 |
//if the selected value exists in the input array skip it and continue processing
|
481 |
if ( is_array( $value ) ) {
|
482 |
|
483 |
-
if ( (stripslashes($value[$option_value]) == $option_selected[$option_value]) || (stripslashes($value[$option_value]) == $option_selected) )
|
484 |
continue;
|
485 |
}
|
486 |
|
474 |
// As of 3.8.9, we deprecated Great Britain as a country in favor of the UK.
|
475 |
// See http://code.google.com/p/wp-e-commerce/issues/detail?id=1079
|
476 |
|
477 |
+
if ( ! is_array( $value ) && 'GB' != get_option( 'base_country' ) && ( ( isset( $input_array[$value] ) && 'GB' == $input_array[$value] ) || ( is_array( $value ) && 'GB' != get_option( 'base_country' ) && in_array( 'GB', $value ) ) ) )
|
478 |
continue;
|
479 |
|
480 |
//if the selected value exists in the input array skip it and continue processing
|
481 |
if ( is_array( $value ) ) {
|
482 |
|
483 |
+
if ( ( isset( $option_selected[$option_value] ) && stripslashes($value[$option_value]) == $option_selected[$option_value] ) || ( isset( $option_selected ) && (stripslashes($value[$option_value]) == $option_selected) ) )
|
484 |
continue;
|
485 |
}
|
486 |
|
wpsc-theme/functions/wpsc-user_log_functions.php
CHANGED
@@ -15,8 +15,6 @@ if ( get_option( 'permalink_structure' ) != '' )
|
|
15 |
else
|
16 |
$separator = "&";
|
17 |
|
18 |
-
$siteurl = site_url();
|
19 |
-
|
20 |
function validate_form_data() {
|
21 |
|
22 |
global $wpdb, $user_ID, $wpsc_purchlog_statuses;
|
@@ -315,9 +313,9 @@ function wpsc_has_downloads() {
|
|
315 |
|
316 |
foreach ( (array)$products as $key => $product ) {
|
317 |
if( empty( $product['uniqueid'] ) ) { // if the uniqueid is not equal to null, its "valid", regardless of what it is
|
318 |
-
$links[] =
|
319 |
} else {
|
320 |
-
$links[] =
|
321 |
}
|
322 |
$sql = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE id = %d", $product['fileid'] );
|
323 |
$file = $wpdb->get_results( $sql, ARRAY_A );
|
@@ -416,15 +414,14 @@ function wpsc_user_profile_links( $args = array() ) {
|
|
416 |
}
|
417 |
|
418 |
function wpsc_user_purchases() {
|
419 |
-
global $wpdb, $user_ID, $wpsc_purchlog_statuses, $gateway_checkout_form_fields, $purchase_log, $col_count;
|
420 |
|
421 |
-
$nzshpcrt_gateways = nzshpcrt_get_gateways();
|
422 |
$i = 0;
|
423 |
$subtotal = 0;
|
424 |
|
425 |
-
|
426 |
|
427 |
-
foreach ( (array)$purchase_log as $purchase ) {
|
428 |
$status_state = "expand";
|
429 |
$status_style = "display:none;";
|
430 |
$alternate = "";
|
15 |
else
|
16 |
$separator = "&";
|
17 |
|
|
|
|
|
18 |
function validate_form_data() {
|
19 |
|
20 |
global $wpdb, $user_ID, $wpsc_purchlog_statuses;
|
313 |
|
314 |
foreach ( (array)$products as $key => $product ) {
|
315 |
if( empty( $product['uniqueid'] ) ) { // if the uniqueid is not equal to null, its "valid", regardless of what it is
|
316 |
+
$links[] = home_url( '/?downloadid=' . $product['id'] );
|
317 |
} else {
|
318 |
+
$links[] = home_url( '/?downloadid=' . $product['uniqueid'] );
|
319 |
}
|
320 |
$sql = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE id = %d", $product['fileid'] );
|
321 |
$file = $wpdb->get_results( $sql, ARRAY_A );
|
414 |
}
|
415 |
|
416 |
function wpsc_user_purchases() {
|
417 |
+
global $wpdb, $user_ID, $wpsc_purchlog_statuses, $gateway_checkout_form_fields, $purchase_log, $col_count, $nzshpcrt_gateways;
|
418 |
|
|
|
419 |
$i = 0;
|
420 |
$subtotal = 0;
|
421 |
|
422 |
+
do_action( 'wpsc_pre_purchase_logs' );
|
423 |
|
424 |
+
foreach ( (array) $purchase_log as $purchase ) {
|
425 |
$status_state = "expand";
|
426 |
$status_style = "display:none;";
|
427 |
$alternate = "";
|
wpsc-theme/wpsc-shopping_cart_page.php
CHANGED
@@ -461,7 +461,7 @@ endif;
|
|
461 |
<?php if(wpsc_has_tnc()) : ?>
|
462 |
<tr>
|
463 |
<td colspan='2'>
|
464 |
-
<label for="agree"><input id="agree" type='checkbox' value='yes' name='agree' /> <?php printf(__("I agree to the <a class='thickbox' target='_blank' href='%s' class='termsandconds'>Terms and Conditions</a>", "wpsc"), esc_url(
|
465 |
</td>
|
466 |
</tr>
|
467 |
<?php endif; ?>
|
461 |
<?php if(wpsc_has_tnc()) : ?>
|
462 |
<tr>
|
463 |
<td colspan='2'>
|
464 |
+
<label for="agree"><input id="agree" type='checkbox' value='yes' name='agree' /> <?php printf(__("I agree to the <a class='thickbox' target='_blank' href='%s' class='termsandconds'>Terms and Conditions</a>", "wpsc"), esc_url( home_url( "?termsandconds=true&width=360&height=400" ) ) ); ?> <span class="asterix">*</span></label>
|
465 |
</td>
|
466 |
</tr>
|
467 |
<?php endif; ?>
|
wpsc-updates/database_template.php
CHANGED
@@ -172,7 +172,7 @@ $table_name = WPSC_TABLE_SUBMITTED_FORM_DATA; /* !wpsc_submitted_form_data */
|
|
172 |
$wpsc_database_template[$table_name]['columns']['id'] = "bigint(20) unsigned NOT NULL auto_increment";
|
173 |
$wpsc_database_template[$table_name]['columns']['log_id'] = "bigint(20) unsigned NOT NULL DEFAULT '0' ";
|
174 |
$wpsc_database_template[$table_name]['columns']['form_id'] = "bigint(20) unsigned NOT NULL DEFAULT '0' ";
|
175 |
-
$wpsc_database_template[$table_name]['columns']['value'] = "
|
176 |
$wpsc_database_template[$table_name]['indexes']['PRIMARY'] = "PRIMARY KEY ( `id` )";
|
177 |
$wpsc_database_template[$table_name]['indexes']['log_id'] = " KEY `log_id` ( `log_id`, `form_id` )";
|
178 |
$wpsc_database_template[$table_name]['previous_names'] = "{$wpdb->prefix}submited_form_data";
|
@@ -209,4 +209,4 @@ $wpsc_database_template[$table_name]['indexes']['last_activity'] = "KEY `last_ac
|
|
209 |
$wpsc_database_template[$table_name]['indexes']['cart_submitted'] = "KEY `cart_submitted` ( `cart_submitted` )";
|
210 |
|
211 |
|
212 |
-
?>
|
172 |
$wpsc_database_template[$table_name]['columns']['id'] = "bigint(20) unsigned NOT NULL auto_increment";
|
173 |
$wpsc_database_template[$table_name]['columns']['log_id'] = "bigint(20) unsigned NOT NULL DEFAULT '0' ";
|
174 |
$wpsc_database_template[$table_name]['columns']['form_id'] = "bigint(20) unsigned NOT NULL DEFAULT '0' ";
|
175 |
+
$wpsc_database_template[$table_name]['columns']['value'] = "longtext NOT NULL DEFAULT '' ";
|
176 |
$wpsc_database_template[$table_name]['indexes']['PRIMARY'] = "PRIMARY KEY ( `id` )";
|
177 |
$wpsc_database_template[$table_name]['indexes']['log_id'] = " KEY `log_id` ( `log_id`, `form_id` )";
|
178 |
$wpsc_database_template[$table_name]['previous_names'] = "{$wpdb->prefix}submited_form_data";
|
209 |
$wpsc_database_template[$table_name]['indexes']['cart_submitted'] = "KEY `cart_submitted` ( `cart_submitted` )";
|
210 |
|
211 |
|
212 |
+
?>
|
wpsc-widgets/donations_widget.php
CHANGED
@@ -121,9 +121,7 @@ function wpsc_donations( $args = null ) {
|
|
121 |
|
122 |
// Args not used yet but this is ready for when it is
|
123 |
$args = wp_parse_args( (array)$args, array() );
|
124 |
-
|
125 |
-
$siteurl = get_option( 'siteurl' );
|
126 |
-
|
127 |
$products = $wpdb->get_results( "SELECT DISTINCT `p` . * , `m`.`meta_value` AS `special_price`
|
128 |
FROM `" . $wpdb->postmeta . "` AS `m`
|
129 |
JOIN `" . $wpdb->posts . "` AS `p` ON `m`.`post_id` = `p`.`ID`
|
121 |
|
122 |
// Args not used yet but this is ready for when it is
|
123 |
$args = wp_parse_args( (array)$args, array() );
|
124 |
+
|
|
|
|
|
125 |
$products = $wpdb->get_results( "SELECT DISTINCT `p` . * , `m`.`meta_value` AS `special_price`
|
126 |
FROM `" . $wpdb->postmeta . "` AS `m`
|
127 |
JOIN `" . $wpdb->posts . "` AS `p` ON `m`.`post_id` = `p`.`ID`
|
wpsc-widgets/latest_product_widget.php
CHANGED
@@ -116,7 +116,6 @@ add_action( 'widgets_init', create_function( '', 'return register_widget("WP_Wid
|
|
116 |
function wpsc_latest_product( $args = null, $instance ) {
|
117 |
global $wpdb;
|
118 |
$args = wp_parse_args( (array)$args, array( 'number' => 5 ) );
|
119 |
-
$siteurl = get_option( 'siteurl' );
|
120 |
$options = get_option( 'wpsc-widget_latest_products' );
|
121 |
$number = isset($instance['number']) ? (int)$instance['number'] : 5;
|
122 |
$image = isset($instance['image']) ? (bool)$instance['image'] : FALSE;
|
116 |
function wpsc_latest_product( $args = null, $instance ) {
|
117 |
global $wpdb;
|
118 |
$args = wp_parse_args( (array)$args, array( 'number' => 5 ) );
|
|
|
119 |
$options = get_option( 'wpsc-widget_latest_products' );
|
120 |
$number = isset($instance['number']) ? (int)$instance['number'] : 5;
|
121 |
$image = isset($instance['image']) ? (bool)$instance['image'] : FALSE;
|
wpsc-widgets/price_range_widget.php
CHANGED
@@ -106,7 +106,6 @@ function wpsc_price_range( $args = null ) {
|
|
106 |
// Filter args not used at the moment, but this is here ready
|
107 |
$args = wp_parse_args( (array)$args, array() );
|
108 |
|
109 |
-
$siteurl = get_option( 'siteurl' );
|
110 |
$product_page = get_option( 'product_list_url' );
|
111 |
$result = $wpdb->get_results( "SELECT DISTINCT CAST(`meta_value` AS DECIMAL) AS `price` FROM " . $wpdb->postmeta . " AS `m` WHERE `meta_key` IN ('_wpsc_price') ORDER BY `price` ASC", ARRAY_A );
|
112 |
|
106 |
// Filter args not used at the moment, but this is here ready
|
107 |
$args = wp_parse_args( (array)$args, array() );
|
108 |
|
|
|
109 |
$product_page = get_option( 'product_list_url' );
|
110 |
$result = $wpdb->get_results( "SELECT DISTINCT CAST(`meta_value` AS DECIMAL) AS `price` FROM " . $wpdb->postmeta . " AS `m` WHERE `meta_key` IN ('_wpsc_price') ORDER BY `price` ASC", ARRAY_A );
|
111 |
|
wpsc-widgets/specials_widget.php
CHANGED
@@ -176,8 +176,6 @@ function wpsc_specials( $args = null, $instance ) {
|
|
176 |
|
177 |
$args = wp_parse_args( (array) $args, array( 'number' => 5 ) );
|
178 |
|
179 |
-
$siteurl = get_option( 'siteurl' );
|
180 |
-
|
181 |
if ( ! $number = (int) $instance['number'] )
|
182 |
$number = 5;
|
183 |
|
176 |
|
177 |
$args = wp_parse_args( (array) $args, array( 'number' => 5 ) );
|
178 |
|
|
|
|
|
179 |
if ( ! $number = (int) $instance['number'] )
|
180 |
$number = 5;
|
181 |
|