Getting all the listing page blank in Magento 2.3
-
20-03-2021 - |
Pergunta
I installed Magento 2.3 on my local system, but ongoing to the listing page it's showing blank. I have checked the error log, exception log, system log, debug log but nothing are there. I tried this also Magento2 website showing all blank pages but doesn't helped me. I'm attaching a snapshot of my listing page(Gear) here for your reference.
Edit: After enabling developer mode it's giving me error like
I have overriden my catalog_category_view.xml. here is my Magento_Catalog/layout/catalog_category_view.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page layout="2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<!--DO NOT MODIFY :: Frontend event tracker code START-->
<block class="Magento\Framework\View\Element\Template" name="shoptimize.category.tracker" template="Magento_Catalog::tracker/category-tracker.phtml">
</block>
<!--DO NOT MODIFY :: Frontend event tracker code START-->
</referenceContainer>
</body>
</page>
Solução
I got solution of my own problem, actually there was a problem in product data, product data coming was invalid due to that it was not rendering phtml file of listing page. So I just added try catch block in foreach at Magento_Catalog/templates/product/list.phtml
and it's now working fine. Here is the code after changes I have made
<?php foreach ($_productCollection as $_product): ?>
<?php try { ?>
<?php /* @escapeNotVerified */ echo($iterator++ == 1) ? '<li class="item product product-item">' : '</li><li class="item product product-item">' ?>
<div class="product-item-info" data-container="product-grid">
<?php
$productImage = $block->getImage($_product, $image);
if ($pos != null) {
$position = ' style="left:' . $productImage->getWidth() . 'px;'
. 'top:' . $productImage->getHeight() . 'px;"';
}
?>
<!--DO NOT MODIFY. TRACKER DIV WRAPPER START-->
<div data-is-trackable="true" data-tracking-context="<?php echo $tracker_constants::PRODUCT_CLICK; ?>" data-event-properties=
'{"product_id": <?php echo $_product->getId() ?>,
"sku": "<?php echo $_product->getSku() ?>",
"product_price": <?php echo $_product->getFinalPrice() ?>,
"source": "Catalog Page"
}'>
<!--DO NOT MODIFY. TRACKER DIV WRAPPER TILL HERE-->
<?php // Product Image ?>
<a href="<?php /* @escapeNotVerified */ echo $_product->getProductUrl() ?>" class="product photo product-item-photo" tabindex="-1">
<?php echo $productImage->toHtml(); ?>
</a>
</div>
...
...
...
...
<?php }
catch (\Exception $err) {
//echo $err->getMessage();
}
?>
<?php endforeach; ?>