cancel
Showing results for 
Search instead for 
Did you mean: 

Compare Index Page Issue

Compare Index Page Issue

I'm running a fairly bespoke theme on my Magento 2 website and the compare functionality has always been disabled via XML. I've removed the 'remove' blocks for it and added a 'Add to Compare' to the list.phtml template which works; the product gets added to the compare list however when I click 'Compare', I get the following:

Invalid method Magento\Catalog\Block\Product\Compare\ListCompare\Interceptor::moduleEnabled

on the URL:

https://www.example.com/catalog/product_compare/index/

Anyone run into this issue before? I've checked both Magento and server logs however they're not very helpful. I've done the general clean up (cleared generated, pub/static etc) and recompiled however this hasn't worked. I've also checked to see if the Magento_Wishlist module was disabled but it wasn't.

Any help is appreciated!

4 REPLIES 4

Re: Compare Index Page Issue

Hello @jazz_singh 

 

You have to find out the code where moduleEnabled method is called.

 

So you can use the below command:

grep -rnw app/ -e 'moduleEnabled'

Hope it helps.

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Compare Index Page Issue

Hi @Sanjay Jethva,

 

I found the module that uses that method and disabled it, I cleared the static files and redeployed however this didn't fix the issue. The only file that came up when I ran that command was the following:

 

public function isModuleEnabled()
    {
        if (!$this->scopeConfig->isSetFlag($this->getConfigPath() . 'enabled')) {
            return false;
        }
        $moduleEnabled = $this->scopeConfig->getValue($this->getConfigPath() . str_rot13('frevny'));
        if (empty($moduleEnabled) || !$moduleEnabled || (0x28 !== strlen(trim($moduleEnabled)))) {
            return false;
        }
        $this->registry->register('xtDisabled', false, true);
        return true;
    }

I've disabled this module and recompiled however same issue.

Re: Compare Index Page Issue

Hello @jazz_singh again,

 

Find the template file for Compare Product listing page.

I think, in this .phtml file, there is an issue in call block method.

 

Thanks.

 

 

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Compare Index Page Issue

Hi @Sanjay Jethva,

 

I managed to find the conflicting module and applied a fix, thanks for your help.