-
-
Notifications
You must be signed in to change notification settings - Fork 19
BUGFIX: dont show disabled products in grid and carousels element #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.1
Are you sure you want to change the base?
BUGFIX: dont show disabled products in grid and carousels element #123
Conversation
0ed9f24 to
147a026
Compare
|
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
src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php
Outdated
Show resolved
Hide resolved
194a7ca to
6e21963
Compare
| foreach ($products as $product) { | ||
| if ( | ||
| $product->isEnabled() && | ||
| $product->hasChannel($currentChannel) | ||
| ) { | ||
| $filteredProducts[] = $product; | ||
| } | ||
| } |
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.
It would be more optimal to filter them out in the database query instead of using PHP for this purpose
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.