Commit Graph

544 Commits

Author SHA1 Message Date
Mike Jolley 196ba7b770 Ensure we have a product before checking if it exists
Fixes #13642
2017-03-17 16:26:26 +00:00
Claudio Sanches 59c2849736 Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
Claudio Sanches 98d26521d1 Keep date compatibility in WC_Ajax::get_customer_details() 2017-03-10 20:13:56 -03:00
Lars Støttrup Nielsen 7829ec297a do_action on single product reordering 2017-02-25 16:42:35 +01:00
Claudio Sanches 1eccb65d85 Fixed coding standards 2017-02-24 17:30:41 -03:00
Mike Jolley 04aebd9fa7 Merge pull request #13306 from woocommerce/fix-13303
Fix multiple item additon to orders
2017-02-23 18:11:02 +00:00
Frédéric Demarle c5247a8c4b Fix call to deprecated methods in ajax reduce/increase stock responses 2017-02-23 16:54:04 +01:00
Mike Jolley f21997d661 Send items in one request rather than multiple requests 2017-02-23 10:19:32 +00:00
Mike Jolley 962b60c8fe kses/sanitize 2017-02-09 15:43:47 +00:00
Mike Jolley 11ef37880b Moved logic to wc_create_refund 2017-02-08 16:20:42 +00:00
Mike Jolley 23cc478bc9 Exit after redirect to prevent incorrect headers being set by wp_die 2017-02-06 17:59:31 +00:00
Frédéric Demarle 4075024bb9 Use wp_die intead of die in ajax responses 2017-01-29 21:43:25 +01:00
Claudio Sanches 11035ba4d7 Fixed "stock increase" string placeholders, closes #12873 2017-01-18 14:34:52 -02:00
Mike Jolley f7d72afcf9 Detect classname when saving attributes 2017-01-05 16:54:47 +00:00
Mike Jolley 813ec28c7b Remove type check in link_all_variations 2017-01-05 16:17:46 +00:00
Mike Jolley ec41ba9ff0 delete, don't trash, variations 2017-01-04 14:05:13 +00:00
Beka Rice 85f06d7d02 [2.7] Fix undefined variable notice 2017-01-03 18:08:37 -05:00
Manos Psychogyiopoulos be436b629d fix include field typo 2016-12-27 10:36:44 +02:00
Mike Jolley 906499bbb8 woocommerce_ajax_get_customer_details filter and deprecation notice
Closes #12654
2016-12-20 16:02:38 +00:00
Mike Jolley 12608af03a Sorting handling 2016-12-08 14:28:51 +00:00
Justin Shreve a315e174b7 Fix tax name typo and wrap with _escape. 2016-12-07 11:03:28 -08:00
Mike Jolley 162aa986b6 Fix tests 2016-12-05 14:21:09 +00:00
Mike Jolley 9a1dd8d04b Menu order 2016-11-24 17:50:24 +00:00
Mike Jolley 1749551021 Customer crud 2016-11-24 15:31:05 +00:00
Mike Jolley 12a216595a CRUD ajax updates 2016-11-24 14:20:58 +00:00
Mike Jolley ac62cffe16 Refactor ajax search for CRUD 2016-11-24 11:50:58 +00:00
Kevin Killingsworth 0b9c2e2f15 CRUD: Add CRUD operations for ajax functions.
This commit changes post and post_meta calls to CRUD objects
throughout the wc-ajax server-side code.

It does not update the most complex functions that have inline SQL.
2016-11-23 15:35:48 -06:00
Justin Shreve f15867bb67 Fix ajax actions for saving items, and misc issues. 2016-11-21 10:57:33 -08:00
Justin Shreve 51a55b6782 Add interface, renaming main order item data store to abstract. Various fixes. 2016-11-21 10:57:33 -08:00
Mike Jolley 32de28355a Merge branch 'master' into order-data-store
# Conflicts:
#	includes/admin/meta-boxes/class-wc-meta-box-order-data.php
2016-11-21 14:45:46 +00:00
Mike Jolley 1b6d7acd24 Data store for downloads 2016-11-18 17:13:02 +00:00
Claudio Sanches e1aeba9f21 Remove all wp_get_post_terms() and wp_get_object_terms() terms occurrences 2016-11-17 17:02:05 -02:00
Justin Shreve 735c1b7a14 Finish moving queries to the shipping zone data store, update usage of deprecated get_zone_id, legacy updates. 2016-11-16 04:53:23 -08:00
Mike Jolley 76b32c9aa5 WIP - Product CRUD (#12065)
* Created function to get the catalog visibility options

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* Hardcode the get_type per product class

* Initial look through getters and setters and abstract data

* Missing var

* Add related product functions and deprecate those in class.

* No need to exclude ID

* Fixed coding standards and improved the docblocks

* Get cached terms from wc_get_related_terms()

* Fixed wrong variable in wc_get_related_terms

* Use count() instead of sizeof()

* Sanitize ids later

* Remove unneeded comments

* wc_get_product_term_ids instead of related wording and use in other places.

get_the_terms is used here and also handles caching, something
wp_get_post_terms does not.

* Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it.

* Bump template version

* Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function

* Made abstract function useful

* External Product CRUD

* _virtual meta should be 'no', not taxable, in product unit test helper

* Grouped product class

* Tests

* Move children to meta and update test

* Use get_upsell_ids

* Spacing in query

* Moving and refactoring methods

* Availability html

* Tidy/add todos

* Rename method

* Put back review functions (still todo)

* missing $this

* get_price_including_tax/excluding_tax functions

* wc_get_price_to_display

* Price handling

* [Product CRUD] Variable (#12146)

* [Product CRUD] Variable Products

* Handle PR feedback.

* [Product CRUD] Grouped Handling (#12151)

* Handle grouped product saving

* Update routine

* [Product CRUD] Product crud terms (#12149)

* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function

* Product crud admin save routine (#12174)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function

* [Product CRUD] Product crud admin use getters (#12196)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Move settings into new files

* Refactor panels and use getters

* Use getters for variation panel

* Revert save variation changes for now

* Add todos

* Fix downloads

* REST API CRUD Updates

* Additional API updates/fixes. Added some todos

* Fix final failing tests and implementing setters/getters and attributes functionality.

* Fix comparison for is_on_sale and remove download_type from WC_Product.

* Add a wc_get_products wrapper.

* Remove the download type input from the product data metabox for downloadable products. (#12221)

* [Product CRUD] Variations - setters, getters and admin. (#12228)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes

* Implement CRUD in the legacy REST API

* Handle PR feedback

* [Product CRUD] Getter setter proxy methods (#12236)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* get_prop implementation in abstract and data classes

* Implement set_prop

* Change handling

* Array key exists

* set_object_read

* Use get_the_terms() instead of wp_get_post_terms()

wp_get_post_terms() is a wrapper around wp_get_object_terms() which does not
use the object cache, and generates a database query every time it is used.

get_the_terms() however can use data from the object cache if present.

* Allow WP_Query to preload post data, and meta in wc_get_products()

Allow WP_Query to bulk query for post data and meta if more than
just IDs are requested from wc_get_products(). Reduces query count
significantly.

* [Product CRUD] Variable, variation, notices, and stock handling (#12277)

* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* Hardcode the get_type per product class

* Initial look through getters and setters and abstract data

* Missing var

* Fixed coding standards and improved the docblocks

* Get cached terms from wc_get_related_terms()

* Fixed wrong variable in wc_get_related_terms

* Use count() instead of sizeof()

* Add related product functions and deprecate those in class.

* No need to exclude ID

* Sanitize ids later

* Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it.

* Remove unneeded comments

* wc_get_product_term_ids instead of related wording and use in other places.

get_the_terms is used here and also handles caching, something
wp_get_post_terms does not.

* Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function

* External Product CRUD

* _virtual meta should be 'no', not taxable, in product unit test helper

* Bump template version

* Made abstract function useful

* Grouped product class

* Tests

* Move children to meta and update test

* Use get_upsell_ids

* Spacing in query

* Moving and refactoring methods

* Availability html

* Tidy/add todos

* Rename method

* Put back review functions (still todo)

* missing $this

* get_price_including_tax/excluding_tax functions

* wc_get_price_to_display

* Price handling

* [Product CRUD] Variable (#12146)

* [Product CRUD] Variable Products

* Handle PR feedback.

* [Product CRUD] Grouped Handling (#12151)

* Handle grouped product saving

* Update routine

* [Product CRUD] Product crud terms (#12149)

* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function

* Product crud admin save routine (#12174)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function

* [Product CRUD] Product crud admin use getters (#12196)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Move settings into new files

* Refactor panels and use getters

* Use getters for variation panel

* Revert save variation changes for now

* Add todos

* Fix downloads

* REST API CRUD Updates

* Additional API updates/fixes. Added some todos

* Fix final failing tests and implementing setters/getters and attributes functionality.

* Fix comparison for is_on_sale and remove download_type from WC_Product.

* Add a wc_get_products wrapper.

* Remove the download type input from the product data metabox for downloadable products. (#12221)

* [Product CRUD] Variations - setters, getters and admin. (#12228)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes

* Implement CRUD in the legacy REST API

* Handle PR feedback

* [Product CRUD] Getter setter proxy methods (#12236)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* get_prop implementation in abstract and data classes

* Implement set_prop

* Change handling

* Array key exists

* set_object_read

* Use get_the_terms() instead of wp_get_post_terms()

wp_get_post_terms() is a wrapper around wp_get_object_terms() which does not
use the object cache, and generates a database query every time it is used.

get_the_terms() however can use data from the object cache if present.

* [Product CRUD] Variable, variation, notices, and stock handling (#12277)

* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback

* Prevent notices

* Handle image_id from parent

* Fix error

* Remove _wc_save_product_price

* Remove todo

* Fixed wrong variation URLs

* Fixed undefined $image_id in WC_Product_Variation::get_image_id()

* Allow wc_rest_prepare_date_response() handle timestamps

* Updated get methods on REST API for variations

* Use variations CRUD to save variations metadata

* [Product CRUD] Abstract todos (#12305)

* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Revert "[Product CRUD] Abstract todos (#12305)"

This reverts commit 9a6136fcf8.

* Remove deprecated get_variation_id()

* New default attributes method

* [Product CRUD] Product Datastore (#12317)

* Fix up tests in the product/* folder.

* Handle data store updates for grouped, variable, external, simple, and general data store updates for products.

* Variations & variable changes.

* Update -functions.php calls to use data store.

* Add an interface for the public product data store methods.

* Finished product factory tests

* Correctly delete in the api, fix up some comments, and implement an interface for the public variable methods.

* Fix up delete in all versions of the api

* Handle feedback

* Match protected decloration to parent

* Product crud abstract todos (#12316)

* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Fix up store

* Fixed method returning in write context

* Fix error in variation admin

* Check for parent value - fixes tax class

* Remove old/complete todos

* Allow set tax class as "parent"

* Removed duplicated sync

* Fixed wrong variation URLs

* Fixed undefined $image_id in WC_Product_Variation::get_image_id()

* Allow wc_rest_prepare_date_response() handle timestamps

* Updated get methods on REST API for variations

* Use variations CRUD to save variations metadata

* Remove deprecated get_variation_id()

* New default attributes method

* Fixed method returning in write context

* Allow set tax class as "parent"

* Removed duplicated sync

* Fixed coding standards

* TODO is not accurate.

* Should pass WC_Product instancies to WC_Comments methods (#12327)

* Use new method in abstract order class to prevent headers sent issue in tests

* Fixed variable description in REST API

* Updated how create initial product variation

* Fixed a few fatal errors and warnings in Products CRUD (#12329)

* Fixed a few fatal errors and warnings in Products CRUD

* Fixed sync functions

* Add variations CRUD to legacy API (#12331)

* Apply crud to variable products in legacy API v1

* New REST API do not need fallback for default attributes

* Apply variations CRUD to legacy API v2

* Legacy v2 - save default attributes

* Variations in legacy API v2 do not have descriptions

* Fixed legacy API v2 variations params

* Applied variations CRUD to legacy API v3

* Sync before save in legacy apis

* Punc

* Removed API todos

* Removed test

* Products endpoint tweaks (#12354)

* Var type already normalized on CRUD

* Let Product CRUD handle with validation, sanitization and conditional checks

* Set downloads using WC_Product_Download

* Stop try catch exceptions more than one time

* Handle WC_Data_Exception in legacy API

* Complete remove products when fails on creating

* On creating I mean!

* Already have a method to complete delete products

* Fixed standards using WP CodeSniffer

* get_the_terms() returns false when empty

* get_manage_stock returns boolean

@claudiosanches

* Merge conflict

* Variations API endpoint fixes

* Product CRUD improvements (#12359)

* args is not used any more - remove todo

* Added test for attributes

* wc_get_price_excluding_tax usage

* parent usage

* Fix rating counts

* Test fixes

* Cleanup after tests

* Make sure status transition code runs even during API calls, not just in admin.

* Default visibility

* Fix attribute setting in API

* Use get name instead of get title

* variation id usage

* Improved cross sell templates

* variation_data

* Grouped product sync

* Notices

* Sync is not needed in API

* Delete

* Rename interfaces

* Update counts in data store
2016-11-16 12:38:24 +00:00
Sabbir Ahmed 7cd5488f26 Fix toggle download and virtual in variation bulk action #12333 2016-11-13 11:45:12 +06:00
Rami Yushuvaev 6cc301e58c add translators comments 2016-10-29 13:16:03 +03:00
Rami Yushuvaev fec057c993 Use get_admin_page_title() function to display admin titles (#12077)
*  Use get_admin_page_title() function to display admin titles

* revert

* i18n: use sprintf() in translation strings
2016-10-13 13:34:48 -03:00
Mike Jolley 0829200299 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	includes/admin/class-wc-admin-help.php
2016-10-12 11:18:27 +01:00
Rami Yushuvaev eae583fc3c Update wp.org plugin directory links 2016-10-12 11:16:58 +01:00
Claudio Sanches 657c312cae Fix strings case (#12069)
* Fixed case for all _e, esc_attr_e and esc_html_e strings

* Fixed case for all _n_noop strings

* Fixed case for all _x strings

* Fixed case for all __, esc_html__ and esc_attr__ strings

* Fixed a few more strings

* Fixed strings in unit tests

* Fix PayPal Standard case.

* Save Order text
2016-10-12 11:16:30 +01:00
Mike Jolley 321a72b957 Add missing comma 2016-10-11 11:53:47 +01:00
Mike Jolley 2d270fb405 Fix saving and rest of world 2016-10-10 18:41:07 +01:00
Mike Jolley 160049eddd Remove save button from zones screen. 2016-10-10 17:50:29 +01:00
Mike Jolley 83cc0c7066 Work on shipping zone screens 2016-09-24 03:22:57 +01:00
Aristeides Stathopoulos 734f284fa4 WordPress.PHP.YodaConditions.NotYoda 2016-09-08 01:32:24 +03:00
Aristeides Stathopoulos d4e3faf014 PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket 2016-09-02 04:51:31 +03:00
Aristeides Stathopoulos 0516e96843 PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket 2016-09-02 04:33:57 +03:00
Aristeides Stathopoulos fde1037757 fix failing tests. 2016-09-01 23:50:14 +03:00
Mike Jolley 1b2df3dd3b Merge branch 'pr/11797'
# Conflicts:
#	includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php
#	includes/api/class-wc-rest-coupons-controller.php
#	includes/class-wc-coupon.php
#	tests/unit-tests/api/coupons.php
#	tests/unit-tests/coupon/crud.php
2016-09-01 11:46:05 +01:00
Mike Jolley 7439f6d79f Use set_props 2016-08-30 17:59:41 +01:00
Aristeides Stathopoulos f2730eea02 WordPress.WhiteSpace.ControlStructureSpacing.BlankLineAfterEnd 2016-08-27 08:57:05 +03:00
Aristeides Stathopoulos 82f3cc221e WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenthesis 2016-08-27 07:23:02 +03:00
Aristeides Stathopoulos ff852038c9 WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys 2016-08-27 06:11:30 +03:00
Aristeides Stathopoulos ec8a0b288b PHPCS: WordPress.Arrays.ArrayDeclaration.NoCommaAfterLast 2016-08-27 05:08:49 +03:00
Aristeides Stathopoulos b063bcfe4c last item in a multiline-array should end in a comma 2016-08-27 04:46:45 +03:00
Mike Jolley b4e05154d7 Error handling for adding items 2016-08-25 14:22:27 +01:00
Mike Jolley 938361535f Exception handling 2016-08-24 16:02:19 +01:00
Mike Jolley 2cea613566 Fix shipping meta save
#11601
2016-08-22 18:07:52 +01:00
Mike Jolley 7cf75f5085 Remove use of deprecated functions 2016-08-22 16:57:54 +01:00
Mike Jolley 95b11606fc get_product_from_item -> get_product 2016-08-22 16:51:24 +01:00
Mike Jolley c88984eb0e Replace add methods 2016-08-22 16:48:19 +01:00
Mike Jolley 9e45927803 Create refund with crud 2016-08-22 13:15:15 +01:00
Mike Jolley 21ad196297 Use CRUD in wc_save_order_items 2016-08-19 13:43:33 +01:00
Mike Jolley 97618fa2af Made stock notes consistent
Fixes #11673
2016-08-12 10:47:01 +01:00
Mike Jolley 8d58febaf8 Merge branch 'master' into orders-crud-function-update
# Conflicts:
#	includes/class-wc-checkout.php
2016-08-09 14:03:06 +01:00
Mike Jolley a8759fc0aa Meta/product handling 2016-08-08 16:20:15 +01:00
Mike Jolley 7685587b22 payment_method 2016-08-05 16:04:41 +01:00
Mike Jolley 84c52370fa more getters 2016-08-05 15:57:40 +01:00
Justin Shreve e3b1f6dbc9 A few fixes to customer CRUD:
* Implement some missing legacy functions
* Stop calling legacy functions from some pages
* Prevent extra meta from being deleted, unless requested by the CRUD (was causing problems with user/customer)
* Prevent save when loading from session AND logged out
2016-08-04 13:13:07 -07:00
Mike Jolley 1bc9da3e91 Merge branch 'master' into WC-CRUD
# Conflicts:
#	includes/class-wc-coupon.php
2016-08-04 12:10:04 +01:00
Lee Willis 15c6389326 Delete method options when deleting method 2016-07-27 18:14:50 +01:00
Mike Jolley 53511e36ec Use permission id to revoke access to downloads to prevent removing wrong rows.
Fixes #11423 @claudiosmweb
2016-07-14 15:54:28 +02:00
danielvonmitschke 857647cc06 Added '$_product' argument to 'woocommerce_restock_refunded_item' hook
currently the hook is only using $_product->id but it might be useful
not to only know the product but also the explicit variation that was
refunded.
2016-07-01 12:53:08 +02:00
danielvonmitschke abce9cc8b6 Added a filter hook for the wc_ajax endpoint url
This might come in handy for some custom ajax implementations
2016-07-01 12:51:37 +02:00
Mike Jolley 78142a8ebb Merge branch 'master' into WC-CRUD
# Conflicts:
#	includes/class-wc-checkout.php
#	includes/class-wc-coupon.php
#	includes/class-wc-customer.php
#	tests/unit-tests/cart/cart.php
#	tests/unit-tests/cart/functions.php
#	tests/unit-tests/coupon/coupon.php
#	woocommerce.php
2016-06-13 15:01:58 +01:00
Mike Jolley 30c4d3ab77 docblock 2016-06-07 14:19:36 +01:00
Mike Jolley 548fe93a97 Make use of unused $x var 2016-06-07 14:10:23 +01:00
Mike Jolley 730019ef18 scrutinizer best practice 2016-06-06 19:39:23 +01:00
Mike Jolley 3fd15ad50f Unused vars and code docs 2016-06-06 18:57:24 +01:00
Mike Jolley d4d6f3181c Best practice tweaks 2016-06-06 17:24:31 +01:00
Mike Jolley a40fb29eca wc_set_time_limit helper function 2016-06-06 16:55:27 +01:00
Claudio Sanches e39274e753 HTTPS for everybody 2016-05-26 22:48:49 -03:00
Mike Jolley 54231c2946 Allow shipping classes interface to be extended. 2016-05-19 12:38:28 +01:00
Caleb Burks 75dfae2bf2 Return to shop if session expires and escape url. 2016-05-17 17:00:09 -05:00
Mike Jolley 986bd5abc7 Fix save and striping 2016-05-12 12:18:35 +01:00
Mike Jolley 2cc0ac294e Fix return on add_metadata
Fixes #10892
2016-05-11 15:28:40 +01:00
Joey Kudish 7f71376418 add action hooks for shipping zone method actions
Adds action hooks for shipping zone methods added, deleted and status
toggled
2016-05-10 11:43:47 -07:00
Harald Rosberg 84887409a0 added a filter to make it possible to override if an attribute is variation by default, #10869 2016-05-06 13:22:32 +02:00
Mike Jolley 4901117f64 Data must exist 2016-04-20 15:02:41 +01:00
Diego Zanella 531f644f5f Added safeguard check for shipping methods post data 2016-04-20 10:21:28 +01:00
Diego Zanella a506909822 Backward compatibility with WC 2.5 and earlier
* Slightly altered previous change to maintain the exact logic used before (i.e. the WC_Ajax class sets the POST data for the shipping method explicitly).
2016-04-20 08:49:32 +01:00
Diego Zanella ba46a5275f Backward compatibility with WC 2.5 and earlier
* Restored signature of WC_Settings_API::process_admin_options() method.
2016-04-20 08:48:29 +01:00
Mike Jolley 6ae2fea045 Allow default address to be empty.
Fixes #10664
2016-04-18 14:51:39 +01:00
Mike Jolley 70d334395d Shipping calculation in backend should be based on line items
Fixes #10718
2016-04-18 12:56:59 +01:00
Mike Jolley dd99c7fb17 Redirect to product screen if referer is missing.
Fixes #10713
2016-04-18 11:48:57 +01:00
EmilEriksen a0ae25ca24 Change AJAX add coupon generic error notice type 2016-04-12 17:07:11 +02:00
Mike Jolley d3ac3f4073 Modals first pass 2016-03-24 17:26:40 +00:00
Mike Jolley ca5a46a2f9 Allow bulk deletion of refunds 2016-03-23 16:32:12 +00:00
Mike Jolley 3205975a24 Fix manual addition of shipping to orders 2016-03-23 15:16:09 +00:00
Mike Jolley f73149feaf Tweak variation display and reenable bulk editing 2016-03-22 17:13:39 +00:00
Mike Jolley 7be2b129b6 Removed bulk actions from order items panel
Reduce/increase order item stock is less important these days do to
automatic stock reduction (when status changes) and because when you
refund items you can restock items via checkbox. Manual stock changes
can be performed by editing products.

Decreases complexity of order items box.
2016-03-21 14:58:14 +00:00
Justin Shreve ffc80ccd15 Start updating some usage, and start implementing the actual CRUD functions, and some new get/setters for username, email, etc. 2016-03-17 09:41:12 -07:00
Mike Jolley 1549158981 Add 'is_enabled' column to instances table and allow toggle in zones screen
@allendav
2016-03-15 17:23:06 +00:00
ConfusedTA 8495d98275 Add filter to output from json_search_customers
Add filter to admin ajax customer search, to allow modification of search result output via plugin or theme.
2016-03-10 12:15:44 +00:00
Mike Jolley 03872e953b [2.5] Round refund values.
Fixes #10456.
2016-03-03 13:40:50 +00:00
Mike Jolley c21b0eda82 Merge pull request #10361 from shivapoudel/ajax-customer-search
Feature to exclude certain users from ajax customer search box
2016-03-03 12:54:19 +00:00
Mike Jolley 73f71191fc [2.5] current class fix on some servers when empty 2016-02-22 15:19:44 +00:00
Mike Jolley e9703da300 Merge pull request #9921 from peterrath/vat-exempt-and-tax-enabled-handling
VAT exempt and “TAX enabled” handling in back end and Orders API
2016-02-19 14:53:39 +00:00
Peter 5a9cec18ee Indent the new if statement 2016-02-18 20:35:33 +01:00
Peter 0cc33c8186 Use !== instead of != in class-wc-ajax.php
Use !== here: if ( wc_tax_enabled() && $is_vat_exempt !== 'yes' ) {
2016-02-18 20:29:10 +01:00
Peter b508a6f19f Remove space before bracket in class-wc-ajax.php
remove space before bracket here: $is_vat_exempt = get_post_meta( $order_id, '_is_vat_exempt', true );
2016-02-18 19:57:55 +01:00
Shiva Poudel 5fb5a7ded2 We need to check for ID in array to exclude user ID as search_columns are of different 2016-02-17 00:25:06 +05:45
Shiva Poudel a88caf5b72 Feature to exclude certain users from ajax customer search box
Closes #10360
CC @mikejolley
2016-02-16 19:40:36 +05:45
Kevin Killingsworth e99e75b5b9 Fix spacing.
Add space after !
2016-02-14 21:56:42 -06:00
Kevin Killingsworth ce90c440cb Cart ajax: apply coupon
Adds an ajax call for applying coupons while on the cart
screen (not checkout, as it already has this.)

This is the first commit to add ajax calls to the cart update
functions. See issue #6734
2016-02-12 15:43:05 -06:00
Mike Jolley 75c264837f Justins feedback/code tidy 2016-02-10 13:21:16 +00:00
Mike Jolley 352184cc06 Merge branch 'master' into shipping-zones
# Conflicts:
#	assets/css/admin.css
#	i18n/languages/woocommerce.pot
#	includes/abstracts/abstract-wc-payment-gateway.php
#	includes/abstracts/abstract-wc-shipping-method.php
#	includes/admin/settings/class-wc-settings-shipping.php
#	includes/wc-core-functions.php
#	uninstall.php
2016-02-05 14:58:48 +00:00
Mike Jolley 3b43a53546 Don't format stock if empty 2016-01-28 11:31:53 +00:00
Mike Jolley a550c77dba [2.5] Remove stock bw compat code which was preventing manage stock being disabled.
Fixes #10167
2016-01-25 18:17:28 +00:00
Mike Jolley 55c8f91c14 [2.5] Set has calculated shipping to true when setting country
Closes #10148
2016-01-25 10:16:39 +00:00
Mike Jolley a26af7b801 [2.5] Unset reload_checkout once processed.
Fixes #10134
2016-01-21 20:29:14 +00:00
Florian Ludwig 6074ea3355 Formatted variation stock with wc_stock_amount 2016-01-20 23:37:22 +01:00
Mike Jolley 6050b204fc Support qty display in cart messages
Closes #10114
2016-01-20 11:32:49 +00:00
Mike Jolley d821b87f8a Move shipping classes to custom UI in shipping section 2016-01-13 16:52:28 +00:00
Mike Jolley 8064b35350 Add methods from zones screen 2016-01-13 15:04:10 +00:00
Mike Jolley 1076854608 Merge branch 'master' into shipping-zones
# Conflicts:
#	assets/css/admin.css
#	includes/abstracts/abstract-wc-shipping-method.php
#	includes/class-wc-shipping.php
#	includes/shipping/flat-rate/class-wc-shipping-flat-rate.php
#	includes/shipping/flat-rate/includes/class-wc-eval-math.php
#	includes/shipping/free-shipping/class-wc-shipping-free-shipping.php
#
includes/shipping/legacy-international-delivery/class-wc-shipping-legacy
-international-delivery.php
#
includes/shipping/legacy-local-delivery/class-wc-shipping-legacy-local-d
elivery.php
2016-01-11 11:48:18 +00:00
Peter 01e55cd7a4 is_vat_exempt and wc_tax_enabled handling in ajax
Tax is calculated in front-end only if tax is enabled and order is not vat exempted.
2016-01-05 21:43:26 +01:00
Shiva Poudel a3889d1a17 Fix - Typo in docblock for 'gruoped' -> 'grouped' 2016-01-05 11:16:54 +05:45
Mike Jolley 62ca37f651 Merge branch 'master' into shipping-zones
# Conflicts:
#	includes/admin/class-wc-admin-assets.php
#	includes/class-wc-install.php
2016-01-04 14:35:45 +00:00
Peter 36b3fdcc68 VAT exempt and TAX enabled handling in back-end
Additional condition for checking if tax is enabled and there is not vat exempt. If this is true, then calculate taxes on front-end, otherwise not.
TAX exempt can be filtered by a new woocommerce_ajax_calc_line_taxes_is_vat_exempt filter.
2015-12-30 15:20:09 +01:00
Mike Jolley 9aa34330ac Fix sorting and saving for methods 2015-12-16 16:09:52 +00:00
Mike Jolley 571469f44c Add methods to zones 2015-12-16 15:16:52 +00:00
Mike Jolley e25d876779 List and sort methods within zones 2015-12-15 17:48:03 +00:00
Manos Psychogyiopoulos 5597a2750b orphaned variations cause "failed to load results" issue 2015-12-12 16:37:32 +02:00
Manos Psychogyiopoulos 2a6a26f800 allow searching from predefined set and introduce search limit
Makes it possible to search from a pre-defined set of known ids without returning all results, avoiding an excessive amount of product instantiations with large result sets.
2015-12-12 14:28:45 +02:00
Mike Jolley 66d4065ae4 postcode saving 2015-12-10 18:33:59 +00:00
Mike Jolley cf5381083d Started on zone regions selector 2015-12-10 15:09:37 +00:00
Mike Jolley 41042e94a7 Sort zones 2015-12-10 12:31:03 +00:00
Mike Jolley 14eeb9f936 Zones first draft with backbone saving of zone names 2015-12-10 11:55:03 +00:00
Mike Jolley 5f940f7877 Send status headers to prevent 404s on wc-ajax
Fixes #9703
2015-11-30 12:10:31 +00:00
Mike Jolley 48f8665e2d Hide SQL errors during ajax requests
Avoids invalid JSON
2015-11-04 13:35:32 +00:00
Mike Jolley 7eb45ba16f Added wc_array_cartesian function to generate variations in a logical order.
Fixes #9515 @claudiosmweb
2015-11-04 12:14:51 +00:00
Claudio Sanches ee30b5b308 Fixed php docs standards 2015-11-03 11:31:20 -02:00
Mike Jolley 5b6e16682c Handle partial/full refund for orders containing free items
Also adds helper method to determine if such as free item exists or
not. Closes #9460
2015-10-29 15:34:33 +00:00
Biont bf4c5b1d91 Provide a filter after tax calculations are done #9313 2015-10-09 15:46:23 +02:00
Mike Jolley 0197a99065 Merge branch 'issue/8587'
Conflicts:
	assets/css/admin.css
	assets/css/woocommerce.css
	includes/admin/class-wc-admin-assets.php
	includes/admin/settings/views/html-settings-tax.php
2015-10-08 13:26:52 +01:00
Mike Jolley abaa8f47d8 Moved refund hooks to avoid emails after API refund failure 2015-10-06 14:43:36 +01:00
Mike Jolley 1f6260a880 Use tax settings in backend and default to base country
Closes #9186
2015-10-05 15:31:58 +01:00
Mike Jolley 786c87523f Improve product search and use WPDB instead of several get_posts queries
Fixes #9203 @claudiosmweb
2015-10-02 10:00:29 +02:00
Mike Jolley d4fbe0e45c Use SKU for stock order notes
Fixes #9133
2015-10-01 18:13:37 +02:00
Florian Ludwig 2d39a91fdc Add username on marking order status
At the moment the status updates via the order list action buttons are
not linked to the correct user. Lets fix that :)
2015-10-01 16:15:29 +02:00
Mike Jolley 7a3bd70c8b Allow bulk edit price to 0
Fixes #9143
2015-09-16 13:20:59 +01:00
Mike Jolley a056e3e649 Unslash key description
Closes #9068
2015-09-07 16:29:03 +01:00
Mike Jolley b111331686 Allow line breaks in non-variation attributes 2015-09-04 14:00:42 +01:00
Florian Ludwig b50a75ce23 Use wc_stock_amount for ajax response in variation admin
My previous pull request of old WC 2.3 didn’t get applied in the new
2.4 AJAX method for the variation admin. So let’s do it again ;) (old
pull request see #8304)
2015-08-28 18:17:54 +02:00
Mike Jolley 0cf74b5dba Set ajax endpoint headers like admin_ajax
@claudiosmweb does this make sense to you?
2015-08-23 21:17:03 +01:00
Mike Jolley 07b1f9329d Bulk update variation: Allow stock to be set to 0. 2015-08-21 16:48:25 +01:00
Mike Jolley bbb00d9a3a Bulk update variation manage stock when _manage_stock meta data is missing. 2015-08-21 16:33:55 +01:00
Mike Jolley ecc50f78ab Don't clean keys - avoids destroying special chars 2015-08-19 11:33:42 +01:00
Mike Jolley dc37e49c02 Suppress set_time_limit errors to prevent issues in some environments
“Warning: Cannot set max_execution_time above master value of 30 (tried
to set unlimited) in
/var/www/web1043/html/wordpress/wp-content/plugins/woocommerce/includes/
class-wc-download-handler.php on line 337</p>”
2015-08-18 13:16:25 +01:00
Mike Jolley a5a7c71aa7 Keep new variation in sync so actions can modify data Closes #8858 2015-08-17 15:11:34 +01:00
Claudio Sanches 934808fc37 Created new wc_sanitize_term_text_based() for properly sanitize term text based before save, closes #8823 2015-08-14 15:22:16 -03:00
Claudio Sanches dc666f6b27 Added missing $menu_order on WC_Ajax::add_variation() 2015-08-14 14:40:46 -03:00
George Stephanis 2aa1650f54 Rearrange things to get ajax working.
Spread them out throughout WooCommerce.
2015-08-13 17:49:59 -04:00
Mike Jolley fb64e6e66e Use wp_unslash and only decode when getting attributes, not saving 2015-08-13 13:03:51 +01:00
Mike Jolley 4908131b86 stripslashes_deep attributes 2015-08-13 12:07:05 +01:00
Mike Jolley 8f759c8af1 Order variations by menu_order by fallback to ID. 2015-08-13 10:40:50 +01:00
Mike Jolley d3e2217227 Allow errors with debug on
Closes #8805
2015-08-13 10:27:22 +01:00
Mike Jolley 19e8cc4634 display_errors > error_reporting 2015-08-12 17:45:49 +01:00
Mike Jolley 457283bc3c Ajax variations: stripslashes to fix attributes with quotes. 2015-08-12 17:08:21 +01:00
Mike Jolley 6a3f4ee969 Disable error_reporting during ajax requests to prevent malformed JSON. 2015-08-12 11:51:05 +01:00
Mike Jolley fafb6d5dca Tweak cart fix to avoid munging %%endpoint%% 2015-08-11 14:04:42 +01:00
Mike Jolley 3eedab457d return; don't break 2015-08-11 13:47:12 +01:00
Mike Jolley 1078564fca Prevent double add to cart due to ajax endpoints. 2015-08-11 11:53:36 +01:00
Mike Jolley c5cba283ed Remove numbered arguments from queries 2015-08-07 11:37:19 +01:00
Mike Jolley e8ea978e9e Merge pull request #8697 from JeroenSormani/define-ajax
Define DOING_AJAX early
2015-08-05 13:53:40 +01:00
Mike Jolley d6bd46c55d Move expand_item_meta to own method
Fixes notices in some extensions (deposits)
2015-08-03 13:21:44 +01:00
Brent Shepherd 501f0b752f Save product type before saving variations
WooCommerce prior to WC 2.4 saved the product type before any variations were saved because
WC_Meta_Box_Product_Data::save_variations() was called by WC_Meta_Box_Product_Data::save().
However, in WC 2.4 the variations are saved independently of other data about the containing
variable product, including product type. Because the product type hasn't been saved yet,
extensions that need to save their own variation level meta data can't know when saving
variations if the product is of the type they want to act on. They also can't check `$_POST`
to find out when saving variations, because 'product-type' isn't passed to that as it's
variable level meta data, not variation level meta data.

This patch passes the product type along with the variation level meta data when saving variations.
It then uses that to save the product type if the variable product has not yet been saved (and
therefore the product type has never been stored, which means calling get_product() would instantiate
a 'simple' product, as that is the default product type). This can lead to fatal errors if callbacks
expect the product type to be variable and attempt to call methods that only exist on those product
types, like variable_product_sync().

It will also update the product type if it was previously saved but has since changed. This prevents
fatal errors like that mentioned above but caused by switching from one product type, like a simple
product, to another, like a variable product.
2015-07-31 11:42:21 -07:00
JeroenSormani 2c81a71f04 Define DOING_AJAX early 2015-07-31 20:15:17 +02:00
Mike Jolley 61cb48afd7 Tweak wc ajax to post to the CURRENT URL rather than a fixed endpoint 2015-07-31 12:56:27 +01:00
Mike Jolley 82f50cedb0 Allow menu_order sorting like in 2.3
Also allow setting manually to allow sorting between pages.

Fixes #8690
2015-07-31 12:39:23 +01:00
Claudio Sanches 6c4893e0b2 Introduces the woocommerce_ajax_admin_get_variations_args filter, closes #8690 2015-07-30 19:11:53 -03:00
Claudio Sanches b28c6db7f5 Added button to dismiss variation error notices 2015-07-29 19:56:33 -03:00
Mike Jolley 7b2aec4791 Take item qty into consideration when refunding orders
Fixes #8675
2015-07-29 13:13:41 +01:00
Mike Jolley 060fb16e2e Move Pre 2.4 handling for attributes - DRY
@claudiosmweb @franticpsyx
2015-07-28 16:20:51 +01:00
Claudio Sanches b0ce578541 Show errors for admin ajax variations 2015-07-27 14:16:52 -03:00
Mike Jolley 0ab151562a Fix issues with trailing slashes on permalinks
Closes #8658
2015-07-27 11:56:07 +01:00
Tamara Zuk 1bd4cf8fad Define new `WC_DOING_AJAX` constant
This constant will allow extensions to selectively load files etc.
during a WC AJAX request.
2015-07-24 15:50:50 -04:00
Brent Shepherd ffdc13fb4b Remove duplication in WC_Ajax::save_variations()
And use the original WC_Meta_Box_Product_Data::save_variations() method instead.
2015-07-23 22:15:44 -07:00
Claudio Sanches 948c5c9cfc Fixed the sanitization for text-based default attributes 2015-07-22 21:40:06 -03:00
Claudio Sanches f3ac5657a4 Fixed link all variations when use text-based attributes 2015-07-22 18:57:50 -03:00
Claudio Sanches 7787673d33 Fix excluded posts ID in json_search_products() 2015-07-20 18:46:37 -03:00
Claudio Sanches 791c20ae51 Added param for exclude posts from wc-product-search, closes #8613 2015-07-20 13:41:14 -03:00
Claudio Sanches 9e41552342 Removed all "@return void" 2015-07-16 16:55:48 -03:00
Claudio Sanches 8d2a98eab1 Improved some docblocks 2015-07-16 16:29:01 -03:00
Claudio Sanches e0be5a2e9f Added truncated consumer key and last access fields in woocommerce_api_keys table 2015-07-16 15:42:00 -03:00
Mike Jolley 47c47ab93c Avoid set_time_limit error supression 2015-07-15 16:14:32 +01:00
Mike Jolley c412a2eb3e Set $post during variation addition 2015-07-14 13:49:13 +01:00
Mike Jolley 8bf1cf60c5 Set $post global so its available like within the admin screens
@claudiosmweb
2015-07-14 12:28:31 +01:00
Mike Jolley 015ace770d Split up bulk edit ajax methods 2015-07-14 11:39:48 +01:00