fix
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Ixrs\Catalog\Support;
|
|||||||
class ElementList
|
class ElementList
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function getGlobalFilter($iBlockId, $globalFilter)
|
public static function getGlobalFilter($iBlockId, $globalFilter, &$offersFilter = [])
|
||||||
{
|
{
|
||||||
$pFilter = [];
|
$pFilter = [];
|
||||||
$af = app()->factory()->iBlock()->getEntityById($iBlockId);
|
$af = app()->factory()->iBlock()->getEntityById($iBlockId);
|
||||||
@@ -141,6 +141,18 @@ class ElementList
|
|||||||
// $this->storage['SUB_FILTER'][$fKey] = $values;
|
// $this->storage['SUB_FILTER'][$fKey] = $values;
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
$offersFilter = is_array($globalFilter['OFFERS'])?$globalFilter['OFFERS']:[];
|
||||||
|
foreach ($oFilter as $fKey => $values) {
|
||||||
|
if(isset($offersFilter[$fKey])){
|
||||||
|
$offersFilter[$fKey] =
|
||||||
|
collect((array)$offersFilter[$fKey])->merge($values)->unique()->toArray();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$offersFilter[$fKey] = $values;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $globalFilter;
|
return $globalFilter;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,14 +57,19 @@ class ElementList extends OriginElementList implements IElementList
|
|||||||
$iblock = $this->storage['CATALOGS'][$this->arParams['IBLOCK_ID']];
|
$iblock = $this->storage['CATALOGS'][$this->arParams['IBLOCK_ID']];
|
||||||
|
|
||||||
/** inject */
|
/** inject */
|
||||||
$this->globalFilter = \Ixrs\Catalog\Support\ElementList::getGlobalFilter($this->arParams['IBLOCK_ID'], $this->globalFilter);
|
$offersFilter = [];
|
||||||
|
$this->globalFilter = \Ixrs\Catalog\Support\ElementList::getGlobalFilter($this->arParams['IBLOCK_ID'], $this->globalFilter, $offersFilter);
|
||||||
|
$this->storage['SUB_FILTER_2'] = $offersFilter;
|
||||||
/** inject end */
|
/** inject end */
|
||||||
|
|
||||||
$offersFilterExists = !empty($this->globalFilter['OFFERS']) && is_array($this->globalFilter['OFFERS']);
|
$offersFilterExists = !empty($this->globalFilter['OFFERS']) && is_array($this->globalFilter['OFFERS']);
|
||||||
|
|
||||||
|
$offersFilterExists = !!$offersFilter;
|
||||||
|
|
||||||
if ($offersFilterExists)
|
if ($offersFilterExists)
|
||||||
{
|
{
|
||||||
$this->storage['SUB_FILTER'] = array_merge($this->globalFilter['OFFERS'], $catalogFilter);
|
//$this->storage['SUB_FILTER'] = array_merge($this->globalFilter['OFFERS'], $catalogFilter);
|
||||||
|
$this->storage['SUB_FILTER'] = array_merge($offersFilter, $catalogFilter);
|
||||||
$this->storage['SUB_FILTER']['IBLOCK_ID'] = $iblock['IBLOCK_ID'];
|
$this->storage['SUB_FILTER']['IBLOCK_ID'] = $iblock['IBLOCK_ID'];
|
||||||
$this->storage['SUB_FILTER']['ACTIVE_DATE'] = 'Y';
|
$this->storage['SUB_FILTER']['ACTIVE_DATE'] = 'Y';
|
||||||
$this->storage['SUB_FILTER']['ACTIVE'] = 'Y';
|
$this->storage['SUB_FILTER']['ACTIVE'] = 'Y';
|
||||||
|
|||||||
Reference in New Issue
Block a user