X
X
xFreake2017-01-25 12:56:45
1C-Bitrix
xFreake, 2017-01-25 12:56:45

How to display Bitrix Product ID?

foreach($ID2 as $_id2) {

                            $rs = CIBlockSection::GetList(Array("SORT"=>"ASC", "NAME"=>"ASC"), Array("IBLOCK_ID"=>17, "ACTIVE"=>"Y", "SECTION_ID"=>$_id2));
                            echo '<select class="cartridge-name1"  id="prodid'.$_id2.'" style="border: #d2d2d2 2px solid; margin: 0px 0px 10px; padding: 5px; width: 150px;display:none"><option value="">Картридж</option>';
                            while($ar = $rs->GetNext())  echo '<option value="'.$ar["ID"].'">'.$ar["NAME"].'</option>';
                            echo '</select><input type="number" class="prodid2'.$_id2.'" style="width: 35px;display: none;">';
                        }?>

There is a code that displays the name of the product and, in theory, should display the ID, the point is, there is a button that adds the product to the cart with ajax, but the ID is not correct, i.e. does not match the product

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2017-01-25
@gangstarcj

Can't you see yourself? CIBlockSection::GetList - selects sections of the same, not elements.
Use CIBlockElement::GetList

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question