cancel
Showing results for 
Search instead for 
Did you mean: 

Products not displaying on category pages after reindexing

Products not displaying on category pages after reindexing

Products are no longer showing on category pages after reindexing.

 

I've tried disabling the cache, deleting the var folder, refreshed the cache and changed to Varnish cache. I've also reindexed several times.

 

While I'm reindexing I always get the message that the product categories index was rebuilt in 00.00.00 seconds while all other indexes take a few seconds. This makes me think it might not be indexing it correctly.

 

I'm using version 2.1.8

 

Any help would be appreciated, thanks

 

6 REPLIES 6

Re: Products not displaying on category pages after reindexing

ou can find a fix in Magento 2 GitHub. The issue is present on 2.1.5.

https://github.com/magento/magento2/issues/8018

One of the soulution is to add a preference

<preference for="Magento\Catalog\Model\Indexer\Category\Product\Action\Full" type="<My>\<Module>\Model\Indexer\Category\Product\Action\Full" />

And override the limit of 500 product while reindex.

    <?phpnamespace <My>\<Module>\Model\Indexer\Category\Product\Action;

/*
 * Need to override this because ranging is limiting the original indexer to 500 rows per category
 *
 */

class Full extends \Magento\Catalog\Model\Indexer\Category\Product\Action\Full{
    protected function isRangingNeeded()
    {
        return false;
    }    
}

Hope this help you.

 

Re: Products not displaying on category pages after reindexing

Thanks for the help. I tried the solution mentioned but I think I went wrong somewhere.

I did the following

1. Created the folders to make the path from the root directory



app/code/Custom/Catalog/etc/di.xml

Added this code to the new blank di.xml file

<?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="Custom\Catalog\Model\Indexer\Category\Product\Action\Full" />
</config>





2. Created the folders to make the path


app/code/Custom/Catalog/Model/Indexer/Category/Product/Action/Full.php

Added this code to the new blank Full.php file

namespace Custom\Catalog\Model\Indexer\Category\Product\Action;

/**
 * Class AbstractAction
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 */
class Full extends \Magento\Catalog\Model\Indexer\Category\Product\Action\Full {

    /**
     * Check whether select ranging is needed
     *
     * @return bool
     */
    public function isRangingNeeded() {
        return false; // By default true, due to indexing issue making it false
    }
}



3. Ran the reindex command but no change

Re: Products not displaying on category pages after reindexing

Any update on this?

Re: Products not displaying on category pages after reindexing

If this was not working check any custom modules are causing this issue. Try to disable the third party modules recently added and that fixes the issue. If so debug further on the module will help you

Re: Products not displaying on category pages after reindexing

Quick update on this. I'm using version 2.1.8 not 2.1.3

 

I tried changing AbstractAction.php for testing purposes

protected function isRangingNeeded()
{
//    return true;
	return false;
}

.That made no difference either

Re: Products not displaying on category pages after reindexing

Thanks, no custom modules have been added, the site was working fine for a couple of years then the catalog indexing failed when the client added a new product