docs/api/source-catalog.controller.common.content_top.html
| 1: | <?php | | 2: | namespace Opencart\Catalog\Controller\Common; | | 3: | /** | | 4: | * Class Content Top | | 5: | * | | 6: | * @package Opencart\Catalog\Controller\Common | | 7: | */ | | 8: | class ContentTop extends \Opencart\System\Engine\Controller { | | 9: | /** | | 10: | * @return string | | 11: | */ | | 12: | public function index(): string { | | 13: | $this->load->model('design/layout'); | | 14: | | | 15: | if (isset($this->request->get['route'])) { | | 16: | $route = (string)$this->request->get['route']; | | 17: | } else { | | 18: | $route = 'common/home'; | | 19: | } | | 20: | | | 21: | $layout_id = 0; | | 22: | | | 23: | if ($route == 'product/category' && isset($this->request->get['path'])) { | | 24: | $this->load->model('catalog/category'); | | 25: | | | 26: | $path = explode('_', (string)$this->request->get['path']); | | 27: | | | 28: | $layout_id = $this->model_catalog_category->getLayoutId((int)end($path)); | | 29: | } | | 30: | | | 31: | if ($route == 'product/product' && isset($this->request->get['product_id'])) { | | 32: | $this->load->model('catalog/product'); | | 33: | | | 34: | $layout_id = $this->model_catalog_product->getLayoutId((int)$this->request->get['product_id']); | | 35: | } | | 36: | | | 37: | if ($route == 'product/manufacturer.info' && isset($this->request->get['manufacturer_id'])) { | | 38: | $this->load->model('catalog/manufacturer'); | | 39: | | | 40: | $layout_id = $this->model_catalog_manufacturer->getLayoutId((int)$this->request->get['manufacturer_id']); | | 41: | } | | 42: | | | 43: | if ($route == 'information/information' && isset($this->request->get['information_id'])) { | | 44: | $this->load->model('catalog/information'); | | 45: | | | 46: | $layout_id = $this->model_catalog_information->getLayoutId((int)$this->request->get['information_id']); | | 47: | } | | 48: | | | 49: | if ($route == 'cms/blog.info' && isset($this->request->get['article_id'])) { | | 50: | $this->load->model('cms/article'); | | 51: | | | 52: | $layout_id = $this->model_cms_article->getLayoutId((int)$this->request->get['article_id']); | | 53: | } | | 54: | | | 55: | if (!$layout_id) { | | 56: | $layout_id = $this->model_design_layout->getLayout($route); | | 57: | } | | 58: | | | 59: | if (!$layout_id) { | | 60: | $layout_id = $this->config->get('config_layout_id'); | | 61: | } | | 62: | | | 63: | $this->load->model('setting/module'); | | 64: | | | 65: | $data['modules'] = []; | | 66: | | | 67: | $modules = $this->model_design_layout->getModules($layout_id, 'content_top'); | | 68: | | | 69: | foreach ($modules as $module) { | | 70: | $part = explode('.', $module['code']); | | 71: | | | 72: | if (isset($part[1]) && $this->config->get('module_' . $part[1] . '_status')) { | | 73: | $module_data = $this->load->controller('extension/' . $part[0] . '/module/' . $part[1]); | | 74: | | | 75: | if ($module_data) { | | 76: | $data['modules'][] = $module_data; | | 77: | } | | 78: | } | | 79: | | | 80: | if (isset($part[2])) { | | 81: | $setting_info = $this->model_setting_module->getModule((int)$part[2]); | | 82: | | | 83: | if ($setting_info && $setting_info['status']) { | | 84: | $output = $this->load->controller('extension/' . $part[0] . '/module/' . $part[1], $setting_info); | | 85: | | | 86: | if ($output) { | | 87: | $data['modules'][] = $output; | | 88: | } | | 89: | } | | 90: | } | | 91: | } | | 92: | | | 93: | return $this->load->view('common/content_top', $data); | | 94: | } | | 95: | } | | 96: | |
OpenCart API API documentation generated by ApiGen dev-master