Answer the question
In order to leave comments, you need to log in
How to fix a site on Bitrix?
Rules file in HTML mode templates-maincomponents-bitrixcatalog.section.default-template.php
Added text, then removed it. But something fell apart.
The catalog gives an error on the site Parse error: syntax error, unexpected 'endif' (T_ENDIF) in httpdocs/local/templates/main/components/bitrix/catalog.section/.default/template.php on line 20
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
<? if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();
use \Bitrix\Main\Localization\Loc;
//debug($arParams);
//debug($arResult);
?>
<div class="catalog-box">
<? foreach ($arResult["ITEMS"] as $arItem) : ?>
<div class="card <span id=" title="Код PHP: <? if ($arParams["TEMPLATE_SMALL"] == "Y") : ?>"><span class="bxhtmled-surrogate-inner"><span class="bxhtmled-right-side-item-icon"></span><span class="bxhtmled-comp-lable" unselectable="on" spellcheck="false">Код PHP</span></span>card-small<? endif; ?>">
<div class="card-pic" style="text-align:center"><? //debug($arItem); ?>
<a href="<?= $arItem[">" data-bx-app-ex-href="<?= $arItem["DETAIL_PAGE_URL"] ?>"><img src="<?= $arItem[" style="width:auto; height:auto; max-width:100%; display:inline-block">" data-bx-app-ex-src="<?= $arItem["PREVIEW_PICTURE"]["src"] ?>" width="" data-bx-app-ex-width="<?= $arItem["PREVIEW_PICTURE"]["WIDTH"] ?>" height="" data-bx-app-ex-height="<?= $arItem["PREVIEW_PICTURE"]["HEIGHT"] ?>" alt="" data-bx-app-ex-alt="<?= $arItem["NAME"] ?>"></a></div>
<div class="card-text">
<h3 class="card-title"><?= $arItem["NAME"] ?></h3>
<div class="card-info">
<? $bSetProps = false;
foreach($arItem["PROPERTIES"] as $arProperty)
if (! (! $arProperty["VALUE"] || ! in_array($arProperty["CODE"], $arParams["PROPERTY_CODE"])))
$bSetProps = true; ?>
<? if ($bSetProps) : ?>
<div class="card-chars">
<? foreach($arItem["PROPERTIES"] as $arProperty) :
if (! $arProperty["VALUE"] || ! in_array($arProperty["CODE"], $arParams["PROPERTY_CODE"]))
continue; ?>
<div class="card-char">
<span class="card-key"><?= $arProperty["NAME"] ?>:</span>
<span class="card-value"><?= $arProperty["VALUE"] ?></span>
</div>
<? endforeach; ?>
</div>
<? endif; ?>
<? if ($arItem["PROPERTIES"]["W_LABEL"]["VALUE"]) : ?>
<div class="card-notice">Образец клиента. Повтор невозможен.</div>
<? endif; ?>
</div>
<div class="card-order">
<a href="/raschyet-tsen/?type=26" class="js-request-price card-calc">Рассчитать</a>
<div class="card-tools">
<a href="javascript:void(0)" onclick="RedHelper.openChat();" class="card-btn">Он-лайн консультация</a>
<?/*<a href="/raschyet-tsen/?type=26" class="card-btn">Узнать цену</a>
<a href="<?= $arItem["DETAIL_PAGE_URL"] ?>" class="card-btn">Купить свой образец</a>*/?>
</div>
</div>
</div>
</div>
<? endforeach; ?>
</div>
<div class="pager">
<div id="pager_nav">
<? echo $arResult["NAV_STRING"]; ?>
</div>
</div>
<? if ($arResult["UF_SEOTEXT"]) : ?>
<div>
<?= $arResult["~UF_SEOTEXT"] ?>
</div>
<? endif; ?>
<?/*
<div class="pager">
<span class="pager-descr">Продукция 1-21 из 661</span>
<div class="pager-nav">
<a href="#/" class="pager-arrow prev"></a>
<a href="#/" class="pager-item active">1</a>
<a href="#/" class="pager-item">2</a>
<a href="#/" class="pager-item">3</a>
<span class="pager-ellipsis">...</span>
<a href="#/" class="pager-item">13</a>
<a href="#/" class="pager-arrow next"></a>
</div>
</div>
*/?>
<?
/*
$signer = new \Bitrix\Main\Security\Sign\Signer;
$signedTemplate = $signer->sign($templateName, 'catalog.section');
$signedParams = $signer->sign(base64_encode(serialize($arResult['ORIGINAL_PARAMETERS'])), 'catalog.section');
*/
?>
try this in a couple of places
<? if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();
use \Bitrix\Main\Localization\Loc;
//\Bitrix\Main\Diag\Debug::dump($arParams);
//\Bitrix\Main\Diag\Debug::dump($arResult);
?>
<div class="catalog-box">
<? foreach ($arResult["ITEMS"] as $arItem) : ?>
<div class="card card-small">
<? if ($arParams["TEMPLATE_SMALL"] == "Y") : ?>
<span class="bxhtmled-surrogate-inner">
<span class="bxhtmled-right-side-item-icon"></span>
<span class="bxhtmled-comp-lable" unselectable="on" spellcheck="false">Код PHP</span>
</span>
<? endif; ?>
<div class="card-pic" style="text-align:center">
<a href="<?= $arItem["DETAIL_PAGE_URL"] ?>" data-bx-app-ex-href="<?= $arItem["DETAIL_PAGE_URL"] ?>">
<img src="<?= $arItem["PREVIEW_PICTURE"]["src"] ?>"
style="width:auto; height:auto; max-width:100%; display:inline-block"
data-bx-app-ex-width="<?= $arItem["PREVIEW_PICTURE"]["WIDTH"] ?>"
data-bx-app-ex-height="<?= $arItem["PREVIEW_PICTURE"]["HEIGHT"] ?>" alt=""
data-bx-app-ex-alt="<?= $arItem["NAME"] ?>"
</a>
</div>
<div class="card-text">
<h3 class="card-title"><?= $arItem["NAME"] ?></h3>
<div class="card-info">
<? $bSetProps = false;
foreach($arItem["PROPERTIES"] as $arProperty)
if (! (! $arProperty["VALUE"] || ! in_array($arProperty["CODE"], $arParams["PROPERTY_CODE"])))
$bSetProps = true; ?>
<? if ($bSetProps) : ?>
<div class="card-chars">
<? foreach($arItem["PROPERTIES"] as $arProperty) :
if (! $arProperty["VALUE"] || ! in_array($arProperty["CODE"], $arParams["PROPERTY_CODE"]))
continue; ?>
<div class="card-char">
<span class="card-key"><?= $arProperty["NAME"] ?>:</span>
<span class="card-value"><?= $arProperty["VALUE"] ?></span>
</div>
<? endforeach; ?>
</div>
<? endif; ?>
<? if ($arItem["PROPERTIES"]["W_LABEL"]["VALUE"]) : ?>
<div class="card-notice">Образец клиента. Повтор невозможен.</div>
<? endif; ?>
</div>
<div class="card-order">
<a href="/raschyet-tsen/?type=26" class="js-request-price card-calc">Рассчитать</a>
<div class="card-tools">
<a href="javascript:void(0)" onclick="RedHelper.openChat();" class="card-btn">Он-лайн консультация</a>
<?/*<a href="/raschyet-tsen/?type=26" class="card-btn">Узнать цену</a>
<a href="<?= $arItem["DETAIL_PAGE_URL"] ?>" class="card-btn">Купить свой образец</a>*/?>
</div>
</div>
</div>
</div>
<? endforeach; ?>
</div>
<div class="pager">
<div id="pager_nav">
<? echo $arResult["NAV_STRING"]; ?>
</div>
</div>
<? if ($arResult["UF_SEOTEXT"]) : ?>
<div>
<?= $arResult["~UF_SEOTEXT"] ?>
</div>
<? endif; ?>
<?/*
<div class="pager">
<span class="pager-descr">Продукция 1-21 из 661</span>
<div class="pager-nav">
<a href="#/" class="pager-arrow prev"></a>
<a href="#/" class="pager-item active">1</a>
<a href="#/" class="pager-item">2</a>
<a href="#/" class="pager-item">3</a>
<span class="pager-ellipsis">...</span>
<a href="#/" class="pager-item">13</a>
<a href="#/" class="pager-arrow next"></a>
</div>
</div>
*/?>
<?
/*
$signer = new \Bitrix\Main\Security\Sign\Signer;
$signedTemplate = $signer->sign($templateName, 'catalog.section');
$signedParams = $signer->sign(base64_encode(serialize($arResult['ORIGINAL_PARAMETERS'])), 'catalog.section');
*/
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question