My problem is that : all products in category page not showing.
And when i displayed the query of $_productColection in Magento_Catalog/templates/product/list.phtml :
/**
* Product list template
*
* @var $block \Magento\Catalog\Block\Product\ListProduct
*/
?>
<?php
$_productCollection = $block->getLoadedProductCollection();
echo($_productCollection->getSelect());
i have (NULL) at the end of the query:
SELECT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `stock_status_index`.`is_salable` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = '1' INNER JOIN `catalog_product_entity` AS `product` ON product.entity_id = e.entity_id INNER JOIN `inventory_stock_2` AS `stock_status_index` ON product.sku = stock_status_index.sku WHERE (stock_status_index.is_salable = 1) AND (NULL)
It was modified at the time of $collection->load();
in vendor/magento/module-catalog/Block/Product/ListProduct.php
- line 212
protected function _beforeToHtml()
{
$collection = $this->_getProductCollection();
$this->addToolbarBlock($collection);
if (!$collection->isLoaded()) {
$collection->load();
}
$categoryId = $this->getLayer()->getCurrentCategory()->getId();
if ($categoryId) {
foreach ($collection as $product) {
$product->setData('category_id', $categoryId);
}
}
return parent::_beforeToHtml();
}
Does anyone know this NULL value ? And where is the file that loads this value?