5

I came across a weird issue. There are around 400 products assigned to a category but it is only displaying around 150 products.

I verified the products enabled and all, actually those products show up on a search or another category.

So, in short, the product is assigned to multiple categories. It is displayed in a few categories but not one.

I tried reindexing but no luck.

The weirdest thing here is when I open the product on the admin panel and resave the product, I can see the product on the frontend. The problem is I can't open every product and save it again. Also after I tried that with few undisplayed products, I reindexed again and the products that appeared after saving individually disappeared again.

Can anyone passed through such a weird situation.

I'm stalled on what to do next to fix this. Can anyone help me with this? Any help would be appreciated. By the way, my Magento version is 2.1.3

4
  • I may be wrong here! you said whenever you save product, product visible in frontend so why not try this progrmatically save the products. Get all the product collections just load and save. Mar 6, 2017 at 4:38
  • I tried saving from admin, i think while product save the index are updated that is why it is displaying the products. I think there is some problem with reindexing. I have checked the indexer_status table and all indexes are valid Mar 6, 2017 at 5:16
  • Check tables catalog_category_product_index count is it 400? & In indexer_state all are valid?
    – Jackson
    Mar 6, 2017 at 7:55
  • magento.stackexchange.com/questions/158646/… Perfect answer... Jul 1, 2017 at 6:45

3 Answers 3

3

Looks like some error happened in process of re-index and index status left processing. You need reset it DB.

For example by query:

UPDATE indexer_state SET status = 'invalid' WHERE status != 'valid';

Then run:

php -f bin/magento indexer:reindex;
1
  • thanks this work for me, now new problem arise, the images doesn't show up Oct 14, 2017 at 10:43
1

the correct procedure for reindex all indexers is the following:

bin/magento indexer:reset

bin/magento indexer:reindex

If you want to reindex a specific indexer:

bin/magento indexer:reset <indexerCode1> <indexerCode2> <indexerCode3>

bin/magento indexer:reindex <indexerCode1> <indexerCode2> <indexerCode3>

List of default indexers:

bin/magento indexer:info

customer_grid Customer Grid

catalog_category_product Category Products

catalog_product_category Product Categories

catalogrule_rule Catalog Rule Product

catalog_product_attribute Product EAV

inventory Inventory

catalogrule_product Catalog Product Rule

cataloginventory_stock Stock

catalog_product_price Product Price

catalogsearch_fulltext Catalog Search

Docs: https://devdocs.magento.com/guides/v2.4/config-guide/cli/config-cli-subcommands-index.html

Cheers

0

I had a similar issue, and as you mentioned in you question, when you save a product it fixes it for that product. So you just need to save all products at once with a mass update to avoid the laborious task of saving them one by one.

From the Magento Admin go to Products > Catalog and in the Products Grid select all products in the catalog. Then select to Update Attributes from the Actions Control dropdown.

enter image description here

Now you just need to update one attribute for all product's, select an attribute which is unlikely to have a value already set for any of the products, e.g. Meta Keywords or Layout Update XML. Click Save to save all the products at once.

enter image description here

Now all your products should display correctly in the categories. Don't forget to repeat the process to remove the value you just set for all products.

Your Answer

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

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