Commit Graph

337 Commits

Author SHA1 Message Date
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
Max Rice a9f6f7fdfe Introduce woocommerce_order_full_refunded_status filter
In certain situations it’s undesirable to automatically change the
order status for an order that has been fully refunded. For example, an
order processed with a credit card whose charge has been authorized but
not yet captured is typically voided, not refunded since no funds have
actually been transferred. In that case, it’s ideal to allow gateways
to change the status to cancelled instead.
2015-07-10 19:51:02 -04:00
Mike Jolley 2834eff221 Merge branch 'variations-8477'
Conflicts:
	assets/js/frontend/add-to-cart-variation.js
	assets/js/frontend/add-to-cart-variation.min.js
	assets/js/frontend/add-to-cart.min.js
	assets/js/frontend/checkout.min.js
	assets/js/frontend/geolocation.min.js
2015-07-10 11:37:05 +01:00
Mike Jolley a976d8e2ba Don't add hyphens for cities
Closes #8547
2015-07-10 11:02:08 +01:00
Claudio Sanches 3394277a86 Admin variations - Set _stock_status when link all variations 2015-07-09 18:28:02 -03:00
Claudio Sanches c5ae7b18c7 Created woocommerce_ajax_save_product_variations action 2015-07-09 17:43:46 -03:00
Mike Jolley 5f8a5bcb63 We don't need get_transient_version for children transients because other products do not affect this. 2015-07-09 16:02:26 +01:00
Mike Jolley 65f19d5ca7 Ajax variation handling
If there are more variations than the threshold allows (set to 20
currently) this loads the matching variation via ajax instead of inline
in the HTML. #8477
2015-07-09 15:56:20 +01:00
Claudio Sanches 042a6644e2 Ajaxify grouped product option, closes #7751 2015-07-08 18:38:17 -03:00
Claudio Sanches bed51c6d0c Removed code test on WC_AJAX::save_variations() 2015-07-08 14:17:33 -03:00
Claudio Sanches ffef95f56f Fixed ajax variations posted data 2015-07-08 13:55:29 -03:00
Claudio Sanches 2ec12a7985 Prevent errors when variation don't have sale price dates 2015-07-08 04:05:08 -03:00
Claudio Sanches 843a55a6b5 Admin ajax variations 2015-07-07 20:53:36 -03:00
Claudio Sanches c03ea5625d Fixed the delete all variable products action 2015-07-07 19:51:50 -03:00
Claudio Sanches bbe3cb5b1b Added bulk variation edit for increase and decrease prices 2015-07-07 17:35:21 -03:00
Claudio Sanches 8b681fddf7 Created bulk edit actions for variable sale schedule 2015-07-07 16:39:59 -03:00
Claudio Sanches e69d172f6c Fixed bulk variation edit and added cases to save regular and sales prices 2015-07-07 16:07:09 -03:00
Claudio Sanches 268a696918 Initial bulk edit variations actions 2015-07-06 22:50:35 -03:00
Claudio Sanches de01133142 Save only updated/edited variations and fixed the variations sync and product cache/transients 2015-07-06 19:07:01 -03:00
Claudio Sanches ae18af8cc7 Added method to save variations via ajax 2015-07-06 01:50:20 -03:00
Claudio Sanches c3b5ad2337 Refactored the link all variations, remove variation and add variation methods 2015-07-05 23:55:08 -03:00
Mohaiminul Islam 653bb17414 Add new parameter on refund deleted hook
This hook parameter dose not helps to get order id when trigger in action due to delete that post. This should add '$order_id' as parameter
2015-07-04 15:22:19 +06:00
Mohaiminul Islam 64f2e2bed0 Refund deleted hook parameter fix
This hook parameter dose not trigger in action due to delete that post. This should set '$order_id' as parameter
2015-07-04 14:17:05 +06:00
Claudio Sanches 3d59933d6b Created initial methods to load variations by ajax 2015-07-02 17:42:22 -03:00
Mike Jolley 84bc6e1b1a Merge branch 'geolocate-cache'
Conflicts:
	includes/class-wc-customer.php

Closes #7939
2015-06-23 12:26:03 +01:00
Mike Jolley 1801f57a39 Fix for permalink structures containing index.php 2015-06-23 11:45:04 +01:00
Mike Jolley f988aae387 Use hashes and server side redirection 2015-06-22 14:55:15 +01:00
Mike Jolley 7e2ba5e05a Ajax endpoint should always be relative 2015-06-19 13:30:57 +01:00
Mike Jolley 33c298fea7 Experiment with appending geolocation to query string to prevent caching 2015-06-17 12:12:49 +01:00
Mike Jolley f8151f416c Merge branch 'text-attribute-handling' 2015-06-16 15:11:58 +01:00
Justin Shreve 12a3a9d305 Return the 'Invalid refund amount' error for negative refunds. 2015-06-15 20:19:52 +00:00
Mike Jolley 89f7e15052 Save full version of text based attributes when dealing with variations 2015-06-11 14:43:02 +01:00
Justin Shreve a7891750b7 Switch the permissions check for json_search_products to use the read_product capability. 2015-06-09 12:35:33 +00:00
Justin Shreve 3233eb471e Switch the json_search_products and json_search_downloadable_products_and_variations ajax functions to check for the `edit_shop_orders` cap instead of `edit_products`. 2015-06-09 12:35:33 +00:00
Claudio Sanches 4698111dd2 Hide api key fields when generate a new keys 2015-06-08 20:22:49 -03:00
Claudio Sanches 91bb8c7ba9 Updated the api authentication 2015-06-08 19:58:38 -03:00
Claudio Sanches 89ddda9ff6 Added new api key generation methods 2015-06-08 19:41:35 -03:00
Mike Jolley 68974655d6 Tweak visible child product query and cache 2015-06-08 13:18:23 +01:00
Justin Shreve e88c1bfb9e When the status is changed via bulk actions or by the status button, execute order.updated. 2015-06-05 16:43:24 +00:00
Mike Jolley a4c2a73050 Max array keys 2015-06-05 13:37:45 +01:00
Claudio Sanches b433f5e2ce Removed duplicated code in WC_AJAX::increase_order_item_stock() 2015-06-04 21:02:03 -03:00
Claudio Sanches 2d5c53942b Removed duplicated code in WC_AJAX::reduce_order_item_stock() 2015-06-04 20:57:43 -03:00
Shiva Poudel db107fac45 Check array in expression for json_search_* events 2015-06-02 22:58:52 +05:45
Shiva Poudel 27adbb2a0b Best practise to check array in expression :) 2015-06-02 22:55:02 +05:45
Mike Jolley 2febc8f20a Add capability checks to ajax requests
Closes #15
2015-06-01 13:38:00 +01:00
Mike Jolley 803f4a9e85 [2.3] Delete correct transient when linking variations
Closes #8241
2015-05-29 15:34:27 +01:00
Nicola Mustone b5e193956b added action woocommerce_refund_deleted 2015-05-27 15:23:59 +02:00
Mike Jolley c01bc43369 Adjust #8165 to deal with 0 2015-05-19 12:53:03 -04:00
Mike Jolley a08b2e5968 Loop over all posted attributes by referencing max posted key
Closes #8165
2015-05-19 12:46:32 -04:00
Nikki DelRosso 940c2369b0 Added method to check if cart is empty 2015-05-14 14:18:53 -07:00
Byron Dokimakis 17af14ef9a Fix for #8034 2015-04-25 02:14:44 +03:00
Mike Jolley 5beeb578a2 Select 'parent' tax class as default for new variations
Closes #8017
2015-04-24 11:05:14 +01:00
Mike Jolley 467a269175 Only set author for user added notes so system notes can be distinguished 2015-04-17 11:23:09 +01:00
Mike Jolley 36a49f87c2 Improve save_attributes ajax function to correctly save text attributes.
Closes #7832
2015-04-10 14:50:23 +01:00
Mike Jolley 0cff7e57cd Run ajax events during template_redirect
Found cases where if you used get_posts during parse_query, you would
get infinite loops.
2015-04-09 12:47:37 +01:00
Mike Jolley 17ca08c020 add endpoints on install 2015-03-20 14:20:12 +00:00
Mike Jolley 94335db2a6 Support default permalinks 2015-03-20 13:10:47 +00:00
Mike Jolley b729480838 Prevent cart hash becoming invalidated due to product/post data 2015-03-20 13:00:05 +00:00
Mike Jolley 21c5513526 Added endpoint for faster ajax requests 2015-03-20 12:28:26 +00:00
Mike Jolley 10c047d38a Send back correct slug after adding term
Fixes #7685
2015-03-13 09:21:55 +00:00
Nicola Mustone 147ccf3ef8 replace int cast with absint 2015-03-03 17:36:47 +01:00
Mike Jolley 7d23acf381 Merge pull request #7597 from woothemes/hotfix-partial-refunds-rounding
Pass max_refund through wc_format_decimal
2015-03-02 10:03:50 +00:00
Gerhard 368bfd97d1 Pass max_refund through wc_format_decimal 2015-03-02 11:54:43 +02:00
Will de6c986953 Filter the default attribute availability 2015-02-26 11:23:19 -05:00
Claudio Sanches 742a48c3eb Fixed the json_search_products when the product title is numeric
@mikejolley
2015-02-23 15:23:53 -03:00
Claudio Sanches 966ca94e41 Fixed non-ASCII variation names in WC_AJAX::json_search_products(), closes #7490 2015-02-19 11:21:02 -02:00
Mike Jolley 2caf287258 Tweak rating prompt text on click, and change once rated
@bftrick This is to keep the .org folk happy and look less spammy :)
2015-02-19 11:38:35 +00:00
Mike Jolley 4feb5fbda9 Restock after refund is successful Closes #7449 2015-02-17 14:56:22 +00:00
Mike Jolley 3691a8fdfb Fix thumbnail notice
Closes #7292
2015-02-04 14:04:02 +00:00
Claudio Sanches d3ac28fbb3 Check if product is published, closes #7220 2015-01-29 16:30:07 -02:00
Brent Shepherd 3a1dc68ff9 Fix typo 2015-01-27 14:42:36 -08:00
Brent Shepherd 60a161aa93 Fix session expired notice on checkout 2015-01-27 14:14:17 -08:00
Claudio Sanches 505501912f Fixed "PHP Notice: Undefined variable: metabox_class" error for non-taxonomy attributes 2015-01-19 11:38:47 -02:00
Claudio Sanches 2d768f9553 Stop "Undefined variable: thepostid" error when add a new attribute 2015-01-13 13:09:43 -02:00
Mike Jolley 2e82cbb311 Customer ajax searches 2015-01-12 13:04:19 +00:00
Claudio Sanches 0accdf6f10 Set order status to refunded when completely refunded, closes #6981 2015-01-02 10:43:47 -02:00
Mike Jolley 22cc1fb0c7 Add attributes with ajax and don't load all attributes at once.
Significantly improves performance with many attributes in admin.
Closes #6852 cc @claudiosmweb
2014-12-22 14:16:15 +00:00
Claudio Sanches 7e780a64b1 Introduces the woocommerce_restock_refunded_item and woocommerce_order_refunded actions, closes #6922 2014-12-19 10:29:47 -02:00
tc33 fb51984a6b Fixes #6979 by fetching attribute slugs instead of names. 2014-12-18 20:09:07 +00:00
Barry Kooij 3f0a8be3d2 Merge branch 'master' into enhancement/checkout-order-review-error-handling 2014-12-11 12:10:53 +01:00
Brent Shepherd 1e8f25defa Use wc_get_order() not new WC_Order()
Because an order might be a custom order type
2014-12-10 18:46:32 -08:00
splashingpixels 25b6377298 ajaxified coupon removal on checkout page for better UX closes #6881 2014-12-07 22:15:03 -08:00
Barry Kooij 438988d9c7 Added the possibility to display notices and/or force reload on order review. 2014-12-04 09:40:49 +01:00
Barry Kooij 36c98dae6d Merge branch 'master' of github.com:woothemes/woocommerce 2014-12-02 12:58:00 +01:00
Barry Kooij f105664805 Introduced 'woocommerce_ajax_calc_line_taxes' filter. 2014-12-02 12:57:53 +01:00
claudiosmweb 3ce620e4f3 Removed eXtremeGoHorse practices from WC_AJAX::calc_line_taxes() and wc_save_order_items()
cc @barrykooij
2014-12-01 21:55:48 -02:00
Mike Jolley 2c1c9896c5 Remove remove_variation and replace with remove_variations 2014-11-27 15:44:51 +00:00
Mike Jolley 44af56ff75 Simplify feature_product() 2014-11-27 15:40:39 +00:00
Mike Jolley e3c1ebc927 Simplify mark_order_status() 2014-11-27 15:37:42 +00:00
Mike Jolley 2e398a3a79 Decoupled the order summary and payments area. Both are updated independently via ajax fragments and can be moved around via actions. TEMPLATES OVERRIDING THESE TEMPLATES WILL NEED TO UPDATE THEIR FILES.
Closes #5781
Closes #6570
2014-11-26 14:19:53 +00:00
Mike Jolley 8b4332a037 Refactors to shipping tax rate methods 2014-11-21 13:06:33 +00:00
Illimar Tambek d510372d64 DRY up mark_order_{$status} 2014-11-19 14:13:24 +02:00
Mike Jolley b3782fa1a5 Removing Mijireh from core 2.3 2014-11-18 16:37:43 +00:00
Mike Jolley 3d1285c8c4 Allow some limited html in text attributes
Fixes #6620. @claudiosmweb @barrykooij see any issues with adding this
one? Doesn’t appear to break anything…
2014-10-29 10:29:51 +00:00
Mike Jolley d90aee6685 Add fallbacks for wp_get_referer()
Closes #6609
2014-10-23 12:13:42 +01:00
Mike Jolley 6f7ff36940 Prefix filter names #6576 2014-10-20 16:12:35 +01:00
Primoz Cigler bbdcdc923a Added the filter for the ajax cart_hash, because in some cases (for example when using WPML) the empty string does not refresh the page fragments properly. 2014-10-18 20:54:25 +02:00
claudiosmweb bc1ea4fdea woocommerce_ prefix in refund actions, related #6477 2014-10-09 13:15:42 -03:00
75nineteen Media f57de2cf9a Added two hooks to support refund Followup Emails 2014-10-07 15:58:21 -07:00
Mike Jolley 700369c386 Refund report changes
1. Ensure refund order_total is negative and reflects the full amount,
not just line items
2. Ensure transients are cleared when doing refunds
3. sales-reports order types so we can exclude refunds from pure
‘sales’ reporting
4. Tweak placement of refunds in legend.

Closes #6411
2014-10-06 13:39:53 +01:00
Nicola Mustone 1337c9cd7b Added $user_id 2014-09-29 09:13:56 +02:00
Nicola Mustone 12129218fb woocommerce_found_customer_details filter improvement
Adding $type_to_load attr to woocommerce_found_customer_details filter
2014-09-26 10:28:46 +02:00
Mike Jolley 4803937222 Fix adding items to orders
* Fix - When manually adding items to an order, show tax columns.
* Fix - When manually adding items to an order, include variation data.

Closes #6313
2014-09-19 12:52:26 +01:00
Mike Jolley 955f497dd7 Prevent headers being sent by wp_send_json()
Fixes #6244
2014-09-16 13:24:05 +01:00
Mike Jolley 79ce7ab926 If a refund fails, delete refund post.
Fixes #6238
2014-09-12 10:09:26 +01:00
claudiosmweb cfb8d42bcb Added missing vars in ajax add_variation() method, closes #6234
@mikejolley
2014-09-11 18:16:37 -03:00
Mike Jolley ebed8dbc85 Correction to last commit to deal with tax arrays 2014-09-08 12:45:32 +01:00
Mike Jolley a588442cbb Format refund amounts as decimals
Fixes #6187
2014-09-08 12:42:30 +01:00