3

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 ?

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.

| improve this answer | |
0

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),
| improve this answer | |
  • Sorry, I did not see your answer. But no luck, I already have 'image' => $this->getImageData($product), in my file – Aubin Jun 27 '19 at 9:52
  • This is not the proper solution as the error comes from $itemResolver. – Afreen Sheikh Jan 29 at 7:59
0

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.