specialsSuccess.php 10.1 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<div class="er_rows" style="padding-bottom: 0;">
    <div class="breadcrumbs">
        <div class="breadcrumbs">
            <span><a href="/" title="Главная">Главная</a>&nbsp;/&nbsp;</span><!--
         --><span><?php echo $breadcrumbs ?></span><!--
         -->
        <h1 style="margin-bottom: 10px"><?php echo $breadcrumbs ?></h1>
        </div>
    </div>
</div>



<table style="padding: 20px" class="std_table js_cat_view" width="100%" cellspacing="0" cellpadding="0">
    <thead>
    <tr valign="bottom" align="left">
        <th colspan="2" style="text-align: left !important;">Название</th>
        <th style="text-align: left !important;">Артикул</th>
        <th>Мин.&nbsp;партия</th>
        <th>В&nbsp;наличии</th>
        <th style="text-align: right !important;">Цена</th>
        <th>&nbsp;</th>
        <th>&nbsp;</th>
    </tr>
    </thead>

    <tbody>
    <?php

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

    foreach ($products as $product)
    {
        echo "<tr class='js_cat_view__ct__tr'>";
        echo "<td align='center' class='first_td'>";

        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 align='center'>";
            echo "Нет в наличии";
            echo "</td>";
            echo "<td><b>";
            if ($product['price'])
            {
                echo number_format($product['price'],2,',',' ') . '<span class="rub" style="position:relative;top:0px;">a</span>';
            }
            echo "</b></td>";
            echo "<td colspan='2'></td>";
        }
        else
        {

            echo "<td>";
            echo $stockCount;
            echo "</td>";
            echo "<td><b>";
            if ($product['price'])
            {
                echo number_format($product['price'],2,',',' ') . '<span class="rub" style="position:relative;top:0px;">a</span>';
            }
            echo "</b></td>";
            ?>

            <td colspan="2" class="last_td">
                <ul class="counter" data-product-id="<?php echo $product['id'] ?>">
                    <li onclick="basket.remove($(this))"  class="btn_all counter__button counter_button_minus red_button2"></li>
                    <li class="counter__num">
                        <?php

                        $value = 0;
                        if (key_exists($product['id'], $productsIdsInBasket))
                        {
                            $value = $productsIdsInBasket[$product['id']];
                        }

                        ?>
                        <input data-price="<?php echo $product['price']; ?>" data-min-p="<?php echo $product['min_order'] ?>" data-stock="<?php echo round($product['stockCount']); ?>" onchange="basket.handWrite($(this));basket.check($(this))" name="" value="<?php echo $value ?>" autocomplete="off" type="text">
                    </li>
                    <li onclick="basket.add($(this))" class="btn_all counter__button counter_button_plus green_button2"></li>
                </ul>
            </td>

            <?php

        }

        echo "</tr>";
    }

    ?>
    </tbody>


</table>

<i class="br20"></i>
<div class="borderForPostNavigation" style="margin: 0px 20px">
    <div class="postNavigation">


        <?php

        $in = ($page * $inPage) - $inPage + 1;
        $to = $inPage + $in - 1 > $productCount ? $productCount : $inPage + $in - 1;

        if ($productCount == 0) {
            $in = 0;
        }

        echo $in . " — " . $to . " из " . $productCount;

        ?>


        <div class="postInPage">
            <b>Показать:</b>

            <?php

            $countInPage = array(30, 50, 100, 250);

            ?>

            <?php
            //            echo '<a href="javascript:void(0);" class="slct">' . $inPage . '</a>';
            //            echo '<ul class="drop">';
            //
            //                foreach ($countInPage as $count)
            //                {
            //                    if ($count != $inPage)
            //                    {
            //                        $url = url_for('@catalog_show_cat?alias=' . $alias) . '?inPage=' . $count . '&sort=' . $sort . '&order=' . $order ;
            //                        echo '<li><a href="' . $url . '">' . $count . '</a></li>';
            //                    }
            //                }
            //
            //            echo '</ul>';

            echo "<select autocomplete='off'>";

            foreach ($countInPage as $count)
            {
                if ($count == $inPage)
                {
                    echo "<option selected='selected'>" . $count . "</option>";
                }
                else
                {
                    $url = url_for('@catalog_special?type=' . $type) . '?inPage=' . $count . '&sort=' . $sort; // . '&order=' . $order ;
                    ?>
                    <option onclick='window.location.href = "<?php echo $url ?>";'><?php echo $count ?></option>
                    <?php
                }
            }

            echo "</select>";



            ?>

        </div>

        <script>
            // Select
            $('.slct').click(function(){
                /* Заносим выпадающий список в переменную */
                var dropBlock = $(this).parent().find('.drop');

                /* Делаем проверку: Если выпадающий блок скрыт то делаем его видимым*/
                if( dropBlock.is(':hidden') ) {
                    dropBlock.css('display', 'inline-block');

                    /* Выделяем ссылку открывающую select */
                    $(this).addClass('active');

                    /* Работаем с событием клика по элементам выпадающего списка */
                    $('.drop').find('li').click(function(){

                        dropBlock.css('display', 'none');
                    });

                    /* Продолжаем проверку: Если выпадающий блок не скрыт то скрываем его */
                } else {
                    $(this).removeClass('active');
                    dropBlock.css('display', 'none');
                }

                /* Предотвращаем обычное поведение ссылки при клике */
                return false;
            });
        </script>

        <div class="postNavigation_changePage">

            <?php
            $class = "";
            $tag = "a";
            $href_previous = 'href="' . url_for('@catalog_special?type=' . $type) . '?page=' . ($page - 1) . '&inPage=' . $inPage . '&sort=' . $sort . '&order=' . $order .'"';
            $href_first = 'href="' . url_for('@catalog_special?type=' . $type) . '?page=1&inPage=' . $inPage . '&sort=' . $sort . '&order=' . $order .'"';
            if ($page == 1)
            {
                $class = "un_active";
                $tag = "b";
                $href_previous = "";
                $href_first = "";
            }
            ?>

            <?php

            if ($class != "un_active")
            {
            ?>
            <<?php echo $tag ?> class="page_link page_prev page_button <?php echo $class ?>" <?php echo $href_first ?>></<?php echo $tag ?>>
    <?php
    }

    ?>

        <?php
        if ($page - 2 >= 0)
        {
            for ($i = $page - 2; $i < $page; $i++)
            {
                if ($i == 0)
                {
                    continue;
                }

                ?>

                <a class="page_link" href="<?php echo url_for('@catalog_special?type=' . $type) ?>?page=<?php echo $i ?>&inPage=<?php echo $inPage ?>&sort=<?php echo $sort ?>&order=<?php echo $order ?>"><?php echo $i ?></a>

                <?php
            }
        }
        ?>

        <b class="page_active"><?php echo $page ?></b>

        <?php
        if ($page + 2 <= $countPage)
        {
            $maxPage = $page + 2;
        }
        else
        {
            $maxPage = $countPage;
        }
        for ($i = $page + 1; $i <= $maxPage; $i++)
        {
            ?>

            <a class="page_link" href="<?php echo url_for('@catalog_special?type=' . $type) ?>?page=<?php echo $i ?>&inPage=<?php echo $inPage ?>&sort=<?php echo $sort ?>&order=<?php echo $order ?>"><?php echo $i ?></a>

            <?php
        }
        ?>


        <?php
        $class = "";
        $tag = "a";
        $href_next = 'href="' . url_for('@catalog_special?type=' . $type) . '?page=' . ($page + 1) . '&inPage=' . $inPage . '&sort=' . $sort . '&order=' . $order .'"';
        $href_last = 'href="' . url_for('@catalog_special?type=' . $type) . '?page=' . $countPage . '&inPage=' . $inPage . '&sort=' . $sort . '&order=' . $order .'"';
        if ($page == $countPage)
        {
            $class = "un_active";
            $tag = "b";
            $href_next = "";
            $href_last = "";
        }
        ?>

        <?php

        if ($class != "un_active")
        {
        ?>

        <<?php echo $tag ?> class="page_link page_next page_button <?php  echo $class ?>" <?php echo $href_last ?>></<?php echo $tag ?>>

    <?php
    }

    ?>


</div>


</div>
</div>

<i class="br20"></i>
<div class="bottomText">
    <?php

    include_component('seo', 'seoBottom');

    ?>
</div>