<div id="search_div" class="title-search-result sq_ct" style="display: block;">

    <?php

        if (count($searchResult) > 0)
        {


            ?>

            <table class="std_table js_cat_view qs_table" width="100%" cellspacing="0" cellpadding="0">
                <thead>
                <tr valign="bottom" align="left">
                    <th colspan="2"
                        data-sort="title" style="text-align: left">Название
                    </th>
                    <th data-sort="article" style="text-align: left">Артикул</th>
                    <th data-sort="min">Мин.&nbsp;партия</th>
                    <th data-sort="quantity">В&nbsp;наличии</th>
                    <th data-sort="price" style="text-align: right">Цена</th>
                    <th>
                        <div class="er_content__main__search__clear" onclick="search.quickSearch('');$('#title-search-input').val('')"></div>
                    </th>
                </tr>
                </thead>
                <tbody>


                <?php

                $productsIdsInBasket = $this->context->getUser()->getProductsIdsInBasket();

                foreach ($searchResult as $product)
                {
                    echo "<tr class='js_cat_view__ct__tr'>";
                    echo "<td style='position: relative; text-align: center'>";
                    if ($product['sell_out'])
                    {
                        echo '<div class="sale_out">Распродажа</div>';
                    }


                    echo "<a href='" . url_for('@catalog_show_prod?alias=' . $product['alias']) . "' style='border-bottom:none;'>";
                    echo '<img class="js_cat_view__img image_view" src="' . url_for('@get_image?id=' . $product['id']) . '?small">';
                    echo "</a>";
                    echo "</td>";
                    echo "<td class='js_cat_view_product_name__td'>";
                    echo "<a href='" . url_for('@catalog_show_prod?alias=' . $product['alias']) . "'>" . $product['title'] . "</a>";
                    echo "</td>";
                    echo "<td>";
                    echo $product['product_code'];
                    echo "</td>";
                    echo "<td>";
                    echo $product['min_order'];
                    echo "</td>";


                    $stockCount = round($product['stockCount']);

                    if($stockCount == 0)
                    {

                        echo "<td colspan='2' align='center'>";
                        echo "Нет в наличии";
                        echo "</td><td></td>";

                        echo "<td><b>";
                        if ($product['price'])
                        {
                            echo number_format($product['price'],2,',',' ') . '<span class="rub">a</span>';
                        }
                        echo "</b></td>";
                    }
                    else
                    {
                        echo "<td>";
                        echo round($product['stockCount']);
                        echo "</td>";

                        echo "<td><b>";
                        if ($product['price'])
                        {
                            echo number_format($product['price'],2,',',' ') . '<span class="rub">a</span>';
                        }
                        echo "</b></td>";

                        $value = 0;
                        $dopBtnClass = '';
                        $canAction = 'false';
                        if (key_exists($product['id'], $productsIdsInBasket))
                        {
                            $value = $productsIdsInBasket[$product['id']];
                            $dopBtnClass = 'disabledBtn';
                            $canAction = 'true';
                        }

                        ?>
                        <td>
                            <ul class="counter"
                                data-product-count="<?php echo $stockCount ?>"
                                data-product-min="<?php echo $product['min_order'] ?>"
                                data-product-id="<?php echo $product['id'] ?>"
                                data-product-price="<?php echo $product['price'] ?>" style="height: 36px; padding-top: 2px; border: 1px solid #d8d8d8;">

                                <li onclick="basketSender.singleDownCount($(this))" action="true" class="btn_all counter__button counter_button_minus red_button2" ></li>
                                <li class="counter__num">
                                    <input onfocus="basketSender.onfocusCheck($(this))"
                                           onkeyup="basketSender.keyUpCheck($(this))"
                                           onchange="basketSender.singleByInput($(this))"
                                           name=""
                                           value="<?php echo $value ?>"
                                           autocomplete="off"
                                           type="text"
                                           style="font-size: 15px"
                                    >
                                </li>
                                <li onclick="basketSender.singleUpCount($(this))" class="btn_all counter__button counter_button_plus green_button2"></li>
                            </ul>
                        </td>
                        <td></td>

                        <?php
                    }


                    echo "</tr>";
                }

                ?>

                </tbody>
            </table>
            <a href="<?php echo url_for('@search') . "?query=" . $searchString ?>" class="qs_all_link">Показать все <?php echo $searchCount ?></a>
            <?php
        }
        else
        {
            ?>
            <div style="padding:6px 20px;color:#969696;">Ничего не найдено</div>
            <?php
        }
    ?>
</div>