@@ -718,17 +718,21 @@ discard block |
||
| 718 | 718 | if (!$query) { |
| 719 | 719 | return []; |
| 720 | 720 | } |
| 721 | - if (!empty($options['where'])) |
|
| 722 | - $query->where($options['where']); |
|
| 721 | + if (!empty($options['where'])) { |
|
| 722 | + $query->where($options['where']); |
|
| 723 | + } |
|
| 723 | 724 | if (!empty($options['group'])) { |
| 724 | 725 | $query->group($options['group']); |
| 725 | 726 | } |
| 726 | - if (!empty($options['order'])) |
|
| 727 | - $query->order($options['order']); |
|
| 728 | - if (!empty($options['join'])) |
|
| 729 | - $query->join($options['join']); |
|
| 730 | - if (!empty($options['distinct'])) |
|
| 731 | - $query->distinct = $options['distinct']; |
|
| 727 | + if (!empty($options['order'])) { |
|
| 728 | + $query->order($options['order']); |
|
| 729 | + } |
|
| 730 | + if (!empty($options['join'])) { |
|
| 731 | + $query->join($options['join']); |
|
| 732 | + } |
|
| 733 | + if (!empty($options['distinct'])) { |
|
| 734 | + $query->distinct = $options['distinct']; |
|
| 735 | + } |
|
| 732 | 736 | |
| 733 | 737 | foreach (static::$relJoins as $join) { |
| 734 | 738 | $query->join($join[0], $join[1]); |
@@ -754,14 +758,14 @@ discard block |
||
| 754 | 758 | } |
| 755 | 759 | static::$needJoin = []; |
| 756 | 760 | |
| 757 | - if (!empty($options['limit'])) |
|
| 758 | - $limit = (int) $options['limit']; |
|
| 759 | - else { |
|
| 761 | + if (!empty($options['limit'])) { |
|
| 762 | + $limit = (int) $options['limit']; |
|
| 763 | + } else { |
|
| 760 | 764 | $limit = 0; |
| 761 | 765 | } |
| 762 | - if (!empty($options['start'])) |
|
| 763 | - $start = (int) $options['start']; |
|
| 764 | - else { |
|
| 766 | + if (!empty($options['start'])) { |
|
| 767 | + $start = (int) $options['start']; |
|
| 768 | + } else { |
|
| 765 | 769 | $start = 0; |
| 766 | 770 | } |
| 767 | 771 | if ($limit || $start) { |
@@ -1020,21 +1024,23 @@ discard block |
||
| 1020 | 1024 | if (!empty($options['where'])) { |
| 1021 | 1025 | static::fixPrefix($options['where'], 'first'); |
| 1022 | 1026 | } |
| 1023 | - if (!empty($options['where'])) |
|
| 1024 | - $query->where($options['where']); |
|
| 1025 | - if (!empty($options['join'])) |
|
| 1026 | - $query->join($options['join']); |
|
| 1027 | + if (!empty($options['where'])) { |
|
| 1028 | + $query->where($options['where']); |
|
| 1029 | + } |
|
| 1030 | + if (!empty($options['join'])) { |
|
| 1031 | + $query->join($options['join']); |
|
| 1032 | + } |
|
| 1027 | 1033 | if (!empty($options['order'])) { |
| 1028 | 1034 | $query->order($options['order']); |
| 1029 | 1035 | } |
| 1030 | - if (!empty($options['limit'])) |
|
| 1031 | - $limit = (int) $options['limit']; |
|
| 1032 | - else { |
|
| 1036 | + if (!empty($options['limit'])) { |
|
| 1037 | + $limit = (int) $options['limit']; |
|
| 1038 | + } else { |
|
| 1033 | 1039 | $limit = 0; |
| 1034 | 1040 | } |
| 1035 | - if (!empty($options['start'])) |
|
| 1036 | - $start = (int) $options['start']; |
|
| 1037 | - else { |
|
| 1041 | + if (!empty($options['start'])) { |
|
| 1042 | + $start = (int) $options['start']; |
|
| 1043 | + } else { |
|
| 1038 | 1044 | $start = 0; |
| 1039 | 1045 | } |
| 1040 | 1046 | if ($limit || $start) { |
@@ -1112,8 +1118,9 @@ discard block |
||
| 1112 | 1118 | |
| 1113 | 1119 | $values = []; |
| 1114 | 1120 | foreach ($cols as $col => $param) { |
| 1115 | - if (isset($params[$col])) |
|
| 1116 | - $values[$col] = $params[$col]; |
|
| 1121 | + if (isset($params[$col])) { |
|
| 1122 | + $values[$col] = $params[$col]; |
|
| 1123 | + } |
|
| 1117 | 1124 | } |
| 1118 | 1125 | if (empty($values)) { |
| 1119 | 1126 | return false; |
@@ -1296,8 +1303,9 @@ discard block |
||
| 1296 | 1303 | $values = []; |
| 1297 | 1304 | |
| 1298 | 1305 | foreach ($this->cols() as $col => $param) { |
| 1299 | - if (isset($this->_params[$col])) |
|
| 1300 | - $values[$col] = $this->_params[$col]; |
|
| 1306 | + if (isset($this->_params[$col])) { |
|
| 1307 | + $values[$col] = $this->_params[$col]; |
|
| 1308 | + } |
|
| 1301 | 1309 | } |
| 1302 | 1310 | if (empty($values) && empty($options['empty'])) { |
| 1303 | 1311 | return false; |
@@ -1457,8 +1465,9 @@ discard block |
||
| 1457 | 1465 | { |
| 1458 | 1466 | |
| 1459 | 1467 | foreach (static::relations() as $relName => $rel) { |
| 1460 | - if ($rel['col'] == $col) |
|
| 1461 | - return $relName; |
|
| 1468 | + if ($rel['col'] == $col) { |
|
| 1469 | + return $relName; |
|
| 1470 | + } |
|
| 1462 | 1471 | } |
| 1463 | 1472 | return NULL; |
| 1464 | 1473 | } |
@@ -61,21 +61,21 @@ |
||
| 61 | 61 | if ($first) { |
| 62 | 62 | $first = false; |
| 63 | 63 | } else { |
| 64 | - $string.= '<br />'; |
|
| 64 | + $string .= '<br />'; |
|
| 65 | 65 | } |
| 66 | - $string.= '<span style="white-space:nowrap;">'; |
|
| 67 | - $string.= number_format($sum, 2, '.', ' '); |
|
| 66 | + $string .= '<span style="white-space:nowrap;">'; |
|
| 67 | + $string .= number_format($sum, 2, '.', ' '); |
|
| 68 | 68 | if (\App::$cur->money) { |
| 69 | 69 | $currency = \Money\Currency::get($currency_id); |
| 70 | 70 | if ($currency) { |
| 71 | - $string.= ' ' . $currency->acronym(); |
|
| 71 | + $string .= ' ' . $currency->acronym(); |
|
| 72 | 72 | } else { |
| 73 | - $string.= ' руб.'; |
|
| 73 | + $string .= ' руб.'; |
|
| 74 | 74 | } |
| 75 | 75 | } else { |
| 76 | - $string.= ' руб.'; |
|
| 76 | + $string .= ' руб.'; |
|
| 77 | 77 | } |
| 78 | - $string.= '</span>'; |
|
| 78 | + $string .= '</span>'; |
|
| 79 | 79 | } |
| 80 | 80 | return $string; |
| 81 | 81 | } |
@@ -3,13 +3,13 @@ discard block |
||
| 3 | 3 | <div class="cart-order_page"> |
| 4 | 4 | <h2>Быстрое оформление заказа</h2> |
| 5 | 5 | <?php |
| 6 | - if (!$cart || !$cart->cartItems) |
|
| 7 | - echo "<h1>Ваша корзина пуста</h1>"; |
|
| 8 | - else { |
|
| 9 | - $form = new Ui\Form; |
|
| 10 | - $form->action = "/ecommerce/cart"; |
|
| 11 | - $form->begin(); |
|
| 12 | - ?> |
|
| 6 | + if (!$cart || !$cart->cartItems) |
|
| 7 | + echo "<h1>Ваша корзина пуста</h1>"; |
|
| 8 | + else { |
|
| 9 | + $form = new Ui\Form; |
|
| 10 | + $form->action = "/ecommerce/cart"; |
|
| 11 | + $form->begin(); |
|
| 12 | + ?> |
|
| 13 | 13 | <div class="row"> |
| 14 | 14 | <div class="col-sm-4"> |
| 15 | 15 | <div class="order_page-info"> |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | </thead> |
| 87 | 87 | <tbody> |
| 88 | 88 | <?php |
| 89 | - if (class_exists('Money\Currency')) { |
|
| 90 | - $defaultCurrency = Money\Currency::get(\App::$cur->ecommerce->config['defaultCurrency']); |
|
| 91 | - } else { |
|
| 92 | - $defaultCurrency = ''; |
|
| 93 | - } |
|
| 94 | - foreach ($cart->cartItems as $cartItem) { |
|
| 95 | - $path = $cartItem->item->image ? $cartItem->item->image->path : '/static/system/images/no-image.png'; |
|
| 96 | - ?> |
|
| 89 | + if (class_exists('Money\Currency')) { |
|
| 90 | + $defaultCurrency = Money\Currency::get(\App::$cur->ecommerce->config['defaultCurrency']); |
|
| 91 | + } else { |
|
| 92 | + $defaultCurrency = ''; |
|
| 93 | + } |
|
| 94 | + foreach ($cart->cartItems as $cartItem) { |
|
| 95 | + $path = $cartItem->item->image ? $cartItem->item->image->path : '/static/system/images/no-image.png'; |
|
| 96 | + ?> |
|
| 97 | 97 | <tr class="cart_item_id<?= $cartItem->id; ?> item" data-cart_item_id = '<?php echo $cartItem->id; ?>' data-priceam = '<?php echo $cartItem->price->price; ?>' data-item_offer_price_id = '<?php echo $cartItem->price->id; ?>'> |
| 98 | 98 | <td class="text-center image"> |
| 99 | 99 | <a href="/ecommerce/view/<?php echo $cartItem->item->id; ?>"> |
@@ -119,41 +119,41 @@ discard block |
||
| 119 | 119 | </td> |
| 120 | 120 | </tr> |
| 121 | 121 | <?php |
| 122 | - } |
|
| 123 | - ?> |
|
| 122 | + } |
|
| 123 | + ?> |
|
| 124 | 124 | </tbody> |
| 125 | 125 | <tfoot> |
| 126 | 126 | <?php |
| 127 | - $colspan = $cart->hasDiscount() ? 5 : 4; |
|
| 128 | - ?> |
|
| 127 | + $colspan = $cart->hasDiscount() ? 5 : 4; |
|
| 128 | + ?> |
|
| 129 | 129 | <tr class="order_page-sum"> |
| 130 | 130 | <td colspan="<?= $colspan; ?>" class="text-right">Сумма:</td> |
| 131 | 131 | <td colspan="2" class="text-right"><?= $cart->itemsSum(); ?></td> |
| 132 | 132 | </tr> |
| 133 | 133 | <?php |
| 134 | - if ($cart->hasDiscount()) { |
|
| 135 | - ?> |
|
| 134 | + if ($cart->hasDiscount()) { |
|
| 135 | + ?> |
|
| 136 | 136 | <tr class="order_page-discountSum"> |
| 137 | 137 | <td colspan="<?= $colspan; ?>" class="text-right">Скидка:</td> |
| 138 | 138 | <td colspan="2" class="text-right"><?= $cart->discountSum(); ?></td> |
| 139 | 139 | </tr> |
| 140 | 140 | <?php |
| 141 | - } |
|
| 142 | - if ($cart->delivery) { |
|
| 143 | - ?> |
|
| 141 | + } |
|
| 142 | + if ($cart->delivery) { |
|
| 143 | + ?> |
|
| 144 | 144 | <tr class="order_page-deliverySum"> |
| 145 | 145 | <td colspan="<?= $colspan; ?>" class="text-right"><?= $cart->delivery->name; ?>:</td> |
| 146 | 146 | <td colspan="2" class="text-right"><?php |
| 147 | - if ($cart->delivery && $cart->delivery->price_text) { |
|
| 148 | - echo $cart->delivery->price_text; |
|
| 149 | - } else { |
|
| 150 | - echo $cart->deliverySum(); |
|
| 151 | - } |
|
| 152 | - ?></td> |
|
| 147 | + if ($cart->delivery && $cart->delivery->price_text) { |
|
| 148 | + echo $cart->delivery->price_text; |
|
| 149 | + } else { |
|
| 150 | + echo $cart->deliverySum(); |
|
| 151 | + } |
|
| 152 | + ?></td> |
|
| 153 | 153 | </tr> |
| 154 | 154 | <?php |
| 155 | - } |
|
| 156 | - ?> |
|
| 155 | + } |
|
| 156 | + ?> |
|
| 157 | 157 | <tr class="order_page-total"> |
| 158 | 158 | <td colspan="<?= $colspan; ?>" class="text-right">Итого:</td> |
| 159 | 159 | <td colspan="2" class="text-right"><?= $cart->finalSum(); ?></td> |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | <div class="clearfix"></div> |
| 166 | 166 | <div class="order_page-finish"> |
| 167 | 167 | <?php |
| 168 | - $form->input('textarea', 'comment', 'Вы можете добавить комментарий к своему заказу', ['value' => (!empty($_POST['comment'])) ? $_POST['comment'] : '']); |
|
| 169 | - ?> |
|
| 168 | + $form->input('textarea', 'comment', 'Вы можете добавить комментарий к своему заказу', ['value' => (!empty($_POST['comment'])) ? $_POST['comment'] : '']); |
|
| 169 | + ?> |
|
| 170 | 170 | <div class="order_page-orderBtn"> |
| 171 | 171 | <button name ="action" value ="order" data-loading-text="Подождите.." class="btn btn-primary">Подтверждение заказа</button> |
| 172 | 172 | </div> |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | </div> |
| 176 | 176 | </div> |
| 177 | 177 | <?php |
| 178 | - $form->end(false); |
|
| 179 | - } |
|
| 180 | - ?> |
|
| 178 | + $form->end(false); |
|
| 179 | + } |
|
| 180 | + ?> |
|
| 181 | 181 | </div> |
| 182 | 182 | </div> |
| 183 | 183 | </div> |
| 184 | 184 | \ No newline at end of file |
@@ -282,7 +282,7 @@ |
||
| 282 | 282 | $groups[$stage->group] = $stage; |
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | - $discounts = Cart\Discount::getList(['where'=>['cart_id',$this->id]]); |
|
| 285 | + $discounts = Cart\Discount::getList(['where'=>['cart_id', $this->id]]); |
|
| 286 | 286 | foreach ($discounts as $discount) { |
| 287 | 287 | if (!isset($groups[$discount->group]) && $discount->auto) { |
| 288 | 288 | $discount->delete(); |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | 'manager' => [ |
| 44 | 44 | 'map' => [ |
| 45 | 45 | ['name', 'code'], |
| 46 | - ['delivery', 'electronic','discount'] |
|
| 46 | + ['delivery', 'electronic', 'discount'] |
|
| 47 | 47 | ] |
| 48 | 48 | ] |
| 49 | 49 | ]; |
@@ -2,24 +2,24 @@ |
||
| 2 | 2 | <div class="col-md-4"> |
| 3 | 3 | <ul class="nav nav-pills nav-stacked"> |
| 4 | 4 | <?php |
| 5 | - $hiddenId = Tools::randomString(); |
|
| 6 | - foreach ($payTypes as $payType) { |
|
| 7 | - if ((!empty($_POST['payType']) && $_POST['payType'] == $payType->id) || ($cart->payType && $payType->id == $cart->payType->id)) { |
|
| 8 | - $checked = 'checked'; |
|
| 9 | - } else { |
|
| 10 | - $checked = ''; |
|
| 11 | - } |
|
| 12 | - echo '<li' . ($checked ? ' class="active"' : '') . '><a href = "#" onclick = "document.getElementById(\'' . $hiddenId . '\').value=\'' . $payType->id . '\';inji.Ecommerce.Cart.calcSum();return false;">'; |
|
| 13 | - echo $payType->name; |
|
| 14 | - echo '</a></li>'; |
|
| 15 | - } |
|
| 16 | - $form->input('hidden', "payType", '', [ |
|
| 17 | - 'value' => $cart->paytype_id, |
|
| 18 | - 'attributes' => [ |
|
| 19 | - 'id' => $hiddenId |
|
| 20 | - ], |
|
| 21 | - ]); |
|
| 22 | - ?> |
|
| 5 | + $hiddenId = Tools::randomString(); |
|
| 6 | + foreach ($payTypes as $payType) { |
|
| 7 | + if ((!empty($_POST['payType']) && $_POST['payType'] == $payType->id) || ($cart->payType && $payType->id == $cart->payType->id)) { |
|
| 8 | + $checked = 'checked'; |
|
| 9 | + } else { |
|
| 10 | + $checked = ''; |
|
| 11 | + } |
|
| 12 | + echo '<li' . ($checked ? ' class="active"' : '') . '><a href = "#" onclick = "document.getElementById(\'' . $hiddenId . '\').value=\'' . $payType->id . '\';inji.Ecommerce.Cart.calcSum();return false;">'; |
|
| 13 | + echo $payType->name; |
|
| 14 | + echo '</a></li>'; |
|
| 15 | + } |
|
| 16 | + $form->input('hidden', "payType", '', [ |
|
| 17 | + 'value' => $cart->paytype_id, |
|
| 18 | + 'attributes' => [ |
|
| 19 | + 'id' => $hiddenId |
|
| 20 | + ], |
|
| 21 | + ]); |
|
| 22 | + ?> |
|
| 23 | 23 | </ul> |
| 24 | 24 | </div> |
| 25 | 25 | <div class="col-md-8"> |
@@ -2,24 +2,24 @@ |
||
| 2 | 2 | <div class="col-md-4"> |
| 3 | 3 | <ul class="nav nav-pills nav-stacked"> |
| 4 | 4 | <?php |
| 5 | - $hiddenId = Tools::randomString(); |
|
| 6 | - foreach ($deliverys as $delivery) {
|
|
| 7 | - if ((!empty($_POST['delivery']) && $_POST['delivery'] == $delivery->id) || ($cart->delivery && $delivery->id == $cart->delivery->id)) {
|
|
| 8 | - $checked = 'checked'; |
|
| 9 | - } else {
|
|
| 10 | - $checked = ''; |
|
| 11 | - } |
|
| 12 | - echo '<li' . ($checked ? ' class="active"' : '') . '><a href = "#" onclick = "document.getElementById(\'' . $hiddenId . '\').value=\'' . $delivery->id . '\';inji.Ecommerce.Cart.calcSum();return false;">'; |
|
| 13 | - echo $delivery->name; |
|
| 14 | - echo '</a></li>'; |
|
| 15 | - } |
|
| 16 | - $form->input('hidden', "delivery", '', [
|
|
| 17 | - 'value' => $cart->delivery_id, |
|
| 18 | - 'attributes' => [ |
|
| 19 | - 'id' => $hiddenId |
|
| 20 | - ], |
|
| 21 | - ]); |
|
| 22 | - ?> |
|
| 5 | + $hiddenId = Tools::randomString(); |
|
| 6 | + foreach ($deliverys as $delivery) {
|
|
| 7 | + if ((!empty($_POST['delivery']) && $_POST['delivery'] == $delivery->id) || ($cart->delivery && $delivery->id == $cart->delivery->id)) {
|
|
| 8 | + $checked = 'checked'; |
|
| 9 | + } else {
|
|
| 10 | + $checked = ''; |
|
| 11 | + } |
|
| 12 | + echo '<li' . ($checked ? ' class="active"' : '') . '><a href = "#" onclick = "document.getElementById(\'' . $hiddenId . '\').value=\'' . $delivery->id . '\';inji.Ecommerce.Cart.calcSum();return false;">'; |
|
| 13 | + echo $delivery->name; |
|
| 14 | + echo '</a></li>'; |
|
| 15 | + } |
|
| 16 | + $form->input('hidden', "delivery", '', [
|
|
| 17 | + 'value' => $cart->delivery_id, |
|
| 18 | + 'attributes' => [ |
|
| 19 | + 'id' => $hiddenId |
|
| 20 | + ], |
|
| 21 | + ]); |
|
| 22 | + ?> |
|
| 23 | 23 | </ul> |
| 24 | 24 | </div> |
| 25 | 25 | <div class="col-md-8"> |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | if ($cart->delivery) {
|
| 28 | 28 | echo "<h4>Информация о доставке</h4>"; |
| 29 | 29 | if ($cart->delivery->price_text || $cart->delivery->price) {
|
| 30 | - echo "<div>Стоимость доставки: <b>" . ($cart->delivery->price_text ? $cart->delivery->price_text : ( $cart->delivery->price . ' ' . ($cart->delivery->currency ? $cart->delivery->currency->acronym() : 'руб.') )) . '</b></div>'; |
|
| 30 | + echo "<div>Стоимость доставки: <b>" . ($cart->delivery->price_text ? $cart->delivery->price_text : ($cart->delivery->price . ' ' . ($cart->delivery->currency ? $cart->delivery->currency->acronym() : 'руб.'))) . '</b></div>'; |
|
| 31 | 31 | } |
| 32 | 32 | if ((float) $cart->delivery->max_cart_price) {
|
| 33 | 33 | echo '<div>При заказе товаров на сумму от ' . $cart->delivery->max_cart_price . ' руб - бесплатно</div>'; |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | $form->input($field->type, "deliveryFields[{$field->id}]", $field->name, ['required' => $field->required]);
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | - } |
|
| 43 | - else {
|
|
| 42 | + } else {
|
|
| 44 | 43 | echo "<h4>Выберите способ доставки</h4>"; |
| 45 | 44 | } |
| 46 | 45 | ?> |