BUGFIX: dont show disabled products in grid and carousels element#123
Open
crydotsnake wants to merge 5 commits intoSylius:1.1from
Open
Conversation
0ed9f24 to
147a026
Compare
Member
Author
|
Since I had to implement the same filter logic for four content elements, I would suggest adding a general PHP class to retrieve the products using the filter logic and using it within the four content elements. This way, we avoid duplicate code. |
4fe6507 to
97e22f9
Compare
…on and products carousel by taxon element
97e22f9 to
194a7ca
Compare
GSadee
reviewed
Jan 20, 2026
src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php
Outdated
Show resolved
Hide resolved
194a7ca to
6e21963
Compare
GSadee
reviewed
Jan 21, 2026
Comment on lines
+65
to
+72
| foreach ($products as $product) { | ||
| if ( | ||
| $product->isEnabled() && | ||
| $product->hasChannel($currentChannel) | ||
| ) { | ||
| $filteredProducts[] = $product; | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
It would be more optimal to filter them out in the database query instead of using PHP for this purpose
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR makes sure that disabled products dont show in the product grid / carousels element.
If you click on a disabled product that is listed in the elements, it returns a exception.