_basket.php 5.26 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
<div class="max_width">
    <div class="truecount" <?php echo (count($offers) > 0  ? '' : 'style="display: none"') ?> >
        <table class="basket_offers_table to_div" width="100%" cellpadding="0" cellspacing="0">
            <thead>
            <tr>
                <th><?php echo __('Наименование');?></th>
                <th></th>
                <th><?php echo __('Количество');?></th>
                <th><?php echo __('Цена');?></th>
                <th><?php echo __('Сумма');?></th>
                <th><a onclick="basket.clean();event.stopPropagation();return false;" class="red_link bbs_d"><?php echo __('Очистить');?></a></th>
            </tr>
            </thead>
            <tbody valign="middle">
            <?php
            if (!isset($percent)) {
                $percent = false;
            }
            $summ = 0;
            $productFreeShipping = 1;
            foreach ($offers as $offer){
                if ($offer['Product']['free_shipping'] == 0) {
                    $productFreeShipping = 0;
                }
                $quantity_type = $offer['Translation'][$culture]['quantity_type'];
                if ($offer['quantity_type_select']) {
                    $quantity_type = (isset(Offer::$quantity_type_select_values[$offer['quantity_type_select']]) ? Offer::$quantity_type_select_values[$offer['quantity_type_select']] : '');
                }
                echo '<tr>';
                $offer_img = $offer['img'];
                if(!$offer_img && $offer['Product']['product_img']){
                    $offer_imgs = explode(';', $offer['Product']['product_img']);
                    $offer_img = $offer_imgs[0];
                }
                //print_r($offer['Product']);
                echo '<td valign="top"><a style="border: none" href="/' . $offer['Translation'][$culture]['lang'] . '/product/' . $offer['Product']['alias'] . '/"><div class="basket_img ' . ($offer['discount_available'] == 1 ? 'discount' : '') . '" ' . ($offer_img ? 'style="background-image: url(/u/i/' . Page::replaceImageSize($offer_img, 'S') . ');"' : '') . '></div></a>';
                echo '<td><div class="basket_offer_title"><a href="/' . $offer['Translation'][$culture]['lang'] . '/product/' . $offer['Product']['alias'] . '/">' . $offer['Translation'][$culture]['title'] . '</a></div></td>';
                echo '</td>';
                echo '<td class="align_center"><div class="product_counter" data-id="' . $offer['id'] . '">';
                echo '<input type="button" class="product_counter_minus" data-symbol="-" onclick="counterLite.update($(this))">';
                echo '<input autocomplete="off" type="text" class="product_counter_val" value="' . $offer['BasketOffer'][0]['amount'] . '" data-symbol="false" onkeyup="counterLite.update($(this))">';
                echo '<input type="button" class="product_counter_plus" data-symbol="+" onclick="counterLite.update($(this))">';
                echo '</div><span class="name_unit">' . ($quantity_type != '' ? $quantity_type : '') . '</span></td>';
                if ($percent && $offer['discount_available'] == 1) {
                    echo '<td valign="middle" class="basket_offers_table__price align_center"><div style="position: relative"><div class="basket_discount"><span style="text-decoration: line-through">' . number_format($offer['price'], 0, ',', ' ') . '&nbsp;</span><span style="font-size: 15px" class="rub">i</span></div><div class="basket_item">' . number_format($offer['price']/100*(100-$percent), 0, ',', ' ') . '&nbsp;<span class="rub">i</span></div></div></td>';
                    echo '<td valign="middle" class="basket_offers_table__price align_center"><div class="basket_item"> ' . number_format($offer['BasketOffer'][0]['price']/100*(100-$percent), 0, ',', ' ') . '&nbsp;<span class="rub">i</span></div></td>';
                    $summ = $summ + $offer['BasketOffer'][0]['price']/100*(100-$percent);
                }else {
                    echo '<td valign="middle" class="basket_offers_table__price align_center"><div class="basket_item">' . number_format($offer['price'], 0, ',', ' ') . '&nbsp;<span class="rub">i</span></div></td>';
                    echo '<td valign="middle" class="basket_offers_table__price align_center"><div class="basket_item">' . number_format($offer['BasketOffer'][0]['price'], 0, ',', ' ') . '&nbsp;<span class="rub">i</span></div></td>';
                    $summ = $summ + $offer['BasketOffer'][0]['price'];
                }
                echo '<td width="1" align="center"><div class="basket_clean" onclick="basket.delete(this);"></div></td>';
                echo '</tr>';
            }
            ?>
            </tbody>
        </table>
        <div class="basket_total" data-delivery-info="<?php echo $productFreeShipping ?>"><?php echo __('Итого');?>:<div class="basket_total__price"><?php echo number_format($summ, 0, ',', ' ');?></div>&nbsp;<span class="rub">i</span></div>
    </div>
</div>

<div class="cart_empty"  <?php echo (count($offers) > 0 ? 'style="display: none"' : '' )?> >
    <p>Тут пока ничего нет. Посмотри в <a href="<?php echo url_for("@catalog"); ?>">каталоге</a>, там много интересного</p>
    <i class="br10"></i>
    <div class="cart_empty__img"></div>
    <i class="br40"></i>
</div>