@@ -14,12 +14,12 @@ |
||
| 14 | 14 | </td> |
| 15 | 15 | <td class="text-left"> |
| 16 | 16 | <?php |
| 17 | - if (!empty($cartItem->item->options['7fc7a4d1-b26a-11e4-9490-80c16e818121']) && $cartItem->item->options['7fc7a4d1-b26a-11e4-9490-80c16e818121']->cip_value) { |
|
| 18 | - echo '<div style="min-width:200px;">'; |
|
| 19 | - $price = $cartItem->price->price; |
|
| 20 | - $max = $cartItem->price->offer->warehouseCount((!empty($_SESSION['cart']['cart_id']) ? $_SESSION['cart']['cart_id'] : 0)) * 1000; |
|
| 21 | - $step = preg_replace('![^0-9]!', '', $cartItem->item->options['7fc7a4d1-b26a-11e4-9490-80c16e818121']->cip_value); |
|
| 22 | - ?> |
|
| 17 | + if (!empty($cartItem->item->options['7fc7a4d1-b26a-11e4-9490-80c16e818121']) && $cartItem->item->options['7fc7a4d1-b26a-11e4-9490-80c16e818121']->cip_value) { |
|
| 18 | + echo '<div style="min-width:200px;">'; |
|
| 19 | + $price = $cartItem->price->price; |
|
| 20 | + $max = $cartItem->price->offer->warehouseCount((!empty($_SESSION['cart']['cart_id']) ? $_SESSION['cart']['cart_id'] : 0)) * 1000; |
|
| 21 | + $step = preg_replace('![^0-9]!', '', $cartItem->item->options['7fc7a4d1-b26a-11e4-9490-80c16e818121']->cip_value); |
|
| 22 | + ?> |
|
| 23 | 23 | Примерный вес |
| 24 | 24 | <input name="items[<?php echo $cartItem->id; ?>]" type = "text" class ="combineRanger item-counter cart-couner rangerCount" data-step ="<?= $step; ?>" data-max="<?= $max; ?>" data-price ="<?= $price; ?>" value="<?php echo (float) $cartItem->count * 1000; ?>" /> |
| 25 | 25 | <?php |
@@ -24,7 +24,8 @@ |
||
| 24 | 24 | <input name="items[<?php echo $cartItem->id; ?>]" type = "text" class ="combineRanger item-counter cart-couner rangerCount" data-step ="<?= $step; ?>" data-max="<?= $max; ?>" data-price ="<?= $price; ?>" value="<?php echo (float) $cartItem->count * 1000; ?>" /> |
| 25 | 25 | <?php |
| 26 | 26 | echo '</div>'; |
| 27 | - } else { |
|
| 27 | + } |
|
| 28 | + else { |
|
| 28 | 29 | ?> |
| 29 | 30 | <div class="input-group"> |
| 30 | 31 | <span class="input-group-btn"> |
@@ -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>'; |
@@ -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 | ?> |
@@ -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 | } |
@@ -234,7 +234,8 @@ discard block |
||
| 234 | 234 | if ($option->item_option_searchable && $option->value) { |
| 235 | 235 | if ($option->item_option_type != 'select') { |
| 236 | 236 | $this->search_index .= $option->value . ' '; |
| 237 | - } elseif (!empty($option->option->items[$option->value])) { |
|
| 237 | + } |
|
| 238 | + elseif (!empty($option->option->items[$option->value])) { |
|
| 238 | 239 | $option->option->items[$option->value]->value . ' '; |
| 239 | 240 | } |
| 240 | 241 | } |
@@ -247,7 +248,8 @@ discard block |
||
| 247 | 248 | if ($option->item_offer_option_searchable && $option->value) { |
| 248 | 249 | if ($option->item_offer_option_type != 'select') { |
| 249 | 250 | $this->search_index .= $option->value . ' '; |
| 250 | - } elseif (!empty($option->option->items[$option->value])) { |
|
| 251 | + } |
|
| 252 | + elseif (!empty($option->option->items[$option->value])) { |
|
| 251 | 253 | $option->option->items[$option->value]->value . ' '; |
| 252 | 254 | } |
| 253 | 255 | } |
@@ -305,7 +307,8 @@ discard block |
||
| 305 | 307 | foreach ($offers[0]->prices as $price) { |
| 306 | 308 | if (!$price->type) { |
| 307 | 309 | $curPrice = $price; |
| 308 | - } elseif ( |
|
| 310 | + } |
|
| 311 | + elseif ( |
|
| 309 | 312 | (!$price->type->roles && !$curPrice) || |
| 310 | 313 | ($price->type->roles && !$curPrice && strpos($price->type->roles, "|" . \Users\User::$cur->role_id . "|") !== false) |
| 311 | 314 | ) { |
@@ -94,7 +94,8 @@ |
||
| 94 | 94 | public function value($default = '') { |
| 95 | 95 | if ($this->option->type != 'select') { |
| 96 | 96 | return $this->value; |
| 97 | - } elseif ($this->optionItem) { |
|
| 97 | + } |
|
| 98 | + elseif ($this->optionItem) { |
|
| 98 | 99 | return $this->optionItem->value; |
| 99 | 100 | } |
| 100 | 101 | return $default; |
@@ -94,7 +94,8 @@ |
||
| 94 | 94 | public function value($default = '') { |
| 95 | 95 | if ($this->option->type != 'select') { |
| 96 | 96 | return $this->value; |
| 97 | - } elseif ($this->optionItem) { |
|
| 97 | + } |
|
| 98 | + elseif ($this->optionItem) { |
|
| 98 | 99 | return $this->optionItem->value; |
| 99 | 100 | } |
| 100 | 101 | return $default; |
@@ -132,9 +132,11 @@ discard block |
||
| 132 | 132 | public function resolveTemplate() { |
| 133 | 133 | if ($this->template !== 'inherit') { |
| 134 | 134 | return $this->template; |
| 135 | - } elseif ($this->template == 'inherit' && $this->category) { |
|
| 135 | + } |
|
| 136 | + elseif ($this->template == 'inherit' && $this->category) { |
|
| 136 | 137 | return $this->category->resolveTemplate(true); |
| 137 | - } else { |
|
| 138 | + } |
|
| 139 | + else { |
|
| 138 | 140 | return (!empty(\App::$cur->ecommerce->config['defaultCategoryTemplate']) ? \App::$cur->ecommerce->config['defaultCategoryTemplate'] : 'current'); |
| 139 | 141 | } |
| 140 | 142 | } |
@@ -142,9 +144,11 @@ discard block |
||
| 142 | 144 | public function resolveViewer() { |
| 143 | 145 | if ($this->viewer !== 'inherit') { |
| 144 | 146 | return $this->viewer; |
| 145 | - } elseif ($this->viewer == 'inherit' && $this->category) { |
|
| 147 | + } |
|
| 148 | + elseif ($this->viewer == 'inherit' && $this->category) { |
|
| 146 | 149 | return $this->category->resolveViewer(true); |
| 147 | - } else { |
|
| 150 | + } |
|
| 151 | + else { |
|
| 148 | 152 | return (!empty(\App::$cur->ecommerce->config['defaultCategoryView']) ? \App::$cur->ecommerce->config['defaultCategoryView'] : 'itemList'); |
| 149 | 153 | } |
| 150 | 154 | } |
@@ -1,20 +1,20 @@ |
||
| 1 | 1 | <div class="ecommerce"> |
| 2 | 2 | <div class="content"> |
| 3 | 3 | <?php |
| 4 | - $cart = Ecommerce\Cart::getList([ |
|
| 5 | - 'where' => [ |
|
| 6 | - ['user_id', Users\User::$cur->id], |
|
| 7 | - ], |
|
| 8 | - 'order' => ['complete_data', 'desc'], |
|
| 9 | - 'limit' => 1 |
|
| 10 | - ]); |
|
| 11 | - $cart_id = isset(array_values($cart)[0]) ? array_values($cart)[0]->id : ''; |
|
| 12 | - $prefix = isset(App::$cur->ecommerce->config['orderPrefix']) ? $config = App::$cur->ecommerce->config['orderPrefix'] : ''; |
|
| 13 | - $text = "<p>История заказа находится в <a href='/users/cabinet'>Личном кабинете</a>. Для просмотра истории, перейдите по ссылке <a href=\"/users/cabinet/ecommerceOrdersHistory\">История заказов</a>.</p> |
|
| 4 | + $cart = Ecommerce\Cart::getList([ |
|
| 5 | + 'where' => [ |
|
| 6 | + ['user_id', Users\User::$cur->id], |
|
| 7 | + ], |
|
| 8 | + 'order' => ['complete_data', 'desc'], |
|
| 9 | + 'limit' => 1 |
|
| 10 | + ]); |
|
| 11 | + $cart_id = isset(array_values($cart)[0]) ? array_values($cart)[0]->id : ''; |
|
| 12 | + $prefix = isset(App::$cur->ecommerce->config['orderPrefix']) ? $config = App::$cur->ecommerce->config['orderPrefix'] : ''; |
|
| 13 | + $text = "<p>История заказа находится в <a href='/users/cabinet'>Личном кабинете</a>. Для просмотра истории, перейдите по ссылке <a href=\"/users/cabinet/ecommerceOrdersHistory\">История заказов</a>.</p> |
|
| 14 | 14 | <p>Если у Вас возникли вопросы, пожалуйста <a href='/materials/contacts'>свяжитесь с нами</a>.</p>"; |
| 15 | 15 | |
| 16 | - if (isset(array_values($cart)[0])) { |
|
| 17 | - ?> |
|
| 16 | + if (isset(array_values($cart)[0])) { |
|
| 17 | + ?> |
|
| 18 | 18 | <h1 class="heading-title">Ваш заказ номер <?= $prefix; ?><?= $cart_id; ?> принят!</h1> |
| 19 | 19 | <p>Ваш заказ принят!</p> |
| 20 | 20 | <?= $text ?> |
@@ -20,7 +20,8 @@ |
||
| 20 | 20 | <?= $text ?> |
| 21 | 21 | <p>Спасибо за покупки в нашем интернет-магазине!</p> |
| 22 | 22 | <?php |
| 23 | - } else { |
|
| 23 | + } |
|
| 24 | + else { |
|
| 24 | 25 | ?> |
| 25 | 26 | <h1 class="heading-title">У вас нет недавних заказов</h1> |
| 26 | 27 | <p>У вас нет недавних заказов</p> |