0

Exception #0 (Exception): Warning: explode() expects parameter 2 to be string, array given in /home/user/public_html/app/code/Mageplaza/LayeredNavigation/Plugin/Model/Adapter/Preprocessor.php on line 92

the code

 if (($filter->getField() === 'category_ids')) {
 $filterValue = implode(',', array_map([$this, 'validateCatIds'], explode(',', $filter->getValue())));
asked Sep 29, 2024 at 9:35

2 Answers 2

0

Check the value for the $filter->getValue() using $filter->getValue()??''.

Your code should be:

$filterValue = implode(',', array_map([$this, 'validateCatIds'], explode(',', $filter->getValue()??'')));
answered Sep 29, 2024 at 13:46
0

Please modify your code like below

if (($filter->getField() === 'category_ids')) {
 $value = $filter->getValue();
 if (is_array($value)) {
 $filterValue = implode(',', array_map([$this, 'validateCatIds'], $value));
 } else {
 $filterValue = implode(',', array_map([$this, 'validateCatIds'], explode(',', $value)));
 }
}
answered Oct 4, 2024 at 11:25

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.