0

Нужна ваша помощь профессионалы. Не могу понять в чем проблема.

СЕЙЧАС ОТОБРАЖАЕТСЯ ТАК

<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
/** @var array $arParams */
/** @var array $arResult */
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @global CDatabase $DB */
/** @var CBitrixComponentTemplate $this */
/** @var string $templateName */
/** @var string $templateFile */
/** @var string $templateFolder */
/** @var string $componentPath */
/** @var CBitrixComponent $component */
$this->setFrameMode(true);
?>

  <?if($arParams["DISPLAY_TOP_PAGER"]):?>
    <p>
      <?=$arResult["NAV_STRING"]?>
    </p>
    <?endif?>


      <div class="col-lg-3 card mb-4">
        <?foreach($arResult["ITEMS"] as $arElement):?>
          <!-- Card -->

          <!--Card image-->
          <div class="card-img">
            <div class="card-img__header d-flex justify-content-between align-items-center">
              <div class="card-like"></div>
              <div class="card-hit active">хит продаж</div>
            </div>
            <div class="card-img__product">
              <img src="/bitrix/templates/.default/img/21.png" alt="Card image cap">
            </div>
          </div>
          <!--Card content-->
          <div class="card-body">
            <!--Title-->
            <a href="<?=$arElement[" DETAIL_PAGE_URL "]?>">
              <h4 class="card-title"><b><?=$arElement["NAME"]?></h4></a>
									<?foreach($arElement["DISPLAY_PROPERTIES"] as $pid=>$arProperty):?>
									<div class="card-text">
										<?if(is_array($arProperty["DISPLAY_VALUE"]))
											echo implode("&nbsp;/&nbsp;", $arProperty["DISPLAY_VALUE"]);
											elseif($arProperty["DISPLAY_VALUE"] === true)
											echo "&nbsp;";
											else
											echo $arProperty["DISPLAY_VALUE"];?>
																			
										<p>материал: саше</p>
										<p>вес/объем: 10 мл</p>
										<p>упаковка: 500 штук</p>
									</div>
									<?endforeach?>
									<?foreach($arResult["PRICES"] as $code=>$arPrice):?>
									<div class="card-price d-flex align-items-center">
										<?if($arPrice = $arElement["PRICES"][$code]):?>
										<?if($arPrice["DISCOUNT_VALUE"] < $arPrice["VALUE"]):?>
										<p>от </p>
										<?else:?>
										<h4 class="cprice"><b><?=$arPrice["PRINT_VALUE"]?></b></h4>
              <?endif?>
                <?else:?>
                  &nbsp;
                  <?endif;?>
                    <p>руб.</p>
                    <p>упаковка</p>
                    <div id="card-question" data-description="Количество товара Вы всегда можете отредактировать в корзине. Окончательная стоимость товара после обработки заказа менеджером"><img src="/bitrix/templates/.default/img/product-info-icon.png" alt="question"></div>
          </div>
          <?endforeach;?>
            <?if(count($arResult["PRICES"]) > 0):?>

              <?if($arElement["CAN_BUY"]):?>
                <button href="<?echo $arElement[" BUY_URL "]?>" type="button" class="card-btn d-flex justify-content-center align-items-center">
										<img src="/bitrix/templates/.default/img/cart-white-icon.png" alt="trash">
										<p><?echo GetMessage("CATALOG_BUY")?></p>
									</button>
                <?elseif((count($arResult["PRICES"]) > 0) || is_array($arElement["PRICE_MATRIX"])):?>
                  <?endif?>

                    <p class="bay-hover"><a href="#"><b>Купить в 1 клик</b></a></p>
                    <?endif;?>
      </div>

      <!-- / Card -->
      <?endforeach;?>
        </div>
        <?if($arParams["DISPLAY_BOTTOM_PAGER"]):?>
          <p>
            <?=$arResult["NAV_STRING"]?>
          </p>
          <?endif?>

Два товара отображает в одной колонке. Причем при большем количества товаров, так же устанавливаются в одной колонке не прерываясь.

1
  • Причем так же при вставке html кодом, отображается так же блоком. 24 окт 2019 в 2:41

1 ответ 1

0

Проблема оказывается была очень проста в решении. Нужно было указать верстку в цикле foreach.

В итоге получился такой. Сам проблему создал, сам же её и решил спустя 4 часа.

<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
    /** @var array $arParams */
    /** @var array $arResult */
    /** @global CMain $APPLICATION */
    /** @global CUser $USER */
    /** @global CDatabase $DB */
    /** @var CBitrixComponentTemplate $this */
    /** @var string $templateName */
    /** @var string $templateFile */
    /** @var string $templateFolder */
    /** @var string $componentPath */
    /** @var CBitrixComponent $component */
    $this->setFrameMode(true);
    ?>

      <?if($arParams["DISPLAY_TOP_PAGER"]):?>
        <p>
          <?=$arResult["NAV_STRING"]?>
        </p>
        <?endif?>


          
            <?foreach($arResult["ITEMS"] as $arElement):?>
              <!-- Card -->
<div class="col-lg-3 card mb-4">
              <!--Card image-->
              <div class="card-img">
                <div class="card-img__header d-flex justify-content-between align-items-center">
                  <div class="card-like"></div>
                  <div class="card-hit active">хит продаж</div>
                </div>
                <div class="card-img__product">
                  <img src="/bitrix/templates/.default/img/21.png" alt="Card image cap">
                </div>
              </div>
              <!--Card content-->
              <div class="card-body">
                <!--Title-->
                <a href="<?=$arElement[" DETAIL_PAGE_URL "]?>">
                  <h4 class="card-title"><b><?=$arElement["NAME"]?></h4></a>
    									<?foreach($arElement["DISPLAY_PROPERTIES"] as $pid=>$arProperty):?>
    									<div class="card-text">
    										<?if(is_array($arProperty["DISPLAY_VALUE"]))
    											echo implode("&nbsp;/&nbsp;", $arProperty["DISPLAY_VALUE"]);
    											elseif($arProperty["DISPLAY_VALUE"] === true)
    											echo "&nbsp;";
    											else
    											echo $arProperty["DISPLAY_VALUE"];?>
    																			
    										<p>материал: саше</p>
    										<p>вес/объем: 10 мл</p>
    										<p>упаковка: 500 штук</p>
    									</div>
    									<?endforeach?>
    									<?foreach($arResult["PRICES"] as $code=>$arPrice):?>
    									<div class="card-price d-flex align-items-center">
    										<?if($arPrice = $arElement["PRICES"][$code]):?>
    										<?if($arPrice["DISCOUNT_VALUE"] < $arPrice["VALUE"]):?>
    										<p>от </p>
    										<?else:?>
    										<h4 class="cprice"><b><?=$arPrice["PRINT_VALUE"]?></b></h4>
                  <?endif?>
                    <?else:?>
                      &nbsp;
                      <?endif;?>
                        <p>руб.</p>
                        <p>упаковка</p>
                        <div id="card-question" data-description="Количество товара Вы всегда можете отредактировать в корзине. Окончательная стоимость товара после обработки заказа менеджером"><img src="/bitrix/templates/.default/img/product-info-icon.png" alt="question"></div>
              </div>
              <?endforeach;?>
                <?if(count($arResult["PRICES"]) > 0):?>

                  <?if($arElement["CAN_BUY"]):?>
                    <button href="<?echo $arElement[" BUY_URL "]?>" type="button" class="card-btn d-flex justify-content-center align-items-center">
    										<img src="/bitrix/templates/.default/img/cart-white-icon.png" alt="trash">
    										<p><?echo GetMessage("CATALOG_BUY")?></p>
    									</button>
                    <?elseif((count($arResult["PRICES"]) > 0) || is_array($arElement["PRICE_MATRIX"])):?>
                      <?endif?>

                        <p class="bay-hover"><a href="#"><b>Купить в 1 клик</b></a></p>
                        <?endif;?>
          </div>
</div>
          <!-- / Card -->
          <?endforeach;?>
            
            <?if($arParams["DISPLAY_BOTTOM_PAGER"]):?>
              <p>
                <?=$arResult["NAV_STRING"]?>
              </p>
              <?endif?>

1
  • Вот вы сами через неделю поймете что конкретно вы изменили в этой простыне? А кто ваш ответ будет смотреть вообще без понимания ситуации, ему каково будет?
    – u_mulder
    24 окт 2019 в 7:29

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.