Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Вывод ссылок в меню


Recommended Posts

Всем привет!

 

Имеется данный бесплатный модуль https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=14861&filter_search=Header Module, в нем все гуд, кроме одного нюанса. Ссылки выводятся только тогда, когда в како-липотому что категории стоит отметка "главное меню". В главном меню не планируется выводить категории, необходимо вывести свои ссылки в люпотому чтом случае вне зависимости от категорий.

 

Да вот, все мои знания структуры и php привели меня к контроллеру tmdheader.php который в install.xml меняет контроллер menu.php. Контроллер модуля практически игдентичен гдефолтному, отличаются несколькими строками. Гуру php помогите разобраться, что нужно сгделать чтобы решить мою проблему, спасипотому что!

 

tmdheader.php:

<?php
class ControllerExtensionTmdHeader extends Controller {
	public function index() {
		$this->load->language('extension/tmdheader');
		
		$data['text_all'] = $this->language->get('text_all');

		// Menu
		$this->load->model('catalog/category');

		$this->load->model('catalog/product');

		$data['categories'] = array();

		$categories = $this->model_catalog_category->getCategories(0);

		foreach ($categories as $category) {
			if ($category['top']) {
				// Level 2
				$children_data = array();

				$children = $this->model_catalog_category->getCategories($category['category_id']);

				foreach ($children as $child) {
					$filter_data = array(
						'filter_category_id'  => $child['category_id'],
						'filter_sub_category' => true
					);

					$children_data[] = array(
						'name'  => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
						'href'  => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
					);
				}

				// Level 1
				$data['categories'][] = array(
					'name'     => $category['name'],
					'children' => $children_data,
					'column'   => $category['column'] ? $category['column'] : 1,
					'href'     => $this->url->link('product/category', 'path=' . $category['category_id'])
				);
			}
		}
		
		$data['headermenus'] = array();
		$this->load->model('extension/headermenu');
		$data['headermenu'] =$this->model_extension_headermenu->getHeadermenu();
		
		return $this->load->view('extension/tmdheader', $data);
	}
}

 

Link to comment
Share on other sites

1 час назад, Tom сказал:

 

Спасипотому что, я уже пыился перегделать данный модуль под 3.0.2.0, сгделать чтобы это рилиило у меня не полулилось. Вот и решил порыться на Opencart.com в поисках готового решения для третей версии. Все устраивает, кроме того, что не получается сгделать без категорий, а подгдержка гденег просит, потому чтолее чем уверен, за пару строк...

Edited by bulldozer323
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.