Пошук по сайту
Результати пошуку за тегами 'how to optimize'.
Знайдено 1 результат
-
Я просто не могу не поделиться с вами творением мастера с themeforest https://themeforest.net/item/kept-responsive-opencart-theme/19982236 Я читал этот файл как хороший детектив на ночь. Угадайте куда он цепляется? Правильно! К common/menu! в Opencart 3! Для тех кто не хочет читать и восхищаться - спойлер <?php /* Project - "KEPT" - Responsive OpenCart Premium Theme -------------------------------------------------------------------------------- BUY LICENCE: https://themeforest.net/user/0808web/portfolio Author: ROBERT from 0808web Website: 0808web.com Theme Version: 1.5.0.0 Compatible: OpenCart 3.0.2.0 or higher -------------------------------------------------------------------------------- COPYRIGHT 2017 ROBERT MIRCIOI ALL RIGHTS RESERVED */ if ($this->config->get('config_theme') == 'kept') { if (isset($this->request->get['path'])) { $parts = explode('_', (string)$this->request->get['path']); } else { $parts = array(); } if (isset($parts[0])) { $data['category_1_id'] = $parts[0]; } else { $data['category_1_id'] = 0; } if (isset($parts[1])) { $data['category_2_id'] = $parts[1]; } else { $data['category_2_id'] = 0; } if (isset($parts[2])) { $data['category_3_id'] = $parts[2]; } else { $data['category_3_id'] = 0; } if (isset($parts[3])) { $data['category_4_id'] = $parts[3]; } else { $data['category_4_id'] = 0; } $this->load->model('catalog/category'); $this->load->model('catalog/product'); $data['kept_categories'] = array(); $kept_categories = $this->model_catalog_category->getCategories(0); foreach ($kept_categories as $category_1) { if ($category_1['top']) { $level_2_data = array(); $categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']); foreach ($categories_2 as $category_2) { $level_3_data = array(); $categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']); foreach ($categories_3 as $category_3) { $level_4_data = array(); $categories_4 = $this->model_catalog_category->getCategories($category_3['category_id']); foreach ($categories_4 as $category_4) { $data_category_4 = array('filter_category_id' => $category_4['category_id'], 'filter_sub_category' => false); $product_total_category_4 = $this->model_catalog_product->getTotalProducts($data_category_4); $level_4_data[] = array( 'name' => $category_4['name'] . ($this->config->get('config_product_count') ? '<sup>' . $product_total_category_4 . '</sup>' : ''), 'id' => $category_4['category_id'], 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'] . '_' . $category_4['category_id']) ); } $data_category_3 = array('filter_category_id' => $category_3['category_id'], 'filter_sub_category' => false); $product_total_category_3 = $this->model_catalog_product->getTotalProducts($data_category_3); $level_3_data[] = array( 'name' => $category_3['name'] . ($this->config->get('config_product_count') ? '<sup>' . $product_total_category_3 . '</sup>' : ''), 'id' => $category_3['category_id'], 'children' => $level_4_data, 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id']) ); } $data_category_2 = array('filter_category_id' => $category_2['category_id'], 'filter_sub_category' => false); $product_total_category_2 = $this->model_catalog_product->getTotalProducts($data_category_2); $level_2_data[] = array( 'name' => $category_2['name'] . ($this->config->get('config_product_count') ? '<sup>' . $product_total_category_2 . '</sup>' : ''), 'id' => $category_2['category_id'], 'children' => $level_3_data, 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id']) ); } $data_category_1 = array('filter_category_id' => $category_1['category_id'], 'filter_sub_category' => true); $product_total_category_1 = $this->model_catalog_product->getTotalProducts($data_category_1); $data['kept_categories'][] = array( 'name' => $category_1['name'], 'name_count' => $category_1['name'] . ($this->config->get('config_product_count') ? '<sup>' . $product_total_category_1 . '</sup>' : ''), 'id' => $category_1['category_id'], 'children' => $level_2_data, 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id']) ); } } $data['kept_sidebar_categories'] = array(); $kept_sidebar_categories = $this->model_catalog_category->getCategories(0); foreach ($kept_sidebar_categories as $category_1) { $level_2_data = array(); $categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']); foreach ($categories_2 as $category_2) { $level_3_data = array(); $categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']); foreach ($categories_3 as $category_3) { $level_4_data = array(); $categories_4 = $this->model_catalog_category->getCategories($category_3['category_id']); foreach ($categories_4 as $category_4) { $data_category_4 = array('filter_category_id' => $category_4['category_id'], 'filter_sub_category' => false); $product_total_category_4 = $this->model_catalog_product->getTotalProducts($data_category_4); $level_4_data[] = array( 'name' => $category_4['name'] . ($this->config->get('config_product_count') ? '<sup>' . $product_total_category_4 . '</sup>' : ''), 'id' => $category_4['category_id'], 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'] . '_' . $category_4['category_id']) ); } $data_category_3 = array('filter_category_id' => $category_3['category_id'], 'filter_sub_category' => false); $product_total_category_3 = $this->model_catalog_product->getTotalProducts($data_category_3); $level_3_data[] = array( 'name' => $category_3['name'] . ($this->config->get('config_product_count') ? '<sup>' . $product_total_category_3 . '</sup>' : ''), 'id' => $category_3['category_id'], 'children' => $level_4_data, 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id']) ); } $data_category_2 = array('filter_category_id' => $category_2['category_id'], 'filter_sub_category' => false); $product_total_category_2 = $this->model_catalog_product->getTotalProducts($data_category_2); $level_2_data[] = array( 'name' => $category_2['name'] . ($this->config->get('config_product_count') ? '<sup>' . $product_total_category_2 . '</sup>' : ''), 'id' => $category_2['category_id'], 'children' => $level_3_data, 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id']) ); } $data_category_1 = array('filter_category_id' => $category_1['category_id'], 'filter_sub_category' => true); $product_total_category_1 = $this->model_catalog_product->getTotalProducts($data_category_1); $data['kept_sidebar_categories'][] = array( 'name' => $category_1['name'], 'name_count' => $category_1['name'] . ($this->config->get('config_product_count') ? '<sup>' . $product_total_category_1 . '</sup>' : ''), 'id' => $category_1['category_id'], 'children' => $level_2_data, 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id']) ); } $data['code'] = $this->session->data['language']; $this->load->model('localisation/language'); $results = $this->model_localisation_language->getLanguages(); foreach ($results as $result) { if ($data['code'] == $result['code']) { $data['t08_kept_language'] = $result['language_id']; } } $data['t08_kept_text'] = $this->config->get('theme_kept_text'); $data['t08_kept_header'] = $this->config->get('theme_kept_header'); $data['t08_kept_header_urls'] = $this->config->get('theme_kept_header_url'); }
- 5 відповідей
-
- 1
-
-
- aaaaaaaaaaaaaaaaaaa
- opencart 3
- (і ще 4)