N
N
Nikolai2018-12-26 19:17:00
1C-Bitrix
Nikolai, 2018-12-26 19:17:00

Buy button 1c bitrix not working?

Customized the complex component template. When I try to add an item to the cart, it says the item can't be found. Although if you put it in the basket from the detailed card, then everything works correctly.

<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>

<div class="col-9">
  <div class="row">
    <?foreach($arResult["ITEMS"] as $cell=>$arElement):?>
      <?
      $this->AddEditAction($arElement['ID'], $arElement['EDIT_LINK'], CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_EDIT"));
      $this->AddDeleteAction($arElement['ID'], $arElement['DELETE_LINK'], CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BCS_ELEMENT_DELETE_CONFIRM')));
      ?>
      <div class="col-4">
        <div class="product-item" id="<?=$this->GetEditAreaId($arElement['ID']);?>">
          <div class="product-item__wrap-elements">
            <a href="<?=$arElement["DETAIL_PAGE_URL"]?>" class="product-item__wrap-img">
              <img class="product-item__img" src="<?=$arElement["DETAIL_PICTURE"]["SRC"]?>" alt="<?=$arElement["NAME"]?>" role="presentation"/>
            </a>
            <div class="product-item__wrap-caption">
              <div class="product-item__price-wrap">
                <span class="product-item__price">
                  <?=$arElement["OFFERS"][0]["PRICES"]["Для покупателей из интернет-магазина"]["PRINT_VALUE"];?> 
                </span>
              </div>
              <a class="comparison comparison--product" href="<?echo $arElement["COMPARE_URL"]?>" rel="nofollow"><i class="comparison__icon"> </i></a>
              <a class="like like--product" href="#"><i class="like__icon"></i></a>
              <b><a class="cart cart--product" href="<?echo $arElement["ADD_URL"]?>" rel="nofollow"><i class="cart__icon"></i></a></b>
            </div>
          </div>
        </div>
      </div>
    <?endforeach; // foreach($arResult["ITEMS"] as $arElement):?>

<?if($arParams["DISPLAY_BOTTOM_PAGER"]):?>
  <br /><?=$arResult["NAV_STRING"]?>
<?endif;?>
  </div>
</div>

5c23a97aa039b083953866.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2018-12-26
@jasper-blondin

Apparently, you are using trade offers. When buying, you need to pass the ID of the trade offer, and not the product, which includes the trade offer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question