if ($arResult['CATALOG'] && isset($arResult['OFFERS']) && !empty($arResult['OFFERS'])) { ... foreach ($arResult['OFFERS'] as &$arOffer) { ... $arResultPrices = CIBlockPriceTools::GetCatalogPrices($arParams['IBLOCK_ID'], $arParams['PRICE_CODE']); foreach ($arResultPrices as $value) { // if (!$value['CAN_VIEW'] && !$value['CAN_BUY']) // continue; $arPriceTypeID[] = $value['ID']; } if (isset($value)) unset($value); $arOffer['PRICE_MATRIX'] = CatalogGetPriceTableEx($arOffer['ID'], 0, $arPriceTypeID, 'Y'); if (is_array($arOffer['PRICE_MATRIX'])) { $boolSKUDisplayProps = true; if (isset($arOffer['PRICE_MATRIX']['COLS']) && is_array($arOffer['PRICE_MATRIX']['COLS'])) { foreach ($arOffer['PRICE_MATRIX']['COLS'] as $keyColumn => $arColumn) $arOffer['PRICE_MATRIX']['COLS'][$keyColumn]['NAME_LANG'] = htmlspecialcharsbx($arColumn['NAME_LANG']); } } } ... }
if ($arResult['CATALOG_TYPE'] == CCatalogProduct::TYPE_PRODUCT || $arResult['CATALOG_TYPE'] == CCatalogProduct::TYPE_SET) { ... $arResultPrices = CIBlockPriceTools::GetCatalogPrices($arParams['IBLOCK_ID'], $arParams['PRICE_CODE']); foreach ($arResultPrices as &$value) { // if (!$value['CAN_VIEW'] && !$value['CAN_BUY']) // continue; $arPriceTypeID[] = $value['ID']; } if (isset($value)) unset($value); $arResult['PRICE_MATRIX'] = CatalogGetPriceTableEx($arResult['ID'], 0, $arPriceTypeID, 'Y'); if (isset($arResult['PRICE_MATRIX']['COLS']) && is_array($arResult['PRICE_MATRIX']['COLS'])) { foreach ($arResult['PRICE_MATRIX']['COLS'] as $keyColumn => $arColumn) $arResult['PRICE_MATRIX']['COLS'][$keyColumn]['NAME_LANG'] = htmlspecialcharsbx($arColumn['NAME_LANG']); } ... }
$strMatrix = ''; if (!isset($arResult['OFFERS']) || empty($arResult['OFFERS'])) { ... if (is_array($arResult['PRICE_MATRIX'])) { $strMatrix .= '<dd class="clear">'; $strMatrix .= '<table cellpadding="0" cellspacing="0" class="price-matrix">'; $strMatrix .= '<thead>'; $strMatrix .= '<tr>'; if (count($arResult['PRICE_MATRIX']['ROWS']) >= 1 && ($arResult['PRICE_MATRIX']['ROWS'][0]['QUANTITY_FROM'] > 0 || $arResult['PRICE_MATRIX']['ROWS'][0]['QUANTITY_TO'] > 0)) { $strMatrix .= '<td>' . GetMessage('CATALOG_QUANTITY') . '</td>'; } foreach ($arResult['PRICE_MATRIX']['COLS'] as $typeID => $arType) { $strMatrix .= '<td>' . $arType['NAME_LANG'] . '</td>'; } $strMatrix .= '</tr>'; $strMatrix .= '</thead>'; foreach ($arResult['PRICE_MATRIX']['ROWS'] as $ind => $arQuantity) { $strMatrix .= '<tr>'; if ((count($arResult['PRICE_MATRIX']['ROWS']) > 1) || (count($arResult['PRICE_MATRIX']['ROWS']) == 1 && ($arResult['PRICE_MATRIX']['ROWS'][0]['QUANTITY_FROM'] > 0 || $arResult['PRICE_MATRIX']['ROWS'][0]['QUANTITY_TO'] > 0))) { $strMatrix .= '<td nowrap>'; if (IntVal($arQuantity['QUANTITY_FROM']) > 0 && IntVal($arQuantity['QUANTITY_TO']) > 0) $strMatrix .= str_replace('#FROM#', $arQuantity['QUANTITY_FROM'], str_replace('#TO#', $arQuantity['QUANTITY_TO'], GetMessage('CATALOG_QUANTITY_FROM_TO'))); elseif (IntVal($arQuantity['QUANTITY_FROM']) > 0) $strMatrix .= str_replace('#FROM#', $arQuantity['QUANTITY_FROM'], GetMessage('CATALOG_QUANTITY_FROM')); elseif(IntVal($arQuantity['QUANTITY_TO']) > 0) $strMatrix .= str_replace('#TO#', $arQuantity['QUANTITY_TO'], GetMessage('CATALOG_QUANTITY_TO')); $strMatrix .= '</td>'; } foreach ($arResult['PRICE_MATRIX']['COLS'] as $typeID => $arType) { $strMatrix .= '<td style="text-align: center;">'; if ($arResult['PRICE_MATRIX']['MATRIX'][$typeID][$ind]['DISCOUNT_PRICE'] < $arResult['PRICE_MATRIX']['MATRIX'][$typeID][$ind]['PRICE']) $strMatrix .= '<s>' . FormatCurrency($arResult['PRICE_MATRIX']['MATRIX'][$typeID][$ind]['PRICE'], $arResult['PRICE_MATRIX']['MATRIX'][$typeID][$ind]['CURRENCY']) . '</s> <span class="catalog-price">' . FormatCurrency($arResult['PRICE_MATRIX']['MATRIX'][$typeID][$ind]['DISCOUNT_PRICE'], $arResult['PRICE_MATRIX']['MATRIX'][$typeID][$ind]['CURRENCY']) . '</span>'; else $strMatrix .= '<span class="catalog-price">' . FormatCurrency($arResult['PRICE_MATRIX']['MATRIX'][$typeID][$ind]['PRICE'], $arResult['PRICE_MATRIX']['MATRIX'][$typeID][$ind]['CURRENCY']) . '</span>'; $strMatrix .= '</td>'; } $strMatrix .= '</tr>'; } $strMatrix .= '</table>'; $strMatrix .= '</dd>'; } if (strlen($strMatrix) > 0) { ?> <div class="item_info_section"> <dl id="<?=$arItemIDs['DISPLAY_MATRIX_DIV'] ?>"><?=$strMatrix?></dl> </div> <?php } }
Источник: