<div id="a_struct__root" class="a_overflow_hidden">
    <div id="a_struct__root__ct">
        <div class="a_struct__block" data-parent_id="<?php echo $sf_request->getParameter('parentId');?>">
            <div class="a_struct__block__add" onclick="$(this).toggleClass('a_struct__block__add__open');">
                <span></span>
                <div class="a_struct__block__add__menu">
                    <?php
                    if(isset($results['cat'])){
                        echo (isset($results['product']) && count($results['product']) > 0 ? '' : '<div class="a_struct__block__add__menu__item" data-module="Struct" onclick="aStruct.events.blank(0, 0, \'' . $sf_request->getParameter('parentId') . '\', $(this))">Категория</div>');
                    }
                    if(isset($results['product'])){
                        echo (isset($results['cat']) && count($results['cat']) > 0 ? '' : '<div class="a_struct__block__add__menu__item" data-module="Struct" onclick="aStruct.events.blank(1, 0, \'' . $sf_request->getParameter('parentId') . '\', $(this))">Товар</div>');
                    }
                    if(isset($results['offer']) && (count($results['offer']) == 0 || $is_detail)){
                        echo '<div class="a_struct__block__add__menu__item" data-module="Struct" onclick="aStruct.events.blank(3, 0, \'' . $sf_request->getParameter('parentId') . '\', $(this))">Товарное предложение</div>';
                    }
                    ?>
                </div>
            </div>
            <div class="a_struct__block__scroll">
                <?php
                if(count($results) > 0){
                    foreach ($results as $key => $result){
                        if(count($result) > 0){
                            foreach ($result as $r){
                                echo '<div data-id="' . $key . '_' . $r['id'] . '" data-module="Struct" class="a_struct__block__item a_struct__block__item__type_' . ($key == 'cat' ? '0' : ($key == 'product' ? '1' : '3')) . '" style="" onclick="aStruct.events.' . ($key != 'offer' ? 'open($(this), \'\')' : 'blank(false, 0, \'' . $sf_request->getParameter('parentId') . '\', $(this))') . ';">';
                                echo $r['Translation']['ru']['title'];
                                if($key != 'offer'){
                                    echo '<span class="a_struct__block__item__props" onclick="aStruct.events.blank(false, 0, \'' . $sf_request->getParameter('parentId') . '\', $(this))"></span>';
                                }
                                echo '</div>';
                            }
                        }
                    }
                }
                ?>
            </div>
        </div><?php
        if(isset($props)){
            echo '<div class="a_struct__props"></div>';
        }
        ?>
    </div>
</div>