I
I
IgorRastarov2017-09-18 12:48:17
1C-Bitrix
IgorRastarov, 2017-09-18 12:48:17

How to pass values ​​from component to modal window?

Hello. Help me please. Completely confused.
I have a catalog.section component.
There is a product with a Buy button. When I click on this button, I need a modal window to open with the name and price of the product. Now I have this:

//Код вывода товара на страницу
foreach($arResult['ITEMS'] as $key => $arItem){
<?=$arItem['NAME']?>
<?=$arItemIDs['PRICE']?>
<button class="to-basket">Купить</button>

//код модального окна
<div id="ModalBasket">
  <div id="wellknow"><?=$arItem["NAME"]?></div>
  <div class="info">
      <div class="add-basket-block-elem "><?=$arItemIDs['PRICE']?></div>
  </div>   
  <button id="<?=$arItemIDs['BUY_LINK']?>" class="btn-big btn-red">Положить в корзину</button>
   <a href="" class="btn-big btn-white" id="trigger">Отмена</a>
</div>	
}

And this code works, but it's crooked. So in the modal window, only ONE product is displayed - no matter what I clicked on, the same product all the time. Means it is necessary to transfer somehow values ​​in a modal window from outside. Do not know how

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IJIL, 2017-09-22
@IJIL

You need to load the goods into this modal window with Ajax, create a php file and do the layout there. You pass the product ID to this file and you get the product. Everything is very simple.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question