Commit Graph

102 Commits

Author SHA1 Message Date
Claudio Sanches 9d42c323bf Fixed includes/wc-user-functions.php PHPCS violations 2018-03-08 18:26:56 -03:00
Steve Grunwell 493298504d Rewrite wc_get_customer_last_order() to leverage the customer data store.
The wc_get_customer_last_order() function (used by the v1 API) was performing a hard-coded SQL query against the postmeta table, regardless of the data store used by the WC_Customer class. This commit effectively makes the function act as a wrapper around WC_Customer::get_last_order().
2018-01-10 18:39:35 +00:00
Claudio Sanches da6c9c769a Include 'product_url' wc_get_customer_available_downloads() results
Also required to fix #17925
2017-11-29 19:49:54 -02:00
Gerhard Potgieter 95b669280a Refactor wc_update_new_customer_past_orders to not call update_post_meta directly but use the datastore. Check if order has downloadable items and then regenerate permissions. 2017-11-20 08:44:42 +02:00
Jeremy Madison 0b7f92ac84 Issue #17505: Apply filters to registration-error-email-exists error. (#17507)
* Issue #17505: Apply filters to registration-error-email-exists error message.

* Inlined apply_filters and fixed filter name
2017-11-07 20:16:56 +00:00
Mike Jolley 7606666de9 woocommerce_pre_customer_bought_product 2017-11-01 15:48:46 +00:00
Gabor Javorszky d530556a0f Add short circuit to customer bought product function 2017-10-30 17:20:55 +00:00
Mike Jolley fae130d038 Allow display_name to be searchable - this will commonly be full name
Closes #17104
2017-10-09 19:20:22 +01:00
Jaydeep Rami 3522857d23 Fix typo in WooCommerce plugin (#16135)
* Fixed typo

* Fixed more typo

* Fixed more typo

* Fix tyop

* Fix more typo

* Fix more typo

* Fix typo

* Fix typo

* Fix typo

* Fix typo datatime object

* Fix short name of compat

* Fix typo: update short name

* Fix typo "deactive" to "deactivate" and short BW - Compat

* Fix typo "Backwards compat"

* Fix typo 'parameters'

* Fix more typo 'pararmeters'

* Fix typo 'compund'

* FIx typo order

* Fix typo

* Fix typo 'incorrecly'

* Fix typo 'genarate'

* Fix typo 'reletive'

* Fix typo 'Handly'

* Fix typo 'rotatated'

* Fix typo

* Fix typo 'additonal'

* Fix typos
2017-07-17 11:10:52 +01:00
Mike Jolley 3939f50ced Download display in account/checkout 2017-07-11 13:45:35 +01:00
Job 9ca5556067 Login > Log in spelling
“Log in” is the verb, not “login”
2017-06-15 11:53:59 +02:00
Claudio Sanches df0ec12fb4 Deprecated wc_get_customer_avatar_url() in favor of get_avatar_url()
And remove duplicated code.
2017-06-09 16:25:57 -03:00
Mike Jolley 4367c9f6d4 Use user_can function
Use user can rather than roles directly.

If the user can edit posts, assume they are allowed an archive.

Fixes #15508
2017-06-09 15:18:35 +01:00
Rasmus Bengtsson 6a7fc8650f Remove unused local variables 2017-05-15 12:06:52 +02:00
Mike Jolley b258e64902 Add $order checks to ensure object is set 2017-04-12 13:46:14 +01:00
Claudio Sanches dbbe4617ee Do not force integer since will be saved as string by WordPress 2017-03-10 01:58:57 -03:00
Claudio Sanches 948963f5c7 Uses GMT/UTC+0 when update customer lastt_update 2017-03-10 01:57:53 -03:00
Claudio Sanches a10fa76438 Fixed empty file object in downloads data and removee extra download_name 2017-03-06 19:45:03 -03:00
pierrebuet f6c9dce9b4 fix user id for download file (#13220) 2017-02-17 11:55:11 +00:00
Brent Shepherd 3f338cd3e1 Fix wc_paying_customer() refund check
wc_paying_customer() needs to check against 'shop_order_refund', which is
the actual return value of WC_Order_Refund::get_type(). No object will return
'refund', so a customer would always be declared as a paying customer even
for refund orders.
2017-01-19 11:16:43 -08:00
Mike Jolley 53436d2043 No need to update totals
#12237
2016-12-15 15:07:48 +00:00
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