Hi. I've just tried reindexing my Magento after upgrading to 2.3.3 last night, and it's giving me the following error after indexing:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Catalog\Model\ResourceModel\Product\Collection::addIsSaleableAttributeToFilter() must be of the type array or null, integer given, called in /home/325194.cloudwaysapps.com/xnjyrekmqf/public_html/vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php on line 1582 and defined in /home/325194.cloudwaysapps.com/xnjyrekmqf/public_html/vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php:2475 Stack trace: #0 /home/325194.cloudwaysapps.com/xnjyrekmqf/public_html/vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php(1582): Magento\Catalog\Model\ResourceModel\Product\Collection->addIsSaleableAttributeToFilter(1) #1 /home/325194.cloudwaysapps.com/xnjyrekmqf/public_html/generated/code/Magento/Catalog/Model/ResourceModel/Product/Collection/Interceptor.php(518): Magento\Catalog\Model\ResourceModel\Product\Collection->addAttributeToFilter('is_saleable', 1, 'left') #2 /home/325194.cloudwaysapps.com/xnjyrekmqf/public_htm in /home/325194.cloudwaysapps.com/xnjyrekmqf/public_html/vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php on line 2475
Does anyone know why and what it is?
Thanks in advance.
Solved! Go to Solution.
I am getting this too after upgrading! However, if I change the theme used (Content -> Design -> Config) I can successfully view my site!
Edit
Looking further into this, my current theme is using
$collection = $this->_objectManager->create('\Magento\Catalog\Model\ResourceModel\Product\Collection'); ... ... $collection->addAttributeToFilter('is_saleable', 1, 'left') ...
The method addAttributeToFilter() is expecting the 2nd parameter $condition to be an array or null, but the theme obviously hasn't been updated. I've changed it from
$collection->addAttributeToFilter('is_saleable', 1, 'left')
to... note 1 -> [1]
addAttributeToFilter('is_saleable', [1], 'left')
This works and I'll feed it back to the theme developer. Suggest you look at the error you're getting...
#1 /home/325194.cloudwaysapps.com/xnjyrekmqf/public_html/generated/code/Magento/Catalog/Model/ResourceModel/Product/Collection/Interceptor.php(518): Magento\Catalog\Model\ResourceModel\Product\Collection->addAttributeToFilter('is_saleable', 1, 'left')
The error is coming from the generate folder, have you done a setup:di:compile since upgrading?
OK. This error appears when Magento is trying to reindex 'Catalog Search', which it can't do.
Don't know what has changed, as have never had this error before.
I am getting this too after upgrading! However, if I change the theme used (Content -> Design -> Config) I can successfully view my site!
Edit
Looking further into this, my current theme is using
$collection = $this->_objectManager->create('\Magento\Catalog\Model\ResourceModel\Product\Collection'); ... ... $collection->addAttributeToFilter('is_saleable', 1, 'left') ...
The method addAttributeToFilter() is expecting the 2nd parameter $condition to be an array or null, but the theme obviously hasn't been updated. I've changed it from
$collection->addAttributeToFilter('is_saleable', 1, 'left')
to... note 1 -> [1]
addAttributeToFilter('is_saleable', [1], 'left')
This works and I'll feed it back to the theme developer. Suggest you look at the error you're getting...
#1 /home/325194.cloudwaysapps.com/xnjyrekmqf/public_html/generated/code/Magento/Catalog/Model/ResourceModel/Product/Collection/Interceptor.php(518): Magento\Catalog\Model\ResourceModel\Product\Collection->addAttributeToFilter('is_saleable', 1, 'left')
The error is coming from the generate folder, have you done a setup:di:compile since upgrading?
what file did you change? Can you provide a path?
In our case it was a compatibility issue with the Porto theme we use. There was a patch issued by them that resolved the issue.
can you give reference to that patch?
Download Porto from your account and it's the patch inside for 2.3.3.
I am facing the same issue. Please provide a path in which file did you change.
How did you resolve this issue?
@chintan_ramani wrote:How did you resolve this issue?
Literally 2 posts up the guy told you Porto now includes a specific 2.3.3 patch to resolve this problem.
As a person who also experienced this I can confirm the patch works.