Merge branch 'master' into maybe_blank_keys_webhooks

This commit is contained in:
Mike Jolley 2017-04-27 12:11:27 +01:00
commit bbffbd6a9f
319 changed files with 9179 additions and 4585 deletions

9
.babelrc Normal file
View File

@ -0,0 +1,9 @@
{
"presets": [
"es2015",
"stage-2"
],
"plugins": [
"add-module-exports"
]
}

View File

@ -93,7 +93,7 @@ By translating video tutorials you'll be helping non-English speaking users and
# Additional Resources
* [General GitHub documentation](https://help.github.com/)
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
* [GitHub pull request documentation](https://help.github.com/articles/about-pull-requests/)
* [Translator Handbook](https://make.wordpress.org/polyglots/handbook/)
* [WooCommerce Docs](https://docs.woocommerce.com/)
* [WooCommerce Support](https://support.woocommerce.com)

View File

@ -1,16 +1,18 @@
## EXPLANATION OF THE ISSUE
### EXPLANATION OF THE ISSUE
<!-- What happens, under which versions, under what conditions, when, and what were you expecting instead. -->
## STEPS TO REPRODUCE THE ISSUE
### STEPS TO REPRODUCE THE ISSUE
<!-- 1. List steps to reproduce your issue so we can replicate. -->
## SYSTEM STATUS REPORT
### SYSTEM STATUS
<details>
```
Grab the system status report from WooCommerce > System Status and paste it here.
Grab the system status report from WooCommerce > System Status and paste it here between the `details` tags.
```
</details>
<!--
BEFORE POSTING YOUR ISSUE

1
.gitignore vendored
View File

@ -32,6 +32,7 @@ tests/cli/vendor
# Unit tests
/tmp
/tests/bin/tmp
/tests/e2e-tests/config/local-*.json
# Logs
/logs

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

View File

@ -1,5 +1,199 @@
== Changelog ==
= 3.0.4 - 2017-04-20 =
* Fix - Variations were not inheriting the product image and shipping class ID.
* Fix - Prevent rating/review counts being duplicated when duplicating products.
* Fix - Fixed gallery navigation between images with long captions.
* Fix - Support transparent PNG in the gallery by setting a background color.
* Fix - Removed name/company from the shipping address Google map links.
* Fix - Fixed the address field sorting script on the checkout.
* Fix - Fixed the upgrade routine for grouped products so that parents are unset.
* Fix - Fixed support for WordPress 4.7 user locale settings.
* Fix - Fixed default option filter for product types in the product meta box.
* Fix - Improved the css in Twenty Seventeen for dark color schemes.
* Fix - Fixed display of refunds in sales report.
* Fix - Updated `single-product/add-to-cart/variable.php` template version to 3.0.0 since it had changes since 2.6.
* Fix - Fixed warnings when product attribute do not exists.
* Fix - Used a div for comment-form-rating to prevent invalid nested markup.
* Fix - Fixed some logic that checks if order taxes are compound.
* Fix - Fixed SKU checks to only exclude products that are trashed.
* Fix - Fixed display of download permissions in first email sent after checkout.
* Fix - Hidden the backorder notification stock text when notification is disabled.
* Fix - Fixed incorrect stock numbers in low stock emails.
* Tweak - Removed the non-functional order total input box, and combined the recalculation buttons into one working button.
* Tweak - Updated Guided Tour videos.
* Tweak - Updated js-cookie.js to 2.1.4.
* Tweak - Updated schema.org URLs to use HTTPS.
* Tweak - Status report request timeouts.
* REST API - Fixed an issue that prevented deleting a term if errors were thrown during creation.
* REST API - Fixed reports endpoint when querying by date.
* REST API - Fixed ignored order parameters when changing order status.
* Dev - Support guest orders in `wc_get_orders` function.
* Dev - Fixed downloadable variation filters for download URLs.
* Dev - Added safeguards to prevent infinite loops while saving coupons, products and orders in admin.
* Dev - Added a fallback for `queue_transactional_email` if background sending is disabled.
* Dev - Added `has_shipping_address` helper method.
* Dev - Introduced `woocommerce_order_item_get_formatted_meta_data` filter.
* Dev - Made wc_add_order_item pass correct values to woocommerce_new_order_item.
* Dev - Fixed `legacy_posted_data` access in checkout class.
* Dev - Fixed undefined property notice in `WC_Order_Item::offsetGet`.
* Dev - Fixed PHP 7.1 warnings when using non-float values to `wc_get_weight()`.
* Dev - Fixed incorrect variable name in `wc_add_order_item()`.
= 3.0.3 - 2017-04-13 =
* Fix - Fixed an issue with variation tax-classes when set to 'parent'. This made taxes apply on top of the tax inclusive price in certain setups.
* Fix - Escaped attribute translations in the `cart.php` template and bumped the template version to match.
* Fix - Corrected the display of refund dates on the order screen.
* Fix - Fixed the grouped product visibility check in the grouped.php template and bumped the template version to match.
* Fix - Fixed the sale badge display for grouped products.
* Fix - Added the `itemReviewed` structured data for product reviews to make it validate.
* Fix - Made the `get_attribute` method work on variation objects.
* Tweak - Turned off the deferred email sending by default which was added in 3.0. Whilst it does improve performance, there were compatibility problems on some servers. It can be enabled with a filter if desired.
* Dev - Added backtrace information to the deprecation messages to help find problem plugins.
= 3.0.2 - 2017-04-12 =
* Fix - Removed required states for GP, GF, KW, LB, MQ, RE and YT countries.
* Fix - Made cache in the [products] shortcode respect filters from plugins.
* Fix - Added missing `woocommerce_cross_sells_columns` filter.
* Fix - Fixed shortcode rendering on the shop page.
* Fix - Fixed incorrect sale dates when bulk editing variations.
* Fix - Fixed calls to wc_reduce_stock_levels in PayPal and Simplify gateways.
* Fix - Exclude "location" meta when reading customer meta data.
* Fix - Updated `emails/email-addresses.php`, `emails/email-order-details.php`, `content-single-product.php`, `checkout/form-shipping.php`, `myaccount/form-add-payment-method.php`, `myaccount/form-edit-address.php`, `myaccount/form-lost-password.php`, `myaccount/form-reset-password.php`, `myaccount/orders.php` and `myaccount/view-order.php` template version to 3.0.0 since they had changes since 2.6.
* Fix - Fixed default behavior of variation tax classes when originally set to "parent".
* Fix - When duplicating products, do not copy slug, append "(Copy)" to the product name, correctly copy all meta data, and prevent children of grouped products being duplicated too.
* Fix - Removed duplicated items when outputting cross sells on the cart page.
* Fix - Fixed output of default "add to cart" text of external products in loops.
* Fix - Fixed backwards compatibility of guest checkout rules when being altered by plugins directly.
* Fix - Use correct thumbnail sizes for variation images in the new gallery.
* Fix - Fixed captions on thumbnails and main image in the new gallery.
* Fix - Trigger wc_fragments_loaded after add to cart fragment refresh.
* Fix - Download permissions; Convert dates to timestamp on read so UTC is preserved.
* Fix - Fixed notices under PHP 7.1 when sorting products by name (numeric).
* Fix - Added additional checks to ensure objects are read before using class methods to avoid errors.
* Fix - Removed legacy suggest.js code which was causing JS error on bulk edit.
* Fix - Fixed warnings on the "Lost password" page and when loading a product with invalid attributes.
* Fix - Made background emailer update the queue after a successful send so duplicate mails are less likely.
* Fix - Typo in flexslider_enabled option in new gallery script.
* Fix - woocommerce_notify_low_stock and woocommerce_notify_no_stock options had no effect.
* Tweak - For downloadable files, only validate file type when dealing with relative paths.
* Tweak - Improved automatic variation name generation.
* Dev - Added product visibility terms to system status report to help debug.
* Dev - Introduced `woocommerce_admin_order_date_format` filter to replace missing `post_date_column_time`.
* Dev - Introduced `woocommerce_update_customer_args` filter to prevent updates to user objects if needed.
* REST API - Fixed saving of variations in legacy REST API v3.
* REST API - Fixed backwards compatibility of line_items meta in legacy REST API.
= 3.0.1 - 2017-04-06 =
* Fix - Show catalog hidden products within grouped products.
* Fix - Fade in the gallery in if no images are set or it's custom.
* Fix - Use wc_deprecated_function in WC_Deprecated_Hooks so notices aren't output in ajax requests.
* Fix - Added back the ability to include extra items to the System Status using the `woocommerce_system_status_environment_rows` filter.
* Fix - Coupon category restrictions and limits for variations.
* Fix - Allow shortcodes and HTML in variation descriptions like in 2.6.
* Fix - Unset post date when duplicating products.
* Fix - Show a sale price on variable products if on sale and all prices are the same.
* Fix - Corrected download links when a product has multiple downloads.
* Fix - Prevented potential errors if the product type was not posted for any reason on save.
* Fix - Updated `single-product/up-sells.php`, `loop/add-to-cart.php`, `loop/rating.php`, `checkout/form-billing.php`, and `content-product.php` template version to 3.0.0.
* Fix - Included clearfixes on billing and shipping field wrappers,
* Fix - Fixed styling of logs table in some languages.
* Fix - Fixed display of variation attributes on old orders.
* Fix - Use placeholder text for external products add to cart button text if left blank.
* Fix - Fallback to home URL if no shop page is set for system status security check for HTTPS.
* Fix - For variations, pull tax status and sold individually from the parent since there is no UI to set this at variation level.
* Fix - Moved cron emails to background processing to avoid multiple sends.
* Fix - Wrapped structured data in a hidden element when added to emails.
* Fix - Missing gateway information in queued emails.
* Fix - Fixed a bug that caused pages to permanently reload if "Default customer location" was set to "Geolocate (with page caching support)".
* Fix - When forcing shipping to billing, set the shipping fields in the order itself.
* Fix - Check for invalid objects in WC_Register_WP_Admin_Settings.
* Fix - Check for error object in wc_get_object_terms.
* Fix - Removed slashes in shipping meta data on the order edit screen.
* Fix - Prevented permalink rewrites for attributes with missing names.
* Fix - Fixed saving of meta data when multiple extensions use the `save_post` action.
* Fix - Allow search customers by ID in edit order screen.
* Fix - Prevents session data overwriting customer data on login.
* Fix - Fixed cross-sell column display and variation support.
* Fix - Fixed variable product stock syncing on save.
* Fix - Included try/catch wrapper to prevent issues with Select2.
* Fix - Prevented a bug that deleted all variations when the product type was change from variable to simple.
* Fix - Switched to WPDB to quicker update when syncing titles for variations.
* Fix - Exclude deprecated properties when loading a customer object.
* Fix - Fixed notices while trying to order again.
* Fix - Fixed notices when `$wpdb->prefix` is empty.
* Fix - Prevent errors when loading a product with an invalid download file types.
* REST API - Fixed missing array declaration in CRUD controller.
* REST API - Removed extra `exclude`, `include` and `search` parameters from taxes endpoint.
* REST API - Fixed variation description formatting.
* REST API - Fixed incorrect attribute check in products endpoint in Legacy REST API.
* REST API - Allow variation image to be unset.
= 3.0.0 - 2017-04-04 =
* New gallery on single product pages with better mobile support, using PhotoSwipe and Zoom. Declare support with add_theme_support() - wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider
* Made the store notice dismissible on the frontend.
* Variable products no longer show striked out prices in combination with ranges for clarity when on sale.
* Prices no longer display as 'free' instead of 0, to fix issues with ranges and localization and for consistency.
* Improved structured product data by using JSON-LD instead of inline Microdata.
* Improved downloads list layout (template file).
* Respect stock status and prevent the "out of stock threshold" setting affecting existing in-stock products.
* Improved handling of shop page rewrite rules to allow subpages.
* Redirect to login after password reset.
* When using authorizations in PayPal Standard, automatically capture funds when the order goes processing/completed.
* On multisite, when a user logs into a store with an account on a site, but not the current site, rather than error, add the user to the current site as a customer.
* Show variable weights/dimensions even when parent values are not set.
* Automatically sort tax rates rather than allow clunky manual sorting.
* When deleting a tax rate class, remove it's tax rates.
* Made WC_Logger pluggable via wc_get_logger function.
* Use 'average rating' post meta for 'rating' product sorting option.
* Show better labels in nav menus metabox.
* Sort “Recently Viewed” products by the view order.
* Removed internal scroll from log viewer.
* Add reply-to to admin emails.
* Improved the zone setup flow.
* Made wc_get_wildcard_postcodes return the orignal postcode plus * since wildcards should match empty strings too.
* Use all paid statuses in $customer->get_total_spent().
* Move location of billing email field to work with password managers.
* Option to restrict selling locations by country.
* Added tool to clear orphaned variations in system status.
* Remove checkbox options in system status tools and replace with constants.
* Added security section in system status report.
* Add image_url setting to PayPal Standard.
* Fixed attribute registration. Attributes are non-hierarchical by default (parent is not supported).
* Add sort parameter to checkout fields to aid with sorting per locale.
* Merged percent and percent product coupon types (they provide the same discount).
* Prevent payment details being cleared after update_checkout events.
* Performance - Converted _featured and _visibility meta data to terms for faster catalog queries. Upgrade routine handles migration. Developers may need to update queries to reflect this change.
* Includes product attributes archives links in "Additional Information" tab.
* Select2 has been upgraded to v4.
* Improved logging system for extensions.
* Tax suffix is now hidden on non-taxable products.
* Grouped products are linked from the parent rather than the children. Children can be in more than one group.
* Removed coupon usage link in coupons admin screen.
* Performance - Converted rating filters to visibility terms.
* Performance - Added visibility term for outofstock products to speed those queries up also.
* Performance - Introduced a new CRUD (create, read, update, delete) system for Products, Orders, Customers and Shipping Zones.
* Performance - Optimised variable product sync. Upper/lower price meta is no longer stored, just the main prices, if a child has weight, and if a child has dimensions.
* Performance - Removed WP_Query from up-sells.php and related.php and replaced with PHP foreach loop (since we already have the product IDs).
* Performance - Removed the feature where old orders get access to new downloads on product edit. Looping potentially thousands of orders to do this is too much of a performance burden for stores and this can sometimes be unexpected behavior too. This does however updates *edited* downloads.
* Performance - Removed 'items' column on orders screen due to loading excessive data.
* Performance - Deferred email sending for faster checkouts. Now uses CRON.
* API - New Rest API v2 with support for meta_data amongst other things.
* API - Removed last order from customers part of the API due to performance concerns - use orders endpoint instead. Other order data on the endpoint is now transient cached.
* API - Allow oAuth1.0a authentication using headers.
* API - New Shipping Zones endpoints.
* API - New variations endpoints.
* API - New settings endpoints.
* API - Payment gateways and shipping methods endpoints.
* API - Prevented the (broken) ability to manipulate variations directly on the products endpoints.
* CLI - New CLI which uses the REST API endpoints rather than it's own functions.
* Localization - Improved RTL support.
* Localization - Added a language independent permalink setting function.
* Localization - Added inline comments for placeholder strings.
* Localization - Added Nigerian and Pakistan Provinces to i18n/state.
* Localization - US and Poland postcode validation.
* To read more about this release, see our dev blog announcement here: http://wp.me/p6wtcw-Uo
= 2.6.14 - 2017-02-02 =
* Fix - Ensure product exists in wc_update_product_stock.
* Fix - Send emails using the site language.
@ -93,7 +287,7 @@
* Fix - API - Allow API to save refund reason.
* Fix - API - Resolved encoding issues with attribute and variation slugs.
* Fix - API - get_attributes should return term name, not slug.
* Fix - API - Product "filter" and "sku" paramaters.
* Fix - API - Product "filter" and "sku" parameters.
* Fix - Handle info notices in cart, not just error messages.
* Fix - Don't remove hyphens in attribute labels.
* Fix - Start sales on variations after they are saved, if applicable.
@ -766,7 +960,7 @@
* Tweak - Use 30 days instead of year for transients to avoid bugs in memcache plugins.
* Tweak - Add reports menu item if user can access reports but not the main WC section.
* Tweak - Improve grouped product quantity inputs.
* Tweak - Load the persistant cart if cart is empty.
* Tweak - Load the persistent cart if cart is empty.
* Tweak - Prevent cart being cleared when accessing the login page.
* Tweak - Shipping calculator - Made state/postcode respect country locale like checkout.
* Tweak - Move default customer location to general settings tab.
@ -849,7 +1043,7 @@
* Fix - Added WC version of GEOIP classes to prevent conflicts with other plugins.
= 2.3.0 - 2015-02-11 =
* Feature - Option to geo-locate the customer's inital location.
* Feature - Option to geo-locate the customer's initial location.
* Feature - Display taxes in store based on the customer location, rather than the shop base.
* Feature - Made tax importer expand postcode ranges.
* Feature - Print styles for reports.
@ -1108,7 +1302,7 @@
* Dev - Introduces the WC_Order::needs_shipping_address() method.
* Dev - Gateways can set transaction ID for the order.
* Dev - Gateways can do refunds via the Payment Gateway API.
* Refactor - Changed the method in which order statuses are stored. Previously, order status was a taxonomy. This caused issues when unique term slugs differed from what we were expecting, and also added additonal overhead to order queries in reports. https://github.com/woocommerce/woocommerce/issues/3064 Order status is now stored as post status - several new post statuses have been added. Order class variables are backwards compatible. The only thing to note (for devs) is that any query must use the order status instead of 'publish' when getting orders and querying by post_status. THe shop_order_status has also been removed.
* Refactor - Changed the method in which order statuses are stored. Previously, order status was a taxonomy. This caused issues when unique term slugs differed from what we were expecting, and also added additional overhead to order queries in reports. https://github.com/woocommerce/woocommerce/issues/3064 Order status is now stored as post status - several new post statuses have been added. Order class variables are backwards compatible. The only thing to note (for devs) is that any query must use the order status instead of 'publish' when getting orders and querying by post_status. THe shop_order_status has also been removed.
* Refactor - Update stock amounts with DB queries.
* Refactor - Simplified attribute name sanitisation which maintains UTF8 char integrity.
* Refactor - Country class return methods.
@ -1130,7 +1324,7 @@
* Fix - Saving tax rates threw notices (missing git cherry pick).
= 2.1.10 - 2014-06-03 =
* Fix - Removed unecessary localization from edit account.
* Fix - Removed unnecessary localization from edit account.
* Fix - Admin welcome screen css.
* Fix - Fixed my account setting values to wrong user submitted strings.
* Fix - Menu order terms were coming back empty.

View File

@ -249,6 +249,12 @@ module.exports = function( grunt ) {
'cd apigen',
'php hook-docs.php'
].join( '&&' )
},
e2e_test: {
command: 'npm run --silent test:single tests/e2e-tests/' + grunt.option( 'file' )
},
e2e_tests: {
command: 'npm run --silent test'
}
},
@ -325,4 +331,12 @@ module.exports = function( grunt ) {
'default',
'makepot'
]);
grunt.registerTask( 'e2e-tests', [
'shell:e2e_tests'
]);
grunt.registerTask( 'e2e-test', [
'shell:e2e_test'
]);
};

View File

@ -26,7 +26,7 @@ charset: [UTF-8]
main: WC
# title of generated documentation
title: WooCommerce 2.6.x Code Reference
title: WooCommerce 3.0.x Code Reference
# base url used for sitemap (useful for public doc)
baseUrl: https://docs.woocommerce.com/wc-apidocs/

View File

@ -83,7 +83,7 @@
</li>
<li class="api">
<a href="https://woothemes.github.io/woocommerce-rest-api-docs/"><span>REST API Docs</span></a>
<a href="https://woocommerce.github.io/woocommerce-rest-api-docs/"><span>REST API Docs</span></a>
</li>
<li class="divider-vertical" n:if="$config->download"></li>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
@charset "UTF-8";@font-face{font-family:star;src:url(../fonts/star.eot);src:url(../fonts/star.eot?#iefix) format("embedded-opentype"),url(../fonts/star.woff) format("woff"),url(../fonts/star.ttf) format("truetype"),url(../fonts/star.svg#star) format("svg");font-weight:400;font-style:normal}@font-face{font-family:WooCommerce;src:url(../fonts/WooCommerce.eot);src:url(../fonts/WooCommerce.eot?#iefix) format("embedded-opentype"),url(../fonts/WooCommerce.woff) format("woff"),url(../fonts/WooCommerce.ttf) format("truetype"),url(../fonts/WooCommerce.svg#WooCommerce) format("svg");font-weight:400;font-style:normal}#adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e03d'}#adminmenu #menu-posts-product .menu-icon-post div.wp-menu-image::before,#adminmenu #menu-posts-product .menu-icon-product div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e006'}#adminmenu #toplevel_page_wc-reports .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e023';font-size:1.3em!important}span.mce_woocommerce_shortcodes_button{background-image:none!important;display:block;text-indent:-9999px;position:relative;height:1em;width:1em}span.mce_woocommerce_shortcodes_button::before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;right:0;width:100%;height:100%;text-align:center;content:"";font-size:.9em;line-height:1.2}.wc_plugin_upgrade_notice{font-weight:400;color:#fff;background:#d54d21;padding:1em;margin:9px 0}.wc_plugin_upgrade_notice a{color:#fff;text-decoration:underline}.wc_plugin_upgrade_notice::before{content:'\f348';display:inline-block;font:400 18px/1 dashicons;speak:none;margin:0 -2px 0 8px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top}
@charset "UTF-8";@font-face{font-family:star;src:url(../fonts/star.eot);src:url(../fonts/star.eot?#iefix) format("embedded-opentype"),url(../fonts/star.woff) format("woff"),url(../fonts/star.ttf) format("truetype"),url(../fonts/star.svg#star) format("svg");font-weight:400;font-style:normal}@font-face{font-family:WooCommerce;src:url(../fonts/WooCommerce.eot);src:url(../fonts/WooCommerce.eot?#iefix) format("embedded-opentype"),url(../fonts/WooCommerce.woff) format("woff"),url(../fonts/WooCommerce.ttf) format("truetype"),url(../fonts/WooCommerce.svg#WooCommerce) format("svg");font-weight:400;font-style:normal}#adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e03d'}#adminmenu #menu-posts-product .menu-icon-post div.wp-menu-image::before,#adminmenu #menu-posts-product .menu-icon-product div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e006'}#adminmenu #toplevel_page_wc-reports .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e023';font-size:1.3em!important}span.mce_woocommerce_shortcodes_button{background-image:none!important;display:block;text-indent:-9999px;position:relative;height:1em;width:1em}span.mce_woocommerce_shortcodes_button::before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;right:0;width:100%;height:100%;text-align:center;content:"";font-size:.9em;line-height:1.2}#woocommerce-update .updating-message .wc_plugin_upgrade_notice{display:none}#woocommerce-update .wc_plugin_upgrade_notice{font-weight:400;color:#fff!important;background:#d54d21!important;padding:1em!important;margin:9px 0!important}#woocommerce-update .wc_plugin_upgrade_notice a{color:#fff;text-decoration:underline}#woocommerce-update .wc_plugin_upgrade_notice::before{color:#fff!important;content:'\f348';display:inline-block;font:400 18px/1 dashicons;speak:none;margin:0 -2px 0 8px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top}

View File

@ -1 +1 @@
@charset "UTF-8";@font-face{font-family:star;src:url(../fonts/star.eot);src:url(../fonts/star.eot?#iefix) format("embedded-opentype"),url(../fonts/star.woff) format("woff"),url(../fonts/star.ttf) format("truetype"),url(../fonts/star.svg#star) format("svg");font-weight:400;font-style:normal}@font-face{font-family:WooCommerce;src:url(../fonts/WooCommerce.eot);src:url(../fonts/WooCommerce.eot?#iefix) format("embedded-opentype"),url(../fonts/WooCommerce.woff) format("woff"),url(../fonts/WooCommerce.ttf) format("truetype"),url(../fonts/WooCommerce.svg#WooCommerce) format("svg");font-weight:400;font-style:normal}#adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e03d'}#adminmenu #menu-posts-product .menu-icon-post div.wp-menu-image::before,#adminmenu #menu-posts-product .menu-icon-product div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e006'}#adminmenu #toplevel_page_wc-reports .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e023';font-size:1.3em!important}span.mce_woocommerce_shortcodes_button{background-image:none!important;display:block;text-indent:-9999px;position:relative;height:1em;width:1em}span.mce_woocommerce_shortcodes_button::before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;content:"";font-size:.9em;line-height:1.2}.wc_plugin_upgrade_notice{font-weight:400;color:#fff;background:#d54d21;padding:1em;margin:9px 0}.wc_plugin_upgrade_notice a{color:#fff;text-decoration:underline}.wc_plugin_upgrade_notice::before{content:'\f348';display:inline-block;font:400 18px/1 dashicons;speak:none;margin:0 8px 0 -2px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top}
@charset "UTF-8";@font-face{font-family:star;src:url(../fonts/star.eot);src:url(../fonts/star.eot?#iefix) format("embedded-opentype"),url(../fonts/star.woff) format("woff"),url(../fonts/star.ttf) format("truetype"),url(../fonts/star.svg#star) format("svg");font-weight:400;font-style:normal}@font-face{font-family:WooCommerce;src:url(../fonts/WooCommerce.eot);src:url(../fonts/WooCommerce.eot?#iefix) format("embedded-opentype"),url(../fonts/WooCommerce.woff) format("woff"),url(../fonts/WooCommerce.ttf) format("truetype"),url(../fonts/WooCommerce.svg#WooCommerce) format("svg");font-weight:400;font-style:normal}#adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e03d'}#adminmenu #menu-posts-product .menu-icon-post div.wp-menu-image::before,#adminmenu #menu-posts-product .menu-icon-product div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e006'}#adminmenu #toplevel_page_wc-reports .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e023';font-size:1.3em!important}span.mce_woocommerce_shortcodes_button{background-image:none!important;display:block;text-indent:-9999px;position:relative;height:1em;width:1em}span.mce_woocommerce_shortcodes_button::before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;content:"";font-size:.9em;line-height:1.2}#woocommerce-update .updating-message .wc_plugin_upgrade_notice{display:none}#woocommerce-update .wc_plugin_upgrade_notice{font-weight:400;color:#fff!important;background:#d54d21!important;padding:1em!important;margin:9px 0!important}#woocommerce-update .wc_plugin_upgrade_notice a{color:#fff;text-decoration:underline}#woocommerce-update .wc_plugin_upgrade_notice::before{color:#fff!important;content:'\f348';display:inline-block;font:400 18px/1 dashicons;speak:none;margin:0 8px 0 -2px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top}

View File

@ -43,26 +43,34 @@ span.mce_woocommerce_shortcodes_button {
}
}
.wc_plugin_upgrade_notice {
font-weight: normal;
color: #fff;
background: #d54d21;
padding: 1em;
margin: 9px 0;
a {
color: #fff;
text-decoration: underline;
#woocommerce-update {
.updating-message {
.wc_plugin_upgrade_notice {
display: none;
}
}
.wc_plugin_upgrade_notice {
font-weight: normal;
color: #fff !important;
background: #d54d21 !important;
padding: 1em !important;
margin: 9px 0 !important;
&::before {
content: '\f348';
display: inline-block;
font: 400 18px/1 dashicons;
speak: none;
margin: 0 8px 0 -2px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: top;
a {
color: #fff;
text-decoration: underline;
}
&::before {
color: #fff !important;
content: '\f348';
display: inline-block;
font: 400 18px/1 dashicons;
speak: none;
margin: 0 8px 0 -2px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: top;
}
}
}

View File

@ -31,6 +31,7 @@
margin: 0;
float: right;
opacity: 0.75;
z-index: 1600;
-webkit-transition: opacity 0.2s;
transition: opacity 0.2s;
-webkit-box-shadow: none;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -372,6 +372,10 @@ table.variations {
margin: 0;
}
.zoomImg {
background-color: #fff;
}
.woocommerce-product-gallery__image:nth-child(n+2) {
width: 25%;
display: inline-block;
@ -981,6 +985,32 @@ button.pswp__button--zoom:hover {
}
}
.colors-dark.woocommerce-checkout {
.wc_payment_method {
.payment_box {
background: #333;
}
}
.select2-container--default {
.select2-results {
.select2-results__options {
background:#333;
}
.select2-results__option[aria-selected="true"]{
color: #333;
}
}
.select2-selection--single {
background-color: #333;
border: 1px solid #555;
.select2-selection__rendered {
color: #ccc;
}
}
}
}
/**
* Layout stuff
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -342,6 +342,11 @@
float: right;
}
}
.woocommerce-billing-fields,
.woocommerce-shipping-fields {
@include clearfix();
}
}
.woocommerce-account {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -39,10 +39,8 @@ p.demo_store,
}
}
.admin-bar {
p.demo_store {
top: 32px;
}
.admin-bar p.demo_store {
top: 32px;
}
/**
@ -103,11 +101,9 @@ p.demo_store,
}
}
.quantity {
.qty {
width: 3.631em;
text-align: center;
}
.quantity .qty {
width: 3.631em;
text-align: center;
}
/**
@ -176,6 +172,10 @@ p.demo_store,
transition: all cubic-bezier(0.795, -0.035, 0.000, 1.000) .5s;
}
.woocommerce-product-gallery__wrapper .zoomImg {
background-color: #fff;
}
.woocommerce-product-gallery__image:nth-child(n+2) {
width: 25%;
display: inline-block;
@ -431,10 +431,8 @@ p.demo_store,
}
}
.woocommerce-variation-description {
p {
margin-bottom: 1em;
}
.woocommerce-variation-description p {
margin-bottom: 1em;
}
.reset_variations {
@ -514,71 +512,69 @@ p.demo_store,
}
}
ul.products {
li.product {
.onsale {
top: 0;
right: 0;
left: auto;
margin: -0.5em -0.5em 0 0;
}
ul.products li.product {
.onsale {
top: 0;
right: 0;
left: auto;
margin: -0.5em -0.5em 0 0;
}
h3,
.woocommerce-loop-product__title,
.woocommerce-loop-category__title {
padding: 0.5em 0;
margin: 0;
font-size: 1em;
}
h3,
.woocommerce-loop-product__title,
.woocommerce-loop-category__title {
padding: 0.5em 0;
margin: 0;
font-size: 1em;
}
a {
text-decoration: none;
}
a {
text-decoration: none;
}
a img {
width: 100%;
height: auto;
display: block;
margin: 0 0 1em;
box-shadow: none;
}
a img {
width: 100%;
height: auto;
display: block;
margin: 0 0 1em;
box-shadow: none;
}
strong {
strong {
display: block;
}
.star-rating {
font-size: 0.857em;
}
.button {
margin-top: 1em;
}
.price {
color: $highlight;
display: block;
font-weight: normal;
margin-bottom: 0.5em;
font-size: 0.857em;
del {
color: inherit;
opacity: 0.5;
display: block;
}
.star-rating {
font-size: 0.857em;
ins {
background: none;
font-weight: 700;
}
.button {
margin-top: 1em;
}
.price {
color: $highlight;
display: block;
font-weight: normal;
margin-bottom: 0.5em;
font-size: 0.857em;
del {
color: inherit;
opacity: 0.5;
display: block;
}
ins {
background: none;
font-weight: 700;
}
.from {
font-size: 0.67em;
margin: -2px 0 0 0;
text-transform: uppercase;
color: rgba(desaturate($highlight, 75%), 0.5);
}
.from {
font-size: 0.67em;
margin: -2px 0 0 0;
text-transform: uppercase;
color: rgba(desaturate($highlight, 75%), 0.5);
}
}
}
@ -685,13 +681,11 @@ p.demo_store,
}
}
&.added {
&::after {
font-family: 'WooCommerce';
content: '\e017';
margin-left: 0.53em;
vertical-align: bottom;
}
&.added::after {
font-family: 'WooCommerce';
content: '\e017';
margin-left: 0.53em;
vertical-align: bottom;
}
&:hover {
@ -911,44 +905,36 @@ p.demo_store,
}
}
.products {
.star-rating {
display: block;
margin: 0 0 0.5em;
float: none;
}
.products .star-rating {
display: block;
margin: 0 0 0.5em;
float: none;
}
.hreview-aggregate {
.star-rating {
margin: 10px 0 0;
}
.hreview-aggregate .star-rating {
margin: 10px 0 0;
}
#review_form {
#respond {
@include clearfix();
position: static;
margin: 0;
width: auto;
padding: 0;
background: transparent none;
border: 0;
#review_form #respond {
@include clearfix();
position: static;
margin: 0;
width: auto;
padding: 0;
background: transparent none;
border: 0;
p {
margin: 0 0 10px;
}
p {
margin: 0 0 10px;
}
.form-submit {
input {
left: auto;
}
}
.form-submit input {
left: auto;
}
textarea {
box-sizing: border-box;
width: 100%;
}
textarea {
box-sizing: border-box;
width: 100%;
}
}
@ -974,19 +960,13 @@ p.demo_store,
text-indent: 0;
}
&:hover {
~ a::before {
content: '\e021';
}
&:hover ~ a::before {
content: '\e021';
}
}
&:hover {
a {
&::before {
content: '\e020';
}
}
&:hover a::before {
content: '\e020';
}
&.selected {
@ -1000,10 +980,8 @@ p.demo_store,
}
}
a:not( .active ) {
&::before {
content: '\e020';
}
a:not( .active )::before {
content: '\e020';
}
}
}
@ -1070,12 +1048,10 @@ p.demo_store,
}
}
tbody:first-child {
tr:first-child {
th,
td {
border-top: 0;
}
tbody:first-child tr:first-child {
th,
td {
border-top: 0;
}
}
@ -1121,11 +1097,9 @@ p.demo_store,
&:last-child {
text-align: left;
}
.woocommerce-MyAccount-downloads-file {
&::before {
content: '\2193';
display: inline-block;
}
.woocommerce-MyAccount-downloads-file::before {
content: '\2193';
display: inline-block;
}
}
}
@ -1161,7 +1135,6 @@ p.demo_store,
min-width: 80px;
}
/**
* Cart sidebar
*/
@ -1237,17 +1210,15 @@ p.demo_store,
}
}
.cart_list {
li {
padding-left: 2em;
position: relative;
padding-top: 0;
.cart_list li {
padding-left: 2em;
position: relative;
padding-top: 0;
a.remove {
position: absolute;
top: 0;
left: 0;
}
a.remove {
position: absolute;
top: 0;
left: 0;
}
}
@ -1263,101 +1234,99 @@ p.demo_store,
/**
* Forms
*/
form {
.form-row {
padding: 3px;
margin: 0 0 6px;
form .form-row {
padding: 3px;
margin: 0 0 6px;
[placeholder]:focus::-webkit-input-placeholder {
-webkit-transition: opacity 0.5s 0.5s ease;
-moz-transition: opacity 0.5s 0.5s ease;
transition: opacity 0.5s 0.5s ease;
opacity: 0;
}
[placeholder]:focus::-webkit-input-placeholder {
-webkit-transition: opacity 0.5s 0.5s ease;
-moz-transition: opacity 0.5s 0.5s ease;
transition: opacity 0.5s 0.5s ease;
opacity: 0;
}
label {
line-height: 2;
}
label.hidden {
visibility: hidden;
}
label.inline {
display: inline;
}
select {
cursor: pointer;
margin: 0;
}
.required {
color: red;
font-weight: 700;
border: 0;
}
.input-checkbox {
display: inline;
margin: -2px 8px 0 0;
text-align: center;
vertical-align: middle;
}
input.input-text,
textarea {
box-sizing: border-box;
width: 100%;
margin: 0;
outline: 0;
line-height: 1;
}
textarea {
height: 4em;
line-height: 1.5;
display: block;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.select2-container {
width: 100%;
line-height: 2em;
}
&.woocommerce-invalid {
label {
line-height: 2;
color: $red;
}
label.hidden {
visibility: hidden;
}
label.inline {
display: inline;
}
select {
cursor: pointer;
margin: 0;
}
.required {
color: red;
font-weight: 700;
border: 0;
}
.input-checkbox {
display: inline;
margin: -2px 8px 0 0;
text-align: center;
vertical-align: middle;
}
.select2-container,
input.input-text,
textarea {
box-sizing: border-box;
width: 100%;
margin: 0;
outline: 0;
line-height: 1;
select {
border-color: $red;
}
}
textarea {
height: 4em;
line-height: 1.5;
display: block;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
&.woocommerce-validated {
.select2-container,
input.input-text,
select {
border-color: $green - #111;
}
}
.select2-container {
width: 100%;
line-height: 2em;
}
::-webkit-input-placeholder {
line-height: normal;
}
&.woocommerce-invalid {
label {
color: $red;
}
.select2-container,
input.input-text,
select {
border-color: $red;
}
}
:-moz-placeholder {
line-height: normal;
}
&.woocommerce-validated {
.select2-container,
input.input-text,
select {
border-color: $green - #111;
}
}
::-webkit-input-placeholder {
line-height: normal;
}
:-moz-placeholder {
line-height: normal;
}
:-ms-input-placeholder {
line-height: normal;
}
:-ms-input-placeholder {
line-height: normal;
}
}
@ -1438,56 +1407,48 @@ p.demo_store,
/**
* Layered nav widget
*/
.widget_layered_nav {
ul {
margin: 0;
padding: 0;
border: 0;
list-style: none outside;
.widget_layered_nav ul {
margin: 0;
padding: 0;
border: 0;
list-style: none outside;
li {
@include clearfix();
padding: 0 0 1px;
list-style: none;
li {
@include clearfix();
padding: 0 0 1px;
list-style: none;
a,
span {
padding: 1px 0;
}
a,
span {
padding: 1px 0;
}
}
li.chosen {
a {
&::before {
@include iconbefore( '\e013' );
color: $red;
}
}
}
li.chosen a::before {
@include iconbefore( '\e013' );
color: $red;
}
}
.widget_layered_nav_filters {
ul {
margin: 0;
padding: 0;
border: 0;
list-style: none outside;
overflow: hidden;
zoom: 1;
.widget_layered_nav_filters ul {
margin: 0;
padding: 0;
border: 0;
list-style: none outside;
overflow: hidden;
zoom: 1;
li {
float: left;
padding: 0 1px 1px 0;
list-style: none;
li {
float: left;
padding: 0 1px 1px 0;
list-style: none;
a {
text-decoration: none;
a {
text-decoration: none;
&::before {
@include iconbefore( '\e013' );
color: $red;
}
&::before {
@include iconbefore( '\e013' );
color: $red;
}
}
}
@ -1508,9 +1469,6 @@ p.demo_store,
.button {
font-size: 1.15em;
}
.button {
float: left;
}
}
@ -1532,10 +1490,8 @@ p.demo_store,
cursor: ew-resize;
outline: none;
top: -0.3em;
//&:last-child {
/* rtl:ignore */
margin-left: -0.5em;
//}
}
.ui-slider .ui-slider-range {
@ -1575,38 +1531,32 @@ p.demo_store,
/**
* Rating Filter Widget
*/
.widget_rating_filter {
ul {
margin: 0;
padding: 0;
border: 0;
list-style: none outside;
.widget_rating_filter ul {
margin: 0;
padding: 0;
border: 0;
list-style: none outside;
li {
@include clearfix();
padding: 0 0 1px;
list-style: none;
li {
@include clearfix();
padding: 0 0 1px;
list-style: none;
a {
padding: 1px 0;
text-decoration: none;
}
.star-rating {
float: none;
display: inline-block;
}
a {
padding: 1px 0;
text-decoration: none;
}
li.chosen {
a {
&::before {
@include iconbefore( '\e013' );
color: $red;
}
}
.star-rating {
float: none;
display: inline-block;
}
}
li.chosen a::before {
@include iconbefore( '\e013' );
color: $red;
}
}
}
@ -1688,18 +1638,8 @@ button.pswp__button--zoom:hover {
/**
* Right to left styles
*/
.rtl {
&.woocommerce {
div.product {
div.images {
.flex-control-thumbs {
li {
float: right;
}
}
}
}
}
.rtl.woocommerce div.product div.images .flex-control-thumbs li {
float: right;
}
.woocommerce-message {
@ -1736,33 +1676,26 @@ button.pswp__button--zoom:hover {
@include clearfix();
}
.addresses {
.title {
@include clearfix();
.addresses .title {
@include clearfix();
h3 {
float: left;
}
h3 {
float: left;
}
.edit {
float: right;
}
.edit {
float: right;
}
}
ol.commentlist.notes {
li.note {
ol.commentlist.notes li.note {
p.meta {
font-weight: 700;
margin-bottom: 0;
}
p.meta {
font-weight: 700;
margin-bottom: 0;
}
.description {
p:last-child {
margin-bottom: 0;
}
}
.description p:last-child {
margin-bottom: 0;
}
}
ul.digital-downloads {
@ -1806,20 +1739,16 @@ button.pswp__button--zoom:hover {
vertical-align: middle;
}
td.actions {
.coupon {
.input-text {
float: left;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid darken( $secondary, 10% );
padding: 6px 6px 5px;
margin: 0 4px 0 0;
outline: 0;
line-height: 1;
}
}
td.actions .coupon .input-text {
float: left;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid darken( $secondary, 10% );
padding: 6px 6px 5px;
margin: 0 4px 0 0;
outline: 0;
line-height: 1;
}
input {
@ -1850,19 +1779,15 @@ button.pswp__button--zoom:hover {
display: block;
}
.shipping-calculator-button {
&::after {
@include iconafter( '\e019' );
}
.shipping-calculator-button::after {
@include iconafter( '\e019' );
}
}
.cart_totals {
p {
small {
color: $subtext;
font-size: 0.83em;
}
p small {
color: $subtext;
font-size: 0.83em;
}
table {
@ -1908,12 +1833,8 @@ button.pswp__button--zoom:hover {
}
}
.cross-sells {
ul.products {
li.product {
margin-top: 0;
}
}
.cross-sells ul.products li.product {
margin-top: 0;
}
}
.checkout {
@ -2163,75 +2084,50 @@ button.pswp__button--zoom:hover {
display: block;
}
/* added to get around variation image flicker issue */
.product.has-default-attributes.has-children {
> .images {
opacity: 0;
}
}
/**
* Twenty Eleven specific styles
*/
#content.twentyeleven {
.woocommerce-pagination {
a {
font-size: 1em;
line-height: 1;
}
}
#content.twentyeleven .woocommerce-pagination a {
font-size: 1em;
line-height: 1;
}
/**
* Twenty Thirteen specific styles
*/
.single-product {
.twentythirteen {
.entry-summary,
#reply-title,
#respond #commentform {
padding: 0;
}
.single-product .twentythirteen {
.entry-summary,
#reply-title,
#respond #commentform {
padding: 0;
}
p.stars {
clear: both;
}
p.stars {
clear: both;
}
}
.twentythirteen {
.woocommerce-breadcrumb {
padding-top: 40px;
}
.twentythirteen .woocommerce-breadcrumb {
padding-top: 40px;
}
/**
* Twenty Fourteen specific styles
*/
.twentyfourteen {
ul.products {
li.product {
margin-top: 0 !important;
}
}
.twentyfourteen ul.products li.product {
margin-top: 0 !important;
}
/**
* Twenty Sixteen specific styles
*/
body:not( .search-results ) {
.twentysixteen {
.entry-summary {
color: inherit;
font-size: inherit;
line-height: inherit;
}
}
body:not( .search-results ) .twentysixteen .entry-summary {
color: inherit;
font-size: inherit;
line-height: inherit;
}
.twentysixteen {
.price ins {
background: inherit;
color: inherit;
}
.twentysixteen .price ins {
background: inherit;
color: inherit;
}

View File

@ -240,10 +240,9 @@ jQuery( function ( $ ) {
.on( 'click', 'button.add-order-fee', this.add_fee )
.on( 'click', 'button.add-order-shipping', this.add_shipping )
.on( 'click', 'button.add-order-tax', this.add_tax )
.on( 'click', 'button.calculate-action', this.calculate_totals )
.on( 'click', 'button.save-action', this.save_line_items )
.on( 'click', 'a.delete-order-tax', this.delete_tax )
.on( 'click', 'button.calculate-tax-action', this.calculate_tax )
.on( 'click', 'button.calculate-action', this.recalculate )
.on( 'click', 'a.edit-order-item', this.edit_item )
.on( 'click', 'a.delete-order-item', this.delete_item )
.on( 'click', 'tr.item, tr.fee, tr.shipping, tr.refund', this.select_row )
@ -524,8 +523,8 @@ jQuery( function ( $ ) {
return false;
},
calculate_tax: function() {
if ( window.confirm( woocommerce_admin_meta_boxes.calc_line_taxes ) ) {
recalculate: function() {
if ( window.confirm( woocommerce_admin_meta_boxes.calc_totals ) ) {
wc_meta_boxes_order_items.block();
var country = '';
@ -575,49 +574,6 @@ jQuery( function ( $ ) {
return false;
},
calculate_totals: function() {
if ( window.confirm( woocommerce_admin_meta_boxes.calc_totals ) ) {
wc_meta_boxes_order_items.block();
// Get row totals
var line_totals = 0;
var tax = 0;
var shipping = 0;
$( '.woocommerce_order_items tr.shipping input.line_total' ).each(function() {
var cost = $( this ).val() || '0';
cost = accounting.unformat( cost, woocommerce_admin.mon_decimal_point );
shipping = shipping + parseFloat( cost );
});
$( '.woocommerce_order_items input.line_tax' ).each(function() {
var cost = $( this ).val() || '0';
cost = accounting.unformat( cost, woocommerce_admin.mon_decimal_point );
tax = tax + parseFloat( cost );
});
$( '.woocommerce_order_items tr.item, .woocommerce_order_items tr.fee' ).each(function() {
var line_total = $( this ).find( 'input.line_total' ).val() || '0';
line_totals = line_totals + accounting.unformat( line_total.replace( ',', '.' ) );
});
// Tax
if ( 'yes' === woocommerce_admin_meta_boxes.round_at_subtotal ) {
tax = parseFloat( accounting.toFixed( tax, woocommerce_admin_meta_boxes.rounding_precision ) );
}
// Set Total
$( '#_order_total' )
.val( accounting.formatNumber( line_totals + tax + shipping, woocommerce_admin_meta_boxes.currency_format_num_decimals, '', woocommerce_admin.mon_decimal_point ) )
.change();
$( 'button.save-action' ).click();
}
return false;
},
save_line_items: function() {
var data = {
order_id: woocommerce_admin_meta_boxes.post_id,
@ -837,8 +793,8 @@ jQuery( function ( $ ) {
var index = $items.find('tr').length + 1;
var $row = '<tr data-meta_id="0">' +
'<td>' +
'<input type="text" name="meta_key[' + $item.attr( 'data-order_item_id' ) + '][new-' + index + ']" />' +
'<textarea name="meta_value[' + $item.attr( 'data-order_item_id' ) + '][new-' + index + ']"></textarea>' +
'<input type="text" placeholder="' + woocommerce_admin_meta_boxes_order.placeholder_name + '" name="meta_key[' + $item.attr( 'data-order_item_id' ) + '][new-' + index + ']" />' +
'<textarea placeholder="' + woocommerce_admin_meta_boxes_order.placeholder_value + '" name="meta_value[' + $item.attr( 'data-order_item_id' ) + '][new-' + index + ']"></textarea>' +
'</td>' +
'<td width="1%"><button class="remove_order_item_meta button">&times;</button></td>' +
'</tr>';

File diff suppressed because one or more lines are too long

View File

@ -407,7 +407,7 @@ jQuery( function( $ ) {
window.alert( response.error );
} else if ( response.slug ) {
// Success.
$wrapper.find( 'select.attribute_values' ).append( '<option value="' + response.slug + '" selected="selected">' + response.name + '</option>' );
$wrapper.find( 'select.attribute_values' ).append( '<option value="' + response.term_id + '" selected="selected">' + response.name + '</option>' );
$wrapper.find( 'select.attribute_values' ).change();
}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*global ajaxurl, inlineEditPost, inlineEditL10n, woocommerce_admin */
/*global inlineEditPost, woocommerce_admin */
jQuery(function( $ ) {
$( '#the-list' ).on( 'click', '.editinline', function() {
@ -104,10 +104,6 @@ jQuery(function( $ ) {
$( 'input.text', '.inline-edit-row' ).val( '' );
$( '#woocommerce-fields' ).find( 'select' ).prop( 'selectedIndex', 0 );
$( '#woocommerce-fields-bulk' ).find( '.inline-edit-group .change-input' ).hide();
// Autosuggest product tags on bulk edit
var tax = 'product_tag';
$( 'tr.inline-editor textarea[name="tax_input[' + tax + ']"]' ).suggest( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma } );
});
$( '#wpbody' ).on( 'change', '#woocommerce-fields-bulk .inline-edit-group .change_to', function() {

View File

@ -1 +1 @@
jQuery(function(a){a("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var b=a(this).closest("tr").attr("id");b=b.replace("post-","");var c=a("#woocommerce_inline_"+b),d=c.find(".sku").text(),e=c.find(".regular_price").text(),f=c.find(".sale_price ").text(),g=c.find(".weight").text(),h=c.find(".length").text(),i=c.find(".width").text(),j=c.find(".height").text(),k=c.find(".shipping_class").text(),l=c.find(".visibility").text(),m=c.find(".stock_status").text(),n=c.find(".stock").text(),o=c.find(".featured").text(),p=c.find(".manage_stock").text(),q=c.find(".menu_order").text(),r=c.find(".tax_status").text(),s=c.find(".tax_class").text(),t=c.find(".backorders").text(),u=e.replace(".",woocommerce_admin.mon_decimal_point),v=f.replace(".",woocommerce_admin.mon_decimal_point);a('input[name="_sku"]',".inline-edit-row").val(d),a('input[name="_regular_price"]',".inline-edit-row").val(u),a('input[name="_sale_price"]',".inline-edit-row").val(v),a('input[name="_weight"]',".inline-edit-row").val(g),a('input[name="_length"]',".inline-edit-row").val(h),a('input[name="_width"]',".inline-edit-row").val(i),a('input[name="_height"]',".inline-edit-row").val(j),a('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).change(),a('select[name="_shipping_class"] option[value="'+k+'"]').attr("selected","selected").change(),a('input[name="_stock"]',".inline-edit-row").val(n),a('input[name="menu_order"]',".inline-edit-row").val(q),a('select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').removeAttr("selected"),a('select[name="_tax_status"] option[value="'+r+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_tax_class"] option[value="'+s+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_visibility"] option[value="'+l+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_stock_status"] option[value="'+m+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_backorders"] option[value="'+t+'"]',".inline-edit-row").attr("selected","selected"),"yes"===o?a('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):a('input[name="_featured"]',".inline-edit-row").removeAttr("checked"),"yes"===p?(a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"),a('input[name="_manage_stock"]',".inline-edit-row").attr("checked","checked")):(a(".stock_qty_field",".inline-edit-row").hide(),a('input[name="_manage_stock"]',".inline-edit-row").removeAttr("checked"));var w=c.find(".product_type").text(),x=c.find(".product_is_virtual").text();"simple"===w||"external"===w?a(".price_fields",".inline-edit-row").show().removeAttr("style"):a(".price_fields",".inline-edit-row").hide(),"yes"===x?a(".dimension_fields",".inline-edit-row").hide():a(".dimension_fields",".inline-edit-row").show().removeAttr("style"),"grouped"===w?a(".stock_fields",".inline-edit-row").hide():a(".stock_fields",".inline-edit-row").show().removeAttr("style")}),a("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){a(this).is(":checked")?a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"):a(".stock_qty_field",".inline-edit-row").hide()}),a("#wpbody").on("click","#doaction, #doaction2",function(){a("input.text",".inline-edit-row").val(""),a("#woocommerce-fields").find("select").prop("selectedIndex",0),a("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide();var b="product_tag";a('tr.inline-editor textarea[name="tax_input['+b+']"]').suggest(ajaxurl+(ajaxurl.indexOf("?")>0?"&":"?")+"action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:!0,multipleSep:inlineEditL10n.comma})}),a("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0<a(this).val()?a(this).closest("div").find(".change-input").show():a(this).closest("div").find(".change-input").hide()})});
jQuery(function(a){a("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var b=a(this).closest("tr").attr("id");b=b.replace("post-","");var c=a("#woocommerce_inline_"+b),d=c.find(".sku").text(),e=c.find(".regular_price").text(),f=c.find(".sale_price ").text(),g=c.find(".weight").text(),h=c.find(".length").text(),i=c.find(".width").text(),j=c.find(".height").text(),k=c.find(".shipping_class").text(),l=c.find(".visibility").text(),m=c.find(".stock_status").text(),n=c.find(".stock").text(),o=c.find(".featured").text(),p=c.find(".manage_stock").text(),q=c.find(".menu_order").text(),r=c.find(".tax_status").text(),s=c.find(".tax_class").text(),t=c.find(".backorders").text(),u=e.replace(".",woocommerce_admin.mon_decimal_point),v=f.replace(".",woocommerce_admin.mon_decimal_point);a('input[name="_sku"]',".inline-edit-row").val(d),a('input[name="_regular_price"]',".inline-edit-row").val(u),a('input[name="_sale_price"]',".inline-edit-row").val(v),a('input[name="_weight"]',".inline-edit-row").val(g),a('input[name="_length"]',".inline-edit-row").val(h),a('input[name="_width"]',".inline-edit-row").val(i),a('input[name="_height"]',".inline-edit-row").val(j),a('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).change(),a('select[name="_shipping_class"] option[value="'+k+'"]').attr("selected","selected").change(),a('input[name="_stock"]',".inline-edit-row").val(n),a('input[name="menu_order"]',".inline-edit-row").val(q),a('select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').removeAttr("selected"),a('select[name="_tax_status"] option[value="'+r+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_tax_class"] option[value="'+s+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_visibility"] option[value="'+l+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_stock_status"] option[value="'+m+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_backorders"] option[value="'+t+'"]',".inline-edit-row").attr("selected","selected"),"yes"===o?a('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):a('input[name="_featured"]',".inline-edit-row").removeAttr("checked"),"yes"===p?(a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"),a('input[name="_manage_stock"]',".inline-edit-row").attr("checked","checked")):(a(".stock_qty_field",".inline-edit-row").hide(),a('input[name="_manage_stock"]',".inline-edit-row").removeAttr("checked"));var w=c.find(".product_type").text(),x=c.find(".product_is_virtual").text();"simple"===w||"external"===w?a(".price_fields",".inline-edit-row").show().removeAttr("style"):a(".price_fields",".inline-edit-row").hide(),"yes"===x?a(".dimension_fields",".inline-edit-row").hide():a(".dimension_fields",".inline-edit-row").show().removeAttr("style"),"grouped"===w?a(".stock_fields",".inline-edit-row").hide():a(".stock_fields",".inline-edit-row").show().removeAttr("style")}),a("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){a(this).is(":checked")?a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"):a(".stock_qty_field",".inline-edit-row").hide()}),a("#wpbody").on("click","#doaction, #doaction2",function(){a("input.text",".inline-edit-row").val(""),a("#woocommerce-fields").find("select").prop("selectedIndex",0),a("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide()}),a("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0<a(this).val()?a(this).closest("div").find(".change-input").show():a(this).closest("div").find(".change-input").hide()})});

View File

@ -110,6 +110,7 @@ jQuery(function( $ ) {
defaultDate: '',
dateFormat: 'yy-mm-dd',
numberOfMonths: 1,
minDate: '-20Y',
maxDate: '+0D',
showButtonPanel: true,
showOn: 'focus',

View File

@ -1 +1 @@
jQuery(function(a){function b(b,c,d){a('<div class="chart-tooltip">'+d+"</div>").css({top:c-16,left:b+20}).appendTo("body").fadeIn(200)}var c=null,d=null;a(".chart-placeholder").bind("plothover",function(e,f,g){if(g){if((c!==g.dataIndex||d!==g.seriesIndex)&&(c=g.dataIndex,d=g.seriesIndex,a(".chart-tooltip").remove(),g.series.points.show||g.series.enable_tooltip)){var h=g.series.data[g.dataIndex][1],i="";g.series.prepend_label&&(i=i+g.series.label+": "),g.series.prepend_tooltip&&(i+=g.series.prepend_tooltip),i+=h,g.series.append_tooltip&&(i+=g.series.append_tooltip),g.series.pie.show?b(f.pageX,f.pageY,i):b(g.pageX,g.pageY,i)}}else a(".chart-tooltip").remove(),c=null}),a(".wc_sparkline.bars").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),bars:{fillColor:a(this).data("color"),fill:!0,show:!0,lineWidth:1,barWidth:a(this).data("barwidth"),align:"center"},shadowSize:0}];a.plot(a(this),d,c)}),a(".wc_sparkline.lines").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),lines:{fill:!1,show:!0,lineWidth:1,align:"center"},shadowSize:0}];a.plot(a(this),d,c)});var e=a(".range_datepicker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,maxDate:"+0D",showButtonPanel:!0,showOn:"focus",buttonImageOnly:!0,onSelect:function(b){var c=a(this).is(".from")?"minDate":"maxDate",d=a(this).data("datepicker"),f=a.datepicker.parseDate(d.settings.dateFormat||a.datepicker._defaults.dateFormat,b,d.settings);e.not(this).datepicker("option",c,f)}}),f=document.createElement("a");"undefined"==typeof f.download&&a(".export_csv").hide(),a(".export_csv").click(function(){var b=a(this).data("exclude_series")||"";b=b.toString(),b=b.split(",");var c,d,e,f=a(this).data("xaxes"),g=a(this).data("groupby"),h=a(this).data("index_type"),i=a(this).data("export"),j="data:application/csv;charset=utf-8,";if("table"===i)a(this).offsetParent().find("thead tr,tbody tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();b=b.replace("[?]","").replace("#",""),j+='"'+b+'",'}),j=j.substring(0,j.length-1),j+="\n"}),a(this).offsetParent().find("tfoot tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();if(b=b.replace("[?]","").replace("#",""),j+='"'+b+'",',a(this).attr("colspan")>0)for(n=1;n<a(this).attr("colspan");n++)j+='"",'}),j=j.substring(0,j.length-1),j+="\n"});else{if(!window.main_chart)return!1;var k=window.main_chart.getData(),l=[];for(j+='"'+f+'",',a.each(k,function(c,d){b&&a.inArray(c.toString(),b)!==-1||l.push(d)}),c=0;c<l.length;++c)j+='"'+l[c].label+'",';j=j.substring(0,j.length-1),j+="\n";var m={};for(c=0;c<l.length;++c)for(d=l[c].data,e=0;e<d.length;++e){m[d[e][0]]=[];for(var n=0;n<l.length;++n)m[d[e][0]].push(0)}for(c=0;c<l.length;++c)for(d=l[c].data,e=0;e<d.length;++e)m[d[e][0]][c]=d[e][1];a.each(m,function(a,b){var c=new Date(parseInt(a,10));j+="none"===h?'"'+a+'",':"day"===g?'"'+c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+"-"+c.getUTCDate()+'",':'"'+c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+'",';for(var d=0;d<b.length;++d){var e=b[d];Math.round(e)!==e&&(e=parseFloat(e),e=e.toFixed(2)),j+='"'+e+'",'}j=j.substring(0,j.length-1),j+="\n"})}return a(this).attr("href",encodeURI(j)),!0})});
jQuery(function(a){function b(b,c,d){a('<div class="chart-tooltip">'+d+"</div>").css({top:c-16,left:b+20}).appendTo("body").fadeIn(200)}var c=null,d=null;a(".chart-placeholder").bind("plothover",function(e,f,g){if(g){if((c!==g.dataIndex||d!==g.seriesIndex)&&(c=g.dataIndex,d=g.seriesIndex,a(".chart-tooltip").remove(),g.series.points.show||g.series.enable_tooltip)){var h=g.series.data[g.dataIndex][1],i="";g.series.prepend_label&&(i=i+g.series.label+": "),g.series.prepend_tooltip&&(i+=g.series.prepend_tooltip),i+=h,g.series.append_tooltip&&(i+=g.series.append_tooltip),g.series.pie.show?b(f.pageX,f.pageY,i):b(g.pageX,g.pageY,i)}}else a(".chart-tooltip").remove(),c=null}),a(".wc_sparkline.bars").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),bars:{fillColor:a(this).data("color"),fill:!0,show:!0,lineWidth:1,barWidth:a(this).data("barwidth"),align:"center"},shadowSize:0}];a.plot(a(this),d,c)}),a(".wc_sparkline.lines").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),lines:{fill:!1,show:!0,lineWidth:1,align:"center"},shadowSize:0}];a.plot(a(this),d,c)});var e=a(".range_datepicker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,minDate:"-20Y",maxDate:"+0D",showButtonPanel:!0,showOn:"focus",buttonImageOnly:!0,onSelect:function(b){var c=a(this).is(".from")?"minDate":"maxDate",d=a(this).data("datepicker"),f=a.datepicker.parseDate(d.settings.dateFormat||a.datepicker._defaults.dateFormat,b,d.settings);e.not(this).datepicker("option",c,f)}}),f=document.createElement("a");"undefined"==typeof f.download&&a(".export_csv").hide(),a(".export_csv").click(function(){var b=a(this).data("exclude_series")||"";b=b.toString(),b=b.split(",");var c,d,e,f=a(this).data("xaxes"),g=a(this).data("groupby"),h=a(this).data("index_type"),i=a(this).data("export"),j="data:application/csv;charset=utf-8,";if("table"===i)a(this).offsetParent().find("thead tr,tbody tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();b=b.replace("[?]","").replace("#",""),j+='"'+b+'",'}),j=j.substring(0,j.length-1),j+="\n"}),a(this).offsetParent().find("tfoot tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();if(b=b.replace("[?]","").replace("#",""),j+='"'+b+'",',a(this).attr("colspan")>0)for(n=1;n<a(this).attr("colspan");n++)j+='"",'}),j=j.substring(0,j.length-1),j+="\n"});else{if(!window.main_chart)return!1;var k=window.main_chart.getData(),l=[];for(j+='"'+f+'",',a.each(k,function(c,d){b&&a.inArray(c.toString(),b)!==-1||l.push(d)}),c=0;c<l.length;++c)j+='"'+l[c].label+'",';j=j.substring(0,j.length-1),j+="\n";var m={};for(c=0;c<l.length;++c)for(d=l[c].data,e=0;e<d.length;++e){m[d[e][0]]=[];for(var n=0;n<l.length;++n)m[d[e][0]].push(0)}for(c=0;c<l.length;++c)for(d=l[c].data,e=0;e<d.length;++e)m[d[e][0]][c]=d[e][1];a.each(m,function(a,b){var c=new Date(parseInt(a,10));j+="none"===h?'"'+a+'",':"day"===g?'"'+c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+"-"+c.getUTCDate()+'",':'"'+c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+'",';for(var d=0;d<b.length;++d){var e=b[d];Math.round(e)!==e&&(e=parseFloat(e),e=e.toFixed(2)),j+='"'+e+'",'}j=j.substring(0,j.length-1),j+="\n"})}return a(this).attr("href",encodeURI(j)),!0})});

View File

@ -2,213 +2,216 @@
jQuery( function( $ ) {
function getEnhancedSelectFormatString() {
var formatString = {
noResults: function() {
return wc_enhanced_select_params.i18n_no_matches;
},
errorLoading: function() {
return wc_enhanced_select_params.i18n_ajax_error;
},
inputTooShort: function( args ) {
var remainingChars = args.minimum - args.input.length;
return {
'language': {
errorLoading: function() {
// Workaround for https://github.com/select2/select2/issues/4355 instead of i18n_ajax_error.
return wc_enhanced_select_params.i18n_searching;
},
inputTooLong: function( args ) {
var overChars = args.input.length - args.maximum;
if ( 1 === remainingChars ) {
return wc_enhanced_select_params.i18n_input_too_short_1;
if ( 1 === overChars ) {
return wc_enhanced_select_params.i18n_input_too_long_1;
}
return wc_enhanced_select_params.i18n_input_too_long_n.replace( '%qty%', overChars );
},
inputTooShort: function( args ) {
var remainingChars = args.minimum - args.input.length;
if ( 1 === remainingChars ) {
return wc_enhanced_select_params.i18n_input_too_short_1;
}
return wc_enhanced_select_params.i18n_input_too_short_n.replace( '%qty%', remainingChars );
},
loadingMore: function() {
return wc_enhanced_select_params.i18n_load_more;
},
maximumSelected: function( args ) {
if ( args.maximum === 1 ) {
return wc_enhanced_select_params.i18n_selection_too_long_1;
}
return wc_enhanced_select_params.i18n_selection_too_long_n.replace( '%qty%', args.maximum );
},
noResults: function() {
return wc_enhanced_select_params.i18n_no_matches;
},
searching: function() {
return wc_enhanced_select_params.i18n_searching;
}
return wc_enhanced_select_params.i18n_input_too_short_n.replace( '%qty%', remainingChars );
},
inputTooLong: function( args ) {
var overChars = args.input.length - args.maximum;
if ( 1 === overChars ) {
return wc_enhanced_select_params.i18n_input_too_long_1;
}
return wc_enhanced_select_params.i18n_input_too_long_n.replace( '%qty%', overChars );
},
maximumSelected: function( args ) {
if ( args.maximum === 1 ) {
return wc_enhanced_select_params.i18n_selection_too_long_1;
}
return wc_enhanced_select_params.i18n_selection_too_long_n.replace( '%qty%', args.maximum );
},
loadingMore: function() {
return wc_enhanced_select_params.i18n_load_more;
},
searching: function() {
return wc_enhanced_select_params.i18n_searching;
}
};
var language = { 'language' : formatString };
return language;
}
$( document.body )
try {
$( document.body )
.on( 'wc-enhanced-select-init', function() {
.on( 'wc-enhanced-select-init', function() {
// Regular select boxes
$( ':input.wc-enhanced-select, :input.chosen_select' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = $.extend({
minimumResultsForSearch: 10,
allowClear: $( this ).data( 'allow_clear' ) ? true : false,
placeholder: $( this ).data( 'placeholder' )
}, getEnhancedSelectFormatString() );
// Regular select boxes
$( ':input.wc-enhanced-select, :input.chosen_select' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = $.extend({
minimumResultsForSearch: 10,
allowClear: $( this ).data( 'allow_clear' ) ? true : false,
placeholder: $( this ).data( 'placeholder' )
}, getEnhancedSelectFormatString() );
$( this ).select2( select2_args ).addClass( 'enhanced' );
});
$( this ).select2( select2_args ).addClass( 'enhanced' );
});
$( ':input.wc-enhanced-select-nostd, :input.chosen_select_nostd' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = $.extend({
minimumResultsForSearch: 10,
allowClear: true,
placeholder: $( this ).data( 'placeholder' )
}, getEnhancedSelectFormatString() );
$( ':input.wc-enhanced-select-nostd, :input.chosen_select_nostd' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = $.extend({
minimumResultsForSearch: 10,
allowClear: true,
placeholder: $( this ).data( 'placeholder' )
}, getEnhancedSelectFormatString() );
$( this ).select2( select2_args ).addClass( 'enhanced' );
});
$( this ).select2( select2_args ).addClass( 'enhanced' );
});
// Ajax product search box
$( ':input.wc-product-search' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = {
allowClear: $( this ).data( 'allow_clear' ) ? true : false,
placeholder: $( this ).data( 'placeholder' ),
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
escapeMarkup: function( m ) {
return m;
},
ajax: {
url: wc_enhanced_select_params.ajax_url,
dataType: 'json',
quietMillis: 250,
data: function( params ) {
return {
term: params.term,
action: $( this ).data( 'action' ) || 'woocommerce_json_search_products_and_variations',
security: wc_enhanced_select_params.search_products_nonce,
exclude: $( this ).data( 'exclude' ),
include: $( this ).data( 'include' ),
limit: $( this ).data( 'limit' )
};
// Ajax product search box
$( ':input.wc-product-search' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = {
allowClear: $( this ).data( 'allow_clear' ) ? true : false,
placeholder: $( this ).data( 'placeholder' ),
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
escapeMarkup: function( m ) {
return m;
},
processResults: function( data ) {
var terms = [];
if ( data ) {
$.each( data, function( id, text ) {
terms.push( { id: id, text: text } );
});
}
return {
results: terms
};
},
cache: true
}
};
select2_args = $.extend( select2_args, getEnhancedSelectFormatString() );
$( this ).select2( select2_args ).addClass( 'enhanced' );
if ( $( this ).data( 'sortable' ) ) {
var $select = $(this);
var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
$list.sortable({
placeholder : 'ui-state-highlight select2-selection__choice',
forcePlaceholderSize: true,
items : 'li:not(.select2-search__field)',
tolerance : 'pointer',
stop: function() {
$( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function() {
var id = $( this ).data( 'data' ).id;
var option = $select.find( 'option[value="' + id + '"]' )[0];
$select.prepend( option );
} );
}
});
}
});
// Ajax customer search boxes
$( ':input.wc-customer-search' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = {
allowClear: $( this ).data( 'allow_clear' ) ? true : false,
placeholder: $( this ).data( 'placeholder' ),
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
escapeMarkup: function( m ) {
return m;
},
ajax: {
url: wc_enhanced_select_params.ajax_url,
dataType: 'json',
quietMillis: 250,
data: function( params ) {
return {
term: params.term,
action: 'woocommerce_json_search_customers',
security: wc_enhanced_select_params.search_customers_nonce,
exclude: $( this ).data( 'exclude' )
};
},
processResults: function( data ) {
var terms = [];
if ( data ) {
$.each( data, function( id, text ) {
terms.push({
id: id,
text: text
ajax: {
url: wc_enhanced_select_params.ajax_url,
dataType: 'json',
delay: 250,
data: function( params ) {
return {
term: params.term,
action: $( this ).data( 'action' ) || 'woocommerce_json_search_products_and_variations',
security: wc_enhanced_select_params.search_products_nonce,
exclude: $( this ).data( 'exclude' ),
include: $( this ).data( 'include' ),
limit: $( this ).data( 'limit' )
};
},
processResults: function( data ) {
var terms = [];
if ( data ) {
$.each( data, function( id, text ) {
terms.push( { id: id, text: text } );
});
});
}
return {
results: terms
};
},
cache: true
}
};
select2_args = $.extend( select2_args, getEnhancedSelectFormatString() );
$( this ).select2( select2_args ).addClass( 'enhanced' );
if ( $( this ).data( 'sortable' ) ) {
var $select = $(this);
var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
$list.sortable({
placeholder : 'ui-state-highlight select2-selection__choice',
forcePlaceholderSize: true,
items : 'li:not(.select2-search__field)',
tolerance : 'pointer',
stop: function() {
$( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function() {
var id = $( this ).data( 'data' ).id;
var option = $select.find( 'option[value="' + id + '"]' )[0];
$select.prepend( option );
} );
}
return {
results: terms
};
},
cache: true
}
});
}
});
})
};
// WooCommerce Backbone Modal
.on( 'wc_backbone_modal_before_remove', function() {
$( '.wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search' ).filter( '.select2-hidden-accessible' ).select2( 'close' );
})
select2_args = $.extend( select2_args, getEnhancedSelectFormatString() );
.trigger( 'wc-enhanced-select-init' );
$( this ).select2( select2_args ).addClass( 'enhanced' );
$( 'html' ).on( 'click', function( event ) {
if ( this === event.target ) {
$( '.wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search' ).filter( '.select2-hidden-accessible' ).select2( 'close' );
}
} );
if ( $( this ).data( 'sortable' ) ) {
var $select = $(this);
var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
$list.sortable({
placeholder : 'ui-state-highlight select2-selection__choice',
forcePlaceholderSize: true,
items : 'li:not(.select2-search__field)',
tolerance : 'pointer',
stop: function() {
$( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function() {
var id = $( this ).data( 'data' ).id;
var option = $select.find( 'option[value="' + id + '"]' )[0];
$select.prepend( option );
} );
}
});
}
});
// Ajax customer search boxes
$( ':input.wc-customer-search' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = {
allowClear: $( this ).data( 'allow_clear' ) ? true : false,
placeholder: $( this ).data( 'placeholder' ),
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '1',
escapeMarkup: function( m ) {
return m;
},
ajax: {
url: wc_enhanced_select_params.ajax_url,
dataType: 'json',
delay: 250,
data: function( params ) {
return {
term: params.term,
action: 'woocommerce_json_search_customers',
security: wc_enhanced_select_params.search_customers_nonce,
exclude: $( this ).data( 'exclude' )
};
},
processResults: function( data ) {
var terms = [];
if ( data ) {
$.each( data, function( id, text ) {
terms.push({
id: id,
text: text
});
});
}
return {
results: terms
};
},
cache: true
}
};
select2_args = $.extend( select2_args, getEnhancedSelectFormatString() );
$( this ).select2( select2_args ).addClass( 'enhanced' );
if ( $( this ).data( 'sortable' ) ) {
var $select = $(this);
var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
$list.sortable({
placeholder : 'ui-state-highlight select2-selection__choice',
forcePlaceholderSize: true,
items : 'li:not(.select2-search__field)',
tolerance : 'pointer',
stop: function() {
$( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function() {
var id = $( this ).data( 'data' ).id;
var option = $select.find( 'option[value="' + id + '"]' )[0];
$select.prepend( option );
} );
}
});
}
});
})
// WooCommerce Backbone Modal
.on( 'wc_backbone_modal_before_remove', function() {
$( '.wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search' ).filter( '.select2-hidden-accessible' ).select2( 'close' );
})
.trigger( 'wc-enhanced-select-init' );
$( 'html' ).on( 'click', function( event ) {
if ( this === event.target ) {
$( '.wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search' ).filter( '.select2-hidden-accessible' ).select2( 'close' );
}
} );
} catch( err ) {
// If select2 failed (conflict?) log the error but don't stop other scripts breaking.
window.console.log( err );
}
});

View File

@ -1 +1 @@
jQuery(function(a){function b(){var a={noResults:function(){return wc_enhanced_select_params.i18n_no_matches},errorLoading:function(){return wc_enhanced_select_params.i18n_ajax_error},inputTooShort:function(a){var b=a.minimum-a.input.length;return 1===b?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",b)},inputTooLong:function(a){var b=a.input.length-a.maximum;return 1===b?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",b)},maximumSelected:function(a){return 1===a.maximum?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",a.maximum)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},searching:function(){return wc_enhanced_select_params.i18n_searching}},b={language:a};return b}a(document.body).on("wc-enhanced-select-init",function(){a(":input.wc-enhanced-select, :input.chosen_select").filter(":not(.enhanced)").each(function(){var c=a.extend({minimumResultsForSearch:10,allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder")},b());a(this).select2(c).addClass("enhanced")}),a(":input.wc-enhanced-select-nostd, :input.chosen_select_nostd").filter(":not(.enhanced)").each(function(){var c=a.extend({minimumResultsForSearch:10,allowClear:!0,placeholder:a(this).data("placeholder")},b());a(this).select2(c).addClass("enhanced")}),a(":input.wc-product-search").filter(":not(.enhanced)").each(function(){var c={allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):"3",escapeMarkup:function(a){return a},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",quietMillis:250,data:function(b){return{term:b.term,action:a(this).data("action")||"woocommerce_json_search_products_and_variations",security:wc_enhanced_select_params.search_products_nonce,exclude:a(this).data("exclude"),include:a(this).data("include"),limit:a(this).data("limit")}},processResults:function(b){var c=[];return b&&a.each(b,function(a,b){c.push({id:a,text:b})}),{results:c}},cache:!0}};if(c=a.extend(c,b()),a(this).select2(c).addClass("enhanced"),a(this).data("sortable")){var d=a(this),e=a(this).next(".select2-container").find("ul.select2-selection__rendered");e.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){a(e.find(".select2-selection__choice").get().reverse()).each(function(){var b=a(this).data("data").id,c=d.find('option[value="'+b+'"]')[0];d.prepend(c)})}})}}),a(":input.wc-customer-search").filter(":not(.enhanced)").each(function(){var c={allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):"3",escapeMarkup:function(a){return a},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",quietMillis:250,data:function(b){return{term:b.term,action:"woocommerce_json_search_customers",security:wc_enhanced_select_params.search_customers_nonce,exclude:a(this).data("exclude")}},processResults:function(b){var c=[];return b&&a.each(b,function(a,b){c.push({id:a,text:b})}),{results:c}},cache:!0}};if(c=a.extend(c,b()),a(this).select2(c).addClass("enhanced"),a(this).data("sortable")){var d=a(this),e=a(this).next(".select2-container").find("ul.select2-selection__rendered");e.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){a(e.find(".select2-selection__choice").get().reverse()).each(function(){var b=a(this).data("data").id,c=d.find('option[value="'+b+'"]')[0];d.prepend(c)})}})}})}).on("wc_backbone_modal_before_remove",function(){a(".wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search").filter(".select2-hidden-accessible").select2("close")}).trigger("wc-enhanced-select-init"),a("html").on("click",function(b){this===b.target&&a(".wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search").filter(".select2-hidden-accessible").select2("close")})});
jQuery(function(a){function b(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(a){var b=a.input.length-a.maximum;return 1===b?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",b)},inputTooShort:function(a){var b=a.minimum-a.input.length;return 1===b?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",b)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(a){return 1===a.maximum?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",a.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}try{a(document.body).on("wc-enhanced-select-init",function(){a(":input.wc-enhanced-select, :input.chosen_select").filter(":not(.enhanced)").each(function(){var c=a.extend({minimumResultsForSearch:10,allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder")},b());a(this).select2(c).addClass("enhanced")}),a(":input.wc-enhanced-select-nostd, :input.chosen_select_nostd").filter(":not(.enhanced)").each(function(){var c=a.extend({minimumResultsForSearch:10,allowClear:!0,placeholder:a(this).data("placeholder")},b());a(this).select2(c).addClass("enhanced")}),a(":input.wc-product-search").filter(":not(.enhanced)").each(function(){var c={allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):"3",escapeMarkup:function(a){return a},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(b){return{term:b.term,action:a(this).data("action")||"woocommerce_json_search_products_and_variations",security:wc_enhanced_select_params.search_products_nonce,exclude:a(this).data("exclude"),include:a(this).data("include"),limit:a(this).data("limit")}},processResults:function(b){var c=[];return b&&a.each(b,function(a,b){c.push({id:a,text:b})}),{results:c}},cache:!0}};if(c=a.extend(c,b()),a(this).select2(c).addClass("enhanced"),a(this).data("sortable")){var d=a(this),e=a(this).next(".select2-container").find("ul.select2-selection__rendered");e.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){a(e.find(".select2-selection__choice").get().reverse()).each(function(){var b=a(this).data("data").id,c=d.find('option[value="'+b+'"]')[0];d.prepend(c)})}})}}),a(":input.wc-customer-search").filter(":not(.enhanced)").each(function(){var c={allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):"1",escapeMarkup:function(a){return a},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(b){return{term:b.term,action:"woocommerce_json_search_customers",security:wc_enhanced_select_params.search_customers_nonce,exclude:a(this).data("exclude")}},processResults:function(b){var c=[];return b&&a.each(b,function(a,b){c.push({id:a,text:b})}),{results:c}},cache:!0}};if(c=a.extend(c,b()),a(this).select2(c).addClass("enhanced"),a(this).data("sortable")){var d=a(this),e=a(this).next(".select2-container").find("ul.select2-selection__rendered");e.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){a(e.find(".select2-selection__choice").get().reverse()).each(function(){var b=a(this).data("data").id,c=d.find('option[value="'+b+'"]')[0];d.prepend(c)})}})}})}).on("wc_backbone_modal_before_remove",function(){a(".wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search").filter(".select2-hidden-accessible").select2("close")}).trigger("wc-enhanced-select-init"),a("html").on("click",function(b){this===b.target&&a(".wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search").filter(".select2-hidden-accessible").select2("close")})}catch(a){window.console.log(a)}});

View File

@ -174,9 +174,6 @@
// Show reset link.
form.toggleResetLink( attributes.chosenCount > 0 );
// added to get around variation image flicker issue
$( '.product.has-default-attributes > .images' ).fadeTo( 200, 1 );
};
/**
@ -564,11 +561,12 @@
$product_img.wc_set_variation_attr( 'sizes', variation.image.sizes );
$product_img.wc_set_variation_attr( 'title', variation.image.title );
$product_img.wc_set_variation_attr( 'alt', variation.image.alt );
$product_img.wc_set_variation_attr( 'data-src', variation.image.full_src );
$product_img.wc_set_variation_attr( 'data-large_image', variation.image.full_src );
$product_img.wc_set_variation_attr( 'data-large_image_width', variation.image.full_src_w );
$product_img.wc_set_variation_attr( 'data-large_image_height', variation.image.full_src_h );
$product_img_wrap.wc_set_variation_attr( 'data-thumb', variation.image.src );
$gallery_img.wc_set_variation_attr( 'src', variation.image.src );
$gallery_img.wc_set_variation_attr( 'src', variation.image.thumb_src );
$product_link.wc_set_variation_attr( 'href', variation.image.full_src );
} else {
$product_img.wc_reset_variation_attr( 'src' );
@ -578,6 +576,7 @@
$product_img.wc_reset_variation_attr( 'sizes' );
$product_img.wc_reset_variation_attr( 'title' );
$product_img.wc_reset_variation_attr( 'alt' );
$product_img.wc_reset_variation_attr( 'data-src' );
$product_img.wc_reset_variation_attr( 'data-large_image' );
$product_img.wc_reset_variation_attr( 'data-large_image_width' );
$product_img.wc_reset_variation_attr( 'data-large_image_height' );

File diff suppressed because one or more lines are too long

View File

@ -107,6 +107,8 @@ jQuery( function( $ ) {
$.each( fragments, function( key, value ) {
$( key ).replaceWith( value );
});
$( document.body ).trigger( 'wc_fragments_loaded' );
}
// Unblock.

View File

@ -1,4 +1,4 @@
/*!
* WooCommerce Add to Cart JS
*/
jQuery(function(a){return"undefined"!=typeof wc_add_to_cart_params&&(a(document).on("click",".add_to_cart_button",function(){var b=a(this);if(b.is(".ajax_add_to_cart")){if(!b.attr("data-product_id"))return!0;b.removeClass("added"),b.addClass("loading");var c={};return a.each(b.data(),function(a,b){c[a]=b}),a(document.body).trigger("adding_to_cart",[b,c]),a.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),c,function(c){if(c)return c.error&&c.product_url?void(window.location=c.product_url):"yes"===wc_add_to_cart_params.cart_redirect_after_add?void(window.location=wc_add_to_cart_params.cart_url):void a(document.body).trigger("added_to_cart",[c.fragments,c.cart_hash,b])}),!1}return!0}),void a(document.body).on("added_to_cart",function(b,c,d,e){var f=window.location.toString().replace("add-to-cart","added-to-cart");e="undefined"!=typeof e&&e,e&&e.removeClass("loading"),c&&a.each(c,function(b){a(b).addClass("updating")}),a(".shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}}),e&&(e.addClass("added"),wc_add_to_cart_params.is_cart||0!==e.parent().find(".added_to_cart").length||e.after(' <a href="'+wc_add_to_cart_params.cart_url+'" class="added_to_cart wc-forward" title="'+wc_add_to_cart_params.i18n_view_cart+'">'+wc_add_to_cart_params.i18n_view_cart+"</a>")),c&&a.each(c,function(b,c){a(b).replaceWith(c)}),a(".widget_shopping_cart, .updating").stop(!0).css("opacity","1").unblock(),a(".shop_table.cart").load(f+" .shop_table.cart:eq(0) > *",function(){a(".shop_table.cart").stop(!0).css("opacity","1").unblock(),a(document.body).trigger("cart_page_refreshed")}),a(".cart_totals").load(f+" .cart_totals:eq(0) > *",function(){a(".cart_totals").stop(!0).css("opacity","1").unblock()})}))});
jQuery(function(a){return"undefined"!=typeof wc_add_to_cart_params&&(a(document).on("click",".add_to_cart_button",function(){var b=a(this);if(b.is(".ajax_add_to_cart")){if(!b.attr("data-product_id"))return!0;b.removeClass("added"),b.addClass("loading");var c={};return a.each(b.data(),function(a,b){c[a]=b}),a(document.body).trigger("adding_to_cart",[b,c]),a.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),c,function(c){if(c)return c.error&&c.product_url?void(window.location=c.product_url):"yes"===wc_add_to_cart_params.cart_redirect_after_add?void(window.location=wc_add_to_cart_params.cart_url):void a(document.body).trigger("added_to_cart",[c.fragments,c.cart_hash,b])}),!1}return!0}),void a(document.body).on("added_to_cart",function(b,c,d,e){var f=window.location.toString().replace("add-to-cart","added-to-cart");e="undefined"!=typeof e&&e,e&&e.removeClass("loading"),c&&a.each(c,function(b){a(b).addClass("updating")}),a(".shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}}),e&&(e.addClass("added"),wc_add_to_cart_params.is_cart||0!==e.parent().find(".added_to_cart").length||e.after(' <a href="'+wc_add_to_cart_params.cart_url+'" class="added_to_cart wc-forward" title="'+wc_add_to_cart_params.i18n_view_cart+'">'+wc_add_to_cart_params.i18n_view_cart+"</a>")),c&&(a.each(c,function(b,c){a(b).replaceWith(c)}),a(document.body).trigger("wc_fragments_loaded")),a(".widget_shopping_cart, .updating").stop(!0).css("opacity","1").unblock(),a(".shop_table.cart").load(f+" .shop_table.cart:eq(0) > *",function(){a(".shop_table.cart").stop(!0).css("opacity","1").unblock(),a(document.body).trigger("cart_page_refreshed")}),a(".cart_totals").load(f+" .cart_totals:eq(0) > *",function(){a(".cart_totals").stop(!0).css("opacity","1").unblock()})}))});

View File

@ -74,10 +74,10 @@ jQuery( function( $ ) {
}
}
if ( thislocale[ key ].sort ) {
field.data( 'priority', thislocale[ key ].sort );
} else if ( locale['default'][ key ].sort ) {
field.data( 'priority', locale['default'][ key ].sort );
if ( thislocale[ key ].priority ) {
field.data( 'priority', thislocale[ key ].priority );
} else if ( locale['default'][ key ].priority ) {
field.data( 'priority', locale['default'][ key ].priority );
}
} else if ( locale['default'][ key ] ) {
@ -106,8 +106,8 @@ jQuery( function( $ ) {
}
}
if ( locale['default'][ key ].sort ) {
field.data( 'priority', locale['default'][ key ].sort );
if ( locale['default'][ key ].priority ) {
field.data( 'priority', locale['default'][ key ].priority );
}
}

View File

@ -1 +1 @@
jQuery(function(a){function b(a,b){b?(a.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),a.addClass("validate-required")):(a.find("label abbr").remove(),a.removeClass("validate-required"))}if("undefined"==typeof wc_address_i18n_params)return!1;var c=wc_address_i18n_params.locale.replace(/&quot;/g,'"'),d=a.parseJSON(c);a(document.body).bind("country_to_state_changing",function(c,e,f){var g,h=f;g="undefined"!=typeof d[e]?d[e]:d.default;var i=h.find("#billing_postcode_field, #shipping_postcode_field"),j=h.find("#billing_city_field, #shipping_city_field"),k=h.find("#billing_state_field, #shipping_state_field");i.attr("data-o_class")||(i.attr("data-o_class",i.attr("class")),j.attr("data-o_class",j.attr("class")),k.attr("data-o_class",k.attr("class")));var l=a.parseJSON(wc_address_i18n_params.locale_fields);a.each(l,function(a,c){var e=h.find(c);g[a]?(g[a].label&&e.find("label").html(g[a].label),g[a].placeholder&&e.find("input").attr("placeholder",g[a].placeholder),b(e,!1),"undefined"==typeof g[a].required&&d.default[a].required===!0?b(e,!0):g[a].required===!0&&b(e,!0),"state"!==a&&(g[a].hidden===!0?e.hide().find("input").val(""):e.show()),g[a].sort?e.data("priority",g[a].sort):d.default[a].sort&&e.data("priority",d.default[a].sort)):d.default[a]&&("state"!==a&&("undefined"==typeof d.default[a].hidden||d.default[a].hidden===!1?e.show():d.default[a].hidden===!0&&e.hide().find("input").val("")),"postcode"!==a&&"city"!==a&&"state"!==a||(d.default[a].label&&e.find("label").html(d.default[a].label),d.default[a].placeholder&&e.find("input").attr("placeholder",d.default[a].placeholder)),d.default[a].required===!0&&0===e.find("label abbr").length&&b(e,!0),d.default[a].sort&&e.data("priority",d.default[a].sort))});var m=a(".woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper, .woocommerce-address-fields__field-wrapper, .woocommerce-additional-fields__field-wrapper .woocommerce-account-fields");m.each(function(b,c){var d=a(c).find(".form-row"),e=d.first().parent(),f=0;d.each(function(){a(this).data("priority")||a(this).data("priority",f+1),f=a(this).data("priority")}),d.sort(function(b,c){var d=a(b).data("priority"),e=a(c).data("priority");return d>e?1:d<e?-1:0}),d.detach().appendTo(e)})})});
jQuery(function(a){function b(a,b){b?(a.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),a.addClass("validate-required")):(a.find("label abbr").remove(),a.removeClass("validate-required"))}if("undefined"==typeof wc_address_i18n_params)return!1;var c=wc_address_i18n_params.locale.replace(/&quot;/g,'"'),d=a.parseJSON(c);a(document.body).bind("country_to_state_changing",function(c,e,f){var g,h=f;g="undefined"!=typeof d[e]?d[e]:d.default;var i=h.find("#billing_postcode_field, #shipping_postcode_field"),j=h.find("#billing_city_field, #shipping_city_field"),k=h.find("#billing_state_field, #shipping_state_field");i.attr("data-o_class")||(i.attr("data-o_class",i.attr("class")),j.attr("data-o_class",j.attr("class")),k.attr("data-o_class",k.attr("class")));var l=a.parseJSON(wc_address_i18n_params.locale_fields);a.each(l,function(a,c){var e=h.find(c);g[a]?(g[a].label&&e.find("label").html(g[a].label),g[a].placeholder&&e.find("input").attr("placeholder",g[a].placeholder),b(e,!1),"undefined"==typeof g[a].required&&d.default[a].required===!0?b(e,!0):g[a].required===!0&&b(e,!0),"state"!==a&&(g[a].hidden===!0?e.hide().find("input").val(""):e.show()),g[a].priority?e.data("priority",g[a].priority):d.default[a].priority&&e.data("priority",d.default[a].priority)):d.default[a]&&("state"!==a&&("undefined"==typeof d.default[a].hidden||d.default[a].hidden===!1?e.show():d.default[a].hidden===!0&&e.hide().find("input").val("")),"postcode"!==a&&"city"!==a&&"state"!==a||(d.default[a].label&&e.find("label").html(d.default[a].label),d.default[a].placeholder&&e.find("input").attr("placeholder",d.default[a].placeholder)),d.default[a].required===!0&&0===e.find("label abbr").length&&b(e,!0),d.default[a].priority&&e.data("priority",d.default[a].priority))});var m=a(".woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper, .woocommerce-address-fields__field-wrapper, .woocommerce-additional-fields__field-wrapper .woocommerce-account-fields");m.each(function(b,c){var d=a(c).find(".form-row"),e=d.first().parent(),f=0;d.each(function(){a(this).data("priority")||a(this).data("priority",f+1),f=a(this).data("priority")}),d.sort(function(b,c){var d=a(b).data("priority"),e=a(c).data("priority");return d>e?1:d<e?-1:0}),d.detach().appendTo(e)})})});

View File

@ -7,48 +7,48 @@ jQuery( function( $ ) {
}
function getEnhancedSelectFormatString() {
var formatString = {
noResults: function() {
return wc_country_select_params.i18n_no_matches;
},
errorLoading: function() {
return wc_country_select_params.i18n_ajax_error;
},
inputTooShort: function( args ) {
var remainingChars = args.minimum - args.input.length;
return {
'language': {
errorLoading: function() {
// Workaround for https://github.com/select2/select2/issues/4355 instead of i18n_ajax_error.
return wc_country_select_params.i18n_searching;
},
inputTooLong: function( args ) {
var overChars = args.input.length - args.maximum;
if ( 1 === remainingChars ) {
return wc_country_select_params.i18n_input_too_short_1;
if ( 1 === overChars ) {
return wc_country_select_params.i18n_input_too_long_1;
}
return wc_country_select_params.i18n_input_too_long_n.replace( '%qty%', overChars );
},
inputTooShort: function( args ) {
var remainingChars = args.minimum - args.input.length;
if ( 1 === remainingChars ) {
return wc_country_select_params.i18n_input_too_short_1;
}
return wc_country_select_params.i18n_input_too_short_n.replace( '%qty%', remainingChars );
},
loadingMore: function() {
return wc_country_select_params.i18n_load_more;
},
maximumSelected: function( args ) {
if ( args.maximum === 1 ) {
return wc_country_select_params.i18n_selection_too_long_1;
}
return wc_country_select_params.i18n_selection_too_long_n.replace( '%qty%', args.maximum );
},
noResults: function() {
return wc_country_select_params.i18n_no_matches;
},
searching: function() {
return wc_country_select_params.i18n_searching;
}
return wc_country_select_params.i18n_input_too_short_n.replace( '%qty%', remainingChars );
},
inputTooLong: function( args ) {
var overChars = args.input.length - args.maximum;
if ( 1 === overChars ) {
return wc_country_select_params.i18n_input_too_long_1;
}
return wc_country_select_params.i18n_input_too_long_n.replace( '%qty%', overChars );
},
maximumSelected: function( args ) {
if ( 1 === args.maximum ) {
return wc_country_select_params.i18n_selection_too_long_1;
}
return wc_country_select_params.i18n_selection_too_long_n.replace( '%qty%', args.maximum );
},
loadingMore: function() {
return wc_country_select_params.i18n_load_more;
},
searching: function() {
return wc_country_select_params.i18n_searching;
}
};
var language = { 'language' : formatString };
return language;
}
// Select2 Enhancement if it exists

View File

@ -1 +1 @@
jQuery(function(a){function b(){var a={noResults:function(){return wc_country_select_params.i18n_no_matches},errorLoading:function(){return wc_country_select_params.i18n_ajax_error},inputTooShort:function(a){var b=a.minimum-a.input.length;return 1===b?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",b)},inputTooLong:function(a){var b=a.input.length-a.maximum;return 1===b?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",b)},maximumSelected:function(a){return 1===a.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",a.maximum)},loadingMore:function(){return wc_country_select_params.i18n_load_more},searching:function(){return wc_country_select_params.i18n_searching}},b={language:a};return b}if("undefined"==typeof wc_country_select_params)return!1;if(a().select2){var c=function(){a("select.country_select:visible, select.state_select:visible").each(function(){var c=a.extend({placeholderOption:"first",width:"100%"},b());a(this).select2(c),a(this).on("select2:select",function(){a(this).focus()})})};c(),a(document.body).bind("country_to_state_changed",function(){c()})}var d=wc_country_select_params.countries.replace(/&quot;/g,'"'),e=a.parseJSON(d);a(document.body).on("change","select.country_to_state, input.country_to_state",function(){var b=a(this).closest(".woocommerce-billing-fields, .woocommerce-shipping-fields, .woocommerce-shipping-calculator");b.length||(b=a(this).closest(".form-row").parent());var c=a(this).val(),d=b.find("#billing_state, #shipping_state, #calc_shipping_state"),f=d.parent(),g=d.attr("name"),h=d.attr("id"),i=d.val(),j=d.attr("placeholder")||d.attr("data-placeholder")||"";if(e[c])if(a.isEmptyObject(e[c]))d.parent().hide().find(".select2-container").remove(),d.replaceWith('<input type="hidden" class="hidden" name="'+g+'" id="'+h+'" value="" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]);else{var k="",l=e[c];for(var m in l)l.hasOwnProperty(m)&&(k=k+'<option value="'+m+'">'+l[m]+"</option>");d.parent().show(),d.is("input")&&(d.replaceWith('<select name="'+g+'" id="'+h+'" class="state_select" data-placeholder="'+j+'"></select>'),d=b.find("#billing_state, #shipping_state, #calc_shipping_state")),d.html('<option value="">'+wc_country_select_params.i18n_select_state_text+"</option>"+k),d.val(i).change(),a(document.body).trigger("country_to_state_changed",[c,b])}else d.is("select")?(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b])):d.is('input[type="hidden"]')&&(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]));a(document.body).trigger("country_to_state_changing",[c,b])}),a(function(){a(":input.country_to_state").change()})});
jQuery(function(a){function b(){return{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(a){var b=a.input.length-a.maximum;return 1===b?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",b)},inputTooShort:function(a){var b=a.minimum-a.input.length;return 1===b?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",b)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(a){return 1===a.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",a.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}}}if("undefined"==typeof wc_country_select_params)return!1;if(a().select2){var c=function(){a("select.country_select:visible, select.state_select:visible").each(function(){var c=a.extend({placeholderOption:"first",width:"100%"},b());a(this).select2(c),a(this).on("select2:select",function(){a(this).focus()})})};c(),a(document.body).bind("country_to_state_changed",function(){c()})}var d=wc_country_select_params.countries.replace(/&quot;/g,'"'),e=a.parseJSON(d);a(document.body).on("change","select.country_to_state, input.country_to_state",function(){var b=a(this).closest(".woocommerce-billing-fields, .woocommerce-shipping-fields, .woocommerce-shipping-calculator");b.length||(b=a(this).closest(".form-row").parent());var c=a(this).val(),d=b.find("#billing_state, #shipping_state, #calc_shipping_state"),f=d.parent(),g=d.attr("name"),h=d.attr("id"),i=d.val(),j=d.attr("placeholder")||d.attr("data-placeholder")||"";if(e[c])if(a.isEmptyObject(e[c]))d.parent().hide().find(".select2-container").remove(),d.replaceWith('<input type="hidden" class="hidden" name="'+g+'" id="'+h+'" value="" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]);else{var k="",l=e[c];for(var m in l)l.hasOwnProperty(m)&&(k=k+'<option value="'+m+'">'+l[m]+"</option>");d.parent().show(),d.is("input")&&(d.replaceWith('<select name="'+g+'" id="'+h+'" class="state_select" data-placeholder="'+j+'"></select>'),d=b.find("#billing_state, #shipping_state, #calc_shipping_state")),d.html('<option value="">'+wc_country_select_params.i18n_select_state_text+"</option>"+k),d.val(i).change(),a(document.body).trigger("country_to_state_changed",[c,b])}else d.is("select")?(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b])):d.is('input[type="hidden"]')&&(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]));a(document.body).trigger("country_to_state_changing",[c,b])}),a(function(){a(":input.country_to_state").change()})});

View File

@ -77,6 +77,12 @@ jQuery( function( $ ) {
this.$target = $target;
this.$images = $( '.woocommerce-product-gallery__image', $target );
// No images? Abort.
if ( 0 === this.$images.length ) {
this.$target.css( 'opacity', 1 );
return;
}
// Make this object available.
$target.data( 'product_gallery', this );
@ -87,7 +93,7 @@ jQuery( function( $ ) {
// ...also taking args into account.
if ( args ) {
this.flexslider_enabled = false === args.photoswipe_enabled ? false : this.flexslider_enabled;
this.flexslider_enabled = false === args.flexslider_enabled ? false : this.flexslider_enabled;
this.zoom_enabled = false === args.zoom_enabled ? false : this.zoom_enabled;
this.photoswipe_enabled = false === args.photoswipe_enabled ? false : this.photoswipe_enabled;
}
@ -103,6 +109,8 @@ jQuery( function( $ ) {
if ( this.flexslider_enabled ) {
this.initFlexslider();
$target.on( 'woocommerce_gallery_reset_slide_position', this.onResetSlidePosition );
} else {
this.$target.css( 'opacity', 1 );
}
if ( this.zoom_enabled ) {
@ -119,9 +127,9 @@ jQuery( function( $ ) {
* Initialize flexSlider.
*/
ProductGallery.prototype.initFlexslider = function() {
var images = this.$images;
var $target = this.$target;
this.$target.flexslider( {
$target.flexslider( {
selector: '.woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image',
animation: wc_single_product_params.flexslider.animation,
smoothHeight: wc_single_product_params.flexslider.smoothHeight,
@ -131,19 +139,7 @@ jQuery( function( $ ) {
animationSpeed: wc_single_product_params.flexslider.animationSpeed,
animationLoop: wc_single_product_params.flexslider.animationLoop, // Breaks photoswipe pagination if true.
start: function() {
var largest_height = 0;
images.each( function() {
var height = $( this ).height();
if ( height > largest_height ) {
largest_height = height;
}
} );
images.each( function() {
$( this ).css( 'min-height', largest_height );
} );
$target.css( 'opacity', 1 );
}
} );
};
@ -163,7 +159,7 @@ jQuery( function( $ ) {
$( zoomTarget ).each( function( index, target ) {
var image = $( target ).find( 'img' );
if ( image.attr( 'width' ) > galleryWidth ) {
if ( image.data( 'large_image_width' ) > galleryWidth ) {
zoomEnabled = true;
return false;
}
@ -171,10 +167,16 @@ jQuery( function( $ ) {
// But only zoom if the img is larger than its container.
if ( zoomEnabled ) {
zoomTarget.trigger( 'zoom.destroy' );
zoomTarget.zoom( {
var zoom_options = {
touch: false
} );
};
if ( 'ontouchstart' in window ) {
zoom_options.on = 'click';
}
zoomTarget.trigger( 'zoom.destroy' );
zoomTarget.zoom( zoom_options );
}
};
@ -239,14 +241,9 @@ jQuery( function( $ ) {
clicked = this.$target.find( '.flex-active-slide' );
}
var options = {
index: $( clicked ).index(),
shareEl: false,
closeOnScroll: false,
history: false,
hideAnimationDuration: 0,
showAnimationDuration: 0
};
var options = $.extend( {
index: $( clicked ).index()
}, wc_single_product_params.photoswipe_options );
// Initializes and opens PhotoSwipe.
var photoswipe = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options );

File diff suppressed because one or more lines are too long

25
assets/js/js-cookie/js.cookie.js Normal file → Executable file
View File

@ -1,5 +1,5 @@
/*!
* JavaScript Cookie v2.1.3
* JavaScript Cookie v2.1.4
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
@ -56,6 +56,9 @@
attributes.expires = expires;
}
// We're using "expires" because "max-age" is not supported by IE
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
try {
result = JSON.stringify(value);
if (/^[\{\[]/.test(result)) {
@ -74,13 +77,19 @@
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
key = key.replace(/[\(\)]/g, escape);
return (document.cookie = [
key, '=', value,
attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
attributes.path ? '; path=' + attributes.path : '',
attributes.domain ? '; domain=' + attributes.domain : '',
attributes.secure ? '; secure' : ''
].join(''));
var stringifiedAttributes = '';
for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue;
}
stringifiedAttributes += '; ' + attributeName;
if (attributes[attributeName] === true) {
continue;
}
stringifiedAttributes += '=' + attributes[attributeName];
}
return (document.cookie = key + '=' + value + stringifiedAttributes);
}
// Read

View File

@ -1,8 +1,8 @@
/*!
* JavaScript Cookie v2.1.3
* JavaScript Cookie v2.1.4
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
!function(a){var b=!1;if("function"==typeof define&&define.amd&&(define(a),b=!0),"object"==typeof exports&&(module.exports=a(),b=!0),!b){var c=window.Cookies,d=window.Cookies=a();d.noConflict=function(){return window.Cookies=c,d}}}(function(){function a(){for(var a=0,b={};a<arguments.length;a++){var c=arguments[a];for(var d in c)b[d]=c[d]}return b}function b(c){function d(b,e,f){var g;if("undefined"!=typeof document){if(arguments.length>1){if(f=a({path:"/"},d.defaults,f),"number"==typeof f.expires){var h=new Date;h.setMilliseconds(h.getMilliseconds()+864e5*f.expires),f.expires=h}try{g=JSON.stringify(e),/^[\{\[]/.test(g)&&(e=g)}catch(a){}return e=c.write?c.write(e,b):encodeURIComponent(String(e)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),b=encodeURIComponent(String(b)),b=b.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),b=b.replace(/[\(\)]/g,escape),document.cookie=[b,"=",e,f.expires?"; expires="+f.expires.toUTCString():"",f.path?"; path="+f.path:"",f.domain?"; domain="+f.domain:"",f.secure?"; secure":""].join("")}b||(g={});for(var i=document.cookie?document.cookie.split("; "):[],j=/(%[0-9A-Z]{2})+/g,k=0;k<i.length;k++){var l=i[k].split("="),m=l.slice(1).join("=");'"'===m.charAt(0)&&(m=m.slice(1,-1));try{var n=l[0].replace(j,decodeURIComponent);if(m=c.read?c.read(m,n):c(m,n)||m.replace(j,decodeURIComponent),this.json)try{m=JSON.parse(m)}catch(a){}if(b===n){g=m;break}b||(g[n]=m)}catch(a){}}return g}}return d.set=d,d.get=function(a){return d.call(d,a)},d.getJSON=function(){return d.apply({json:!0},[].slice.call(arguments))},d.defaults={},d.remove=function(b,c){d(b,"",a(c,{expires:-1}))},d.withConverter=b,d}return b(function(){})});
!function(a){var b=!1;if("function"==typeof define&&define.amd&&(define(a),b=!0),"object"==typeof exports&&(module.exports=a(),b=!0),!b){var c=window.Cookies,d=window.Cookies=a();d.noConflict=function(){return window.Cookies=c,d}}}(function(){function a(){for(var a=0,b={};a<arguments.length;a++){var c=arguments[a];for(var d in c)b[d]=c[d]}return b}function b(c){function d(b,e,f){var g;if("undefined"!=typeof document){if(arguments.length>1){if(f=a({path:"/"},d.defaults,f),"number"==typeof f.expires){var h=new Date;h.setMilliseconds(h.getMilliseconds()+864e5*f.expires),f.expires=h}f.expires=f.expires?f.expires.toUTCString():"";try{g=JSON.stringify(e),/^[\{\[]/.test(g)&&(e=g)}catch(a){}e=c.write?c.write(e,b):encodeURIComponent(String(e)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),b=encodeURIComponent(String(b)),b=b.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),b=b.replace(/[\(\)]/g,escape);var i="";for(var j in f)f[j]&&(i+="; "+j,f[j]!==!0&&(i+="="+f[j]));return document.cookie=b+"="+e+i}b||(g={});for(var k=document.cookie?document.cookie.split("; "):[],l=/(%[0-9A-Z]{2})+/g,m=0;m<k.length;m++){var n=k[m].split("="),o=n.slice(1).join("=");'"'===o.charAt(0)&&(o=o.slice(1,-1));try{var p=n[0].replace(l,decodeURIComponent);if(o=c.read?c.read(o,p):c(o,p)||o.replace(l,decodeURIComponent),this.json)try{o=JSON.parse(o)}catch(a){}if(b===p){g=o;break}b||(g[p]=o)}catch(a){}}return g}}return d.set=d,d.get=function(a){return d.call(d,a)},d.getJSON=function(){return d.apply({json:!0},[].slice.call(arguments))},d.defaults={},d.remove=function(b,c){d(b,"",a(c,{expires:-1}))},d.withConverter=b,d}return b(function(){})});

View File

@ -9,9 +9,8 @@
},
"require-dev": {
"squizlabs/php_codesniffer": "*",
"wp-coding-standards/wpcs": "*",
"wimg/php-compatibility": "*",
"simplyadmire/composer-plugins" : "@dev"
"wp-coding-standards/wpcs": "0.10.0",
"phpunit/phpunit": "5.7.19"
},
"scripts": {
"post-install-cmd": [

1323
composer.lock generated

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -436,9 +436,9 @@ return array(
),
'PL' => array(
'currency_code' => 'PLN',
'currency_pos' => 'right',
'thousand_sep' => ',',
'decimal_sep' => '.',
'currency_pos' => 'right_space',
'thousand_sep' => ' ',
'decimal_sep' => ',',
'num_decimals' => 2,
'weight_unit' => 'kg',
'dimension_unit' => 'cm',

22
i18n/states/BO.php Normal file
View File

@ -0,0 +1,22 @@
<?php
/**
* Bolivian states
*
* @author Roman Random
* @category i18n
* @package WooCommerce/i18n
* @version 3.1.0
*/
global $states;
$states['BO'] = array(
'B' => __( 'Chuquisaca', 'woocommerce' ),
'H' => __( 'Beni', 'woocommerce' ),
'C' => __( 'Cochabamba', 'woocommerce' ),
'L' => __( 'La Paz', 'woocommerce' ),
'O' => __( 'Oruro', 'woocommerce' ),
'N' => __( 'Pando', 'woocommerce' ),
'P' => __( 'Potosí', 'woocommerce' ),
'S' => __( 'Santa Cruz', 'woocommerce' ),
'T' => __( 'Tarija', 'woocommerce' ),
);

View File

@ -91,7 +91,7 @@ abstract class WC_Data {
protected $cache_group = '';
/**
* Stores additonal meta data.
* Stores additional meta data.
*
* @since 3.0.0
* @var array
@ -104,12 +104,49 @@ abstract class WC_Data {
* @param int|object|array $read ID to load from the DB (optional) or already queried data.
*/
public function __construct( $read = 0 ) {
$this->data = array_merge( $this->data, $this->extra_data );
$this->data = array_merge( $this->data, $this->extra_data );
$this->default_data = $this->data;
}
/**
* Only store the object ID to avoid serializing the data object instance.
*
* @return array
*/
public function __sleep() {
return array( 'id' );
}
/**
* Re-run the constructor with the object ID.
*
* If the object no longer exists, remove the ID.
*/
public function __wakeup() {
try {
$this->__construct( absint( $this->id ) );
} catch ( Exception $e ) {
$this->set_id( 0 );
$this->set_object_read( true );
}
}
/**
* When the object is cloned, make sure meta is duplicated correctly.
*
* @since 3.0.2
*/
public function __clone() {
$this->maybe_read_meta_data();
if ( ! empty( $this->meta_data ) ) {
foreach ( $this->meta_data as $array_key => $meta ) {
if ( ! empty( $meta->id ) ) {
unset( $this->meta_data[ $array_key ]->id );
}
}
}
}
/**
* Get the data store.
*
@ -147,7 +184,7 @@ abstract class WC_Data {
}
/**
* Save should create or update based on object existance.
* Save should create or update based on object existence.
*
* @since 2.6.0
* @return int
@ -238,14 +275,16 @@ abstract class WC_Data {
*/
public function get_meta( $key = '', $single = true, $context = 'view' ) {
$this->maybe_read_meta_data();
$array_keys = array_keys( wp_list_pluck( $this->get_meta_data(), 'key' ), $key );
$meta_data = $this->get_meta_data();
$array_keys = array_keys( wp_list_pluck( $meta_data, 'key' ), $key );
$value = $single ? '' : array();
if ( ! empty( $array_keys ) ) {
// We don't use the $this->meta_data property directly here because we don't want meta with a null value (i.e. meta which has been deleted via $this->delete_meta_data())
if ( $single ) {
$value = $this->meta_data[ current( $array_keys ) ]->value;
$value = $meta_data[ current( $array_keys ) ]->value;
} else {
$value = array_intersect_key( $this->meta_data, array_flip( $array_keys ) );
$value = array_intersect_key( $meta_data, array_flip( $array_keys ) );
}
if ( 'view' === $context ) {
@ -448,7 +487,6 @@ abstract class WC_Data {
if ( ! empty( $this->cache_group ) ) {
WC_Cache_Helper::incr_cache_prefix( $this->cache_group );
wp_cache_delete( 'object-' . $this->get_id(), $this->cache_group );
}
}
@ -612,16 +650,33 @@ abstract class WC_Data {
protected function set_date_prop( $prop, $value ) {
try {
if ( empty( $value ) ) {
$datetime = null;
} elseif ( is_a( $value, 'WC_DateTime' ) ) {
$this->set_prop( $prop, null );
return;
}
if ( is_a( $value, 'WC_DateTime' ) ) {
$datetime = $value;
} elseif ( is_numeric( $value ) ) {
// Timestamps are handled as UTC timestamps in all cases.
$datetime = new WC_DateTime( "@{$value}", new DateTimeZone( 'UTC' ) );
} else {
// Strings are defined in local WP timezone. Convert to UTC.
if ( 1 === preg_match( '/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|((-|\+)\d{2}:\d{2}))$/', $value, $date_bits ) ) {
$offset = ! empty( $date_bits[7] ) ? iso8601_timezone_to_offset( $date_bits[7] ) : wc_timezone_offset();
$timestamp = gmmktime( $date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1] ) - $offset;
} else {
$timestamp = wc_string_to_timestamp( get_gmt_from_date( gmdate( 'Y-m-d H:i:s', wc_string_to_timestamp( $value ) ) ) );
}
$datetime = new WC_DateTime( "@{$timestamp}", new DateTimeZone( 'UTC' ) );
}
// Set local timezone or offset.
if ( get_option( 'timezone_string' ) ) {
$datetime->setTimezone( new DateTimeZone( wc_timezone_string() ) );
} else {
$datetime = new WC_DateTime( $value, new DateTimeZone( wc_timezone_string() ) );
$datetime->setTimezone( new DateTimeZone( wc_timezone_string() ) );
$datetime->set_utc_offset( wc_timezone_offset() );
}
$this->set_prop( $prop, $datetime );
} catch ( Exception $e ) {}
}

View File

@ -78,7 +78,7 @@ abstract class WC_Deprecated_Hooks {
* Display a deprecated notice for old hooks.
*/
protected function display_notice( $old_hook, $new_hook ) {
_deprecated_function( sprintf( 'The "%s" hook uses out of date data structures and', esc_html( $old_hook ) ), WC_VERSION, esc_html( $new_hook ) );
wc_deprecated_function( sprintf( 'The "%s" hook uses out of date data structures and', esc_html( $old_hook ) ), WC_VERSION, esc_html( $new_hook ) );
}
/**

View File

@ -189,7 +189,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
// Add/save items.
foreach ( $this->items as $item_group => $items ) {
if ( is_array( $items ) ) {
foreach ( $items as $item_key => $item ) {
foreach ( array_filter( $items ) as $item_key => $item ) {
$item->set_order_id( $this->get_id() );
$item_id = $item->save();
@ -412,7 +412,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$tax_totals[ $code ]->rate_id = $tax->get_rate_id();
$tax_totals[ $code ]->is_compound = $tax->is_compound();
$tax_totals[ $code ]->label = $tax->get_label();
$tax_totals[ $code ]->amount += $tax->get_tax_total() + $tax->get_shipping_tax_total();
$tax_totals[ $code ]->amount += (float) $tax->get_tax_total() + (float) $tax->get_shipping_tax_total();
$tax_totals[ $code ]->formatted_amount = wc_price( wc_round_tax_total( $tax_totals[ $code ]->amount ), array( 'currency' => $this->get_currency() ) );
}
@ -434,6 +434,25 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
return array_keys( wc_get_order_statuses() );
}
/**
* Get user ID. Used by orders, not other order types like refunds.
*
* @param string $context
* @return int
*/
public function get_user_id( $context = 'view' ) {
return 0;
}
/**
* Get user. Used by orders, not other order types like refunds.
*
* @return WP_User|false
*/
public function get_user() {
return false;
}
/*
|--------------------------------------------------------------------------
| Setters
@ -453,7 +472,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
* @throws WC_Data_Exception
*/
public function set_parent_id( $value ) {
if ( $value && ! wc_get_order( $value ) ) {
if ( $value && ( $value === $this->get_id() || ! wc_get_order( $value ) ) ) {
$this->error( 'order_invalid_parent_id', __( 'Invalid parent ID', 'woocommerce' ) );
}
$this->set_prop( 'parent_id', absint( $value ) );
@ -470,18 +489,21 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$old_status = $this->get_status();
$new_status = 'wc-' === substr( $new_status, 0, 3 ) ? substr( $new_status, 3 ) : $new_status;
// Only allow valid new status
if ( ! in_array( 'wc-' . $new_status, $this->get_valid_statuses() ) && 'trash' !== $new_status ) {
$new_status = 'pending';
// If setting the status, ensure it's set to a valid status.
if ( true === $this->object_read ) {
// Only allow valid new status
if ( ! in_array( 'wc-' . $new_status, $this->get_valid_statuses() ) && 'trash' !== $new_status ) {
$new_status = 'pending';
}
// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
if ( $old_status && ! in_array( 'wc-' . $old_status, $this->get_valid_statuses() ) && 'trash' !== $old_status ) {
$old_status = 'pending';
}
}
$this->set_prop( 'status', $new_status );
// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
if ( $old_status && ! in_array( 'wc-' . $old_status, $this->get_valid_statuses() ) && 'trash' !== $old_status ) {
$old_status = 'pending';
}
return array(
'from' => $old_status,
'to' => $new_status,
@ -652,13 +674,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
* @return string group
*/
protected function type_to_group( $type ) {
$type_to_group = array(
$type_to_group = apply_filters( 'woocommerce_order_type_to_group', array(
'line_item' => 'line_items',
'tax' => 'tax_lines',
'shipping' => 'shipping_lines',
'fee' => 'fee_lines',
'coupon' => 'coupon_lines',
);
) );
return isset( $type_to_group[ $type ] ) ? $type_to_group[ $type ] : '';
}
@ -678,7 +700,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$this->items[ $group ] = $this->data_store->read_items( $this, $type );
}
// Don't use array_merge here because keys are numeric
$items = $items + $this->items[ $group ];
$items = array_filter( $items + $this->items[ $group ] );
}
}
@ -1075,14 +1097,14 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
foreach ( $this->get_items( array( 'line_item', 'fee' ) ) as $item_id => $item ) {
$taxes = $item->get_taxes();
foreach ( $taxes['total'] as $tax_rate_id => $tax ) {
$cart_taxes[ $tax_rate_id ] = isset( $cart_taxes[ $tax_rate_id ] ) ? $cart_taxes[ $tax_rate_id ] + $tax : $tax;
$cart_taxes[ $tax_rate_id ] = isset( $cart_taxes[ $tax_rate_id ] ) ? $cart_taxes[ $tax_rate_id ] + (float) $tax : (float) $tax;
}
}
foreach ( $this->get_shipping_methods() as $item_id => $item ) {
$taxes = $item->get_taxes();
foreach ( $taxes['total'] as $tax_rate_id => $tax ) {
$shipping_taxes[ $tax_rate_id ] = isset( $shipping_taxes[ $tax_rate_id ] ) ? $shipping_taxes[ $tax_rate_id ] + $tax : $tax;
$shipping_taxes[ $tax_rate_id ] = isset( $shipping_taxes[ $tax_rate_id ] ) ? $shipping_taxes[ $tax_rate_id ] + (float) $tax : (float) $tax;
}
}
@ -1348,7 +1370,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
// Remove non-compound taxes.
foreach ( $this->get_taxes() as $tax ) {
if ( $this->is_compound() ) {
if ( $tax->is_compound() ) {
continue;
}
$subtotal = $subtotal + $tax->get_tax_total() + $tax->get_shipping_tax_total();

View File

@ -1155,13 +1155,17 @@ class WC_Product extends WC_Abstract_Legacy_Product {
// Validate the file extension
if ( ! $download_object->is_allowed_filetype() ) {
$errors[] = sprintf( __( 'The downloadable file %1$s cannot be used as it does not have an allowed file type. Allowed types include: %2$s', 'woocommerce' ), '<code>' . basename( $download_object->get_file() ) . '</code>', '<code>' . implode( ', ', array_keys( $download_object->get_allowed_mime_types() ) ) . '</code>' );
if ( $this->get_object_read() ) {
$errors[] = sprintf( __( 'The downloadable file %1$s cannot be used as it does not have an allowed file type. Allowed types include: %2$s', 'woocommerce' ), '<code>' . basename( $download_object->get_file() ) . '</code>', '<code>' . implode( ', ', array_keys( $download_object->get_allowed_mime_types() ) ) . '</code>' );
}
continue;
}
// Validate the file exists.
if ( ! $download_object->file_exists() ) {
$errors[] = sprintf( __( 'The downloadable file %s cannot be used as it does not exist on the server.', 'woocommerce' ), '<code>' . $download_object->get_file() . '</code>' );
if ( $this->get_object_read() ) {
$errors[] = sprintf( __( 'The downloadable file %s cannot be used as it does not exist on the server.', 'woocommerce' ), '<code>' . $download_object->get_file() . '</code>' );
}
continue;
}
@ -1289,7 +1293,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
$this->data_store->create( $this );
}
if ( $this->get_parent_id() ) {
wp_schedule_single_event( time(), 'woocommerce_deferred_product_sync', array( 'product_id' => $this->get_parent_id() ) );
wc_deferred_product_sync( $this->get_parent_id() );
}
return $this->get_id();
}
@ -1581,6 +1585,17 @@ class WC_Product extends WC_Abstract_Legacy_Product {
return $this->is_downloadable() && $this->get_file( $download_id );
}
/**
* Returns whether or not the product has additonal options that need
* selecting before adding to cart.
*
* @since 3.0.0
* @return boolean
*/
public function has_options() {
return false;
}
/*
|--------------------------------------------------------------------------
| Non-CRUD Getters
@ -1834,7 +1849,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
/**
* Returns the availability of the product.
*
* @return string
* @return string[]
*/
public function get_availability() {
return apply_filters( 'woocommerce_get_availability', array(
@ -1852,7 +1867,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
if ( ! $this->is_in_stock() ) {
$availability = __( 'Out of stock', 'woocommerce' );
} elseif ( $this->managing_stock() && $this->is_on_backorder( 1 ) ) {
$availability = __( 'Available on backorder', 'woocommerce' );
$availability = $this->backorders_require_notification() ? __( 'Available on backorder', 'woocommerce' ) : '';
} elseif ( $this->managing_stock() ) {
$availability = wc_format_stock_for_display( $this );
} else {

View File

@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
/**
* Abstract Rest Controler Class
* Abstract Rest Controller Class
*
* @author WooThemes
* @category API

View File

@ -1,6 +1,6 @@
<?php
/**
* Abstract Rest CRUD Controler Class
* Abstract Rest CRUD Controller Class
*
* @author Automattic
* @category API
@ -471,7 +471,8 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
* @return array
*/
public function get_collection_params() {
$params['context'] = $this->get_context_param();
$params = array();
$params['context'] = $this->get_context_param();
$params['context']['default'] = 'view';
$params['page'] = array(

View File

@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
/**
* Abstract Rest Posts Controler Class
* Abstract Rest Posts Controller Class
*
* @author WooThemes
* @category API
@ -204,7 +204,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
/**
* Fires after a single item is created or updated via the REST API.
*
* @param object $post Inserted object (not a WP_Post object).
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/
@ -282,7 +282,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
/**
* Fires after a single item is created or updated via the REST API.
*
* @param object $post Inserted object (not a WP_Post object).
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/

View File

@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
/**
* Abstract Rest Terms Controler Class
* Abstract Rest Terms Controller Class
*
* @author WooThemes
* @category API
@ -405,7 +405,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
// Add term data.
$meta_fields = $this->update_term_meta_fields( $term, $request );
if ( is_wp_error( $meta_fields ) ) {
wp_delete_term( $term['term_id'], $taxonomy );
wp_delete_term( $term->term_id, $taxonomy );
return $meta_fields;
}

View File

@ -23,8 +23,8 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
*/
public function __construct() {
parent::__construct( array(
'singular' => __( 'key', 'woocommerce' ),
'plural' => __( 'keys', 'woocommerce' ),
'singular' => 'key',
'plural' => 'keys',
'ajax' => false,
) );
}

View File

@ -222,6 +222,8 @@ class WC_Admin_Assets {
'i18n_select_state_text' => esc_attr__( 'Select an option&hellip;', 'woocommerce' ),
'default_country' => isset( $default_location['country'] ) ? $default_location['country'] : '',
'default_state' => isset( $default_location['state'] ) ? $default_location['state'] : '',
'placeholder_name' => esc_attr__( 'Name (required)', 'woocommerce' ),
'placeholder_value' => esc_attr__( 'Value (required)', 'woocommerce' ),
) );
}
if ( in_array( $screen_id, array( 'shop_coupon', 'edit-shop_coupon' ) ) ) {
@ -252,8 +254,7 @@ class WC_Admin_Assets {
'visible_label' => __( 'Visible on the product page', 'woocommerce' ),
'used_for_variations_label' => __( 'Used for variations', 'woocommerce' ),
'new_attribute_prompt' => __( 'Enter a name for the new attribute term:', 'woocommerce' ),
'calc_totals' => __( 'Calculate totals based on order items, discounts, and shipping?', 'woocommerce' ),
'calc_line_taxes' => __( 'Calculate line taxes? This will calculate taxes based on the customers country. If no billing/shipping is set it will use the store base country.', 'woocommerce' ),
'calc_totals' => __( 'Recalculate totals? This will calculate taxes based on the customers country (or the store base country) and update totals.', 'woocommerce' ),
'copy_billing' => __( 'Copy billing information to shipping information? This will remove any currently entered shipping information.', 'woocommerce' ),
'load_billing' => __( 'Load the customer\'s billing information? This will remove any currently entered billing information.', 'woocommerce' ),
'load_shipping' => __( 'Load the customer\'s shipping information? This will remove any currently entered shipping information.', 'woocommerce' ),

View File

@ -384,7 +384,7 @@ class WC_Admin_Attributes {
<div class="row-actions"><span class="edit"><a href="<?php echo esc_url( add_query_arg( 'edit', $tax->attribute_id, 'edit.php?post_type=product&amp;page=product_attributes' ) ); ?>"><?php _e( 'Edit', 'woocommerce' ); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'delete', $tax->attribute_id, 'edit.php?post_type=product&amp;page=product_attributes' ), 'woocommerce-delete-attribute_' . $tax->attribute_id ) ); ?>"><?php _e( 'Delete', 'woocommerce' ); ?></a></span></div>
</td>
<td><?php echo esc_html( $tax->attribute_name ); ?></td>
<td><?php echo esc_html( ucfirst( $tax->attribute_type ) ); ?> <?php echo $tax->attribute_public ? __( '(Public)', 'woocommerce' ) : ''; ?></td>
<td><?php echo esc_html( wc_get_attribute_type_label( $tax->attribute_type ) ); ?> <?php echo $tax->attribute_public ? __( '(Public)', 'woocommerce' ) : ''; ?></td>
<td><?php
switch ( $tax->attribute_orderby ) {
case 'name' :

View File

@ -0,0 +1,98 @@
<?php
/**
* Setup customize items.
*
* @author WooCommerce
* @category Admin
* @package WooCommerce/Admin/Customize
* @version 3.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'WC_Admin_Customize', false ) ) :
/**
* WC_Admin_Customize Class.
*/
class WC_Admin_Customize {
/**
* Initialize customize actions.
*/
public function __construct() {
// Include custom items to customizer nav menu settings.
add_filter( 'customize_nav_menu_available_item_types', array( $this, 'register_customize_nav_menu_item_types' ) );
add_filter( 'customize_nav_menu_available_items', array( $this, 'register_customize_nav_menu_items' ), 10, 4 );
}
/**
* Register customize new nav menu item types.
* This will register WooCommerce account endpoints as a nav menu item type.
*
* @since 3.1.0
* @param array $item_types Menu item types.
* @return array
*/
public function register_customize_nav_menu_item_types( $item_types ) {
$item_types[] = array(
'title' => __( 'WooCommerce endpoints', 'woocommerce' ),
'type_label' => __( 'WooCommerce endpoint', 'woocommerce' ),
'type' => 'woocommerce_nav',
'object' => 'woocommerce_endpoint',
);
return $item_types;
}
/**
* Register account endpoints to customize nav menu items.
*
* @since 3.1.0
* @param array $items List of nav menu items.
* @param string $type Nav menu type.
* @param string $object Nav menu object.
* @param integer $page Page number.
* @return array
*/
public function register_customize_nav_menu_items( $items = array(), $type = '', $object = '', $page = 0 ) {
if ( 'woocommerce_endpoint' !== $object ) {
return $items;
}
// Don't allow pagination since all items are loaded at once.
if ( 0 < $page ) {
return $items;
}
// Get items from account menu.
$endpoints = wc_get_account_menu_items();
// Remove dashboard item.
if ( isset( $endpoints['dashboard'] ) ) {
unset( $endpoints['dashboard'] );
}
// Include missing lost password.
$endpoints['lost-password'] = __( 'Lost password', 'woocommerce' );
$endpoints = apply_filters( 'woocommerce_custom_nav_menu_items', $endpoints );
foreach ( $endpoints as $endpoint => $title ) {
$items[] = array(
'id' => $endpoint,
'title' => $title,
'type_label' => __( 'Custom Link', 'woocommerce' ),
'url' => esc_url_raw( wc_get_account_endpoint_url( $endpoint ) ),
);
}
return $items;
}
}
endif;
return new WC_Admin_Customize();

View File

@ -246,10 +246,8 @@ class WC_Admin_Dashboard {
*/
public function recent_reviews() {
global $wpdb;
$comments = $wpdb->get_results( "
SELECT posts.ID, posts.post_title, comments.comment_author, comments.comment_ID, SUBSTRING(comments.comment_content,1,100) AS comment_excerpt
FROM $wpdb->comments comments
LEFT JOIN $wpdb->posts posts ON (comments.comment_post_ID = posts.ID)
$query_from = apply_filters( 'woocommerce_report_recent_reviews_query_from', "FROM {$wpdb->comments} comments
LEFT JOIN {$wpdb->posts} posts ON (comments.comment_post_ID = posts.ID)
WHERE comments.comment_approved = '1'
AND comments.comment_type = ''
AND posts.post_password = ''
@ -257,6 +255,10 @@ class WC_Admin_Dashboard {
ORDER BY comments.comment_date_gmt DESC
LIMIT 5
" );
$comments = $wpdb->get_results( "
SELECT posts.ID, posts.post_title, comments.comment_author, comments.comment_ID, SUBSTRING(comments.comment_content,1,100) AS comment_excerpt
{$query_from};
" );
if ( $comments ) {
echo '<ul>';

View File

@ -117,11 +117,17 @@ class WC_Admin_Duplicate_Product {
$duplicate = clone $product;
$duplicate->set_id( 0 );
$duplicate->set_name( sprintf( __( '%s (Copy)', 'woocommerce' ), $duplicate->get_name() ) );
$duplicate->set_total_sales( 0 );
if ( '' !== $product->get_sku( 'edit' ) ) {
$duplicate->set_sku( wc_product_generate_unique_sku( 0, $product->get_sku( 'edit' ) ) );
}
$duplicate->set_status( 'draft' );
$duplicate->set_date_created( null );
$duplicate->set_slug( '' );
$duplicate->set_rating_counts( 0 );
$duplicate->set_average_rating( 0 );
$duplicate->set_review_count( 0 );
foreach ( $meta_to_exclude as $meta_key ) {
$duplicate->delete_meta_data( $meta_key );
@ -133,7 +139,8 @@ class WC_Admin_Duplicate_Product {
// Save parent product.
$duplicate->save();
if ( ! apply_filters( 'woocommerce_duplicate_product_exclude_children', false ) && ( $product->is_type( 'variable' ) || $product->is_type( 'grouped' ) ) ) {
// Duplicate children of a variable product.
if ( ! apply_filters( 'woocommerce_duplicate_product_exclude_children', false ) && $product->is_type( 'variable' ) ) {
foreach ( $product->get_children() as $child_id ) {
$child = wc_get_product( $child_id );
$child_duplicate = clone $child;

View File

@ -49,18 +49,6 @@ class WC_Admin_Help {
'title' => __( 'Product Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf.jsonp?',
),
'wc-settings-products-display' => array(
'title' => __( 'Display Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf.jsonp?time=55s&',
),
'wc-settings-products-inventory' => array(
'title' => __( 'Inventory Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf.jsonp?time=2m38s&',
),
'wc-settings-products-downloadable' => array(
'title' => __( 'Downloadable Products Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf.jsonp?time=3m50s&',
),
'wc-settings-tax' => array(
'title' => __( 'Tax Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/qp1v19dwrh.jsonp?',
@ -133,54 +121,30 @@ class WC_Admin_Help {
'title' => __( 'API Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq.jsonp?',
),
'wc-settings-api-keys' => array(
'title' => __( 'Keys & Apps', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq.jsonp?time=1m06s&',
),
'wc-settings-api-webhooks' => array(
'title' => __( 'Webhooks', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq.jsonp?time=1m52s&',
),
'product' => array(
'title' => __( 'Creating Products', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/ziyjmd4kut.jsonp?',
'url' => '//fast.wistia.net/embed/iframe/fw0477t6wr.jsonp?',
),
'edit-product_cat' => array(
'title' => __( 'Product Categories', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp?time=21s&',
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp?',
),
'edit-product_tag' => array(
'title' => __( 'Product Tags', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp??time=1m56s&',
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp?',
),
'product_attributes' => array(
'title' => __( 'Product Attributes', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp??time=2m18s&',
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp?',
),
'wc-status' => array(
'title' => __( 'System Status', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/xdn733nnhi.jsonp?',
),
'wc-status-tools' => array(
'title' => __( 'Tools', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/xdn733nnhi.jsonp?time=3m55s&',
),
'wc-reports' => array(
'title' => __( 'Reports', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/6aasex0w99.jsonp?',
),
'wc-reports-customers' => array(
'title' => __( 'Customer Reports', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/6aasex0w99.jsonp?time=2m07s&',
),
'wc-reports-stock' => array(
'title' => __( 'Stock Reports', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/6aasex0w99.jsonp?time=2m41s&',
),
'wc-reports-taxes' => array(
'title' => __( 'Tax Reports', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/6aasex0w99.jsonp?time=3m14s&',
),
'edit-shop_coupon' => array(
'title' => __( 'Coupons', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit.jsonp?',

View File

@ -23,8 +23,8 @@ class WC_Admin_Log_Table_List extends WP_List_Table {
*/
public function __construct() {
parent::__construct( array(
'singular' => __( 'log', 'woocommerce' ),
'plural' => __( 'logs', 'woocommerce' ),
'singular' => 'log',
'plural' => 'logs',
'ajax' => false,
) );
}

View File

@ -38,8 +38,8 @@ class WC_Admin_Menus {
add_filter( 'menu_order', array( $this, 'menu_order' ) );
add_filter( 'custom_menu_order', array( $this, 'custom_menu_order' ) );
// Add endpoints custom URLs in Appearance > Menus > Pages
add_action( 'admin_init', array( $this, 'add_nav_menu_meta_boxes' ) );
// Add endpoints custom URLs in Appearance > Menus > Pages.
add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) );
// Admin bar menus
if ( apply_filters( 'woocommerce_show_admin_bar_visit_store', true ) ) {
@ -94,7 +94,7 @@ class WC_Admin_Menus {
* Add menu item.
*/
public function status_menu() {
add_submenu_page( 'woocommerce', __( 'WooCommerce status', 'woocommerce' ), __( 'System status', 'woocommerce' ) , 'manage_woocommerce', 'wc-status', array( $this, 'status_page' ) );
add_submenu_page( 'woocommerce', __( 'WooCommerce status', 'woocommerce' ), __( 'Status', 'woocommerce' ) , 'manage_woocommerce', 'wc-status', array( $this, 'status_page' ) );
}
/**
@ -238,30 +238,39 @@ class WC_Admin_Menus {
* Output menu links.
*/
public function nav_menu_links() {
$exclude = array( 'view-order', 'add-payment-method', 'order-pay', 'order-received' );
// Get items from account menu.
$endpoints = wc_get_account_menu_items();
// Remove dashboard item.
if ( isset( $endpoints['dashboard'] ) ) {
unset( $endpoints['dashboard'] );
}
// Include missing lost password.
$endpoints['lost-password'] = __( 'Lost password', 'woocommerce' );
$endpoints = apply_filters( 'woocommerce_custom_nav_menu_items', $endpoints );
?>
<div id="posttype-woocommerce-endpoints" class="posttypediv">
<div id="tabs-panel-woocommerce-endpoints" class="tabs-panel tabs-panel-active">
<ul id="woocommerce-endpoints-checklist" class="categorychecklist form-no-clear">
<?php
$i = -1;
foreach ( WC()->query->query_vars as $key => $value ) {
if ( in_array( $key, $exclude ) ) {
continue;
}
foreach ( $endpoints as $key => $value ) :
?>
<li>
<label class="menu-item-title">
<input type="checkbox" class="menu-item-checkbox" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-object-id]" value="<?php echo esc_attr( $i ); ?>" /> <?php echo esc_html( $key ); ?>
<input type="checkbox" class="menu-item-checkbox" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-object-id]" value="<?php echo esc_attr( $i ); ?>" /> <?php echo esc_html( $value ); ?>
</label>
<input type="hidden" class="menu-item-type" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-type]" value="custom" />
<input type="hidden" class="menu-item-title" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-title]" value="<?php echo esc_html( $key ); ?>" />
<input type="hidden" class="menu-item-url" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-url]" value="<?php echo esc_url( wc_get_endpoint_url( $key, '', wc_get_page_permalink( 'myaccount' ) ) ); ?>" />
<input type="hidden" class="menu-item-title" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-title]" value="<?php echo esc_html( $value ); ?>" />
<input type="hidden" class="menu-item-url" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-url]" value="<?php echo esc_url( wc_get_account_endpoint_url( $key ) ); ?>" />
<input type="hidden" class="menu-item-classes" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-classes]" />
</li>
<?php
$i --;
}
$i--;
endforeach;
?>
</ul>
</div>

View File

@ -91,7 +91,7 @@ class WC_Admin_Meta_Boxes {
* Show any stored error messages.
*/
public function output_errors() {
$errors = maybe_unserialize( get_option( 'woocommerce_meta_box_errors' ) );
$errors = array_filter( (array) get_option( 'woocommerce_meta_box_errors' ) );
if ( ! empty( $errors ) ) {

View File

@ -95,8 +95,8 @@ class WC_Admin_Post_Types {
// Disable post type view mode options
add_filter( 'view_mode_post_types', array( $this, 'disable_view_mode_options' ) );
// Update the screen options user meta.
add_action( 'admin_init', array( $this, 'adjust_shop_order_columns' ) );
// Update the screen options.
add_filter( 'default_hidden_columns', array( $this, 'adjust_shop_order_columns' ), 10, 2 );
// Show blank state
add_action( 'manage_posts_extra_tablenav', array( $this, 'maybe_render_blank_state' ) );
@ -109,14 +109,15 @@ class WC_Admin_Post_Types {
/**
* Adjust shop order columns for the user on certain conditions.
*/
public function adjust_shop_order_columns() {
$option_value = get_user_option( 'manageedit-shop_ordercolumnshidden' );
// If first time editing, disable columns by default. Likewise, CB should never be hidden.
if ( false === $option_value || ( is_array( $option_value ) && in_array( 'cb', $option_value ) ) ) {
$user = wp_get_current_user();
update_user_option( get_current_user_id(), 'manageedit-shop_ordercolumnshidden', array( 0 => 'billing_address' ), true );
public function adjust_shop_order_columns( $hidden, $screen ) {
if ( isset( $screen->id ) && 'edit-shop_order' === $screen->id ) {
if ( 'disabled' === get_option( 'woocommerce_ship_to_countries' ) ) {
$hidden[] = 'shipping_address';
} else {
$hidden[] = 'billing_address';
}
}
return $hidden;
}
/**
@ -323,6 +324,11 @@ class WC_Admin_Post_Types {
$the_product = wc_get_product( $post );
}
// Only continue if we have a product.
if ( empty( $the_product ) ) {
return;
}
switch ( $column ) {
case 'thumb' :
echo '<a href="' . get_edit_post_link( $post->ID ) . '">' . $the_product->get_image( 'thumbnail' ) . '</a>';
@ -433,7 +439,7 @@ class WC_Admin_Post_Types {
}
if ( $the_product->managing_stock() ) {
$stock_html .= ' (' . $the_product->get_stock_quantity() . ')';
$stock_html .= ' (' . wc_stock_amount( $the_product->get_stock_quantity() ) . ')';
}
echo apply_filters( 'woocommerce_admin_stock_html', $stock_html, $the_product );
@ -531,7 +537,7 @@ class WC_Admin_Post_Types {
printf( '<mark class="%s tips" data-tip="%s">%s</mark>', esc_attr( sanitize_html_class( $the_order->get_status() ) ), esc_attr( wc_get_order_status_name( $the_order->get_status() ) ), esc_html( wc_get_order_status_name( $the_order->get_status() ) ) );
break;
case 'order_date' :
printf( '<time datetime="%s">%s</time>', esc_attr( $the_order->get_date_created()->date( 'c' ) ), esc_html( $the_order->get_date_created()->date_i18n( __( 'Y-m-d', 'woocommerce' ) ) ) );
printf( '<time datetime="%s">%s</time>', esc_attr( $the_order->get_date_created()->date( 'c' ) ), esc_html( $the_order->get_date_created()->date_i18n( apply_filters( 'woocommerce_admin_order_date_format', __( 'Y-m-d', 'woocommerce' ) ) ) ) );
break;
case 'customer_message' :
if ( $the_order->get_customer_note() ) {

View File

@ -53,11 +53,11 @@ class WC_Admin_Profile {
'description' => '',
),
'billing_address_1' => array(
'label' => __( 'Address 1', 'woocommerce' ),
'label' => __( 'Address line 1', 'woocommerce' ),
'description' => '',
),
'billing_address_2' => array(
'label' => __( 'Address 2', 'woocommerce' ),
'label' => __( 'Address line 2', 'woocommerce' ),
'description' => '',
),
'billing_city' => array(
@ -106,11 +106,11 @@ class WC_Admin_Profile {
'description' => '',
),
'shipping_address_1' => array(
'label' => __( 'Address 1', 'woocommerce' ),
'label' => __( 'Address line 1', 'woocommerce' ),
'description' => '',
),
'shipping_address_2' => array(
'label' => __( 'Address 2', 'woocommerce' ),
'label' => __( 'Address line 2', 'woocommerce' ),
'description' => '',
),
'shipping_city' => array(

View File

@ -291,33 +291,19 @@ class WC_Admin_Settings {
case 'text':
case 'email':
case 'number':
case 'color' :
case 'password' :
$type = $value['type'];
$option_value = self::get_option( $value['id'], $value['default'] );
if ( 'color' === $value['type'] ) {
$type = 'text';
$value['class'] .= 'colorpick';
$description .= '<div id="colorPickerDiv_' . esc_attr( $value['id'] ) . '" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>';
}
?><tr valign="top">
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
<?php echo $tooltip_html; ?>
</th>
<td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">
<?php
if ( 'color' == $value['type'] ) {
echo '<span class="colorpickpreview" style="background: ' . esc_attr( $option_value ) . ';"></span>';
}
?>
<input
name="<?php echo esc_attr( $value['id'] ); ?>"
id="<?php echo esc_attr( $value['id'] ); ?>"
type="<?php echo esc_attr( $type ); ?>"
type="<?php echo esc_attr( $value['type'] ); ?>"
style="<?php echo esc_attr( $value['css'] ); ?>"
value="<?php echo esc_attr( $option_value ); ?>"
class="<?php echo esc_attr( $value['class'] ); ?>"
@ -328,6 +314,33 @@ class WC_Admin_Settings {
</tr><?php
break;
// Color picker.
case 'color' :
$option_value = self::get_option( $value['id'], $value['default'] );
?><tr valign="top">
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
<?php echo $tooltip_html; ?>
</th>
<td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">&lrm;
<span class="colorpickpreview" style="background: <?php echo esc_attr( $option_value ); ?>"></span>
<input
name="<?php echo esc_attr( $value['id'] ); ?>"
id="<?php echo esc_attr( $value['id'] ); ?>"
type="text"
dir="ltr"
style="<?php echo esc_attr( $value['css'] ); ?>"
value="<?php echo esc_attr( $option_value ); ?>"
class="<?php echo esc_attr( $value['class'] ); ?>colorpick"
placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>"
<?php echo implode( ' ', $custom_attributes ); ?>
/>&lrm; <?php echo $description; ?>
<div id="colorPickerDiv_<?php echo esc_attr( $value['id'] ); ?>" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
</td>
</tr><?php
break;
// Textarea
case 'textarea':
@ -616,7 +629,7 @@ class WC_Admin_Settings {
}
/**
* Helper function to get the formated description and tip HTML for a
* Helper function to get the formatted description and tip HTML for a
* given form field. Plugins can call this when implementing their own custom
* settings types.
*

View File

@ -54,7 +54,7 @@ class WC_Admin_Setup_Wizard {
if ( empty( $_GET['page'] ) || 'wc-setup' !== $_GET['page'] ) {
return;
}
$this->steps = array(
$default_steps = array(
'introduction' => array(
'name' => __( 'Introduction', 'woocommerce' ),
'view' => array( $this, 'wc_setup_introduction' ),
@ -86,6 +86,8 @@ class WC_Admin_Setup_Wizard {
'handler' => '',
),
);
$this->steps = apply_filters( 'woocommerce_setup_wizard_steps', $default_steps );
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
@ -116,7 +118,7 @@ class WC_Admin_Setup_Wizard {
) );
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
call_user_func( $this->steps[ $this->step ]['handler'] );
call_user_func( $this->steps[ $this->step ]['handler'], $this );
}
ob_start();
@ -127,9 +129,30 @@ class WC_Admin_Setup_Wizard {
exit;
}
public function get_next_step_link() {
/**
* Get the URL for the next step's screen.
* @param string step slug (default: current step)
* @return string URL for next step if a next step exists.
* Admin URL if it's the last step.
* Empty string on failure.
* @since 3.0.0
*/
public function get_next_step_link( $step = '' ) {
if ( ! $step ) {
$step = $this->step;
}
$keys = array_keys( $this->steps );
return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ] );
if ( end( $keys ) === $step ) {
return admin_url();
}
$step_index = array_search( $step, $keys );
if ( false === $step_index ) {
return '';
}
return add_query_arg( 'step', $keys[ $step_index + 1 ] );
}
/**
@ -191,7 +214,7 @@ class WC_Admin_Setup_Wizard {
*/
public function setup_wizard_content() {
echo '<div class="wc-setup-content">';
call_user_func( $this->steps[ $this->step ]['view'] );
call_user_func( $this->steps[ $this->step ]['view'], $this );
echo '</div>';
}
@ -503,12 +526,30 @@ class WC_Admin_Setup_Wizard {
public function wc_setup_shipping_taxes_save() {
check_admin_referer( 'wc-setup' );
$enable_shipping = isset( $_POST['woocommerce_calc_shipping'] );
$enable_taxes = isset( $_POST['woocommerce_calc_taxes'] );
$enable_shipping = isset( $_POST['woocommerce_calc_shipping'] );
$enable_taxes = isset( $_POST['woocommerce_calc_taxes'] );
$current_shipping = get_option( 'woocommerce_ship_to_countries' );
if ( $enable_shipping ) {
update_option( 'woocommerce_ship_to_countries', '' );
WC_Admin_Notices::add_notice( 'no_shipping_methods' );
/*
* If this is the initial shipping setup, create a shipping
* zone containing the country the store is located in, with
* a "free shipping" method preconfigured.
*/
if ( false === $current_shipping ) {
$default_country = get_option( 'woocommerce_default_country' );
$location = wc_format_country_state_string( $default_country );
$zone = new WC_Shipping_Zone( null );
$zone->set_zone_order( 0 );
$zone->add_location( $location['country'], 'country' );
$zone->set_zone_name( $zone->get_formatted_location() );
$zone->add_shipping_method( 'free_shipping' );
$zone->save();
}
} else {
update_option( 'woocommerce_ship_to_countries', 'disabled' );
}

View File

@ -23,8 +23,8 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
*/
public function __construct() {
parent::__construct( array(
'singular' => __( 'webhook', 'woocommerce' ),
'plural' => __( 'webhooks', 'woocommerce' ),
'singular' => 'webhook',
'plural' => 'webhooks',
'ajax' => false,
) );
}

View File

@ -129,7 +129,7 @@ class WC_Admin_Webhooks {
* @param WC_Webhook $webhook Webhook instance.
*/
private function update_api_version( $webhook ) {
$version = ! empty( $_POST['webhook_api_version'] ) ? wc_clean( $_POST['webhook_api_version'] ) : 'wp_api_v1';
$version = ! empty( $_POST['webhook_api_version'] ) ? wc_clean( $_POST['webhook_api_version'] ) : 'wp_api_v2';
$webhook->set_api_version( $version );
}
@ -225,7 +225,7 @@ class WC_Admin_Webhooks {
update_post_meta( $webhook_id, '_webhook_pending_delivery', true );
$webhook = new WC_Webhook( $webhook_id );
$webhook->set_api_version( 'wp_api_v1' );
$webhook->set_api_version( 'wp_api_v2' );
delete_transient( 'woocommerce_webhook_ids' );

View File

@ -48,6 +48,7 @@ class WC_Admin {
include_once( dirname( __FILE__ ) . '/class-wc-admin-post-types.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-taxonomies.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-menus.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-customize.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-notices.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-assets.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-api-keys.php' );

View File

@ -43,7 +43,7 @@ class WC_Meta_Box_Order_Actions {
<option value=""><?php _e( 'Actions', 'woocommerce' ); ?></option>
<?php
$mailer = WC()->mailer();
$available_emails = apply_filters( 'woocommerce_resend_order_emails_available', array( 'new_order', 'cancelled_order', 'customer_processing_order', 'customer_completed_order', 'customer_invoice', 'customer_refunded_order' ) );
$available_emails = apply_filters( 'woocommerce_resend_order_emails_available', array( 'new_order', 'cancelled_order', 'customer_processing_order', 'customer_completed_order', 'customer_invoice' ) );
$mails = $mailer->get_emails();
if ( ! empty( $mails ) && ! empty( $available_emails ) ) { ?>

View File

@ -52,11 +52,11 @@ class WC_Meta_Box_Order_Data {
'show' => false,
),
'address_1' => array(
'label' => __( 'Address 1', 'woocommerce' ),
'label' => __( 'Address line 1', 'woocommerce' ),
'show' => false,
),
'address_2' => array(
'label' => __( 'Address 2', 'woocommerce' ),
'label' => __( 'Address line 2', 'woocommerce' ),
'show' => false,
),
'city' => array(
@ -101,11 +101,11 @@ class WC_Meta_Box_Order_Data {
'show' => false,
),
'address_1' => array(
'label' => __( 'Address 1', 'woocommerce' ),
'label' => __( 'Address line 1', 'woocommerce' ),
'show' => false,
),
'address_2' => array(
'label' => __( 'Address 2', 'woocommerce' ),
'label' => __( 'Address line 2', 'woocommerce' ),
'show' => false,
),
'city' => array(
@ -213,7 +213,7 @@ class WC_Meta_Box_Order_Data {
<h3><?php _e( 'General Details', 'woocommerce' ); ?></h3>
<p class="form-field form-field-wide"><label for="order_date"><?php _e( 'Order date:', 'woocommerce' ) ?></label>
<input type="text" class="date-picker" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="<?php echo esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ); ?>" />@<input type="number" class="hour" placeholder="<?php esc_attr_e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" min="0" max="23" step="1" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php esc_attr_e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" min="0" max="59" step="1" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="[0-5]{1}[0-9]{1}" />
<input type="text" class="date-picker" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="<?php echo esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ); ?>" />@&lrm;<input type="number" class="hour" placeholder="<?php esc_attr_e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" min="0" max="23" step="1" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php esc_attr_e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" min="0" max="59" step="1" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="[0-5]{1}[0-9]{1}" />&lrm;
</p>
<p class="form-field form-field-wide wc-order-status"><label for="order_status"><?php _e( 'Order status:', 'woocommerce' ) ?> <?php

View File

@ -75,43 +75,76 @@ class WC_Meta_Box_Product_Data {
* @return array
*/
private static function get_product_data_tabs() {
return apply_filters( 'woocommerce_product_data_tabs', array(
$tabs = apply_filters( 'woocommerce_product_data_tabs', array(
'general' => array(
'label' => __( 'General', 'woocommerce' ),
'target' => 'general_product_data',
'class' => array( 'hide_if_grouped' ),
'label' => __( 'General', 'woocommerce' ),
'target' => 'general_product_data',
'class' => array( 'hide_if_grouped' ),
'priority' => 10,
),
'inventory' => array(
'label' => __( 'Inventory', 'woocommerce' ),
'target' => 'inventory_product_data',
'class' => array( 'show_if_simple', 'show_if_variable', 'show_if_grouped', 'show_if_external' ),
'label' => __( 'Inventory', 'woocommerce' ),
'target' => 'inventory_product_data',
'class' => array( 'show_if_simple', 'show_if_variable', 'show_if_grouped', 'show_if_external' ),
'priority' => 20,
),
'shipping' => array(
'label' => __( 'Shipping', 'woocommerce' ),
'target' => 'shipping_product_data',
'class' => array( 'hide_if_virtual', 'hide_if_grouped', 'hide_if_external' ),
'label' => __( 'Shipping', 'woocommerce' ),
'target' => 'shipping_product_data',
'class' => array( 'hide_if_virtual', 'hide_if_grouped', 'hide_if_external' ),
'priority' => 30,
),
'linked_product' => array(
'label' => __( 'Linked Products', 'woocommerce' ),
'target' => 'linked_product_data',
'class' => array(),
'label' => __( 'Linked Products', 'woocommerce' ),
'target' => 'linked_product_data',
'class' => array(),
'priority' => 40,
),
'attribute' => array(
'label' => __( 'Attributes', 'woocommerce' ),
'target' => 'product_attributes',
'class' => array(),
'label' => __( 'Attributes', 'woocommerce' ),
'target' => 'product_attributes',
'class' => array(),
'priority' => 50,
),
'variations' => array(
'label' => __( 'Variations', 'woocommerce' ),
'target' => 'variable_product_options',
'class' => array( 'variations_tab', 'show_if_variable' ),
'label' => __( 'Variations', 'woocommerce' ),
'target' => 'variable_product_options',
'class' => array( 'variations_tab', 'show_if_variable' ),
'priority' => 60,
),
'advanced' => array(
'label' => __( 'Advanced', 'woocommerce' ),
'target' => 'advanced_product_data',
'class' => array(),
'label' => __( 'Advanced', 'woocommerce' ),
'target' => 'advanced_product_data',
'class' => array(),
'priority' => 70,
),
) );
// Sort tabs based on priority.
uasort( $tabs, array( __CLASS__, 'product_data_tabs_sort' ) );
return $tabs;
}
/**
* Callback to sort product data tabs on priority.
*
* @since 3.1.0
* @param int $a First item.
* @param int $b Second item.
*
* @return bool
*/
private static function product_data_tabs_sort( $a, $b ) {
if ( ! isset( $a['priority'], $b['priority'] ) ) {
return -1;
}
if ( $a['priority'] == $b['priority'] ) {
return 0;
}
return $a['priority'] < $b['priority'] ? -1 : 1;
}
/**
@ -257,8 +290,8 @@ class WC_Meta_Box_Product_Data {
*/
public static function save( $post_id, $post ) {
// Process product type first so we have the correct class to run setters.
$product_type = empty( $_POST['product-type'] ) ? 'simple' : sanitize_title( stripslashes( $_POST['product-type'] ) );
$classname = WC_Product_Factory::get_product_classname( $post_id, $product_type );
$product_type = empty( $_POST['product-type'] ) ? WC_Product_Factory::get_product_type( $post_id ) : sanitize_title( stripslashes( $_POST['product-type'] ) );
$classname = WC_Product_Factory::get_product_classname( $post_id, $product_type ? $product_type : 'simple' );
$product = new $classname( $post_id );
$attributes = self::prepare_attributes();
$errors = $product->set_props( array(
@ -351,7 +384,7 @@ class WC_Meta_Box_Product_Data {
'downloadable' => isset( $_POST['variable_is_downloadable'][ $i ] ),
'date_on_sale_from' => wc_clean( $_POST['variable_sale_price_dates_from'][ $i ] ),
'date_on_sale_to' => wc_clean( $_POST['variable_sale_price_dates_to'][ $i ] ),
'description' => wp_kses_post( wc_sanitize_textarea( $_POST['variable_description'][ $i ] ) ),
'description' => wp_kses_post( $_POST['variable_description'][ $i ] ),
'download_limit' => wc_clean( $_POST['variable_download_limit'][ $i ] ),
'download_expiry' => wc_clean( $_POST['variable_download_expiry'][ $i ] ),
'downloads' => self::prepare_downloads(

View File

@ -38,8 +38,8 @@ $hidden_order_itemmeta = apply_filters( 'woocommerce_hidden_order_itemmeta', arr
?>
<tr data-meta_id="<?php echo esc_attr( $meta_id ); ?>">
<td>
<input type="text" name="meta_key[<?php echo esc_attr( $item_id ); ?>][<?php echo esc_attr( $meta_id ); ?>]" value="<?php echo esc_attr( $meta->key ); ?>" />
<textarea name="meta_value[<?php echo esc_attr( $item_id ); ?>][<?php echo esc_attr( $meta_id ); ?>]"><?php echo esc_textarea( rawurldecode( $meta->value ) ); ?></textarea>
<input type="text" placeholder="<?php esc_attr_e( 'Name (required)', 'woocommerce' ); ?>" name="meta_key[<?php echo esc_attr( $item_id ); ?>][<?php echo esc_attr( $meta_id ); ?>]" value="<?php echo esc_attr( $meta->key ); ?>" />
<textarea placeholder="<?php esc_attr_e( 'Value (required)', 'woocommerce' ); ?>" name="meta_value[<?php echo esc_attr( $item_id ); ?>][<?php echo esc_attr( $meta_id ); ?>]"><?php echo esc_textarea( rawurldecode( $meta->value ) ); ?></textarea>
</td>
<td width="1%"><button class="remove_order_item_meta button">&times;</button></td>
</tr>

View File

@ -121,7 +121,11 @@ $thumbnail = $product ? apply_filters( 'woocommerce_admin_order_item_thumbnai
}
if ( $item->get_subtotal() !== $item->get_total() ) {
echo '<span class="wc-order-item-discount">-' . wc_price( wc_round_tax_total( $tax_item_subtotal - $tax_item_total ), array( 'currency' => $order->get_currency() ) ) . '</span>';
if ( '' === $tax_item_total ) {
echo '<span class="wc-order-item-discount">&ndash;</span>';
} else {
echo '<span class="wc-order-item-discount">-' . wc_price( wc_round_tax_total( $tax_item_subtotal - $tax_item_total ), array( 'currency' => $order->get_currency() ) ) . '</span>';
}
}
if ( $refunded = $order->get_tax_refunded_for_item( $item_id, $tax_item_id ) ) {

View File

@ -161,19 +161,9 @@ if ( wc_tax_enabled() ) {
<tr>
<td class="label"><?php _e( 'Order total', 'woocommerce' ); ?>:</td>
<td>
<?php if ( $order->is_editable() ) : ?>
<div class="wc-order-edit-line-item-actions">
<a class="edit-order-item" href="#"></a>
</div>
<?php endif; ?>
</td>
<td width="1%"></td>
<td class="total">
<div class="view"><?php echo $order->get_formatted_order_total(); ?></div>
<div class="edit" style="display: none;">
<input type="text" class="wc_input_price" id="_order_total" name="_order_total" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo esc_attr( wc_format_localized_price( $order->get_total( 'edit' ) ) ); ?>" />
<div class="clear"></div>
</div>
<?php echo $order->get_formatted_order_total(); ?>
</td>
</tr>
@ -210,8 +200,7 @@ if ( wc_tax_enabled() ) {
do_action( 'woocommerce_order_item_add_action_buttons', $order );
?>
<?php if ( $order->is_editable() ) : ?>
<button type="button" class="button button-primary calculate-tax-action"><?php _e( 'Calculate taxes', 'woocommerce' ); ?></button>
<button type="button" class="button button-primary calculate-action"><?php _e( 'Calculate total', 'woocommerce' ); ?></button>
<button type="button" class="button button-primary calculate-action"><?php _e( 'Recalculate', 'woocommerce' ); ?></button>
<?php endif; ?>
</p>
</div>
@ -219,12 +208,12 @@ if ( wc_tax_enabled() ) {
<button type="button" class="button add-order-item"><?php _e( 'Add product(s)', 'woocommerce' ); ?></button>
<button type="button" class="button add-order-fee"><?php _e( 'Add fee', 'woocommerce' ); ?></button>
<button type="button" class="button add-order-shipping"><?php _e( 'Add shipping cost', 'woocommerce' ); ?></button>
<button type="button" class="button cancel-action"><?php _e( 'Cancel', 'woocommerce' ); ?></button>
<button type="button" class="button button-primary save-action"><?php _e( 'Save', 'woocommerce' ); ?></button>
<?php
// allow adding custom buttons
do_action( 'woocommerce_order_item_add_line_buttons', $order );
?>
<button type="button" class="button cancel-action"><?php _e( 'Cancel', 'woocommerce' ); ?></button>
<button type="button" class="button button-primary save-action"><?php _e( 'Save', 'woocommerce' ); ?></button>
</div>
<?php if ( 0 < $order->get_total() - $order->get_total_refunded() || 0 < absint( $order->get_item_count() - $order->get_item_count_refunded() ) ) : ?>
<div class="wc-order-data-row wc-order-refund-items wc-order-data-row-toggle" style="display: none;">

View File

@ -14,7 +14,7 @@ $who_refunded = new WP_User( $refund->get_refunded_by() );
<td class="name">
<?php
/* translators: 1: refund id 2: date */
printf( __( 'Refund #%1$s - %2$s', 'woocommerce' ), $refund->get_id(), wc_format_datetime( $order->get_date_created(), get_option( 'date_format' ) . ', ' . get_option( 'time_format' ) ) );
printf( __( 'Refund #%1$s - %2$s', 'woocommerce' ), $refund->get_id(), wc_format_datetime( $refund->get_date_created(), get_option( 'date_format' ) . ', ' . get_option( 'time_format' ) ) );
if ( $who_refunded->exists() ) {
echo ' ' . esc_attr_x( 'by', 'Ex: Refund - $date >by< $username', 'woocommerce' ) . ' ' . '<abbr class="refund_by" title="' . sprintf( esc_attr__( 'ID: %d', 'woocommerce' ), absint( $who_refunded->ID ) ) . '">' . esc_attr( $who_refunded->display_name ) . '</abbr>' ;

View File

@ -44,7 +44,7 @@
<label for="_sale_price_dates_from">' . __( 'Sale price dates', 'woocommerce' ) . '</label>
<input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . _x( 'From&hellip;', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
<input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . _x( 'To&hellip;', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
<a href="#" class="cancel_sale_schedule">' . __( 'Cancel', 'woocommerce' ) . '</a>' . wc_help_tip( __( 'The sale will end at the beginning of the set date.', 'woocommerce' ) ) . '
<a href="#" class="description cancel_sale_schedule">' . __( 'Cancel', 'woocommerce' ) . '</a>' . wc_help_tip( __( 'The sale will end at the beginning of the set date.', 'woocommerce' ) ) . '
</p>';
do_action( 'woocommerce_product_options_pricing' );

View File

@ -12,7 +12,7 @@
</label>
<?php foreach ( self::get_product_type_options() as $key => $option ) :
if ( $product_object ) {
if ( metadata_exists( 'post', $post->ID, '_' . $key ) ) {
$selected_value = is_callable( array( $product_object, "is_$key" ) ) ? $product_object->{"is_$key"}() : 'yes' === get_post_meta( $post->ID, '_' . $key, true );
} else {
$selected_value = 'yes' === ( isset( $option['default'] ) ? $option['default'] : 'no' );

View File

@ -513,11 +513,13 @@ class WC_Admin_Report {
switch ( $current_range ) {
case 'custom' :
$this->start_date = strtotime( sanitize_text_field( $_GET['start_date'] ) );
$this->end_date = strtotime( 'midnight', strtotime( sanitize_text_field( $_GET['end_date'] ) ) );
if ( ! $this->end_date ) {
$this->end_date = current_time( 'timestamp' );
$this->start_date = max( strtotime( '-20 years' ), strtotime( sanitize_text_field( $_GET['start_date'] ) ) );
if ( empty( $_GET['end_date'] ) ) {
$this->end_date = strtotime( 'midnight', current_time( 'timestamp' ) );
} else {
$this->end_date = strtotime( 'midnight', strtotime( sanitize_text_field( $_GET['end_date'] ) ) );
}
$interval = 0;
@ -643,4 +645,21 @@ class WC_Admin_Report {
* Output the report.
*/
public function output_report() {}
/**
* Check nonce for current range.
*
* @since 3.0.4
* @param string $current_range Current range.
*/
public function check_current_range_nonce( $current_range ) {
if ( 'custom' !== $current_range ) {
return;
}
if ( ! isset( $_GET['wc_reports_nonce'] ) || ! wp_verify_nonce( $_GET['wc_reports_nonce'], 'custom_range' ) ) {
wp_safe_redirect( remove_query_arg( array( 'start_date', 'end_date', 'range', 'wc_reports_nonce' ) ) );
exit;
}
}
}

View File

@ -105,14 +105,14 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
$total_coupons = absint( $this->get_order_report_data( $total_coupons_query ) );
$legend[] = array(
/* translators: %s: discount ammount */
/* translators: %s: discount amount */
'title' => sprintf( __( '%s discounts in total', 'woocommerce' ), '<strong>' . wc_price( $total_discount ) . '</strong>' ),
'color' => $this->chart_colours['discount_amount'],
'highlight_series' => 1,
);
$legend[] = array(
/* translators: %s: coupons ammount */
/* translators: %s: coupons amount */
'title' => sprintf( __( '%s coupons used in total', 'woocommerce' ), '<strong>' . $total_coupons . '</strong>' ),
'color' => $this->chart_colours['coupon_count'],
'highlight_series' => 0,
@ -144,6 +144,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
$current_range = '7day';
}
$this->check_current_range_nonce( $current_range );
$this->calculate_current_range( $current_range );
include( WC()->plugin_path() . '/includes/admin/views/html-report-by-date.php' );

View File

@ -24,8 +24,8 @@ class WC_Report_Customer_List extends WP_List_Table {
public function __construct() {
parent::__construct( array(
'singular' => __( 'Customer', 'woocommerce' ),
'plural' => __( 'Customers', 'woocommerce' ),
'singular' => 'customer',
'plural' => 'customers',
'ajax' => false,
) );
}

View File

@ -37,7 +37,7 @@ class WC_Report_Customers extends WC_Admin_Report {
$legend = array();
$legend[] = array(
/* translators: %s: signups ammount */
/* translators: %s: signups amount */
'title' => sprintf( __( '%s signups in this period', 'woocommerce' ), '<strong>' . sizeof( $this->customers ) . '</strong>' ),
'color' => $this->chart_colours['signups'],
'highlight_series' => 2,
@ -178,6 +178,7 @@ class WC_Report_Customers extends WC_Admin_Report {
$current_range = '7day';
}
$this->check_current_range_nonce( $current_range );
$this->calculate_current_range( $current_range );
$admin_users = new WP_User_Query(

View File

@ -125,6 +125,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
$current_range = '7day';
}
$this->check_current_range_nonce( $current_range );
$this->calculate_current_range( $current_range );
// Get item sales data

Some files were not shown because too many files have changed in this diff Show More