@@ -22,16 +22,19 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | $sitePath = App::$primary->path; |
| 24 | 24 | |
| 25 | - if (!is_uploaded_file($file['tmp_name'])) |
|
| 26 | - return 0; |
|
| 25 | + if (!is_uploaded_file($file['tmp_name'])) { |
|
| 26 | + return 0; |
|
| 27 | + } |
|
| 27 | 28 | |
| 28 | 29 | $fileinfo = pathinfo($file['name']); |
| 29 | - if (empty($fileinfo['extension'])) |
|
| 30 | - return 0; |
|
| 30 | + if (empty($fileinfo['extension'])) { |
|
| 31 | + return 0; |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | $type = Files\Type::get($fileinfo['extension'], 'ext'); |
| 33 | - if (!$type) |
|
| 34 | - return 0; |
|
| 35 | + if (!$type) { |
|
| 36 | + return 0; |
|
| 37 | + } |
|
| 35 | 38 | |
| 36 | 39 | if (!empty($options['accept_group']) && $options['accept_group'] != $type->group) { |
| 37 | 40 | return 0; |
@@ -47,8 +50,9 @@ discard block |
||
| 47 | 50 | } |
| 48 | 51 | $fileObject->name = $fileinfo['filename']; |
| 49 | 52 | $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
| 50 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
| 51 | - unlink($sitePath . $fileObject->path); |
|
| 53 | + if ($fileObject->id && file_exists($sitePath . $fileObject->path)) { |
|
| 54 | + unlink($sitePath . $fileObject->path); |
|
| 55 | + } |
|
| 52 | 56 | |
| 53 | 57 | Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
| 54 | 58 | |
@@ -84,12 +88,14 @@ discard block |
||
| 84 | 88 | $sitePath = App::$primary->path; |
| 85 | 89 | |
| 86 | 90 | $fileinfo = pathinfo($url); |
| 87 | - if (empty($fileinfo['extension'])) |
|
| 88 | - return 0; |
|
| 91 | + if (empty($fileinfo['extension'])) { |
|
| 92 | + return 0; |
|
| 93 | + } |
|
| 89 | 94 | |
| 90 | 95 | $type = Files\Type::get($fileinfo['extension'], 'ext'); |
| 91 | - if (!$type) |
|
| 92 | - return 0; |
|
| 96 | + if (!$type) { |
|
| 97 | + return 0; |
|
| 98 | + } |
|
| 93 | 99 | |
| 94 | 100 | if (!empty($options['accept_group']) && $options['accept_group'] != $type->group) { |
| 95 | 101 | return 0; |
@@ -105,8 +111,9 @@ discard block |
||
| 105 | 111 | } |
| 106 | 112 | $fileObject->name = $fileinfo['filename']; |
| 107 | 113 | $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
| 108 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
| 109 | - unlink($sitePath . $fileObject->path); |
|
| 114 | + if ($fileObject->id && file_exists($sitePath . $fileObject->path)) { |
|
| 115 | + unlink($sitePath . $fileObject->path); |
|
| 116 | + } |
|
| 110 | 117 | |
| 111 | 118 | Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
| 112 | 119 | |
@@ -24,7 +24,8 @@ |
||
| 24 | 24 | <?php |
| 25 | 25 | if ($file->type->group == 'image') { |
| 26 | 26 | echo "<img class='img-responsive' src ='{$file->path}?resize=200x200' />"; |
| 27 | - } else { |
|
| 27 | + } |
|
| 28 | + else { |
|
| 28 | 29 | echo "<img class='img-responsive' src ='/static/moduleAsset/Files/images/formats/" . pathinfo($file->path, PATHINFO_EXTENSION) . ".png' />"; |
| 29 | 30 | } |
| 30 | 31 | ?> |
@@ -26,7 +26,8 @@ discard block |
||
| 26 | 26 | $currency_id = $cartItem->price && $cartItem->price->currency ? $cartItem->price->currency->id : (!empty(\App::$cur->ecommerce->config['defaultCurrency']) ? \App::$cur->ecommerce->config['defaultCurrency'] : 0); |
| 27 | 27 | if (empty($sums[$currency_id])) { |
| 28 | 28 | $sums[$currency_id] = $cartItem->final_price * $cartItem->count; |
| 29 | - } else { |
|
| 29 | + } |
|
| 30 | + else { |
|
| 30 | 31 | $sums[$currency_id] += $cartItem->final_price * $cartItem->count; |
| 31 | 32 | } |
| 32 | 33 | } |
@@ -34,7 +35,8 @@ discard block |
||
| 34 | 35 | $currency_id = $cart->delivery->currency_id; |
| 35 | 36 | if (empty($sums[$currency_id])) { |
| 36 | 37 | $sums[$currency_id] = $cart->delivery->price; |
| 37 | - } else { |
|
| 38 | + } |
|
| 39 | + else { |
|
| 38 | 40 | $sums[$currency_id] += $cart->delivery->price; |
| 39 | 41 | } |
| 40 | 42 | } |
@@ -42,7 +44,8 @@ discard block |
||
| 42 | 44 | $currency_id = $extra->currency ? $extra->currency->id : \App::$cur->ecommerce->config['defaultCurrency']; |
| 43 | 45 | if (empty($sums[$currency_id])) { |
| 44 | 46 | $sums[$currency_id] = $extra->price * $extra->count; |
| 45 | - } else { |
|
| 47 | + } |
|
| 48 | + else { |
|
| 46 | 49 | $sums[$currency_id] += $extra->price * $extra->count; |
| 47 | 50 | } |
| 48 | 51 | } |
@@ -62,10 +65,12 @@ discard block |
||
| 62 | 65 | $currency = Money\Currency::get($currency_id); |
| 63 | 66 | if ($currency) { |
| 64 | 67 | echo ' ' . $currency->acronym(); |
| 65 | - } else { |
|
| 68 | + } |
|
| 69 | + else { |
|
| 66 | 70 | echo ' р.'; |
| 67 | 71 | } |
| 68 | - } else { |
|
| 72 | + } |
|
| 73 | + else { |
|
| 69 | 74 | echo ' р.'; |
| 70 | 75 | } |
| 71 | 76 | echo '<br />'; |
@@ -76,9 +81,11 @@ discard block |
||
| 76 | 81 | <td><?php |
| 77 | 82 | if ($cart->payed) { |
| 78 | 83 | echo 'Оплачено'; |
| 79 | - } elseif (!App::$cur->money) { |
|
| 84 | + } |
|
| 85 | + elseif (!App::$cur->money) { |
|
| 80 | 86 | echo 'Не оплачено'; |
| 81 | - } else { |
|
| 87 | + } |
|
| 88 | + else { |
|
| 82 | 89 | $handlers = App::$cur->ecommerce->getSnippets('payTypeHandler'); |
| 83 | 90 | $redirect = ['/ecommerce/cart/success']; |
| 84 | 91 | if ($cart->payType && !empty($handlers[$cart->payType->handler]['handler'])) { |
@@ -86,7 +93,8 @@ discard block |
||
| 86 | 93 | } |
| 87 | 94 | if (!empty($newRedirect[0])) { |
| 88 | 95 | echo '<a class="btn btn-warning btn-sm" href = "' . $newRedirect[0] . '">Оплатить</a>'; |
| 89 | - } else { |
|
| 96 | + } |
|
| 97 | + else { |
|
| 90 | 98 | echo 'Не оплачено'; |
| 91 | 99 | } |
| 92 | 100 | } |
@@ -6,7 +6,8 @@ discard block |
||
| 6 | 6 | foreach ($payTypes as $payType) { |
| 7 | 7 | if ((!empty($_POST['payType']) && $_POST['payType'] == $payType->id) || ($cart->payType && $payType->id == $cart->payType->id)) { |
| 8 | 8 | $checked = 'checked'; |
| 9 | - } else { |
|
| 9 | + } |
|
| 10 | + else { |
|
| 10 | 11 | $checked = ''; |
| 11 | 12 | } |
| 12 | 13 | echo '<li' . ($checked ? ' class="active"' : '') . '><a href = "#" onclick = "document.getElementById(\'' . $hiddenId . '\').value=\'' . $payType->id . '\';inji.Ecommerce.Cart.calcSum();return false;">'; |
@@ -27,7 +28,8 @@ discard block |
||
| 27 | 28 | if ($cart->payType) { |
| 28 | 29 | echo "<h4>Информация об оплате</h4>"; |
| 29 | 30 | echo $cart->payType->info; |
| 30 | - } else { |
|
| 31 | + } |
|
| 32 | + else { |
|
| 31 | 33 | echo "<h4>Выберите способ оплаты</h4>"; |
| 32 | 34 | } |
| 33 | 35 | ?> |
@@ -3,7 +3,8 @@ discard block |
||
| 3 | 3 | $price = $cartItem->item->getPrice(); |
| 4 | 4 | if (empty(App::$cur->ecommerce->config['sell_over_warehouse'])) { |
| 5 | 5 | $max = $price->offer->warehouseCount((!empty($_SESSION['cart']['cart_id']) ? $_SESSION['cart']['cart_id'] : 0)); |
| 6 | -} else { |
|
| 6 | +} |
|
| 7 | +else { |
|
| 7 | 8 | $max = 100; |
| 8 | 9 | } |
| 9 | 10 | if (!empty($options[16]) && $options[16]->value) { |
@@ -15,7 +16,8 @@ discard block |
||
| 15 | 16 | <input type = "text" data-miltiple="1000" class ="combineRanger item-counter" data-step ="<?= $step; ?>" data-max="<?= $max; ?>" data-price ="<?= $price->price; ?>" name="cartItems[<?php echo $cartItem->id; ?>]" value ="<?= $cartItem->count; ?>" /> |
| 16 | 17 | <?php |
| 17 | 18 | echo '</div>'; |
| 18 | -} else { |
|
| 19 | +} |
|
| 20 | +else { |
|
| 19 | 21 | ?> |
| 20 | 22 | <div class="input-group number-spinner" > |
| 21 | 23 | <span class="input-group-btn"> |
@@ -6,7 +6,8 @@ discard block |
||
| 6 | 6 | foreach ($deliverys as $delivery) { |
| 7 | 7 | if ((!empty($_POST['delivery']) && $_POST['delivery'] == $delivery->id) || ($cart->delivery && $delivery->id == $cart->delivery->id)) { |
| 8 | 8 | $checked = 'checked'; |
| 9 | - } else { |
|
| 9 | + } |
|
| 10 | + else { |
|
| 10 | 11 | $checked = ''; |
| 11 | 12 | } |
| 12 | 13 | echo '<li' . ($checked ? ' class="active"' : '') . '><a href = "#" onclick = "document.getElementById(\'' . $hiddenId . '\').value=\'' . $delivery->id . '\';inji.Ecommerce.Cart.calcSum();return false;">'; |
@@ -43,7 +44,8 @@ discard block |
||
| 43 | 44 | $options['value'] = $key; |
| 44 | 45 | $form->input($field->type, "deliveryFields[{$field->id}]", $value, $options); |
| 45 | 46 | } |
| 46 | - } else { |
|
| 47 | + } |
|
| 48 | + else { |
|
| 47 | 49 | if ($field->type == 'select') { |
| 48 | 50 | $options['values'] = $field->fieldItems(['forSelect' => true]); |
| 49 | 51 | } |
@@ -51,7 +53,8 @@ discard block |
||
| 51 | 53 | } |
| 52 | 54 | } |
| 53 | 55 | } |
| 54 | - } else { |
|
| 56 | + } |
|
| 57 | + else { |
|
| 55 | 58 | echo "<h4>Выберите способ доставки</h4>"; |
| 56 | 59 | } |
| 57 | 60 | ?> |
@@ -86,7 +86,8 @@ discard block |
||
| 86 | 86 | $user->{$path[0]}->{$path[1]} = $info->value; |
| 87 | 87 | $relations[$path[0]] = $path[0]; |
| 88 | 88 | } |
| 89 | - } else { |
|
| 89 | + } |
|
| 90 | + else { |
|
| 90 | 91 | if (!$user->{$field->userfield}) { |
| 91 | 92 | $user->{$field->userfield} = $info->value; |
| 92 | 93 | } |
@@ -142,7 +143,8 @@ discard block |
||
| 142 | 143 | $user->{$path[0]}->{$path[1]} = $info->value; |
| 143 | 144 | $relations[$path[0]] = $path[0]; |
| 144 | 145 | } |
| 145 | - } else { |
|
| 146 | + } |
|
| 147 | + else { |
|
| 146 | 148 | if (!$user->{$field->userfield}) { |
| 147 | 149 | $user->{$field->userfield} = $info->value; |
| 148 | 150 | } |
@@ -262,7 +264,8 @@ discard block |
||
| 262 | 264 | $optionValueArr[] = \App::$cur->db->connection->pdo->quote($val); |
| 263 | 265 | } |
| 264 | 266 | $qstr = 'IN (' . implode(',', $optionValueArr) . ')'; |
| 265 | - } else { |
|
| 267 | + } |
|
| 268 | + else { |
|
| 266 | 269 | $qstr = '= ' . \App::$cur->db->connection->pdo->quote($optionValue); |
| 267 | 270 | } |
| 268 | 271 | $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' . |
@@ -281,7 +284,8 @@ discard block |
||
| 281 | 284 | $optionValueArr[] = \App::$cur->db->connection->pdo->quote($val); |
| 282 | 285 | } |
| 283 | 286 | $qstr = 'IN (' . implode(',', $optionValueArr) . ')'; |
| 284 | - } else { |
|
| 287 | + } |
|
| 288 | + else { |
|
| 285 | 289 | $qstr = '= ' . \App::$cur->db->connection->pdo->quote($optionValue); |
| 286 | 290 | } |
| 287 | 291 | $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index() . ' = ' . 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer::index() . ' AND ' . |
@@ -306,7 +310,8 @@ discard block |
||
| 306 | 310 | $first = false; |
| 307 | 311 | } |
| 308 | 312 | $selectOptions['where'][] = $where; |
| 309 | - } elseif (!empty($options['parent'])) { |
|
| 313 | + } |
|
| 314 | + elseif (!empty($options['parent'])) { |
|
| 310 | 315 | $category = \Ecommerce\Category::get($options['parent']); |
| 311 | 316 | $selectOptions['where'][] = ['tree_path', $category->tree_path . (int) $options['parent'] . '/%', 'LIKE']; |
| 312 | 317 | } |
@@ -492,7 +497,8 @@ discard block |
||
| 492 | 497 | foreach ($cartItem->price->offer->bonuses as $bonus) { |
| 493 | 498 | if ($bonus->limited && $bonus->left <= 0) { |
| 494 | 499 | continue; |
| 495 | - } elseif ($bonus->limited && $bonus->left > 0) { |
|
| 500 | + } |
|
| 501 | + elseif ($bonus->limited && $bonus->left > 0) { |
|
| 496 | 502 | $bonus->left -= 1; |
| 497 | 503 | $bonus->save(); |
| 498 | 504 | } |
@@ -17,14 +17,16 @@ discard block |
||
| 17 | 17 | if (!$this->id) { |
| 18 | 18 | $event = new Event(['cart_id' => $this->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 1, 'info' => $this->item_offer_price_id]); |
| 19 | 19 | $event->save(); |
| 20 | - } else { |
|
| 20 | + } |
|
| 21 | + else { |
|
| 21 | 22 | $cur = Item::get($this->id); |
| 22 | 23 | if ($cur->item_id != $this->item_id) { |
| 23 | 24 | $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 2, 'info' => $cur->item_offer_price_id]); |
| 24 | 25 | $event->save(); |
| 25 | 26 | $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 1, 'info' => $this->item_offer_price_id]); |
| 26 | 27 | $event->save(); |
| 27 | - } else { |
|
| 28 | + } |
|
| 29 | + else { |
|
| 28 | 30 | if ($cur->item_offer_price_id != $this->item_offer_price_id) { |
| 29 | 31 | $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 3, 'info' => $this->item_offer_price_id]); |
| 30 | 32 | $event->save(); |
@@ -56,14 +58,16 @@ discard block |
||
| 56 | 58 | if ($block) { |
| 57 | 59 | $block->count = $this->count; |
| 58 | 60 | $block->save(); |
| 59 | - } else { |
|
| 61 | + } |
|
| 62 | + else { |
|
| 60 | 63 | $block = new \Ecommerce\Warehouse\Block(); |
| 61 | 64 | $block->item_offer_id = $this->price->item_offer_id; |
| 62 | 65 | $block->cart_id = $this->cart_id; |
| 63 | 66 | $block->count = $this->count; |
| 64 | 67 | $block->save(); |
| 65 | 68 | } |
| 66 | - } elseif ($block) { |
|
| 69 | + } |
|
| 70 | + elseif ($block) { |
|
| 67 | 71 | $block->delete(); |
| 68 | 72 | } |
| 69 | 73 | $this->cart->checkStage(); |
@@ -313,7 +313,8 @@ discard block |
||
| 313 | 313 | $deliveryPrice = new \Money\Sums([$this->delivery->currency_id => $this->delivery->max_cart_price]); |
| 314 | 314 | if ($this->delivery->max_cart_price && $sums->greater($deliveryPrice) || $sums->equal($deliveryPrice)) { |
| 315 | 315 | $sum->sums = [$this->delivery->currency_id => 0]; |
| 316 | - } else if ($this->delivery->prices) { |
|
| 316 | + } |
|
| 317 | + else if ($this->delivery->prices) { |
|
| 317 | 318 | foreach ($this->delivery->prices(['order' => ['cart_price', 'asc']]) as $delPrice) { |
| 318 | 319 | $deliveryPrice = new \Money\Sums([$delPrice->currency_id => $delPrice->cart_price]); |
| 319 | 320 | if ($sums->greater($deliveryPrice) || $sums->equal($deliveryPrice)) { |
@@ -323,7 +324,8 @@ discard block |
||
| 323 | 324 | if (!$sum->sums) { |
| 324 | 325 | $sum->sums = [$this->delivery->currency_id => $this->delivery->price]; |
| 325 | 326 | } |
| 326 | - } else { |
|
| 327 | + } |
|
| 328 | + else { |
|
| 327 | 329 | $sum->sums = [$this->delivery->currency_id => $this->delivery->price]; |
| 328 | 330 | } |
| 329 | 331 | } |