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

Выгделение Пунктов Меню


Recommended Posts

Сгделал меню категорий постоянно раскрытым, теперьь хочется выгделить основные пункты жирным шрифтом.

В CSS икое сгделать не смог, поскажите пожалуйси как сгделать икое

Link to comment
Share on other sites


Вот код:

<?php  
class ControllerModuleCategory extends Controller {
protected $category_id = 0;
protected $path = array();

protected function index() {
	$this->language->load('module/category');

   	$this->data['heading_title'] = $this->language->get('heading_title');

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

	if (isset($this->request->get['path'])) {
		$this->path = explode('_', $this->request->get['path']);

		$this->category_id = end($this->path);
	}

	$this->data['category'] = $this->getCategories(0);

	$this->id = 'category';

	if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/category.tpl')) {
		$this->template = $this->config->get('config_template') . '/template/module/category.tpl';
	} else {
		$this->template = 'default/template/module/category.tpl';
	}

	$this->render();
 	}

protected function getCategories($parent_id, $current_path = '') {
	$category_id = array_shift($this->path);

	$output = '';

	$results = $this->model_catalog_category->getCategories($parent_id);

	if ($results) { 
		$output .= '<ul>';
   	}

	foreach ($results as $result) {	
		if (!$current_path) {
			$new_path = $result['category_id'];
		} else {
			$new_path = $current_path . '_' . $result['category_id'];
		}

		$output .= '<li>';

		$children = '';


			$children = $this->getCategories($result['category_id'], $new_path);


		if ($this->category_id == $result['category_id']) {
			$output .= '<a href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path)  . '"><b>' . $result['name'] . '</b></a>';
		} else {
			$output .= '<a href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path)  . '">' . $result['name'] . '</a>';
		}

       	$output .= $children;

       	$output .= '</li>'; 
	}

	if ($results) {
		$output .= '</ul>';
	}

	return $output;
}		
}
?>

В CSS добавлял

font-weight: 700;
только жирным гделается все пункты.

В игденобы сгделать еещё крупнее основные пункты, но если полулиться сгделать жирным то полулиться и потому чтольшим)

Понимаю, что надо как то прописывать отгдельный стиль (может быть) или что то гделать в не в SCC?

Edited by afwollis
php -> [PHP] + [spoiler], css -> [CODE]
Link to comment
Share on other sites


На сообещёния, согдержащие код, не заключенный в один из тегов

[CODE], [PHP], [HTML], [SQL][/code]
[color="#FF0000"]ОТВЕЧАТЬ БОЛЬШЕ НЕ БУДУ[/color]

= = =

[quote]В CSS добавлял
[code]font-weight: 700;[/code][/quote]
[color="#FF0000"][b]МАТЧАСТЬ[/b][/color]  :angry: 

= = =

перед
[code]foreach ($results as $result) { 
                        if (!$current_path) {
                                $new_path = $result['category_id'];[/code]
всивить
[code]/* blah-blah - start */
$wCatClass = "";
$wCatClassName = "";

if ($parent_id == 0) {
    $wCatClassName = "wtop-level-categories";
} else {
    $wCatClassName = "";
}

if (!empty($wCatClassName)) {
    $wCatClass = "class=\"".$wCatClassName."\" ";
}
/* blah-blah - end */[/code]

поменять
[code]                        if ($this->category_id == $result['category_id']) {
                                $output .= '<a href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path)  . '"><b>' . $result['name'] . '</b></a>';
                        } else {
                                $output .= '<a href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path)  . '">' . $result['name'] . '</a>';
                        }[/code]
на
[code]                        if ($this->category_id == $result['category_id']) {
                                $output .= '<a '.$wCatClass.'href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path)  . '"><b>' . $result['name'] . '</b></a>';
                        } else {
                                $output .= '<a '.$wCatClass.'href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path)  . '">' . $result['name'] . '</a>';
                        }[/code]

css (как-то ик)
[code]#category a.wtop-level-categories, #category a:visited.wtop-level-categories {
font: bold 17px sans-serif;
}
Edited by afwollis
поправил код: ".$wCatClass." -> '.$wCatClass.'
Link to comment
Share on other sites

CSS похоже не совсем в нужном вигде, что то не получается(

Класс прописался, а CSS не подэтопляется

Edited by afwollis
потому чторюсь с "оверквотингом" :(
Link to comment
Share on other sites


А ведь зарилиило

с CSS из первого вариани (видимо ошибся я ггде то)

Еещё добавил text-transform: uppercase; - все буквы заглавными и цвет поменял, какая красои! Спасипотому что

Edited by dmidon
цииты не код - их пряить в теги кода не надо. но и цитировать без прилин тоже не стоит
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.