0

We have upgraded our Magento site to Latest Magento version Magento 2.3.1, After upgrade, We are facing error while opening configurable product as below.

{
    "[data-role=swatch-options]": {
        "Magento_Swatches/js/swatch-renderer": {
            "jsonConfig": <br /> 
<b>Fatal error</b>:  Uncaught Error: Call to a member function getUrl() on null in /vendor/magento/module-configurable-product/Helper/Data.php:56
Stack trace: #0 /vendor/magento/module-configurable-product/Block/Product/View/Type/Configurable.php(261): Magento\ConfigurableProduct\Helper\Data-&gt;getGalleryImages(Object(Magento\Catalog\Model\Product\Interceptor))
#1 /vendor/magento/module-configurable-product/Block/Product/View/Type/Configurable.php(238): Magento\ConfigurableProduct\Block\Product\View\Type\Configurable-&gt;getOptionImages()
#2 /generated/code/Magento/Swatches/Block/Product/Renderer/Configurable/Interceptor.php(206): Magento\ConfigurableProduct\Block\Product\View\Type\Configurable-&gt;getJsonConfig()
#3 /vendor/magento/module-swatches/view/frontend/templates/product/view/renderer.phtml(16): Magento\Swatches\Block\Product\Renderer\Configurable\Interceptor-&gt;getJsonConfig()
#4 /v in <b>/vendor/magento/module-configurable-product/Helper/Data.php</b> on line <b>56</b><br />

Simple product details page is working fine, but having error in configurable product. Does anybody has solution of this issue? Please help. Thank you.

  • Hi Ronak , have you mange to solve the issue , i am facing a similar issue – Vishwas Bhatnagar Nov 4 '19 at 10:18
  • Yes, Please have a look in my answer. – Ronak Parmar Nov 4 '19 at 10:46
1

I have fixed this issue by my own. I have overridden the

\Magento\ConfigurableProduct\Helper\Data

Class in my custom module and forgot to call parent constructor in my Data helper file. So I have added below line of code in file and fixed the issue.

parent::__construct($imageHelper, $urlBuilder);

Thank you.

|improve this answer|||||
  • 1
    Yes, i have found the same issue in my code was about to answer here . Anyways thank you – Vishwas Bhatnagar Nov 4 '19 at 13:04

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.