I
I
I'm Yoda2018-03-07 11:00:17
1C-Bitrix
I'm Yoda, 2018-03-07 11:00:17

How to divide goods into groups?

Hello! What is the best way to divide products into groups? There is a property "Printed Circuit Boards" and its values ​​"Large Boards", "Medium Boards", "Small Boards". By this property it is necessary to divide the list of goods into groups. Now I do this:

foreach ($arResult["ITEMS"] as $cell => $arElement) {
     if ($arElement["PROPERTIES"]["BOARDS"]["VALUE_XML_ID"] == "big_boards")
          continue;
}

In fact, it turns out 3 foreach loops. Is it correct to do the breakdown like this or can it be done differently?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-03-07
@demon416nds

one loop with three ifs is enough

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question