1: | <?php
|
2: | namespace Opencart\Catalog\Controller\Checkout;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Checkout extends \Opencart\System\Engine\Controller {
|
9: | |
10: | |
11: |
|
12: | public function index(): void {
|
13: |
|
14: | if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))) {
|
15: | $this->response->redirect($this->url->link('checkout/cart', 'language=' . $this->config->get('config_language'), true));
|
16: | }
|
17: |
|
18: |
|
19: | $products = $this->cart->getProducts();
|
20: |
|
21: | foreach ($products as $product) {
|
22: | if (!$product['minimum']) {
|
23: | $this->response->redirect($this->url->link('checkout/cart', 'language=' . $this->config->get('config_language'), true));
|
24: |
|
25: | break;
|
26: | }
|
27: | }
|
28: |
|
29: | $this->load->language('checkout/checkout');
|
30: |
|
31: | $this->document->setTitle($this->language->get('heading_title'));
|
32: |
|
33: | $data['breadcrumbs'] = [];
|
34: |
|
35: | $data['breadcrumbs'][] = [
|
36: | 'text' => $this->language->get('text_home'),
|
37: | 'href' => $this->url->link('common/home', 'language=' . $this->config->get('config_language'))
|
38: | ];
|
39: |
|
40: | $data['breadcrumbs'][] = [
|
41: | 'text' => $this->language->get('text_cart'),
|
42: | 'href' => $this->url->link('checkout/cart', 'language=' . $this->config->get('config_language'))
|
43: | ];
|
44: |
|
45: | $data['breadcrumbs'][] = [
|
46: | 'text' => $this->language->get('heading_title'),
|
47: | 'href' => $this->url->link('checkout/checkout', 'language=' . $this->config->get('config_language'))
|
48: | ];
|
49: |
|
50: | if (!$this->customer->isLogged()) {
|
51: | $data['register'] = $this->load->controller('checkout/register');
|
52: | } else {
|
53: | $data['register'] = '';
|
54: | }
|
55: |
|
56: | if ($this->customer->isLogged() && $this->config->get('config_checkout_payment_address')) {
|
57: | $data['payment_address'] = $this->load->controller('checkout/payment_address');
|
58: | } else {
|
59: | $data['payment_address'] = '';
|
60: | }
|
61: |
|
62: | if ($this->customer->isLogged() && $this->cart->hasShipping()) {
|
63: | $data['shipping_address'] = $this->load->controller('checkout/shipping_address');
|
64: | } else {
|
65: | $data['shipping_address'] = '';
|
66: | }
|
67: |
|
68: | if ($this->cart->hasShipping()) {
|
69: | $data['shipping_method'] = $this->load->controller('checkout/shipping_method');
|
70: | } else {
|
71: | $data['shipping_method'] = '';
|
72: | }
|
73: |
|
74: | $data['payment_method'] = $this->load->controller('checkout/payment_method');
|
75: | $data['confirm'] = $this->load->controller('checkout/confirm');
|
76: |
|
77: | $data['column_left'] = $this->load->controller('common/column_left');
|
78: | $data['column_right'] = $this->load->controller('common/column_right');
|
79: | $data['content_top'] = $this->load->controller('common/content_top');
|
80: | $data['content_bottom'] = $this->load->controller('common/content_bottom');
|
81: | $data['footer'] = $this->load->controller('common/footer');
|
82: | $data['header'] = $this->load->controller('common/header');
|
83: |
|
84: | $this->response->setOutput($this->load->view('checkout/checkout', $data));
|
85: | }
|
86: | }
|
87: | |