quick_searchSuccess.php 5.91 KB
Newer Older
Яков's avatar
first  
Яков committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<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>