[英]Magento 2 Products Missing from Category Pages after Magento 2.4.5 Update
After updating to Magento 2.4.5 product category pages no longer show products.更新到 Magento 2.4.5 产品类别页面后不再显示产品。 However, the filters on the left side of the page indicate that products should be visible for instance:
但是,页面左侧的过滤器表明产品应该是可见的,例如:
I've tried the following to fix the issue to no avail:我尝试了以下方法来解决此问题但无济于事:
After a long search I was able to find this issue and work-around for this problem.经过长时间的搜索,我找到了这个问题并解决了这个问题。 It seems to be an issue around the catalog option to display all products.
显示所有产品的目录选项似乎是一个问题。
Workaround option #1:解决方法选项 #1:
Override limiter.phtml
in your theme:覆盖主题中的
limiter.phtml
:
app/design/frontend/Your/Theme/Magento_Catalog/templates/product/list/toolbar/limiter.phtml
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php
/**
* Product list toolbar
*
* @var \Magento\Catalog\Block\Product\ProductList\Toolbar $block
* @var \Magento\Framework\Locale\LocaleFormatter $localeFormatter
*/
?>
<div class="field limiter">
<label class="label" for="limiter">
<span><?= $block->escapeHtml(__('Show')) ?></span>
</label>
<div class="control">
<select id="limiter" data-role="limiter" class="limiter-options">
<?php foreach ($block->getAvailableLimit() as $_key => $_limit):?>
<option value="<?= $block->escapeHtmlAttr($_key) ?>"
<?php if ($block->isLimitCurrent($_key)):?>
selected="selected"
<?php endif ?>>
<?= $block->escapeHtml($_limit) ?>
</option>
<?php endforeach; ?>
</select>
</div>
<span class="limiter-text"><?= $block->escapeHtml(__('per page')) ?></span>
</div>
After doing so be sure to run: php bin/magento setup:di:compile
这样做之后一定要运行:
php bin/magento setup:di:compile
Workaround option #2:解决方法选项 #2:
Turn off Allow All Products per Page
by going to Stores > Settings > Configuration > Catalog > Catalog
通过转到
Stores > Settings > Configuration > Catalog > Catalog
关闭Allow All Products per Page
Set Allow All Products per Page
to No将
Allow All Products per Page
设置为否
After doing so be sure to run:这样做之后一定要运行:
php bin/magento setup:di:compile
php bin/magento cache:flush
https://github.com/magento/magento2/issues/35900#issuecomment-1210181110 https://github.com/magento/magento2/issues/35900#issuecomment-1210181110
This should fix the issue: https://github.com/magento/magento2/commit/bb55549cd3016987663272e7ffe3f452c8d6e40d这应该可以解决问题: https ://github.com/magento/magento2/commit/bb55549cd3016987663272e7ffe3f452c8d6e40d
You can create a patch for it.你可以为它创建一个补丁。
vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar/limiter.phtml
<?php if ($block->isLimitCurrent($_key)):?>
selected="selected"
<?php endif ?>>
- <?= $block->escapeHtml($localeFormatter->formatNumber((int) $_limit)) ?>
+ <?= $block->escapeHtml(
+ is_numeric($_limit) ? $localeFormatter->formatNumber((int) $_limit) : $_limit
+ ) ?>
</option>
<?php endforeach; ?>
</select>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.