fix
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Bitrix\Iblock\Component;
|
||||
|
||||
/**
|
||||
* @see bitrix/modules/iblock/lib/component/elementlist.php
|
||||
*/
|
||||
class OriginElementList extends ElementList
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace Bitrix\Iblock\Component;
|
||||
|
||||
if(class_exists('Bitrix\Iblock\Component\ElementList', false)){
|
||||
throw new \Exception('Class Bitrix\Iblock\Component\ElementList already loaded');
|
||||
}
|
||||
if(!class_exists('Bitrix\Iblock\Component\ElementList', false)){
|
||||
$dirPath = $_SERVER['DOCUMENT_ROOT'].BX_PERSONAL_ROOT.'/modules/iblock/lib/component';
|
||||
$filePath = $dirPath . '/elementlist.php';
|
||||
|
||||
$fileContent = file_get_contents($filePath);
|
||||
|
||||
$fileContent = str_replace('class ElementList', 'class OriginElementList', $fileContent);
|
||||
|
||||
$fileContent = str_replace('private ', 'protected ', $fileContent);
|
||||
$fileContent = str_replace('self::', 'static::', $fileContent);
|
||||
$fileContent = str_replace('__DIR__', var_export($dirPath, true), $fileContent);
|
||||
$fileContent = str_replace('__FILE__', var_export($filePath, true), $fileContent);
|
||||
|
||||
eval('?>' . $fileContent);
|
||||
}
|
||||
|
||||
use Ixrs\Catalog\Interfaces\IBlock\Component\IElementList;
|
||||
|
||||
/**
|
||||
* @see bitrix/modules/iblock/lib/component/elementlist.php
|
||||
*/
|
||||
class ElementList extends OriginElementList implements IElementList
|
||||
{
|
||||
|
||||
protected function initSubQuery()
|
||||
{
|
||||
$this->storage['SUB_FILTER'] = array();
|
||||
|
||||
if (
|
||||
$this->useCatalog
|
||||
&& !$this->isMultiIblockMode()
|
||||
&& $this->offerIblockExist($this->arParams['IBLOCK_ID'])
|
||||
)
|
||||
{
|
||||
$catalogFilter = array();
|
||||
foreach ($this->globalFilter as $key => $value)
|
||||
{
|
||||
if (\CProductQueryBuilder::isCatalogFilterField($key))
|
||||
{
|
||||
//TODO: remove this hack after new catalog.section filter
|
||||
if ($key === '=PRODUCT_UF_PRODUCT_MAPPING')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$catalogFilter[$key] = $value;
|
||||
unset($this->globalFilter[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$iblock = $this->storage['CATALOGS'][$this->arParams['IBLOCK_ID']];
|
||||
|
||||
/** inject */
|
||||
$this->globalFilter = \Ixrs\Catalog\Support\ElementList::getGlobalFilter($this->arParams['IBLOCK_ID'], $this->globalFilter);
|
||||
/** inject end */
|
||||
|
||||
$offersFilterExists = !empty($this->globalFilter['OFFERS']) && is_array($this->globalFilter['OFFERS']);
|
||||
|
||||
if ($offersFilterExists)
|
||||
{
|
||||
$this->storage['SUB_FILTER'] = array_merge($this->globalFilter['OFFERS'], $catalogFilter);
|
||||
$this->storage['SUB_FILTER']['IBLOCK_ID'] = $iblock['IBLOCK_ID'];
|
||||
$this->storage['SUB_FILTER']['ACTIVE_DATE'] = 'Y';
|
||||
$this->storage['SUB_FILTER']['ACTIVE'] = 'Y';
|
||||
|
||||
if ($this->arParams['HIDE_NOT_AVAILABLE'] === 'Y')
|
||||
{
|
||||
$this->storage['SUB_FILTER']['AVAILABLE'] = 'Y';
|
||||
}
|
||||
|
||||
$this->filterFields['=ID'] = \CIBlockElement::SubQuery(
|
||||
'PROPERTY_'.$iblock['SKU_PROPERTY_ID'],
|
||||
$this->storage['SUB_FILTER']
|
||||
);
|
||||
}
|
||||
elseif (!empty($catalogFilter))
|
||||
{
|
||||
$this->storage['SUB_FILTER'] = $catalogFilter;
|
||||
$this->storage['SUB_FILTER']['IBLOCK_ID'] = $iblock['IBLOCK_ID'];
|
||||
$this->storage['SUB_FILTER']['ACTIVE_DATE'] = 'Y';
|
||||
$this->storage['SUB_FILTER']['ACTIVE'] = 'Y';
|
||||
|
||||
$this->filterFields[] = array(
|
||||
'LOGIC' => 'OR',
|
||||
array($catalogFilter),
|
||||
'=ID' => \CIBlockElement::SubQuery(
|
||||
'PROPERTY_'.$iblock['SKU_PROPERTY_ID'],
|
||||
$this->storage['SUB_FILTER']
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user