@@ -3,33 +3,33 @@ 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 | - $sums = []; |
|
10 | - $cartDelivery = $cart->delivery; |
|
11 | - $deliveryPrice = 0; |
|
12 | - $deliveryCurrency = 0; |
|
13 | - if (!$cartDelivery) { |
|
14 | - $cartDelivery = current($deliverys); |
|
15 | - } |
|
16 | - if ($cartDelivery) { |
|
17 | - if ($cartDelivery->max_cart_price) { |
|
18 | - $deliveryPrice = (($cart->sum >= $cartDelivery->max_cart_price) ? '0' : $cartDelivery->price); |
|
19 | - } else { |
|
20 | - $deliveryPrice = $cartDelivery->price; |
|
21 | - } |
|
22 | - $deliveryCurrency = $cartDelivery->currency_id; |
|
23 | - } |
|
24 | - $cartPayType = $cart->payType; |
|
25 | - if (!$cartPayType) { |
|
26 | - $cartPayType = current($payTypes); |
|
27 | - } |
|
6 | + if (!$cart || !$cart->cartItems) |
|
7 | + echo "<h1>Ваша корзина пуста</h1>"; |
|
8 | + else { |
|
9 | + $sums = []; |
|
10 | + $cartDelivery = $cart->delivery; |
|
11 | + $deliveryPrice = 0; |
|
12 | + $deliveryCurrency = 0; |
|
13 | + if (!$cartDelivery) { |
|
14 | + $cartDelivery = current($deliverys); |
|
15 | + } |
|
16 | + if ($cartDelivery) { |
|
17 | + if ($cartDelivery->max_cart_price) { |
|
18 | + $deliveryPrice = (($cart->sum >= $cartDelivery->max_cart_price) ? '0' : $cartDelivery->price); |
|
19 | + } else { |
|
20 | + $deliveryPrice = $cartDelivery->price; |
|
21 | + } |
|
22 | + $deliveryCurrency = $cartDelivery->currency_id; |
|
23 | + } |
|
24 | + $cartPayType = $cart->payType; |
|
25 | + if (!$cartPayType) { |
|
26 | + $cartPayType = current($payTypes); |
|
27 | + } |
|
28 | 28 | |
29 | - $form = new Ui\Form; |
|
30 | - $form->action = "/ecommerce/cart"; |
|
31 | - $form->begin(); |
|
32 | - ?> |
|
29 | + $form = new Ui\Form; |
|
30 | + $form->action = "/ecommerce/cart"; |
|
31 | + $form->begin(); |
|
32 | + ?> |
|
33 | 33 | <div class="row"> |
34 | 34 | <div class="col-sm-4"> |
35 | 35 | <div class="order_page-info"> |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | <div class="col-md-8"> |
140 | 140 | <h4>Информация об оплате</h4> |
141 | 141 | <?php |
142 | - echo $cartPayType->info; |
|
143 | - ?> |
|
142 | + echo $cartPayType->info; |
|
143 | + ?> |
|
144 | 144 | </div> |
145 | 145 | </div> |
146 | 146 | </div> |
@@ -167,23 +167,23 @@ discard block |
||
167 | 167 | </thead> |
168 | 168 | <tbody> |
169 | 169 | <?php |
170 | - if (class_exists('Money\Currency')) { |
|
171 | - $defaultCurrency = Money\Currency::get(\App::$cur->ecommerce->config['defaultCurrency']); |
|
172 | - } else { |
|
173 | - $defaultCurrency = ''; |
|
174 | - } |
|
175 | - $discountSum = 0; |
|
176 | - foreach ($cart->cartItems as $cartItem) { |
|
177 | - $path = $cartItem->item->image ? $cartItem->item->image->path : '/static/system/images/no-image.png'; |
|
178 | - $discount = $cartItem->discount(); |
|
179 | - $discountSum += $discount; |
|
180 | - $itemName = $cartItem->item->name(); |
|
181 | - if (!isset($sums[$cartItem->price->currency_id])) { |
|
182 | - $sums[$cartItem->price->currency_id] = $cartItem->price->price * $cartItem->count; |
|
183 | - } else { |
|
184 | - $sums[$cartItem->price->currency_id] += $cartItem->price->price * $cartItem->count; |
|
185 | - } |
|
186 | - ?> |
|
170 | + if (class_exists('Money\Currency')) { |
|
171 | + $defaultCurrency = Money\Currency::get(\App::$cur->ecommerce->config['defaultCurrency']); |
|
172 | + } else { |
|
173 | + $defaultCurrency = ''; |
|
174 | + } |
|
175 | + $discountSum = 0; |
|
176 | + foreach ($cart->cartItems as $cartItem) { |
|
177 | + $path = $cartItem->item->image ? $cartItem->item->image->path : '/static/system/images/no-image.png'; |
|
178 | + $discount = $cartItem->discount(); |
|
179 | + $discountSum += $discount; |
|
180 | + $itemName = $cartItem->item->name(); |
|
181 | + if (!isset($sums[$cartItem->price->currency_id])) { |
|
182 | + $sums[$cartItem->price->currency_id] = $cartItem->price->price * $cartItem->count; |
|
183 | + } else { |
|
184 | + $sums[$cartItem->price->currency_id] += $cartItem->price->price * $cartItem->count; |
|
185 | + } |
|
186 | + ?> |
|
187 | 187 | <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; ?>'> |
188 | 188 | <td class="text-center image"> |
189 | 189 | <a href="/ecommerce/view/<?php echo $cartItem->item->id; ?>"> |
@@ -195,24 +195,24 @@ discard block |
||
195 | 195 | </td> |
196 | 196 | <td class="text-left quantity"> |
197 | 197 | <?php |
198 | - $options = $cartItem->item->options(['key' => 'item_option_id']); |
|
199 | - $price = $cartItem->item->getPrice(); |
|
200 | - if (empty(App::$cur->ecommerce->config['sell_over_warehouse'])) { |
|
201 | - $max = $price->offer->warehouseCount((!empty($_SESSION['cart']['cart_id']) ? $_SESSION['cart']['cart_id'] : 0)); |
|
202 | - } else { |
|
203 | - $max = 100; |
|
204 | - } |
|
205 | - if (!empty($options[16]) && $options[16]->value) { |
|
206 | - echo '<div style="min-width:200px;">'; |
|
207 | - $price = $cartItem->price; |
|
208 | - $step = preg_replace('![^0-9]!', '', $options[16]->value) / 1000; |
|
209 | - ?> |
|
198 | + $options = $cartItem->item->options(['key' => 'item_option_id']); |
|
199 | + $price = $cartItem->item->getPrice(); |
|
200 | + if (empty(App::$cur->ecommerce->config['sell_over_warehouse'])) { |
|
201 | + $max = $price->offer->warehouseCount((!empty($_SESSION['cart']['cart_id']) ? $_SESSION['cart']['cart_id'] : 0)); |
|
202 | + } else { |
|
203 | + $max = 100; |
|
204 | + } |
|
205 | + if (!empty($options[16]) && $options[16]->value) { |
|
206 | + echo '<div style="min-width:200px;">'; |
|
207 | + $price = $cartItem->price; |
|
208 | + $step = preg_replace('![^0-9]!', '', $options[16]->value) / 1000; |
|
209 | + ?> |
|
210 | 210 | Примерный вес |
211 | 211 | <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; ?>" /> |
212 | 212 | <?php |
213 | - echo '</div>'; |
|
214 | - } else { |
|
215 | - ?> |
|
213 | + echo '</div>'; |
|
214 | + } else { |
|
215 | + ?> |
|
216 | 216 | <div class="input-group number-spinner" > |
217 | 217 | <span class="input-group-btn"> |
218 | 218 | <button type="button" class="btn btn-default btn-sm btn-number" data-type="minus" data-field="cartItems[<?php echo $cartItem->id; ?>]"><span class="glyphicon glyphicon-minus"></span></button> |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | </span> |
224 | 224 | </div> |
225 | 225 | <?php |
226 | - } |
|
227 | - ?> |
|
226 | + } |
|
227 | + ?> |
|
228 | 228 | |
229 | 229 | </td> |
230 | 230 | <td class="text-right price"><?= number_format($cartItem->price->price, 2, '.', ' '); ?> <?= $cartItem->price->currency ? $cartItem->price->currency->acronym() : ($defaultCurrency ? $defaultCurrency->acronym() : 'Руб.'); ?></td> |
@@ -240,109 +240,109 @@ discard block |
||
240 | 240 | </td> |
241 | 241 | </tr> |
242 | 242 | <?php |
243 | - } |
|
244 | - ?> |
|
243 | + } |
|
244 | + ?> |
|
245 | 245 | </tr> |
246 | 246 | </tbody> |
247 | 247 | <tfoot> |
248 | 248 | <?php |
249 | - $colspan = $cart->card ? 5 : 4; |
|
250 | - ?> |
|
249 | + $colspan = $cart->card ? 5 : 4; |
|
250 | + ?> |
|
251 | 251 | <tr class="order_page-sum"> |
252 | 252 | <td colspan="<?= $colspan; ?>" class="text-right">Сумма:</td> |
253 | 253 | <td colspan="2" class="text-right"><?php |
254 | - foreach ($sums as $currency_id => $sum) { |
|
255 | - if (!$sum) { |
|
256 | - continue; |
|
257 | - } |
|
258 | - echo number_format($sum, 2, '.', ' '); |
|
259 | - if (App::$cur->money) { |
|
260 | - $currency = Money\Currency::get($currency_id); |
|
261 | - if ($currency) { |
|
262 | - echo ' ' . $currency->acronym(); |
|
263 | - } else { |
|
264 | - echo ' руб.'; |
|
265 | - } |
|
266 | - } else { |
|
267 | - echo ' руб.'; |
|
268 | - } |
|
269 | - echo '<br />'; |
|
270 | - } |
|
271 | - ?></td> |
|
254 | + foreach ($sums as $currency_id => $sum) { |
|
255 | + if (!$sum) { |
|
256 | + continue; |
|
257 | + } |
|
258 | + echo number_format($sum, 2, '.', ' '); |
|
259 | + if (App::$cur->money) { |
|
260 | + $currency = Money\Currency::get($currency_id); |
|
261 | + if ($currency) { |
|
262 | + echo ' ' . $currency->acronym(); |
|
263 | + } else { |
|
264 | + echo ' руб.'; |
|
265 | + } |
|
266 | + } else { |
|
267 | + echo ' руб.'; |
|
268 | + } |
|
269 | + echo '<br />'; |
|
270 | + } |
|
271 | + ?></td> |
|
272 | 272 | </tr> |
273 | 273 | <?php |
274 | - if ($cartDelivery) { |
|
275 | - ?> |
|
274 | + if ($cartDelivery) { |
|
275 | + ?> |
|
276 | 276 | <tr class="order_page-deliverySum"> |
277 | 277 | <td colspan="<?= $colspan; ?>" class="text-right"><?= $cartDelivery->name; ?>:</td> |
278 | 278 | <td colspan="2" class="text-right"><?php |
279 | - if ($cartDelivery && $cartDelivery->price_text) { |
|
280 | - echo $cartDelivery->price_text; |
|
281 | - } else { |
|
282 | - echo number_format($deliveryPrice, 2, '.', ' '); |
|
283 | - if ($deliveryCurrency && App::$cur->money) { |
|
284 | - $currency = Money\Currency::get($deliveryCurrency); |
|
285 | - if ($currency) { |
|
286 | - echo ' ' . $currency->acronym(); |
|
287 | - } else { |
|
288 | - echo ' руб.'; |
|
289 | - } |
|
290 | - } else { |
|
291 | - echo ' руб.'; |
|
292 | - } |
|
293 | - } |
|
294 | - ?></td> |
|
279 | + if ($cartDelivery && $cartDelivery->price_text) { |
|
280 | + echo $cartDelivery->price_text; |
|
281 | + } else { |
|
282 | + echo number_format($deliveryPrice, 2, '.', ' '); |
|
283 | + if ($deliveryCurrency && App::$cur->money) { |
|
284 | + $currency = Money\Currency::get($deliveryCurrency); |
|
285 | + if ($currency) { |
|
286 | + echo ' ' . $currency->acronym(); |
|
287 | + } else { |
|
288 | + echo ' руб.'; |
|
289 | + } |
|
290 | + } else { |
|
291 | + echo ' руб.'; |
|
292 | + } |
|
293 | + } |
|
294 | + ?></td> |
|
295 | 295 | </tr> |
296 | 296 | <?php |
297 | - } |
|
298 | - if ($packItem) { |
|
299 | - if ($packchecked) { |
|
300 | - $packSum = ceil(($cart->sum + $deliveryPrice) / 1000) * (float) $packItem->price->price; |
|
301 | - } else { |
|
302 | - $packSum = 0; |
|
303 | - } |
|
304 | - ?> |
|
297 | + } |
|
298 | + if ($packItem) { |
|
299 | + if ($packchecked) { |
|
300 | + $packSum = ceil(($cart->sum + $deliveryPrice) / 1000) * (float) $packItem->price->price; |
|
301 | + } else { |
|
302 | + $packSum = 0; |
|
303 | + } |
|
304 | + ?> |
|
305 | 305 | <tr class="order_page-packSum"> |
306 | 306 | <td colspan="<?= $colspan; ?>" class="text-right">Пакеты:</td> |
307 | 307 | <td colspan="2" class="text-right"><?= number_format($packSum, 2, '.', ' '); ?> руб.</td> |
308 | 308 | </tr> |
309 | 309 | <?php |
310 | - } |
|
311 | - if ($cart->card) { |
|
312 | - ?> |
|
310 | + } |
|
311 | + if ($cart->card) { |
|
312 | + ?> |
|
313 | 313 | <tr class="order_page-discountSum"> |
314 | 314 | <td colspan="<?= $colspan; ?>" class="text-right">Скидка:</td> |
315 | 315 | <td colspan="2" class="text-right"><?= number_format($discountSum, 2, '.', ' '); ?> руб.</td> |
316 | 316 | </tr> |
317 | 317 | <?php |
318 | - } |
|
319 | - if (!isset($sums[$deliveryCurrency])) { |
|
320 | - $sums[$deliveryCurrency] = $deliveryPrice; |
|
321 | - } else { |
|
322 | - $sums[$deliveryCurrency] += $deliveryPrice; |
|
323 | - } |
|
324 | - ?> |
|
318 | + } |
|
319 | + if (!isset($sums[$deliveryCurrency])) { |
|
320 | + $sums[$deliveryCurrency] = $deliveryPrice; |
|
321 | + } else { |
|
322 | + $sums[$deliveryCurrency] += $deliveryPrice; |
|
323 | + } |
|
324 | + ?> |
|
325 | 325 | <tr class="order_page-total"> |
326 | 326 | <td colspan="<?= $colspan; ?>" class="text-right">Итого:</td> |
327 | 327 | <td colspan="2" class="text-right"><?php |
328 | - foreach ($sums as $currency_id => $sum) { |
|
329 | - if (!$sum) { |
|
330 | - continue; |
|
331 | - } |
|
332 | - echo number_format($sum, 2, '.', ' '); |
|
333 | - if (App::$cur->money) { |
|
334 | - $currency = Money\Currency::get($currency_id); |
|
335 | - if ($currency) { |
|
336 | - echo ' ' . $currency->acronym(); |
|
337 | - } else { |
|
338 | - echo ' руб.'; |
|
339 | - } |
|
340 | - } else { |
|
341 | - echo ' руб.'; |
|
342 | - } |
|
343 | - echo '<br />'; |
|
344 | - } |
|
345 | - ?></td> |
|
328 | + foreach ($sums as $currency_id => $sum) { |
|
329 | + if (!$sum) { |
|
330 | + continue; |
|
331 | + } |
|
332 | + echo number_format($sum, 2, '.', ' '); |
|
333 | + if (App::$cur->money) { |
|
334 | + $currency = Money\Currency::get($currency_id); |
|
335 | + if ($currency) { |
|
336 | + echo ' ' . $currency->acronym(); |
|
337 | + } else { |
|
338 | + echo ' руб.'; |
|
339 | + } |
|
340 | + } else { |
|
341 | + echo ' руб.'; |
|
342 | + } |
|
343 | + echo '<br />'; |
|
344 | + } |
|
345 | + ?></td> |
|
346 | 346 | </tr> |
347 | 347 | </tfoot> |
348 | 348 | </table> |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | <div class="clearfix"></div> |
353 | 353 | <div class="order_page-finish"> |
354 | 354 | <?php |
355 | - $form->input('textarea', 'comment', 'Вы можете добавить комментарий к своему заказу', ['value' => (!empty($_POST['comment'])) ? $_POST['comment'] : '']); |
|
356 | - ?> |
|
355 | + $form->input('textarea', 'comment', 'Вы можете добавить комментарий к своему заказу', ['value' => (!empty($_POST['comment'])) ? $_POST['comment'] : '']); |
|
356 | + ?> |
|
357 | 357 | <div class="order_page-orderBtn"> |
358 | 358 | <button name ="action" value ="order" data-loading-text="Подождите.." class="btn btn-primary">Подтверждение заказа</button> |
359 | 359 | </div> |
@@ -363,9 +363,9 @@ discard block |
||
363 | 363 | </div> |
364 | 364 | |
365 | 365 | <?php |
366 | - $form->end(false); |
|
367 | - } |
|
368 | - ?> |
|
366 | + $form->end(false); |
|
367 | + } |
|
368 | + ?> |
|
369 | 369 | </div> |
370 | 370 | </div> |
371 | 371 | </div> |
372 | 372 | \ No newline at end of file |
@@ -3,9 +3,9 @@ |
||
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 { |
|
6 | + if (!$cart || !$cart->cartItems) { |
|
7 | + echo "<h1>Ваша корзина пуста</h1>"; |
|
8 | + } else { |
|
9 | 9 | $sums = []; |
10 | 10 | $cartDelivery = $cart->delivery; |
11 | 11 | $deliveryPrice = 0; |