15

I have installed Smile_Elasticsearch extension.It is working fine with the default mode but when I enabled developer mode it is showing an error.

Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in app/code/Smile/ElasticsuiteVirtualCategory/Model/Layer/Filter/Category.php on line 150

Please see attached screenshot.

enter image description here

Technology Detail's:

  • Magento version: 2.3
  • Smile Elasticsearch version: 2.7.0 (which is compatible with Magento 2.3)
  • Installed Elasticsearch version: 5.6.15 (which is compatible with magento 2.3)
  • PHP version: 7.1

So, Please let me know how can I fix this error? Your help would be appreciated. Thanks in advance.!!!

0

Here parameter 1 [$virtualRule, $callback] must be an array to callback these function.
Here is solution.
Goto line around 151 to 156 /module-elasticsuite-virtual-category/Model/Layer/Filter/Category.php

if ($data === false) {
$virtualRule = $category->getVirtualRule();
$data = call_user_func_array([$virtualRule, $callback], [$category]);
$cacheData = serialize($data);
$this->cache->save($cacheData, $cacheKey, [\Magento\Catalog\Model\Category::CACHE_TAG]);
}

Change to this

if ($data === false) {
$virtualRule = $category->getVirtualRule();
$data = call_user_func_array(array[$virtualRule, $callback], [$category]);
$cacheData = serialize($data);
$this->cache->save($cacheData, $cacheKey, [\Magento\Catalog\Model\Category::CACHE_TAG]);
}

Reference: https://www.php.net/manual/en/function.call-user-func.php

| 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.