@@ -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; |
@@ -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 ?> |
@@ -24,7 +24,8 @@ |
||
| 24 | 24 | $code .= '$' . $this->name . ' = '; |
| 25 | 25 | if (is_array($this->value)) { |
| 26 | 26 | $code .= \CodeGenerator::genArray($this->value); |
| 27 | - } else { |
|
| 27 | + } |
|
| 28 | + else { |
|
| 28 | 29 | $code .= '"' . str_replace('"', '\"', $this->value) . '";'; |
| 29 | 30 | } |
| 30 | 31 | return $code; |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | <tr> |
| 18 | 18 | <td class="text-left" style="width: 50%;"> |
| 19 | 19 | <?php |
| 20 | - foreach ($orderDeatilCols as $col => $label) { |
|
| 21 | - echo "<b>{$label}</b> " . $cart->$col . "<br>"; |
|
| 22 | - } |
|
| 23 | - ?> |
|
| 20 | + foreach ($orderDeatilCols as $col => $label) { |
|
| 21 | + echo "<b>{$label}</b> " . $cart->$col . "<br>"; |
|
| 22 | + } |
|
| 23 | + ?> |
|
| 24 | 24 | </td> |
| 25 | 25 | <td class="text-left"> |
| 26 | 26 | <b>Способ оплаты</b> <?= $cart->payType ? $cart->payType->name : '' ?><br> |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | <tr> |
| 40 | 40 | <td class="text-left"> |
| 41 | 41 | <?php |
| 42 | - if ($cart->infos) { |
|
| 43 | - foreach ($cart->infos as $info) { |
|
| 44 | - echo "<b>{$info->field->name()}</b> " . $info->value . "<br>"; |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - ?> |
|
| 42 | + if ($cart->infos) { |
|
| 43 | + foreach ($cart->infos as $info) { |
|
| 44 | + echo "<b>{$info->field->name()}</b> " . $info->value . "<br>"; |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + ?> |
|
| 48 | 48 | </td> |
| 49 | 49 | </tr> |
| 50 | 50 | </tbody> |
@@ -65,45 +65,45 @@ discard block |
||
| 65 | 65 | </thead> |
| 66 | 66 | <tbody> |
| 67 | 67 | <?php |
| 68 | - $sums = []; |
|
| 69 | - foreach ($cart->cartItems as $cartItem) { |
|
| 70 | - $item = $cartItem->item; |
|
| 71 | - $itemName = $item->name(); |
|
| 72 | - if (!isset($sums[$cartItem->price->currency_id])) { |
|
| 73 | - $sums[$cartItem->price->currency_id] = $cartItem->price->price; |
|
| 74 | - } else { |
|
| 75 | - $sums[$cartItem->price->currency_id] += $cartItem->price->price; |
|
| 76 | - } |
|
| 77 | - ?> |
|
| 68 | + $sums = []; |
|
| 69 | + foreach ($cart->cartItems as $cartItem) { |
|
| 70 | + $item = $cartItem->item; |
|
| 71 | + $itemName = $item->name(); |
|
| 72 | + if (!isset($sums[$cartItem->price->currency_id])) { |
|
| 73 | + $sums[$cartItem->price->currency_id] = $cartItem->price->price; |
|
| 74 | + } else { |
|
| 75 | + $sums[$cartItem->price->currency_id] += $cartItem->price->price; |
|
| 76 | + } |
|
| 77 | + ?> |
|
| 78 | 78 | <tr> |
| 79 | 79 | <td class="text-left"><?= $itemName; ?></td> |
| 80 | 80 | <td class="text-right"><?= $cartItem->count; ?></td> |
| 81 | 81 | <td class="text-right"><?= $cartItem->price->price; ?> |
| 82 | 82 | <?php |
| 83 | - if (App::$cur->money) { |
|
| 84 | - $currency = Money\Currency::get($cartItem->price->currency_id); |
|
| 85 | - if ($currency) { |
|
| 86 | - echo $currency->acronym(); |
|
| 87 | - } else { |
|
| 88 | - echo 'руб.'; |
|
| 89 | - } |
|
| 90 | - } else { |
|
| 91 | - echo 'руб.'; |
|
| 92 | - } |
|
| 93 | - ?></td> |
|
| 83 | + if (App::$cur->money) { |
|
| 84 | + $currency = Money\Currency::get($cartItem->price->currency_id); |
|
| 85 | + if ($currency) { |
|
| 86 | + echo $currency->acronym(); |
|
| 87 | + } else { |
|
| 88 | + echo 'руб.'; |
|
| 89 | + } |
|
| 90 | + } else { |
|
| 91 | + echo 'руб.'; |
|
| 92 | + } |
|
| 93 | + ?></td> |
|
| 94 | 94 | <td class="text-right"><?= ($cartItem->price->price * $cartItem->count); ?> |
| 95 | 95 | <?php |
| 96 | - if (App::$cur->money) { |
|
| 97 | - $currency = Money\Currency::get($cartItem->price->currency_id); |
|
| 98 | - if ($currency) { |
|
| 99 | - echo $currency->acronym(); |
|
| 100 | - } else { |
|
| 101 | - echo 'руб.'; |
|
| 102 | - } |
|
| 103 | - } else { |
|
| 104 | - echo 'руб.'; |
|
| 105 | - } |
|
| 106 | - ?></td> |
|
| 96 | + if (App::$cur->money) { |
|
| 97 | + $currency = Money\Currency::get($cartItem->price->currency_id); |
|
| 98 | + if ($currency) { |
|
| 99 | + echo $currency->acronym(); |
|
| 100 | + } else { |
|
| 101 | + echo 'руб.'; |
|
| 102 | + } |
|
| 103 | + } else { |
|
| 104 | + echo 'руб.'; |
|
| 105 | + } |
|
| 106 | + ?></td> |
|
| 107 | 107 | <td class="text-right" style="white-space: nowrap;"> |
| 108 | 108 | <a onclick = 'inji.Ecommerce.Cart.addItem(<?= $item->getPrice()->id; ?>, 1); |
| 109 | 109 | return false;' data-original-title="Добавить в корзину" href="#" data-toggle="tooltip" title="" class="btn btn-primary"><i class="glyphicon glyphicon-shopping-cart"></i></a> |
@@ -117,24 +117,24 @@ discard block |
||
| 117 | 117 | <td colspan="2"></td> |
| 118 | 118 | <td class="text-right"><b>Сумма</b></td> |
| 119 | 119 | <td class="text-right"><?php |
| 120 | - foreach ($sums as $currency_id => $sum) { |
|
| 121 | - if (!$sum) { |
|
| 122 | - continue; |
|
| 123 | - } |
|
| 124 | - echo number_format($sum, 2, '.', ' '); |
|
| 125 | - if (App::$cur->money) { |
|
| 126 | - $currency = Money\Currency::get($currency_id); |
|
| 127 | - if ($currency) { |
|
| 128 | - echo ' ' . $currency->acronym(); |
|
| 129 | - } else { |
|
| 130 | - echo ' руб.'; |
|
| 131 | - } |
|
| 132 | - } else { |
|
| 133 | - echo ' руб.'; |
|
| 134 | - } |
|
| 135 | - echo '<br />'; |
|
| 136 | - } |
|
| 137 | - ?></td> |
|
| 120 | + foreach ($sums as $currency_id => $sum) { |
|
| 121 | + if (!$sum) { |
|
| 122 | + continue; |
|
| 123 | + } |
|
| 124 | + echo number_format($sum, 2, '.', ' '); |
|
| 125 | + if (App::$cur->money) { |
|
| 126 | + $currency = Money\Currency::get($currency_id); |
|
| 127 | + if ($currency) { |
|
| 128 | + echo ' ' . $currency->acronym(); |
|
| 129 | + } else { |
|
| 130 | + echo ' руб.'; |
|
| 131 | + } |
|
| 132 | + } else { |
|
| 133 | + echo ' руб.'; |
|
| 134 | + } |
|
| 135 | + echo '<br />'; |
|
| 136 | + } |
|
| 137 | + ?></td> |
|
| 138 | 138 | <td></td> |
| 139 | 139 | </tr> |
| 140 | 140 | <?php |
@@ -160,24 +160,24 @@ discard block |
||
| 160 | 160 | <td colspan="2"></td> |
| 161 | 161 | <td class="text-right"><b>Итого</b></td> |
| 162 | 162 | <td class="text-right"><?php |
| 163 | - foreach ($sums as $currency_id => $sum) { |
|
| 164 | - if (!$sum) { |
|
| 165 | - continue; |
|
| 166 | - } |
|
| 167 | - echo number_format($sum, 2, '.', ' '); |
|
| 168 | - if (App::$cur->money) { |
|
| 169 | - $currency = Money\Currency::get($currency_id); |
|
| 170 | - if ($currency) { |
|
| 171 | - echo ' ' . $currency->acronym(); |
|
| 172 | - } else { |
|
| 173 | - echo ' руб.'; |
|
| 174 | - } |
|
| 175 | - } else { |
|
| 176 | - echo ' руб.'; |
|
| 177 | - } |
|
| 178 | - echo '<br />'; |
|
| 179 | - } |
|
| 180 | - ?></td> |
|
| 163 | + foreach ($sums as $currency_id => $sum) { |
|
| 164 | + if (!$sum) { |
|
| 165 | + continue; |
|
| 166 | + } |
|
| 167 | + echo number_format($sum, 2, '.', ' '); |
|
| 168 | + if (App::$cur->money) { |
|
| 169 | + $currency = Money\Currency::get($currency_id); |
|
| 170 | + if ($currency) { |
|
| 171 | + echo ' ' . $currency->acronym(); |
|
| 172 | + } else { |
|
| 173 | + echo ' руб.'; |
|
| 174 | + } |
|
| 175 | + } else { |
|
| 176 | + echo ' руб.'; |
|
| 177 | + } |
|
| 178 | + echo '<br />'; |
|
| 179 | + } |
|
| 180 | + ?></td> |
|
| 181 | 181 | <td></td> |
| 182 | 182 | </tr> |
| 183 | 183 | </tfoot> |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | </thead> |
| 195 | 195 | <tbody> |
| 196 | 196 | <?php |
| 197 | - $statuses = Ecommerce\Cart\Event::getList(['where' => [['cart_id', $cart->id]], 'order' => ['date_create', 'desc']]); |
|
| 198 | - foreach ($statuses as $status) { |
|
| 199 | - ?> |
|
| 197 | + $statuses = Ecommerce\Cart\Event::getList(['where' => [['cart_id', $cart->id]], 'order' => ['date_create', 'desc']]); |
|
| 198 | + foreach ($statuses as $status) { |
|
| 199 | + ?> |
|
| 200 | 200 | <tr> |
| 201 | 201 | <td class="text-left"><?= $status->date_create; ?></td> |
| 202 | 202 | <td class="text-left"><?= $status->type->name; ?></td> |
@@ -71,7 +71,8 @@ discard block |
||
| 71 | 71 | $itemName = $item->name(); |
| 72 | 72 | if (!isset($sums[$cartItem->price->currency_id])) { |
| 73 | 73 | $sums[$cartItem->price->currency_id] = $cartItem->price->price; |
| 74 | - } else { |
|
| 74 | + } |
|
| 75 | + else { |
|
| 75 | 76 | $sums[$cartItem->price->currency_id] += $cartItem->price->price; |
| 76 | 77 | } |
| 77 | 78 | ?> |
@@ -84,10 +85,12 @@ discard block |
||
| 84 | 85 | $currency = Money\Currency::get($cartItem->price->currency_id); |
| 85 | 86 | if ($currency) { |
| 86 | 87 | echo $currency->acronym(); |
| 87 | - } else { |
|
| 88 | + } |
|
| 89 | + else { |
|
| 88 | 90 | echo 'руб.'; |
| 89 | 91 | } |
| 90 | - } else { |
|
| 92 | + } |
|
| 93 | + else { |
|
| 91 | 94 | echo 'руб.'; |
| 92 | 95 | } |
| 93 | 96 | ?></td> |
@@ -97,10 +100,12 @@ discard block |
||
| 97 | 100 | $currency = Money\Currency::get($cartItem->price->currency_id); |
| 98 | 101 | if ($currency) { |
| 99 | 102 | echo $currency->acronym(); |
| 100 | - } else { |
|
| 103 | + } |
|
| 104 | + else { |
|
| 101 | 105 | echo 'руб.'; |
| 102 | 106 | } |
| 103 | - } else { |
|
| 107 | + } |
|
| 108 | + else { |
|
| 104 | 109 | echo 'руб.'; |
| 105 | 110 | } |
| 106 | 111 | ?></td> |
@@ -126,10 +131,12 @@ discard block |
||
| 126 | 131 | $currency = Money\Currency::get($currency_id); |
| 127 | 132 | if ($currency) { |
| 128 | 133 | echo ' ' . $currency->acronym(); |
| 129 | - } else { |
|
| 134 | + } |
|
| 135 | + else { |
|
| 130 | 136 | echo ' руб.'; |
| 131 | 137 | } |
| 132 | - } else { |
|
| 138 | + } |
|
| 139 | + else { |
|
| 133 | 140 | echo ' руб.'; |
| 134 | 141 | } |
| 135 | 142 | echo '<br />'; |
@@ -142,7 +149,8 @@ discard block |
||
| 142 | 149 | $deliveryPrice = $cart->delivery->price; |
| 143 | 150 | if (!isset($sums[$deliveryCurrency])) { |
| 144 | 151 | $sums[$deliveryCurrency] = $deliveryPrice; |
| 145 | - } else { |
|
| 152 | + } |
|
| 153 | + else { |
|
| 146 | 154 | $sums[$deliveryCurrency] += $deliveryPrice; |
| 147 | 155 | } |
| 148 | 156 | $delCurrency = false; |
@@ -169,10 +177,12 @@ discard block |
||
| 169 | 177 | $currency = Money\Currency::get($currency_id); |
| 170 | 178 | if ($currency) { |
| 171 | 179 | echo ' ' . $currency->acronym(); |
| 172 | - } else { |
|
| 180 | + } |
|
| 181 | + else { |
|
| 173 | 182 | echo ' руб.'; |
| 174 | 183 | } |
| 175 | - } else { |
|
| 184 | + } |
|
| 185 | + else { |
|
| 176 | 186 | echo ' руб.'; |
| 177 | 187 | } |
| 178 | 188 | echo '<br />'; |
@@ -208,7 +218,8 @@ discard block |
||
| 208 | 218 | $price = Ecommerce\Item\Offer\Price::get($status->info); |
| 209 | 219 | if ($price) { |
| 210 | 220 | echo "<a href = '/ecommerce/view/{$item->id}'>" . $price->offer->item->name() . "</a>"; |
| 211 | - } else { |
|
| 221 | + } |
|
| 222 | + else { |
|
| 212 | 223 | echo 'Товар удален'; |
| 213 | 224 | } |
| 214 | 225 | break; |
@@ -217,7 +228,8 @@ discard block |
||
| 217 | 228 | $price = Ecommerce\Item\Offer\Price::get($info[0]); |
| 218 | 229 | if ($price) { |
| 219 | 230 | echo "<a href = '/ecommerce/view/{$item->id}'>" . $price->offer->item->name() . "</a> " . ($info[1] > 0 ? '+' . $info[1] : $info[1]); |
| 220 | - } else { |
|
| 231 | + } |
|
| 232 | + else { |
|
| 221 | 233 | echo 'Товар удален'; |
| 222 | 234 | } |
| 223 | 235 | break; |
@@ -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; ?>"> |
@@ -124,8 +124,8 @@ discard block |
||
| 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> |
@@ -144,12 +144,12 @@ discard block |
||
| 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 | 155 | } |
@@ -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> |
@@ -3,8 +3,9 @@ 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>"; |
|
| 6 | + if (!$cart || !$cart->cartItems) { |
|
| 7 | + echo "<h1>Ваша корзина пуста</h1>"; |
|
| 8 | + } |
|
| 8 | 9 | else { |
| 9 | 10 | $form = new Ui\Form; |
| 10 | 11 | $form->action = "/ecommerce/cart"; |
@@ -88,7 +89,8 @@ discard block |
||
| 88 | 89 | <?php |
| 89 | 90 | if (class_exists('Money\Currency')) { |
| 90 | 91 | $defaultCurrency = Money\Currency::get(\App::$cur->ecommerce->config['defaultCurrency']); |
| 91 | - } else { |
|
| 92 | + } |
|
| 93 | + else { |
|
| 92 | 94 | $defaultCurrency = ''; |
| 93 | 95 | } |
| 94 | 96 | foreach ($cart->cartItems as $cartItem) { |
@@ -146,7 +148,8 @@ discard block |
||
| 146 | 148 | <td colspan="2" class="text-right"><?php |
| 147 | 149 | if ($cart->delivery && $cart->delivery->price_text) { |
| 148 | 150 | echo $cart->delivery->price_text; |
| 149 | - } else { |
|
| 151 | + } |
|
| 152 | + else { |
|
| 150 | 153 | echo $cart->deliverySum(); |
| 151 | 154 | } |
| 152 | 155 | ?></td> |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <div class="ecommerce"> |
| 2 | 2 | <div class="cart-order_page"> |
| 3 | 3 | <?php |
| 4 | - $form = new Ui\Form; |
|
| 5 | - $form->action = "/ecommerce/buyCard"; |
|
| 6 | - $form->begin(); |
|
| 7 | - ?> |
|
| 4 | + $form = new Ui\Form; |
|
| 5 | + $form->action = "/ecommerce/buyCard"; |
|
| 6 | + $form->begin(); |
|
| 7 | + ?> |
|
| 8 | 8 | <div class="row"> |
| 9 | 9 | <div class="col-sm-4"> |
| 10 | 10 | <div class="order_page-info"> |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | </thead> |
| 35 | 35 | <tbody class="cartitems"> |
| 36 | 36 | <?php |
| 37 | - $first = true; |
|
| 38 | - foreach (\Ecommerce\Card::getList() as $card) { |
|
| 39 | - $checked = $first; |
|
| 40 | - $first = false; |
|
| 41 | - ?> |
|
| 37 | + $first = true; |
|
| 38 | + foreach (\Ecommerce\Card::getList() as $card) { |
|
| 39 | + $checked = $first; |
|
| 40 | + $first = false; |
|
| 41 | + ?> |
|
| 42 | 42 | <tr> |
| 43 | 43 | <td> |
| 44 | 44 | <input id ="cardId" type="radio" name ="card_id" value ="<?= $card->id; ?>" <?= $checked ? 'checked' : ''; ?> /> |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | <td> |
| 51 | 51 | <ul> |
| 52 | 52 | <?php |
| 53 | - foreach ($card->levels as $level) { |
|
| 54 | - ?> |
|
| 53 | + foreach ($card->levels as $level) { |
|
| 54 | + ?> |
|
| 55 | 55 | <li><?= $level->name; ?> - <?= $level->discount->name; ?></li> |
| 56 | 56 | <?php |
| 57 | 57 | } |
@@ -17,20 +17,20 @@ |
||
| 17 | 17 | <h1><?= $item->name(); ?></h1> |
| 18 | 18 | <ul class="item-options"> |
| 19 | 19 | <?php |
| 20 | - foreach ($item->options as $param) { |
|
| 21 | - if (!$param->item_option_view || !$param->value) |
|
| 22 | - continue; |
|
| 23 | - if ($param->item_option_type == 'select') { |
|
| 24 | - if (empty($param->option->items[$param->value])) |
|
| 25 | - continue; |
|
| 26 | - $value = $param->option->items[$param->value]->value; |
|
| 27 | - } else { |
|
| 28 | - $value = $param->value; |
|
| 29 | - } |
|
| 30 | - $paramName = $param->item_option_name; |
|
| 31 | - echo "<li>{$paramName}: {$value} {$param->item_option_postfix}</li>"; |
|
| 32 | - } |
|
| 33 | - ?> |
|
| 20 | + foreach ($item->options as $param) { |
|
| 21 | + if (!$param->item_option_view || !$param->value) |
|
| 22 | + continue; |
|
| 23 | + if ($param->item_option_type == 'select') { |
|
| 24 | + if (empty($param->option->items[$param->value])) |
|
| 25 | + continue; |
|
| 26 | + $value = $param->option->items[$param->value]->value; |
|
| 27 | + } else { |
|
| 28 | + $value = $param->value; |
|
| 29 | + } |
|
| 30 | + $paramName = $param->item_option_name; |
|
| 31 | + echo "<li>{$paramName}: {$value} {$param->item_option_postfix}</li>"; |
|
| 32 | + } |
|
| 33 | + ?> |
|
| 34 | 34 | </ul> |
| 35 | 35 | <div class="item-actions"> |
| 36 | 36 | <div class="item-price"> |
@@ -18,13 +18,16 @@ |
||
| 18 | 18 | <ul class="item-options"> |
| 19 | 19 | <?php |
| 20 | 20 | foreach ($item->options as $param) { |
| 21 | - if (!$param->item_option_view || !$param->value) |
|
| 22 | - continue; |
|
| 21 | + if (!$param->item_option_view || !$param->value) { |
|
| 22 | + continue; |
|
| 23 | + } |
|
| 23 | 24 | if ($param->item_option_type == 'select') { |
| 24 | - if (empty($param->option->items[$param->value])) |
|
| 25 | - continue; |
|
| 25 | + if (empty($param->option->items[$param->value])) { |
|
| 26 | + continue; |
|
| 27 | + } |
|
| 26 | 28 | $value = $param->option->items[$param->value]->value; |
| 27 | - } else { |
|
| 29 | + } |
|
| 30 | + else { |
|
| 28 | 31 | $value = $param->value; |
| 29 | 32 | } |
| 30 | 33 | $paramName = $param->item_option_name; |