A
A
Alexander2021-05-10 18:42:38
1C-Bitrix
Alexander, 2021-05-10 18:42:38

Why can't the block with pictures be deleted in card catalog.item so that adding to cart would still work?

I made my layout, added a title, a preview image, a price.

When you try to delete the old code, adding to cart stops working.

<div class="product-item">
    <span class="product-item-image-slider-slide-container slide" id="<?= $itemIds['PICT_SLIDER'] ?>"
      <?= ($showSlider ? '' : 'style="display: none;"') ?>
      data-slider-interval="<?= $arParams['SLIDER_INTERVAL'] ?>" data-slider-wrap="true">
      <?
            if ($showSlider) {
                foreach ($morePhoto as $key => $photo) {
                    ?>
                    <span class="product-item-image-slide item <?= ($key == 0 ? 'active' : '') ?>"
                          style="background-image: display: none"></span>
                    <?
                }
            }
            ?>
    </span>

    <?
        if ($item['SECOND_PICT']) {
            $bgImage = !empty($item['PREVIEW_PICTURE_SECOND']) ? $item['PREVIEW_PICTURE_SECOND']['SRC'] : $item['PREVIEW_PICTURE']['SRC'];
            ?>
            <span class="" id="<?= $itemIds['SECOND_PICT'] ?>"
                  style="background-image: display: none"></span>
            <?
        }
        ?>
</div>

Why doesn't add to cart work without this code?
The product is not added, the window does not pop up.
I cut what I could

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PetrPo, 2021-05-11
@kikher

Because js says

init: function()
{
  // ................
  if (!this.obPict)
  {
    this.errorCode = -2;
  }
  // ................
  
  if (!this.obPictSlider)
  {
    this.errorCode = -4;
  }
  // ................
  
  if (this.errorCode === 0)
  {
  // здесь все инициализируется, добавление в корзину в том числе

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question