This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 220
Make Filter Products by Stock block compatible with PHP rendered Classic Template block #6261
Merged
Merged
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
09efe3f
Enable Attribute Filter block to work with the PHP rendered Classic T…
tjcafferkey ead2195
Merge branch 'trunk' into update/filter-product-by-attribute-php-temp…
tjcafferkey 859df13
Check for presence of option before rendering it
tjcafferkey 8ad3ea2
Merge branch 'trunk' of github.com:woocommerce/woocommerce-gutenberg-…
gigitux b468320
improve filter product by attribute
gigitux 829da22
Merge branch 'trunk' of github.com:woocommerce/woocommerce-gutenberg-…
gigitux 89a173d
fix pagination problem
gigitux 0bdf8a7
fix check when two filter block with same attribute are used
gigitux 5beac29
Merge branch 'trunk' into update/filter-product-by-attribute-php-temp…
gigitux 5f14396
Merge branch 'update/filter-product-by-attribute-php-template' of git…
gigitux eaccd7e
Merge branch 'trunk' of github.com:woocommerce/woocommerce-gutenberg-…
gigitux 92c8b5d
fix filter by stock for PHP templates
gigitux aa0da23
fix naming and comment
gigitux 38e3642
Update filter key in ClassicTemplate
tjcafferkey 03c607f
Update stock filter block for PHP templates when the filter button is…
tjcafferkey 5f4de0c
Remove unused useEffect and fix ESLint error
tjcafferkey d37fb36
Set active stock filter and track using local state
tjcafferkey 3ee7eb8
ESLint fix
tjcafferkey 8cc2da4
Remove unncessary dependencies from useEffect
tjcafferkey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { isString } from '@woocommerce/types'; | ||
import { getUrlParameter } from '@woocommerce/utils'; | ||
|
||
export const getActiveFilters = ( | ||
filters: Record< string, string >, | ||
queryParamKey: 'filter_stock_status' | ||
) => { | ||
const params = getUrlParameter( queryParamKey ); | ||
|
||
if ( ! params ) { | ||
return []; | ||
} | ||
|
||
const parsedParams = isString( params ) ? params.split( ',' ) : params; | ||
|
||
return Object.keys( filters ).filter( ( filter ) => | ||
parsedParams.includes( filter ) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export * from './attributes-query'; | ||
export * from './attributes'; | ||
export * from './filters'; | ||
export * from './global-style'; | ||
export * from './notices'; | ||
export * from './products'; | ||
export * from './shared-attributes'; | ||
export * from './useThrottle'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this logic because with the previous implementation, ALL query parameters were removed, instead only the query parameters related to the attribute filter have to be removed.