Plugin_Product_Table implements Registerable, JsonSerializable

Integration class for the product table plugin.

Interfaces, Classes and Traits

Registerable
JsonSerializable

Table of Contents

INTEGRATION_PREFIX  = '_wpt'
Holds the prefix used for identifying the query.
$settings  : Collection
Misc settings from the WPT plugin.
$cache  : Query_Cache
Holds the query and filters cache handler.
add_argument_to_query()  : array<string|int, mixed>
Add the filtering flag to the queries.
adjust_children()  : array<string|int, mixed>
Make sure to filter only variations.
adjust_pricing_api()  : array<string|int, mixed>
Inject variations ids into the list of products that is loaded when checking the max price.
adjust_ranged_parameters()  : mixed
Adjust the parameters for the ranged filters.
after_delete_product()  : void
Automatically delete variations data when the product is deleted.
assets()  : void
Load the assets specific to this integration.
cache_query()  : void
Cache the prefilled query so that it can then be used at a later point when sending back an ajax response.
catch_table_page()  : void
If this is a product table page.
disable_wp_query_wrapper()  : void
Disable the original query wrapper because elementor runs queries twice so the wrapper goes to the wrong place.
include_variations_in_counts()  : bool
Include variations in the counts based on the user's settings.
index_variations()  : mixed
Index variations of a product.
init()  : void
Hook into WP.
inject_template()  : void
Print the expected json response before headers are sent.
intercept()  : void
Intercept the search request, load the hooks and buffer the output.
jsonSerialize()  : array<string|int, mixed>
Prepare fallback json array.
pre_get_posts()  : void
Detect if an ajax request is taking place.
register()  : void
Register the integration.
table_output()  : string
Adjust output of the table and include our custom elements.
add_fallback_product_ids()  : string
Add list of ids of all products loaded.
add_fallback_total_products()  : string
Add count of total products as a hidden div.
adjust_available_terms()  : array<string|int, mixed>
If the table has specific restrictions like categories.
disable_parent_terms_restriction()  : void
Disable parent terms restriction on table.
prepare_filters_collection()  : Collection
Build a collection of all the parameters sent through the ajax request.
should_display_additional_elements()  : bool
Determine if the additional elements should be displayed.
should_enqueue()  : bool
Determine if the assets should be loaded.

Constants

INTEGRATION_PREFIX

Holds the prefix used for identifying the query.

public mixed INTEGRATION_PREFIX = '_wpt'

Properties

Methods

add_argument_to_query()

Add the filtering flag to the queries.

public add_argument_to_query(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>
Return values
array<string|int, mixed>

adjust_children()

Make sure to filter only variations.

public adjust_children(array<string|int, mixed> $children, object $product, object $table) : array<string|int, mixed>
Parameters
$children : array<string|int, mixed>
$product : object
$table : object

instance of the table

Return values
array<string|int, mixed>

adjust_pricing_api()

Inject variations ids into the list of products that is loaded when checking the max price.

public adjust_pricing_api(array<string|int, mixed> $ids) : array<string|int, mixed>
Parameters
$ids : array<string|int, mixed>
Return values
array<string|int, mixed>

adjust_ranged_parameters()

Adjust the parameters for the ranged filters.

public adjust_ranged_parameters(mixed $value, Attribute|Taxonomy $filter, Collection $parameters) : mixed

Whether they're attribute or taxonomy filters.

Parameters
$value : mixed
$filter : Attribute|Taxonomy
$parameters : Collection
Return values
mixed

after_delete_product()

Automatically delete variations data when the product is deleted.

public after_delete_product(string|int $product_id) : void
Parameters
$product_id : string|int
Return values
void

assets()

Load the assets specific to this integration.

public assets() : void
Return values
void

cache_query()

Cache the prefilled query so that it can then be used at a later point when sending back an ajax response.

public cache_query(WP_Query $query, Collection $filters, string $orderby, array<string|int, mixed> $post_ids) : void
Parameters
$query : WP_Query
$filters : Collection
$orderby : string
$post_ids : array<string|int, mixed>
Return values
void

catch_table_page()

If this is a product table page.

public catch_table_page() : void
  • disable our custom pagination template override.
Return values
void

disable_wp_query_wrapper()

Disable the original query wrapper because elementor runs queries twice so the wrapper goes to the wrong place.

public disable_wp_query_wrapper() : void
Return values
void

include_variations_in_counts()

Include variations in the counts based on the user's settings.

public include_variations_in_counts(mixed $include_variations) : bool
Parameters
$include_variations : mixed
Return values
bool

index_variations()

Index variations of a product.

public index_variations(mixed $product_id, object $product, array<string|int, mixed> $filters, Indexer $indexer) : mixed
Parameters
$product_id : mixed
$product : object

instance of a WC product

$filters : array<string|int, mixed>

collection of filters for which the index is being generated

$indexer : Indexer

instance of the indexer

Return values
mixed

inject_template()

Print the expected json response before headers are sent.

public inject_template() : void
Return values
void

intercept()

Intercept the search request, load the hooks and buffer the output.

public intercept() : void
Return values
void

jsonSerialize()

Prepare fallback json array.

public jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

pre_get_posts()

Detect if an ajax request is taking place.

public pre_get_posts(WP_Query $query) : void

Filtering of the query only takes place when the WPT Table is triggering an ajax request.

Parameters
$query : WP_Query
Return values
void

table_output()

Adjust output of the table and include our custom elements.

public table_output(string $result, string $output, object $table) : string
Parameters
$result : string
$output : string
$table : object
Return values
string

add_fallback_product_ids()

Add list of ids of all products loaded.

private add_fallback_product_ids(object $query) : string
Parameters
$query : object
Return values
string

add_fallback_total_products()

Add count of total products as a hidden div.

private add_fallback_total_products(object $query) : string
Parameters
$query : object
Return values
string

adjust_available_terms()

If the table has specific restrictions like categories.

private adjust_available_terms(object $table) : array<string|int, mixed>

Remove those terms from the list of terms of a filter.

Parameters
$table : object
Return values
array<string|int, mixed>

disable_parent_terms_restriction()

Disable parent terms restriction on table.

private disable_parent_terms_restriction() : void
Return values
void

prepare_filters_collection()

Build a collection of all the parameters sent through the ajax request.

private prepare_filters_collection(array<string|int, mixed> $groups) : Collection
Parameters
$groups : array<string|int, mixed>
Return values
Collection

should_display_additional_elements()

Determine if the additional elements should be displayed.

private should_display_additional_elements() : bool
Return values
bool

should_enqueue()

Determine if the assets should be loaded.

private should_enqueue() : bool
Return values
bool

Search results