1: | <?php
|
2: | namespace Opencart\Catalog\Controller\Extension\Opencart\Module;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Store extends \Opencart\System\Engine\Controller {
|
9: | |
10: | |
11: | |
12: | |
13: |
|
14: | public function index(): string {
|
15: | $status = true;
|
16: |
|
17: | if ($this->config->get('module_store_admin')) {
|
18: | $this->user = new \Opencart\System\Library\Cart\User($this->registry);
|
19: |
|
20: | $status = $this->user->isLogged();
|
21: | }
|
22: |
|
23: | if ($status) {
|
24: | $this->load->language('extension/opencart/module/store');
|
25: |
|
26: | $data['store_id'] = $this->config->get('config_store_id');
|
27: |
|
28: | $data['stores'] = [];
|
29: |
|
30: | $data['stores'][] = [
|
31: | 'store_id' => 0,
|
32: | 'name' => $this->language->get('text_default'),
|
33: | 'url' => HTTP_SERVER . 'index.php?route=common/home&session_id=' . $this->session->getId()
|
34: | ];
|
35: |
|
36: | $this->load->model('setting/store');
|
37: |
|
38: | $results = $this->model_setting_store->getStores();
|
39: |
|
40: | foreach ($results as $result) {
|
41: | $data['stores'][] = [
|
42: | 'store_id' => $result['store_id'],
|
43: | 'name' => $result['name'],
|
44: | 'url' => $result['url'] . 'index.php?route=common/home&session_id=' . $this->session->getId()
|
45: | ];
|
46: | }
|
47: |
|
48: | return $this->load->view('extension/opencart/module/store', $data);
|
49: | } else {
|
50: | return '';
|
51: | }
|
52: | }
|
53: | }
|
54: | |