4

I have many issues in the error log file that I don't understand. I didn't found any info on this specific issue anywhere.

There is the error :

[:error] [pid 23390] [client 78.235.181.108:52380] PHP Fatal error: Uncaught Error: Call to a member function getFinalProduct() on null in /data/www/mystore/prod/vendor/magento/module-wishlist/CustomerData/Wishlist.php:135\nStack trace:\n#0 /data/www/mystore/prod/vendor/magento/module-wishlist/CustomerData/Wishlist.php(120): Magento\Wishlist\CustomerData\Wishlist->getItemData(Object(Magento\Wishlist\Model\Item))\n#1 /data/www/mystore/prod/vendor/magento/module-wishlist/CustomerData/Wishlist.php(77): Magento\Wishlist\CustomerData\Wishlist->getItems()\n#2 /data/www/mystore/prod/vendor/magento/module-customer/CustomerData/SectionPool.php(79): Magento\Wishlist\CustomerData\Wishlist->getSectionData()\n#3 /data/www/mystore/prod/vendor/magento/module-customer/CustomerData/SectionPool.php(60): Magento\Customer\CustomerData\SectionPool->getSectionDataByNames(Array)\n#4 /data/www/mystore/prod/vendor/magento/module-customer/Controller/Section/Load.php(77): Magento\Customer\CustomerData\SectionPool->getSectionsData(Array, false)\n#5 /data/ww in /data/www/mystore/prod/vendor/magento/module-wishlist/CustomerData/Wishlist.php on line 135

, referer:

The wishlist feature is the basic one from Magento (no extension should overwrite that on our website).

Do you have any idea about this problem ?

asked Jan 17, 2019 at 13:44

3 Answers 3

2

Many themes override this Class. The error comes because they are not compatible with the latest magento version as 'itemResolver' param is added in new version.

To fix this issue find any file which is overriding this

\Magento\Wishlist\CustomerData\Wishlist

Check for their construct for param

\Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface $itemResolver

if not present add this param in construct.

answered Jan 29, 2020 at 7:57
1

In the file vendor/magento/module-wishlist/CustomerData/Wishlist.php at line no 135

Need to change inside the method

protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem)
Change 
'image' => $this->getImageData($this->itemResolver->getFinalProduct($wishlistItem)),
To
'image' => $this->getImageData($product),
answered May 27, 2019 at 15:20
2
  • Sorry, I did not see your answer. But no luck, I already have 'image' => $this->getImageData($product), in my file Commented Jun 27, 2019 at 9:52
  • This is not the proper solution as the error comes from $itemResolver. Commented Jan 29, 2020 at 7:59
1

Check if you have any rewrites for class \Magento\Wishlist\CustomerData\Wishlist and fix conflicts. Looks like base class constructor never runs so $this->itemResolver variable is null.

answered Jul 18, 2019 at 5:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.