8

Got a little issue here with Categories.

Running Magento 2.1.3

All other categories display the correct amount of product, except this one click here to view1]

Under Products->Categories->"Kingdom Death" category shows 66 products.

However, when you go to a front-end it would only display 16 products.

Things I've done so far:

  • Cleared Cached
  • Re-indexed everything
  • Remove/Re-added products to the same category
  • Made sure the products are enabled
  • Made sure the items are in stock
  • Made sure the product visibility is set to "Catalog, Search"

I've compared those 16 products that are visible to the "invisible" ones and there is no visible changes all the parameters and attributes are identical.

Also, if I search for the "invisible" product on the site, it will display it and find it, but doesn't work if i try to find it using a category .

Greatly appreciate the help!

1
  • you have to set product visibility Catalog,Search from backend and run indexing command. Commented Feb 8, 2017 at 5:15

1 Answer 1

4

This is my correct answer. I just experienced your issue on my site. My site is based on Magento 2.1.5. You should add some xml and php file on your app folder.

Especially, site is just live production one, my answer is just more convenient answer.

We can easily add these two files on original Modules folder.

app\code\Modules\Catalog\etc\di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Catalog\Model\Indexer\Category\Product\Action\Full" type="Modules\Catalog\Model\Indexer\Category\Product\Action\Full" />
</config>

app\code\Modules\Catalog\Model\Indexer\Category\Product\Action\Full.php

<?php 
namespace Modules\Catalog\Model\Indexer\Category\Product\Action;

/**
 * Class AbstractAction
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/

class Full extends \Magento\Catalog\Model\Indexer\Category\Product\Action\Full {

    public function isRangingNeeded() {
        return false; //It was "true" on default vendor part. 
    }
}

Then, we should run this command.

php bin/magento cache:clean
php bin/magento indexer:reindex

Finally, we got whole 2000 products on our category page instead of previous 340 products on frontend page. Also, the "Product category" tab on index management is just updated from date of version upgraded to current indexing date and time.

Great experience!

Hope this will help many developers and owners.

5
  • Excellent answer..as I have a category having 60K products and was looking for some solution and this is just excellent... Commented Jul 1, 2017 at 6:36
  • I don't have an "app\code\Modules" folder in my store? Is it enough to simply create that Modules folder and create these two files, or is more detail needed in the answer to help my understanding?
    – robgt
    Commented Oct 23, 2017 at 8:48
  • I found this (github.com/bangerkuwranger/…) which covers the same answer details, but as a standard module which you can use as-is, or copy into your own module. This might help others better understand how to perform these tasks.
    – robgt
    Commented Oct 23, 2017 at 10:25
  • Ok, you can create those folders as like you create a new module. Commented Oct 24, 2017 at 9:46
  • @robgt you can easily create a custom module. Commented Mar 23, 2023 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.