0

Our new products are no longer showing on their respective category pages on the frontend.

I have checked lots of items on the admin:

General->Status = Enabled
General->Visibility = Catalog,Search
Inventory->Qty > 0
Inventory->Stock Availability = In Stock
Websites = assigned to website
Catgories = assigned to their respective categories.

Whereas new products are visible on the homepage in New Arrivals Block.

I have already run all the required commands as below:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reset
php bin/magento indexer:reindex
php bin/magento cache:flush
php bin/magento cache:clean
sudo chmod -R 777 pub/ var/ generated/
php bin/magento cron:run

I have also checked table in database "inventory_stock_1" and data is properly updated in this table as well.

Also checked below and there is no value as working:

update Magento.indexer_state set status='invalid' where status ='working'

But still, the front end category view shows the only older products and not our newly uploaded products.

Kindly help to resolve this issue as soon as possible.

3 Answers 3

1

please debug this file in this path - vendor/magento/module-catalog/view/frontend/templates/product/list.phtml , because this list.phtml file is responsible for the products on the category page i.e PLP (Product List page), add a breakpoint in line no 19, and start checking from there, to see if the products are getting there.

4
  • Can you please help with how and what to add in breakpoint? Actually, I don't know how to debug.
    – Zarana
    Oct 25, 2021 at 10:59
  • That is a separate topic for a day , debugging skills are as much requirement as is developing , the most efficient way i'll recommend is by using xdebug. Please read these links , this will help you how to set up xdebug and use it - magenest.com/en/debug-magento-2-code-xdebug-phpstorm-1 devdocs.magento.com/cloud/howtos/debug.html Before installing the xdebug , please note that latest version of xdebug is not supported by magento , so you need to install specific version of xdebug which is version - 2.9.8 using pecl which i will recommend. Oct 25, 2021 at 18:43
  • Thank you so much for your help. I tried below code in this file: app/design/frontend/theme/Magento_Catalog/templates/product/list.phtml
    – Zarana
    Oct 29, 2021 at 12:07
  • Code Added top of file: $objectManager= \Magento\Framework\App\ObjectManager::getInstance(); $categoryFactory=$objectManager->get('\Magento\Catalog\Model\CategoryFactory'); $category=$categoryFactory->create()->load(122); $categoryProducts=$category->getProductCollection()->addAttributeToSelect('*'); echo "<h3>Product Count: ".$categoryProducts->count()."</h3>"; foreach ($categoryProducts as $product) {echo "Name: ".$product->getName()."<br />"; } Above code is working fine & prints all product names but how can i implement this code & show all the products on my category pages?
    – Zarana
    Oct 29, 2021 at 12:09
0

Try these commands:

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

if you are stilling having same problem let me know

1
  • Thank you for your help but I already tried this and still, the issue remains the same.
    – Zarana
    Oct 25, 2021 at 11:02
0

Please check are you able to access product by this url

baseurl/catalog/product/view/id/product_id

if yes then its cache issue. And make sure you have assigned products to correct category and category is enabled and even products too.

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.