Commit Graph

131 Commits

Author SHA1 Message Date
Mike Jolley 1b6d7acd24 Data store for downloads 2016-11-18 17:13:02 +00:00
Mike Jolley 599a2ad296 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:17:00 +00:00
Mike Jolley 5f4dbdb733 [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
2016-11-09 16:05:49 +00:00
Mike Jolley 32e814eef1 Use all paid statuses in $customer->get_total_spent() 2016-11-03 11:27:03 +00:00
Rami Yushuvaev f27499b501 i18n Improvements (#12078)
* use %s in translations strings

* merge simmilar error strings

* i18n: use sprintf() in translation strings to make them easier to understand for translators

* i18n: remove sprintf() function from translation string with unused parameter

* i18n: move colons and brackets into the translation strings

* revert comit addaa5d

* Fix broken sprintf()

* i18n: move colons into the translation strings on error messages

* Fix Travis-CI Error: operator must be surrounded by a single space
2016-10-24 08:33:32 +01:00
Mike Jolley cfbb8d6601 Use meta as a cache for order/spent methods.
Closes #12080
2016-10-14 15:11:10 +01:00
Nirav Mehta a0c3c29005 Allow extending customer available downloads (#12019)
* Fix: Escape HTML entities during output of coupon description on admin page

* Added filter for customer available downloads
2016-10-11 15:36:03 +01:00
Mike Jolley 78bde4ad09 Tweak download layout 2016-09-12 23:00:31 +01:00
Aristeides Stathopoulos fde1037757 fix failing tests. 2016-09-01 23:50:14 +03:00
Aristeides Stathopoulos a19848978a WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterCloseParenthesis 2016-08-27 07:47:24 +03:00
Aristeides Stathopoulos 6c30f84fa2 WordPress.Arrays.ArrayKeySpacingRestrictions.SpacesAroundArrayKeys 2016-08-27 06:23:21 +03:00
Aristeides Stathopoulos b063bcfe4c last item in a multiline-array should end in a comma 2016-08-27 04:46:45 +03:00
Claudio Sanches 838f3737ea [2.6] Fixed downloadable variable product URL, closes #11699 2016-08-18 00:53:27 -03:00
Mike Jolley 5afac69f10 Fix write context errors 2016-08-15 17:50:02 +01:00
Mike Jolley f4a4f6c361 Reduce stock and other notices 2016-08-09 14:15:04 +01:00
Mike Jolley 6a493f7350 order total 2016-08-08 17:06:12 +01:00
Mike Jolley 84c52370fa more getters 2016-08-05 15:57:40 +01:00
Mike Jolley 39b4831e95 get_id 2016-08-05 15:56:23 +01:00
Mike Jolley 837e08143b Merge branch 'master' into orders-crud-classes
# Conflicts:
#	includes/abstracts/abstract-wc-order.php
2016-08-03 12:32:27 +01:00
Matias Saggiorato e97acc82b5 Fixed emails not properly encoded in download URLs 2016-08-01 15:22:39 -03:00
Claudio Sanches 7d9d091767 Fixed mixed tabs and spaces 2016-07-11 16:56:35 +02:00
Mike Jolley 9a77620cc4 Split download permission query from order retrieval to reduce overhead.
Closes #11274 @claudiosmweb
2016-06-29 12:06:03 +01:00
Mike Jolley 67de655f71 wc_paying_customer unit test compat 2016-06-22 13:06:02 +01:00
Scrutinizer Auto-Fixer 7cef8ae4c9 Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2016-06-06 16:50:18 +00:00
Claudio Sanches b6d33ee906 WP-API 2016-04-19 12:49:16 -03:00
Claudio Sanches fce5584185 Makes wc_create_new_customer() pluggable
And fixed some coding standards.

Closes #10683
2016-04-18 15:30:57 -03:00
Gabor Javorszky 49ff906322 Fixes comparison functions for customer total orders / spent
No issue. For much performance improvement.

If the moeny spent is 0, or the total order count is also 0, but actually set, the if clause will return false. Even after the body recalculates, for example the money spent, it will still be 0, which means it will never be stored on the user meta, and that body won't be short circuited.

In the case of sites with a lot of orders (customer has ~100k), that query takes about 13 seconds, and due to how the API works, during one request, it runs 4 times (we're working on solving that one though).

We probably want to see whether the meta is set or not. If it's not set, it will be an empty string.
2016-04-11 18:06:36 -05:00
Mike Jolley c1e8dd1fe8 Use wc_get_orders iternally 2016-03-09 16:11:05 +00:00
Claudio Sanches c46521ae80 Created functions to fetch customer last order and to grap gravatar url 2016-03-01 20:07:05 -03:00
Mike Jolley 1ee2b431a3 Show all downloads regardless of file
Closes #10388
2016-02-19 17:17:14 +00:00
Claudio Sanches 2de00c61ff Added account endpoint for customer payment methods 2016-02-16 13:57:46 -02:00
Justin Shreve 8b01290e56 Add punctuation to docblocks. update_user_meta hook should be in single quotes. 2016-02-10 08:47:37 -08:00
Justin Shreve 09ba8c0fc8 Only track meta updates for certain fields. 2016-02-10 08:28:24 -08:00
Justin Shreve 1b2195b819 Track a users last updated time (profile/user attributes) and display it in the WC Customer API. 2016-02-10 08:28:24 -08:00
Brent Shepherd 6d2b570f30 Fix Unknown column '_customer_user' notice
When deleting a user. Also ensures the customer value on orders is set
correctly to a guest user (0).
2016-01-06 17:53:21 -08:00
Mike Jolley 6892d73ea9 Store product ids for terms in term meta rather than transient
Data is kept in sync by looking at when terms are set for an object and
then clearing the meta for old and new terms.
2015-11-14 16:25:09 +00:00
Claudio Sanches 5893875b0c Removed period for file headers 2015-11-03 11:53:50 -02:00
Claudio Sanches ee30b5b308 Fixed php docs standards 2015-11-03 11:31:20 -02:00
Claudio Sanches cf6fb76741 Created function to disable author archives for customers
cc @mikejolley
2015-10-26 15:38:44 -02:00
Jeff Stieler 1b370bb64a Helper method to retrieve review verification status from comment meta, generating it on the fly for existing reviews. 2015-10-20 22:05:17 -06:00
Jeff Stieler 80628e9f97 Store all purchased product ids for a given customer in a single transient. 2015-10-20 22:03:29 -06:00
Claudio Sanches 5372579546 Fixed the hook name for #9290
cc @jeffstieler
2015-10-13 15:13:31 -06:00
Jeff Stieler aa86069e56 When a WordPress user is deleted, turn any orders they have into Guest orders. 2015-10-05 14:38:20 -06:00
Claudio Sanches f447a66281 Introduces woocommerce_update_new_customer_past_order action, closes #9078 2015-09-15 19:56:59 -03:00
Mike Jolley 0da69f2bef Query within wc_customer_bought_product(). 2015-08-12 10:44:44 +01:00
Mike Jolley 5c9ac6a893 Avoid double escape when passing in arrays to sql queries. Use esc_sql 2015-08-07 11:37:19 +01:00
Claudio Sanches 9e41552342 Removed all "@return void" 2015-07-16 16:55:48 -03:00
Ben Bidner 2740db17c0 Merge conflict - esc customer data 2015-06-01 12:57:48 +01:00
nickrouty 0f88f6386b Verify order was found
Verify the order was found before evaluating the user_id on the $order object. Would previously throw an error if attempting to view an invalid order number.
2015-04-14 15:16:34 -07:00
Mike Jolley ddb6c585bc Merge pull request #7862 from javorszky/download_perm
Add null date check for download permissions
2015-04-13 09:37:55 +01:00
Gabor Javorszky 5f8f1fc10f Add null date check for download permissions
Fixes #7861

* implements check if `access_expiry` is 0 epoch

Sadly there's no way to circumvent WordPress's sanitization without using raw query in `WC_Meta_Box_Order_Downloads::save`, but it's a lot easier to check for 0 epoch.
2015-04-01 01:04:22 +02:00
Gabor Javorszky e76749de03 Adds filter to download permissions results
The justification for this filter is that Subscriptions will be saving download permissions on the subscription itself, not the original order. This filter would allow us in the future to remove the entry for a file for the original order if the same file has a subscription associated with it.
2015-03-30 14:19:47 +02:00
Mike Jolley f55e7d6969 wc_customer_bought_product transient
Closes #7322
2015-03-27 13:17:54 +00:00
Mike Jolley 97c1a32aa7 Small improvement to #7322 2015-03-27 13:08:27 +00:00
nils-fredrik@maksimer.no 07f7db297f Fix for #7752
wc_create_new_customer() returns identifying error codes for
identifiable errors.
2015-03-18 00:18:52 +01:00
Nicola Mustone 40a7605c99 fix missing downloads 2015-02-19 14:42:24 +01:00
Gerhard 7beb159927 Remove posts join from wc_get_customer_available_downloads, speeds query up by 50% 2015-02-18 12:04:19 +02:00
Claudio Sanches de4d70d16a Fixed the product_id type in wc_get_customer_available_downloads() 2015-01-21 10:21:42 -02:00
Claudio Sanches b896c5063f Stop erros when the user does not exist in wc_customer_bought_product() function, closes #7145 2015-01-19 00:25:32 -02:00
Mike Jolley 03043a7c02 Expiry date along with download details
Closes #7096
2015-01-13 12:29:37 +00:00
Mike Jolley 4769d27415 Added missing global $wpdb; 2015-01-12 17:18:17 +00:00
Mike Jolley 2c32f6cdd0 Add functions to get money spent/order count for customers and fix in API Closes #7083 2015-01-12 17:09:46 +00:00
Claudio Sanches 256216e13d Fixed the wc_update_new_customer_past_orders() function, closes #6903
get_post_status() returns post status (string) or false (bool) on failure.
2014-12-04 11:09:37 -02:00
Mike Jolley b98b7354ad String sanitize_user Closes #6667 2014-11-11 13:11:40 +00:00
Mike Jolley b6835a009c wc_paying_customer to only increase for 'simple' orders and added tool to refresh stats to customer list.
Closes #6395
2014-10-02 16:44:36 +01:00
Barry Kooij 73648c1b91 Removed the 'delete_users' case.
Related #6102
2014-09-04 13:30:48 +02:00
Barry Kooij f77395c572 Only add the 'do_not_allow' if target user ($args[0]) is set.
Fixes #6095.
2014-08-27 20:18:44 +02:00
claudiosmweb aeaa1577e3 fixed wc_get_customer_available_downloads() query, closes #6057 2014-08-19 14:50:27 -03:00
Mike Jolley 474cba9b87 Merge pull request #6052 from barrykooij/refactor/get_product
Renamed get_product to wc_get_product
2014-08-19 11:51:20 +01:00
Barry Kooij 94365791af Changed all use of get_product to wc_get_product 2014-08-19 12:09:29 +02:00
Mike Jolley 16754a7d01 Add file to downloads array Closes #6044 2014-08-19 11:01:55 +01:00
Barry Kooij 6655188f0b Changed use of get_order with wc_get_order 2014-08-15 14:29:21 +02:00
Mike Jolley 755001f19b Use order types where required 2014-07-11 12:43:42 +01:00
Coen Jacobs 86a4add087 Merge remote-tracking branch 'upstream/master' into order-factory-refactor
Conflicts:
	includes/class-wc-order.php
2014-07-03 13:38:55 +02:00
toddlahman f6c3f4d0b7 Remove diff code block from wc-customer 2014-06-27 05:56:27 -07:00
Coen Jacobs 89ea6c46ab Replace new WC_Order calls with get_order 2014-06-13 15:24:51 +02:00
Mike Jolley f30e95663b Prefixes for queries 2014-06-03 11:29:01 +01:00
Mike Jolley fca32a98de Implement is_status functions and update_status 2014-05-30 17:16:22 +01:00
Mike Jolley 2f374cf8b4 Optimize user functions 2014-05-30 16:14:24 +01:00
claudiosmweb d0fac1f737 introduces the wc_get_customer_available_downloads() function 2014-05-28 14:05:19 -03:00
Mike Jolley e7898f8670 [2.2] Protect admins from shop managers
Closes #5322
2014-04-23 14:18:21 +01:00