If I open frontend page or catalog menu in backend admin page, HTTP 500 error is occurred.
/var/log/nginx/error.log :
[error] 9326#9326: *4135 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to a member function isSwatchAttribute() on null in /home/(...)/vendor/magento/module-swatches/Helper/Data.php
[error] 9326#9326: *4220 access forbidden by rule
How can I fix this?
Hi @NDelt,
Can you please mentioned on which line no error display and your Magento 2.x version?
I hope you have set permission for your site like below,
sudo find var pub/static pub/media -type f -exec chmod g+w {} \; sudo find var pub/static pub/media -type d -exec chmod g+ws {} \; sudo find ./pub/media -type d -exec chmod 777 {} \; sudo find ./pub/static -type d -exec chmod 777 {} \;
I'm using Magento 2.2.5. And this error has occurred after installing templates.
Hello,
please check below file for same
vendor/magento/module-swatches/Helper/Data.php
Fixed it with a core hack.
Above: $swatchAttributes = $this->swatchAttributesProvider->provide($product); Put this: if (!isset($this->swatchAttributesProvider)) { $this->swatchAttributesProvider = ObjectManager::getInstance()->get(SwatchAttributesProvider::class); }
More info :
https://github.com/magento/magento2/issues/10388
Hope it will help you.
If works then mark as solution.