A
A
Andrey Bely2020-03-04 18:34:27
1C-Bitrix
Andrey Bely, 2020-03-04 18:34:27

How to form catalog items into a table?

Good evening!
I'm trying to display the elements of the catalog in a table, as planned, it should be like this:
5e5fca80e4868060602331.png

Here's what happened the most adequate:
5e5fc9039b5a2884435167.png

<table class="table-catalog">
  <tbody>
    <tr class="one">
      <th>Название</th>
      <th>Краткое описание</th>
      <th>Цена (₽)</th>
      <th>Подогрев воды</th>
      <th>Клапан на лейке</th>
      <th>Напряжение питания (АС/DC)</th>
      <th>Ток потребления (А)</th>
      <th>Мощность (Вт)</th>
      <th>Защита от включения в сухую</th>
      <th>Производительность при подъеме воды на высоту 2 метра (л/час)</th>
      <th>Максимальная высота подъема воды (м)</th>
      <th>Размеры прибора (см)</th>
      <th>Длина душевого шланга (м)</th>
      <th>Длинна кабеля (м)</th>
      <th>Масса (кг)</th>
    </tr>
  <?if(CModule::IncludeModule("iblock"))
    {
    $arSelect = Array("IBLOCK_ID", "ID", "DETAIL_PICTURE", "DETAIL_PAGE_URL", "NAME", "PROPERTY_SUPPLY_VOLTAGE", "PROPERTY_SIZE", "CATALOG_PRICE_1", "PROPERTY_SHORT_DESCRIPTION",  "PROPERTY_WATER_HEATING", "PROPERTY_FLAP", "PROPERTY_AMPERAGE", "PROPERTY_POWER_CONSUMPTION", "PROPERTY_CURRENT_PROTECTION_DRY", "PROPERTY_PRODUCTIVITY_WATER_METRE_2", "PROPERTY_RISE_WATER_MAX", "PROPERTY_LENGHT_HOSE", "PROPERTY_LENGHT_CORD", "PROPERTY_WEIGHT");
    $arFilter = Array("IBLOCK_ID"=>2, "ACTIVE"=>"Y","PROPERTY_DEVICE_TYPE_VALUE"=>"Переносной душ-насос");
    $res = CIBlockElement::GetList(false, $arFilter, false, false , $arSelect);?>
      <?while($ob = $res->GetNextElement()){?>
      <?$arItem = $ob->GetFields();
      $arItem["DETAIL_PICTURE_URL"] = CFile::GetPath($arItem["DETAIL_PICTURE"]);
      $arResult = $arItem;
      $arProp = array(
      "NAME" => $arResult["NAME"],
      "SHORT_DESCRIPTION" => $arResult["PROPERTY_SHORT_DESCRIPTION_VALUE"],
      "CATALOG_PRICE_1" => $arResult["CATALOG_PRICE_1"],
      "WATER_HEATING" => $arResult["PROPERTY_WATER_HEATING_VALUE"],
      "FLAP" => $arResult["PROPERTY_FLAP_VALUE"],
      "SUPPLY_VOLTAGE" => $arResult["PROPERTY_SUPPLY_VOLTAGE_VALUE"],
      "AMPERAGE" => $arResult["PROPERTY_AMPERAGE_VALUE"],
      "POWER_CONSUMPTION" => $arResult["PROPERTY_POWER_CONSUMPTION_VALUE"],
      "CURRENT_PROTECTION_DRY" => $arResult["PROPERTY_CURRENT_PROTECTION_DRY_VALUE"],
      "PRODUCTIVITY_WATER_METRE_2" => $arResult["PROPERTY_PRODUCTIVITY_WATER_METRE_2_VALUE"],
      "RISE_WATER_MAX" => $arResult["PROPERTY_RISE_WATER_MAX_VALUE"],
      "SIZE" => $arResult["PROPERTY_SIZE_VALUE"],
      "LENGHT_HOSE" => $arResult["PROPERTY_LENGHT_HOSE_VALUE"],
      "LENGHT_CORD" => $arResult["PROPERTY_LENGHT_CORD_VALUE"],
      "WEIGHT" => $arResult["PROPERTY_WEIGHT_VALUE"]
      );
      ?>
      <tr class="one">
        <?php for ($i=0; $i < 1 ; $i++) {?>
          <?foreach ($arProp as $key => $value) {?> 
            <td><?= $value ?></td>
          <?}?>
        <?}?>
        </tr>
      <?}?>
    <?}?>
  </tbody>
  </table>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question