Commit Graph

359 Commits

Author SHA1 Message Date
Nestor Soriano 07b62dabbd Improve the query to retrieve "Any..."-attributed variations in filtering widget
The new query doesn't need empty attribute entries in the meta table,
therefore the code that generates them and the migration to backfill
the missing existing ones have been removed.
2020-09-01 16:47:41 +02:00
Nestor Soriano 3a583feab1 Change filter by attributes widget to count products, not variations.
Right now the filter by attributes widget counts available variations
(for variation products). This is confusing since the counter shows
numbers that are higher than the actual count of products displayed.

This commit changes the query used by the widget so that instead
of counting variations it returns the parent product ids, and then
counts the distinct values. This also covers the case of products
where some of the variations have concrete values and some have
"Any..." values.
2020-08-31 12:22:33 +02:00
Nestor Soriano a75da34a45 Fix filter by attribute widget now working for "Any..." attributes
When a variation product has an attribute with a value of "Any...",
and there's a filter by attribute widget for that attribute, then
that product won't be included in the counts displayed in the widget
(and if the count ends up being zero, the attribute won't be shown
in the widget).

This happens before since Woo 4.4, this widget works by looking at
entries in the term relationships table for varitions too
(used to do so for simple products and for "main" variable products
only), see PR #26260; but there are no such entries for
"Any..." attributes.

This commit fixes that by extending the SQL query used by the widget
to look for variations that have empty attribute values in the meta
table too.
2020-08-27 10:59:15 +02:00
Claudio Sanches d48f1d4e2e Fixed package tag usage 2020-08-05 13:36:24 -03:00
Nestor Soriano 681401850a Adjustments in the items count calculation on the nav filtering widget.
The calculations are now consistent with the change made to the
visibility of the variable products when using one or multiple filters.
2020-07-28 09:01:55 +02:00
Néstor Soriano e9d692f455 Apply suggestions from code review
Mostly adding "since 4.4.0" annotations and updating
db update functions from 4.2 to 4.4.

Co-authored-by: Claudio Sanches <contato@claudiosanches.com>
2020-07-28 09:01:55 +02:00
Nestor Soriano 9de1306c21 Fix counters in nav filtering widgets for variable products.
After the change that registers variation attributes as terms
(in addition to reigstering them as post meta) it is now time
to modify the get_filtered_term_product_counts methods in
WC_Widget_Layered_Nav so that it works consistently for both
variable and non-variable products. The logic for the counters
is now as follows:

with OR operator:
- Simple products: count the attributes of all visible products
  (unchanged behavior).
- Variable products: count attributes corresponding to
  visible variations.

with AND operator:
- Simple products: count the attributes of visible products but only
  for products that have all the selected (unchanged behavior).
- Variable products: find all the products for which all the variations
  corresponding to the selected attributes exist and are visible,
  then count the attributes corresponding to the visible variations
  of those products.

A product is "visible" if it's published, not excluded for catalog,
and has stock. Additionally, a variable product will not be considered
visible if the parent product is not.
2020-07-28 08:55:55 +02:00
Nestor Soriano c27283dffe Fix code sniffer errors in some files.
Fixed files:

includes/abstracts/abstract-wc-product.php
includes/class-wc-query.php
includes/wc-template-functions.php
includes/widgets/class-wc-widget-layered-nav.php
templates/loop/result-count.php
tests/unit-tests/util/class-wc-tests-wc-query.php
2020-07-28 08:47:29 +02:00
Christopher Allford 4ae1e1f5fc Extracted the repetitive Constants::get_constant( 'WC_VERSION' ) calls where possible 2020-02-04 14:02:57 -08:00
Christopher Allford 1d1413b4ee Replaced direct access of many constants with the Constants library 2020-01-31 22:18:47 -08:00
Christopher Allford 6ad091a9b7 Changed all of the constant accesses into corresponding Automattic\Jetpack\Constants usages 2020-01-28 21:21:29 -08:00
Sergey Ratushnuy bd647cd9cf Small fix 2020-01-21 18:03:01 +02:00
Sergey Ratushnuy 2d1ce22e25 Changed filter name 2020-01-21 17:29:58 +02:00
Sergey Ratushnuy e3ac006420 Add `woocommerce_top_rated_widget_args` filter for WC_Widget_Top_Rated_Products widget 2019-12-26 11:51:34 +02:00
Rodrigo Primo 7337ab60c2 Fix PEAR.Functions.FunctionCallSignature violations
This commit fixes all violations of the PEAR.Functions.FunctionCallSignature sniff automatically using phpcbf.
2019-12-20 15:25:23 -03:00
Rodrigo Primo 02ae8d1206
Merge pull request #24292 from woocommerce/fix/24116
Prevent PHP notices in WooCommerce widgets using Gutenberg's Legacy Widget Block
2019-12-03 14:25:05 -03:00
Rodrigo Primo 353945f638
Merge pull request #23384 from CasperBraske/CasperBraske-patch-1
Moved HTML from widget code to template file
2019-08-08 15:46:45 -03:00
Luis 0d80af01dc
Fixing code standards violations 2019-08-02 00:10:11 -03:00
Claudio Sanches 78c5a37b4b Prevent PHP notices in WooCommerce widgets using Gutenberg's Legacy Widget Block 2019-08-01 14:43:59 -03:00
parmarhardip 470b0a5424 I have updated the code with suggestion and tested it. Please review from your side. 2019-05-16 10:24:00 +05:30
parmarhardip d5337fac70 fix- 23589 I have fixed pricing issue. 2019-05-15 17:49:46 +05:30
Luis 99d85a2c02
Changing HTML string to template call
template/content-widget-price-filter.php
2019-04-19 00:18:24 -03:00
Mike Jolley 1274136b32 Check isset rather than empty so cart title can be removed 2019-04-18 13:10:42 +01:00
Francesco Pinto 69d4d9b221
Fixed Coding Standard 2019-03-23 20:58:36 +01:00
Francesco Pinto d1df273f9e
Fixed Coding Standards 2019-03-23 20:28:58 +01:00
Francesco Pinto c2bd9bcdf5
Add taxonomy-specific classes to active filters 2019-03-23 18:03:01 +01:00
Mike Jolley a3c2dcd8f2 Update from master 2019-03-08 09:50:56 +00:00
Mike Jolley 33c576a2fd
Merge pull request #22570 from woocommerce/performance/slow-term-queries
Improve slow term ordering queries
2019-03-07 16:33:01 +00:00
Mike Jolley e7bb5a8f41 Merge branch 'master' into experiment/product-sorting-index 2019-03-07 12:49:25 +00:00
Mike Jolley e1ff1bfae9 Update from master 2019-03-06 12:37:24 +00:00
Mike Jolley 16a0a3e27e Update from master 2019-03-05 19:03:01 +00:00
Mike Jolley 5af9d968e5 Update from master 2019-03-01 10:29:17 +00:00
Mike Jolley 611bf3b1dd Price filter + stock widget requires lookup table 2019-02-28 14:24:05 +00:00
Mike Jolley 7def966e4f Impoved JSON handling 2019-02-20 12:00:47 +00:00
Mike Jolley 3309276e82 Renamed table to wc_product_meta_lookup 2019-02-15 12:37:45 +00:00
Mike Jolley 7b6558e1df Correct table names and updater 2019-02-12 14:04:22 +00:00
Mike Jolley 47b37c7104 Queries 2019-02-11 14:42:54 +00:00
Mike Jolley 1efe7747a8 merge conflict 2019-02-08 13:08:55 +00:00
Mike Jolley b2c33b8e34 Merge branch 'master' into performance/slow-term-queries 2019-02-07 13:49:48 +00:00
Mike Jolley 5f5272ba2e
Merge pull request #22541 from woocommerce/pr/20830
Init cart widget when added to sidebar via the customizer
2019-02-05 10:39:29 +00:00
Mike Jolley a4acf5643a
Merge pull request #22533 from woocommerce/fix/21265
Exclude `paged` from price slider
2019-02-04 10:18:51 +00:00
Mike Jolley 8b7414cfb5 Apply fix to rating filter 2019-02-01 14:13:37 +00:00
Mike Jolley 74cd1ced37 Merge branch 'fix/20710' 2019-01-31 13:37:02 +00:00
Mike Jolley 5b57cb5356 Layered nav should use base link 2019-01-30 16:29:01 +00:00
Mike Jolley e129d18c00 get_current_page_url should not persist 2019-01-30 16:18:56 +00:00
Mike Jolley fa58f3bb9f Lax the kses here - link and name is already escaped. 2019-01-30 16:10:48 +00:00
Mike Jolley 7f4444ef7c direct meta sort 2019-01-25 19:57:06 +00:00
Mike Jolley a38add7ac8 No need for default sorting 2019-01-25 19:55:25 +00:00
claudiulodro 8078e6bfc2 Simplified title check that works on all wc widgets 2019-01-24 10:47:05 -08:00
Mike Jolley 9b655c0ba7 Use hasSelectiveRefresh 2019-01-23 21:29:55 +00:00