Page 1 of 1

create the same left side category menu like in sitemap page

Posted: Wed Nov 09, 2016 3:14 am
by jasminej
opencart 2.3
theme-default

I am New to opencart. I Just want to show all Category & Sub- Categories in every page of my web site as it is in sitemap page ,already tried to edit code in /catalog/controller/extension/module/category.php and also in \catalog\view\theme\default\template\extension\module\category.tpl ,but nothing seems to work for me.

Re: create the same left side category menu like in sitemap

Posted: Thu Nov 10, 2016 5:40 pm
by cyclops12
Would the categories module be any good for you?
If so just goto layouts and add the module to pages you want it to show.

Re: create the same left side category menu like in sitemap

Posted: Mon Nov 14, 2016 4:34 pm
by jasminej
I want to use category module ,but with some changes . For example ` i have three level deep categories
structure (as it's shown on picture 1.jpg).

So ,i want the categories module to show all the categories and subcategories in the same way as it's in sitemap page(index.php?route=information/sitemap) (as it's shown on picture 2.jpg).

i have already tried to edit catalog/controller/extension/module/category.php (maybe the problem is in foreach loop) and also catalog/view/theme/default/template/extension/module/category.tpl ,but nothing really seems to work for me... :(

p.s. Thank you in advance :)

Re: create the same left side category menu like in sitemap

Posted: Tue Nov 15, 2016 5:41 pm
by cyclops12
I would make a seperate module for this.
Copy all the category module files into your new module name then look at the sitemap files for inspiration ;)

Re: create the same left side category menu like in sitemap

Posted: Sat Nov 19, 2016 12:37 am
by cyclops12
Did you have any luck with this ?

Re: create the same left side category menu like in sitemap

Posted: Sat Nov 19, 2016 7:47 pm
by jasminej
Unfortunately ,no .This is still unsolved problem.Really can't find the right solution.

Maybe ,as i should use the same code from sitemap for creating module,it would be easier to edit the default category.php file then creating separete module ???

i wonder ,maybe the problem is in this part of code ??
( \catalog\controller\extension\module\category.php from line 34 )

Code: Select all

foreach ($categories as $category) {
			$children_data = array();

			if ($category['category_id'] == $data['category_id']) {
				$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(
						'category_id' => $child['category_id'],
						'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'])
					);


				}
			}

			$filter_data = array(
				'filter_category_id'  => $category['category_id'],
				'filter_sub_category' => true
			);

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

Re: create the same left side category menu like in sitemap

Posted: Sun Nov 20, 2016 11:56 pm
by cyclops12
Ok then try this, just unzip and follow instructions in Readme file.

Re: create the same left side category menu like in sitemap

Posted: Wed Nov 23, 2016 12:58 am
by jasminej
:yahoo: :yahoo: :yahoo:

Yes !!!Your module is absolutely great ,i can't believe that this problem has been solved ...
THANK YOU SO MUCH FOR THIS GREAT SOLUTION,FOR YOUR HELP ,REPLY AND SUPPORT...
I DEEPLY APPRECIATE IT

Re: create the same left side category menu like in sitemap

Posted: Wed Nov 23, 2016 2:42 am
by cyclops12
Glad to be of help :)