Здравствуйте.
Есть сайт, в котором 1200 свойств ( так исторически сложилось ).
Использую комплексный компонент bitrix.catalog, который в свою очередь подключает bitrix:catalog.section.
Вот вывод параметров компонента bitrix:catalog.section
То есть я никакие свойства для вывода в PROPERTY_CODE не передаю.
А компонент делает тормозной до ужаса запрос, куда передаются все ID свойств для выборки.
Вот он, выполняется 9 секунд.
Вопросы. Как избавиться от такого и где настроить?
Нашел кусок кода в ядре от куда этот бред формируется.
Есть такой "замечательный" метод modifyDisplayProperties абстрактного класса ElementList( наследник Base).
Он вызывается от класса компонента /bitrix/components/bitrix/catalog.section/class.php и далее по цепочке наследования.
Кто-нибудь знает решение?
Не очень хочется CatalogSectionComponent выносить в свой неймспейс, там не только его придется править, а это гемор.
Есть сайт, в котором 1200 свойств ( так исторически сложилось ).
Использую комплексный компонент bitrix.catalog, который в свою очередь подключает bitrix:catalog.section.
Вот вывод параметров компонента bitrix:catalog.section
То есть я никакие свойства для вывода в PROPERTY_CODE не передаю.
А компонент делает тормозной до ужаса запрос, куда передаются все ID свойств для выборки.
Вот он, выполняется 9 секунд.
Скрытый текст |
|---|
| SELECT `iblock_property_enumeration`.`ID` AS `ID`, `iblock_property_enumeration`.`PROPERTY_ID` AS `PROPERTY_ID`, `iblock_property_enumeration`.`VALUE` AS `VALUE`, `iblock_property_enumeration`.`SORT` AS `SORT`, `iblock_property_enumeration`.`XML_ID` AS `XML_ID` FROM `b_iblock_property_enum` `iblock_property_enumeration` WHERE (`iblock_property_enumeration`.`PROPERTY_ID` in (55, 1526, 1576, 1626, 1676, 1723, 1726, 2004, 2029, 56, 135, 1527, 1577, 1627, 1677, 1724, 1777, 2127, 57, 136, 167, 1528, 1578, 1628, 1678, 1728, 1778, 2006, 2031, 137, 168, 1529, 1579, 1629, 1679, 1729, 2032, 54, 59, 138, 154, 155, 156, 169, 1530, 1580, 1630, 1680, 1730, 1780, 2033, 60, 1531, 1581, 1631, 1681, 1731, 1781, 2034, 1532, 1582, 1632, 1682, 1732, 1782, 2035, 62, 1533, 1583, 1633, 1683, 1783, 2036, 2133, 63, 1534, 1584, 1634, 1684, 1734, 2134, 139, 171, 1535, 1585, 1635, 1685, 1735, 1785, 65, 140, 1536, 1586, 1636, 1686, 1786, 2039, 66, 141, 1537, 1587, 1637, 1687, 1737, 1787, 67, 142, 1538, 1588, 1638, 1688, 1738, 1788, 2138, 68, 143, 1539, 1589, 1639, 1689, 1739, 2042, 144, 175, 1540, 1590, 1640, 1690, 1790, 2043, 70, 145, 1541, 1591, 1641, 1691, 1741, 2044, 71, 146, 176, 1542, 1592, 1642, 1692, 1742, 2142, 72, 1543, 1593, 1643, 1693, 1743, 2046, 2143, 1544, 1594, 1644, 1694, 1744, 2047, 2144, 74, 178, 1545, 1595, 1645, 1695, 1745, 1795, 75, 179, 1546, 1596, 1646, 1696, 1746, 2146, 180, 1547, 1597, 1647, 1697, 1747, 2050, 2147, 77, 1548, 1598, 1648, 1698, 1748, 2051, 2148, 78, 182, 1549, 1599, 1649, 1699, 1749, 1799, 2149, 79, 1550, 1600, 1650, 1700, 1750, 2053, 80, 1551, 1601, 1651, 1701, 1751, 1801, 2054, 81, 1552, 1602, 1652, 1702, 1752, 2152, 82, 682, 1553, 1603, 1653, 1703, 1753, 2056, 2153, 186, 1554, 1604, 1654, 1704, 1754, 2057, 2154, 84, 1555, 1605, 1655, 1705, 1755, 2058, 85, 702, 1556, 1606, 1656, 1706, 1756, 86, 1557, 1607, 1657, 1707, 1757, 2060, 2157, 87, 1558, 1608, 1658, 1708, 1758, 2061, 88, 189, 1559, 1609, 1659, 1709, 1759, 2062, 89, 1560, 1610, 1660, 1710, 1760, 2063, 2160, 90, 191, 1561, 1611, 1661, 1711, 1761, 2064, 2161, 91, 1612, 1662, 1762, 2065, 92, 193, 1563, 1613, 1663, 1713, 1763, 2066, 93, 1564, 1614, 1664, 1714, 1764, 2067, 94, 1565, 1615, 1665, 1715, 1765, 2068, 95, 1566, 1616, 1666, 1716, 2069, 96, 196, 1567, 1617, 1667, 1717, 1767, 2070, 1568, 1618, 1668, 1768, 2071, 98, 708, 1569, 1619, 1669, 1769, 2072, 99, 198, 1570, 1620, 1670, 1770, 2073, 199, 1571, 1621, 1671, 1721, 1771, 2010, 2074, 2171, 101, 557, 1498, 1572, 1622, 1672, 1772, 2011, 2075, 2172, 102, 1573, 1623, 1673, 1773, 2012, 103, 1574, 1624, 1674, 2013, 2077, 2174, 104, 203, 1499, 1575, 1625, 1775, 2014, 2078, 2175, 105, 2015, 2079, 2176, 106, 671, 2080, 107, 205, 2081, 2178, 108, 2179, 109, 2083, 2180, 110, 2020, 2084, 2181, 111, 207, 1442, 2021, 2085, 2182, 112, 2022, 2086, 2183, 113, 2023, 2184, 114, 209, 2088, 2185, 115, 210, 2089, 2186, 116, 2187, 117, 2027, 2091, 2188, 118, 211, 2092, 2189, 119, 2093, 2190, 120, 212, 2191, 121, 1509, 2192, 122, 214, 2193, 2194, 124, 216, 2098, 2195, 2196, 218, 2100, 2197, 127, 219, 2198, 128, 220, 129, 647, 2103, 221, 710, 2104, 131, 2105, 222, 1500, 133, 2107, 223, 1490, 2108, 224, 2109, 225, 226, 2111, 2112, 672, 2113, 228, 2114, 229, 2115, 2116, 677, 2117, 232, 2118, 2119, 2120, 2121, 2122, 237, 1491, 2123, 238, 2124, 239, 240, 241, 595, 244, 245, 246, 248, 249, 251, 252, 253, 1443, 257, 711, 259, 1445, 260, 680, 262, 1446, 263, 264, 266, 267, 268, 269, 271, 272, 696, 275, 280, 281, 282, 283, 650, 284, 286, 287, 289, 290, 712, 291, 603, 651, 294, 295, 1501, 296, 300, 652, 301, 1510, 605, 303, 1511, 304, 685, 306, 310, 1492, 312, 1493, 313, 315, 1450, 319, 1451, 321, 1452, 323, 704, 326, 327, 329, 330, 332, 334, 336, 1453, 337, 339, 340, 341, 342, 343, 346, 347, 348, 349, 350, 1455, 356, 357, 358, 359, 361, 673, 363, 366, 609, 1494, 368, 1495, 1512, 371, 1502, 373, 374, 674, 655, 378, 379, 381, 1497, 1496, 387, 388, 389, 390, 675, 391, 394, 395, 397, 398, 400, 402, 403, 404, 406, 1487, 411, 412, 413, 414, 417, 419, 1513, 421, 422, 425, 1514, 427, 613, 433, 434, 1515, 435, 437, 438, 659, 1516, 442, 443, 444, 1465, 446, 447, 449, 450, 453, 455, 456, 457, 660, 458, 459, 676, 464, 465, 468, 706, 1517, 470, 471, 472, 475, 481, 482, 484, 485, 1467, 585, 489, 490, 491, 493, 664, 718, 496, 498, 501, 502, 503, 564, 506, 507, 511, 513, 514, 516, 518, 519, 520, 523, 524, 666, 526, 527, 529, 530, 532, 533, 1518, 534, 535, 720, 536, 1488, 537, 539, 540, 1519, 543, 544, 1471, 546, 547, 548, 1472, 1504, 1520, 679, 1474, 707, 691, 692, 1478, 1521, 1482, 1522, 1523, 1506, 1483, 1508, 1524, 1525)) ORDER BY `iblock_property_enumeration`.`PROPERTY_ID` ASC, `iblock_property_enumeration`.`SORT` ASC, `iblock_property_enumeration`.`VALUE` ASC |
Вопросы. Как избавиться от такого и где настроить?
Нашел кусок кода в ядре от куда этот бред формируется.
Есть такой "замечательный" метод modifyDisplayProperties абстрактного класса ElementList( наследник Base).
Он вызывается от класса компонента /bitrix/components/bitrix/catalog.section/class.php и далее по цепочке наследования.
| Код |
|---|
protected function processResultData()
{
if ($this->initSectionResult())
{
$this->initSectionProperties();
parent::processResultData(); // переходим по цепочке >>
}
}
#####################################
// >> Оказываемся в Bitrix\Iblock\Component в классе Base
protected function processResultData()
{
$this->iblockProducts = $this->getProductsSeparatedByIblock();
$this->checkIblock();
if ($this->hasErrors())
return;
$this->initCurrencyConvert();
$this->initCatalogInfo();
$this->initPrices();
$this->initUrlTemplates();
$this->initElementList(); // переходим сюда >>>
if (!$this->hasErrors())
{
$this->sortElementList();
$this->makeElementLinks();
$this->prepareData();
$this->filterPureOffers();
$this->makeOutputResult();
}
}
#########################
// >>> Оказываемся в в этом же классе
protected function initElementList()
{
$this->storage['CURRENCY_LIST'] = array();
$this->storage['DEFAULT_MEASURE'] = $this->getDefaultMeasure();
$this->initQueryFields();
foreach ($this->iblockProducts as $iblock => $products)
{
$elementIterator = $this->getElementList($iblock, $products);
$iblockElements = $this->getIblockElements($elementIterator);
if (!empty($iblockElements) && !$this->hasErrors())
{
$this->modifyDisplayProperties($iblock, $iblockElements); // переходим сюда >>>
$this->elements = array_merge($this->elements, array_values($iblockElements));
$this->iblockProducts[$iblock] = array_keys($iblockElements);
}
unset($elementIterator, $iblockElements, $element);
}
}
################################
// >>> Оказываемся в Bitrix\Iblock\Component в классе ElementList modifyDisplayProperties
и видим, что от параметров компонента ничего не зависит
protected function modifyDisplayProperties($iblock, &$iblockElements){
if (!empty($iblockElements))
{
$iblockParams = $this->storage['IBLOCK_PARAMS'][$iblock];
$propertyCodes = $iblockParams['PROPERTY_CODE'];
$productProperties = $iblockParams['CART_PROPERTIES'];
$getPropertyCodes = !empty($propertyCodes);
$getProductProperties = $this->arParams['ADD_PROPERTIES_TO_BASKET'] === 'Y' && !empty($productProperties);
$getIblockProperties = $getPropertyCodes || $getProductProperties;
// вот здесь в любом варианте мы попадаем на выборку
// то есть я не смог с помощью параметров, сделать так, чтобы не попасть на выборку \CIBlockElement::GetPropertyValuesArray
if ($getIblockProperties || ($this->useCatalog && $this->useDiscountCache))
{
$propFilter = array(
'ID' => array_keys($iblockElements),
'IBLOCK_ID' => $iblock
);
// сюда передаются iblockElements - все элементы выборки покой-то фиг и загружаются все свойства.
\CIBlockElement::GetPropertyValuesArray($iblockElements, $iblock, $propFilter);
if ($getPropertyCodes)
|
Кто-нибудь знает решение?
Не очень хочется CatalogSectionComponent выносить в свой неймспейс, там не только его придется править, а это гемор.