Commit Graph

135 Commits

Author SHA1 Message Date
Mike Jolley bb4c303c39 get_type has no args 2015-06-08 12:22:26 +01:00
Mike Jolley 3c87e39ce6 Product get_type() method 2015-06-08 12:20:39 +01:00
Mike Jolley 28d838c5cd [2.3] Related posts tweaks
Remove real randomness and add transient caching to improve performance.

The above was not worth the cost of the query - only users refreshing a
product page would see a difference.
2015-05-25 15:40:28 +01:00
Mike Jolley b8bcd24edd [2.3] Combine transients for get_rating_count
@claudiosmweb
2015-05-25 02:00:20 +01:00
Mike Jolley 1b73322874 [2.3] Replace max_related_posts_query with wp_count_posts 2015-05-25 01:20:31 +01:00
Mike Jolley c6dae2b286 Merge pull request #7834 from SiR-DanieL/scrutinizer-issues
Small tweaks and style fixes
2015-03-30 10:33:27 +01:00
Nicola Mustone 95cdb0390f fix related products error 2015-03-27 17:52:21 +01:00
Nicola Mustone 214a0b669f splitted get_related for complexity 2015-03-27 17:28:26 +01:00
Nicola Mustone d2af01df5b scrutinizer suggested tweaks 2015-03-27 16:15:40 +01:00
Mike Jolley ca934ba0d9 Add get methods for length, width, height and add filters
Closes #7617
2015-03-24 16:52:26 +00:00
Mike Jolley f04ebeb78e has_enough_stock - use get_stock_quantity
Closes #7779
2015-03-20 10:40:53 +00:00
Mike Jolley fa0be55b01 transient cache dashboard reports
Closes #7641
2015-03-09 11:07:49 +00:00
Tanel Jüris fe60425eeb Rename filter prefix from wc_ to woocommerce_ 2015-03-02 12:09:24 +02:00
Tanel Jüris d9a568bbea Apply filters to product/tag terms when querying related products 2015-02-25 16:02:31 +02:00
Mike Jolley d9455994c8 Use 30 days instead of year for transients to avoid bugs in memcache plugins.
Closes #7520
2015-02-24 12:02:56 +00:00
Mike Jolley 6c9562112f Fix Related post offset. 2015-02-20 16:17:45 +00:00
Mike Jolley 44cf2c2b70 Filter before max_related_posts 2015-02-16 16:48:11 +00:00
Mike Jolley 5c1a0d92e8 Related posts - replace ORDER BY RAND() with random offset.
Closes #7436
2015-02-16 13:16:18 +00:00
Mike Jolley 969e2d3b18 Stock status when updating out of stock product.
Fixes #7402
2015-02-16 12:14:10 +00:00
Tamara Zuk 7eaae2d561 Fix average product rating when ratings are not required
If ratings are not required, the total rating count was counting all
reviews which skewed the average rating. In other words, reviews with
no rating were counted as a “zero” rating in the average rating
calculation. This bug was introduced in
83a457b29c which provided a fix for #6839.

This change introduces a new product method `get_review_count()` which
can be used to accurately calculate the total number of reviews for a
product. Some instances of `get_rating_count()` were replaced with
`get_review_count()` where appropriate. Additionally, the
`single-product/rating.php` template was adjusted to display the
correct number of customer reviews and ratings in rich snippets. I’ve
also included the `bestRating` rich snippet detailed
[here](http://schema.org/AggregateRating). The version number was
adjusted to 2.3.2 on that template as I think this is a larger change.
2015-02-11 17:55:16 -05:00
Claudio Sanches 0558c3c286 Added woocommerce_product_get_rating_html filter for WC_Product class, closes #7337 2015-02-10 13:01:04 -02:00
Mike Jolley 840efcaa00 is_on_sale should compare type Fixes #7344 2015-02-10 12:34:53 +00:00
Mike Jolley 893babaaef woocommerce_product_get_weight filter Closes #7319 2015-02-10 11:18:38 +00:00
Mike Jolley 74abdf27c9 Cast to array 2015-02-03 15:06:08 +00:00
Mike Jolley 7c019c0c50 More docblocks; the check for WP_POST isn't needed as the second case (isset) runs regardless and is true for posts 2015-02-03 13:13:07 +00:00
Mike Jolley c038001eab Docblocks for order/product 2015-02-03 12:57:08 +00:00
Brent Shepherd 95d87e28d6 Do not set property when calling __get()
SHA: 100b95a tweaked the `__get()` magic method in `WC_Product` to:
 * only call `get_post_meta()` once; and
 * set `$this->$key` to save the overhead of calling `__get()` every
   time that property needs to be accessed.

However, in the process, it also set an empty value (`''`) - the default
return value of `get_post_meta()` for every single value accessed on
the product object, meaning that any calls to `isset()` after attempting
to get that value would return `true`, even if `metadata_exists()` for
that property would return false (and no value is set in memory).
2015-01-23 15:01:10 -08:00
Claudio Sanches 04c584ccf6 Added properties docs for abstract product class 2015-01-23 15:51:33 -02:00
Mike Jolley 2584041700 wc_price enhancements
- Renamed some 2.3 methods for consistency
- Allow more args to be passed to wc_price to control output
- Filter wc_price args which Closes #7188
- wc_get_price_decimal_separator function
- wc_get_price_thousand_separator function
- wc_get_price_decimals function
2015-01-23 11:50:32 +00:00
Mike Jolley 91de767442 Product constructor setting post incorrectly 2015-01-20 14:00:30 +00:00
Mike Jolley de4129f9b2 WP_POST docs 2015-01-20 13:20:22 +00:00
Mike Jolley baea8f9ad4 Product class properties 2015-01-20 13:00:56 +00:00
Mike Jolley fef41c149c @uses WP_POST 2015-01-15 15:03:12 +00:00
James Koster 9cf1a8e7e8 is_sold_individually() tweak. closes #7041 2015-01-07 10:03:49 +00:00
Claudio Sanches d1f9cbfcf2 Merge pull request #6954 from SiR-DanieL/patch-2
Introduced woocommerce_get_product_attributes filter
2015-01-05 13:39:25 -02:00
Mike Jolley 7ef8f4d156 Invalidate unknown product transients Closes #6815 2014-12-30 15:27:08 +00:00
Nicola Mustone 7cec3c9f0b introduced woocommerce_get_product_attributes filter 2014-12-15 14:40:23 +01:00
Mike Jolley 100b95ae4f Tweak the get magic method in product class 2014-12-11 14:54:56 +00:00
Manos Psychogyiopoulos 4b04701cc8 add display_prices in variation data
The commit introduces 3 changes:
1. It adds 2 extra fields to the available_variations array,
display_price and display_regular_price, to be used by extensions in
cases like
https://github.com/woothemes/woocommerce-product-addons/issues/19
2. Introduces a get_display_price() function in WC_Product to retrieve
product prices incl or excl tax relative to the
woocommerce_tax_display_shop setting.
3. Fixes a minor issue where passing a 0 price to
get_price_including_tax() or get_price_excluding_tax() results in a
wrong output.
2014-12-03 11:28:04 +02:00
claudiosmweb 676549b4ab Fixed docblock for WC_Product::get_categories() 2014-12-01 22:09:42 -02:00
Bryce 83a457b29c improve get_rating_count() for rating-less reviews
Should close #6839.

According to `woocommerce_enable_review_rating` &
`woocommerce_review_rating_required`, it will do a different DB query,
so that when reviews without ratings are allowed, it will do a query
that counts those comments as reviews.
2014-11-27 14:32:09 +07:00
Barry Kooij 47cc448028 Added correct docblock. 2014-11-21 22:34:30 +01:00
Barry Kooij 4b539e7a9a Merge branch 'master' of github.com:woothemes/woocommerce 2014-11-21 22:31:17 +01:00
Barry Kooij 6ebadd572a Added correct docblock. 2014-11-21 22:31:09 +01:00
Michael Tieso 70d5fc834a Spelling correction - calculdate to calculate 2014-11-21 13:26:32 -08:00
claudiosmweb 74ba11c189 Removed some unused code 2014-11-19 21:36:47 -02:00
claudiosmweb e87aefc8e0 Fixed missing initial $query = array() 2014-11-19 16:26:10 -02:00
claudiosmweb f34cead914 Removed old code in favor of wc_tax_enabled() and wc_prices_include_tax() 2014-11-18 14:45:29 -02:00
Tamara Zuk 20655d367d Introduce `woocommerce_product_is_on_sale` filter
This filter is useful for extensions like Measurement Price Calculator
which alter the product price quite a bit, but would still like the
sale badge to appear :)

Current workaround is to use three filters ( `woocommerce_get_price`,
`woocommerce_get_regular_price`, and `woocommerce_get_sale_price` )
which most extension may be using already, but not all need/want to
alter these prices.
2014-11-14 18:00:03 -05:00
Mike Jolley cb8fe34b4c get_base_tax_rates() + filter. Closes #6668 2014-11-11 11:56:17 +00:00