get_results($sql, ARRAY_A); $goods = new nc_netshop_item_collection(); $goods->set_index_property('_ItemKey'); // обеспечит уникальность товаров в коллекции foreach ($rows as $row) { try { $item = nc_netshop_item::by_id($row['Item_Type'], $row['Item_ID']); if (!$item['Sub_Class_ID']) { throw new Exception(''); } // seems that the item data is missing if ($item->has_parent()) { $item = $item['_Parent']; } $goods->add($item); } catch (Exception $e) {} } if (count($goods)) { echo '
'; }