-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Categories Don't Display All Products #8681
Comments
I also get the same problem after migrating from magento 1.9.x version to magento v2.1.x. |
I have the same problem. My categories have products in the hundreds but the category only shows a few. I have tried many things such as reindexing and clearing cache. Not sure how to resolve this issue as I do not see any exception or errors. My Index looks fine: [-x-x-x-x-x-x@s01 public_html]$ ./bin/magento indexer:status Where should I be looking to figure out the problem. Any help would be appreciated. |
I have been trying many things. So I disabled all products and set them back to enabled and that fixed things. |
I've tried to disable and than enable again but doesn't work. |
@gputignano After enabling and disabling them try rebuilding the index and clearing the cache. Also check the status of your reindex to make sure it completes. Also clear the cache of your browser. |
We had this same issue... sorta solved it... just resave the category... all the products will come back. Also reorder the products in the category... both of those actions solved the issue. |
I tried but doesn't work for me. |
This one was hard to track down. In the following file: \vendor\magento\module-catalog\Model\Indexer\Category\Product\AbstractAction.php There is a constant variable called RANGE_CATEGORY_STEP, and it is set to 500. This variable is used when the function isRangingNeeded() returns true for an index (which is the default unless overridden). This effectively limits what gets put in the product category index table which in turn shows a limited result set of products on category pages. My solution was to extend the class Magento\Catalog\Model\Indexer\Category\Product\Action\Full, overriding the function isRangingNeeded() and returning false instead of the default value of true. I think Magento has this behavior to keep massive catalogs under control, especially when the category hierarchy has many levels and products, but this "feature" was unacceptable for my store. |
We are facing the same issue after migration from 1.8 - indexing, disable/enable , cache - did not work, the only way we found to solve it is to run a script in the background that saves all products this put them back in the category but since we have a lot of products takes a long time, would love to get some other ideas how to solve it |
Had same issue after data migration, I think this may be more of a bug with the data migration tool. Workaround: Manually opened each category in admin and clicked save. Re-indexed afterward and all products show up on frontend category view now. |
Is there a permanent solution to this for now? |
As AirmanAJK pointed out above, the RANGE_CATEGORY_STEP is causing a bug. It's using that number to create a set of select queries with a limit of RANGE_CATEGORY_STEP. Once that number has been satisfied, it's creating the next select statement but with entity Id (category id) being greater than the previous select. For example, we have 50 categories being index. Once the first select statement reaches the RANGE_CATEGORY_STEP value, it creates a new statement and adds "AND ( |
@AirmanAJK and @gclift. Would it be possible for you to write some steps to show how to do this? I get the idea but I am not 100% sure on what file to edit and what to exactly edit in it. |
@hubaig, sure thing. Here are the steps I performed and it's working like a charm. STEP 1: Create a new module or use an existing custom module FILE: {company}{module}\Model\Indexer\Product\Category\Action\Full.php
FILE: {company}{module}\etc\di.xml
Note 1: Replace {company} and {module} with your custom module name and directory. Hope this helps. |
@gclift Thank you for taking your time out to write the steps for me. I have a programming foundation and I still am learning about Magento. I am going to see online tutorials on how to create a Magento module and see if I can get this working. I have about 6000+ items in the online store. Hopefully this won't cause problems. |
I strongly recommend you set up a proper development environment before making changes. You NEVER want to make programming changes to a production server or modify the core code as a fix. Magento has quite a steep learning curve, especially if you aren't already well-versed in web development. Despite this, it's worth the time to learn how to do it the right way (however painful the experience can be). |
Confirmed. We have same issue on EE 2.1.4 isRangingNeeded workaround helped. Ranging needs to be fixed. |
This is most likely a duplicate of #8018 |
For the lazy (or backwards lazy, like myself...) |
I can confirm overriding to 50k fixed an issue we saw, which isn't ideal but at least proved its a weird bug. |
This is still present in 2.1.7 - Major bug for an commerce system but not answered or fixed since month. Wow! |
@andidhouse try following its working fine for me in 2.1.7 {your magento}/vendor/magento/module-catalog/Model/Indexer/Category/Product/AbstractAction.php
|
Official fix exists as MAGETWO-62616 - though it only exists in the devel and 2.2 RC branches. I'm planning to work on a module version of this fix tomorrow - which is a true fix and not a workaround. (At least until the core fix is released.) |
I've compiled a standalone version of the official fix at composer package For now I just have I'm using identical code in a full Magento 2 install, so it should work - I just haven't tested the composer version yet. |
Closing as the fix for this issue is already available on Magento 2.2.0 branch. Anyone, do not hesitate to create a backport to |
Thanks it worked on my end! I created a module based on your instructions @gclift Currently using Magento 2.1.3 |
Thanks @gclift it really worked for me |
Hey lads, issue worked for us for two days only. Now we are facing it again. |
Magento 2.4.2 still happening. |
Good for you! Sorry if this sounds sarcastic, but leaving comments like this on super old tickets is almost useless, it makes a lot more sense to investigate the problem a little bit and if a bug in core Magento is found by that investigation, then please open a new issue with a description of how the bug can be reproduced. |
@hostep I undestand. I'm sorry. |
2.1.4
When clicking my categories on my homepage not all products are shown.
For example if a category has 2000 products, when displaying on the site it shows a max of lets say 500.
This causes all sorts of problems with filtering etc because not all products are being included.
To be clear if a category contains 2000 products as an example, and I go on my site and click that category, the range will say "Showing 1-32 products out of 5xx" or some other number, it does not show the full amount of products. It isn't just a display issue either.
The text was updated successfully, but these errors were encountered: