Skip to content

Commit 58adfbf

Browse files
author
silinmykola
committed
33589 fix array values in catalogsearch parameters
1 parent 2c94da6 commit 58adfbf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

app/code/Magento/CatalogSearch/Model/Advanced.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,13 @@ protected function getPreparedSearchCriteria($attribute, $value)
368368
if (!empty($value['from']) || !empty($value['to'])) {
369369
$from = '';
370370
$to = '';
371+
if (is_array($value['from'])) {
372+
$value['from'] = $this->getFirstArrayElement($value['from']);
373+
}
374+
if (is_array($value['to'])) {
375+
$value['to'] = $this->getFirstArrayElement($value['to']);
376+
}
377+
371378
if (isset($value['currency'])) {
372379
/** @var $currencyModel Currency */
373380
$currencyModel = $this->_currencyFactory->create()->load($value['currency']);
@@ -433,4 +440,16 @@ public function getSearchCriterias()
433440
{
434441
return $this->_searchCriterias;
435442
}
443+
444+
/**
445+
* Return first value in array
446+
*
447+
* @param $value
448+
*
449+
* @return mixed
450+
*/
451+
private function getFirstArrayElement($value)
452+
{
453+
return is_array($value) ? $this->getFirstArrayElement(array_shift($value)) : $value;
454+
}
436455
}

0 commit comments

Comments
 (0)