3

I am having a problem with the product list when adding new products. It was working properly until I added a new product. Then, the product list stopped being visible in the catalog pages and search results. I'm not able to replicate this in my local environment, and upon further investigation, I found out that this line of code doesn't work in a catalog page if there are products in that particular catalog:

<?= $block->getProductListHtml() ?>

Note: I changed the theme back to luma, and the issue still exists.

Update: I found out that these lines of code in vendor/magento/module-catalog/view/frontend/templates/product/list.phtml are causing the issue:

$productImage = $block->getImage($_product, $imageDisplayArea);
if ($pos != null) {
   $position = ' style="left:' . $productImage->getWidth() . 'px;'
               . 'top:' . $productImage->getHeight() . 'px;"';
}
0

Try to reindex by using following command

php bin/magento indexer:reindex

  • I did this a lot of times, but the issue still persists. – Y. Cai Mar 12 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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