Post by jasminej » Wed Nov 09, 2016 3:14 am

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.

New member

Posts

Joined
Wed Nov 09, 2016 2:56 am

Post by cyclops12 » Thu Nov 10, 2016 5:40 pm

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.

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by jasminej » Mon Nov 14, 2016 4:34 pm

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 :)

Attachments

2.jpg

2.jpg (95.22 KiB) Viewed 1992 times

1.jpg

1.jpg (61.31 KiB) Viewed 1992 times


New member

Posts

Joined
Wed Nov 09, 2016 2:56 am

Post by cyclops12 » Tue Nov 15, 2016 5:41 pm

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 ;)

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by cyclops12 » Sat Nov 19, 2016 12:37 am

Did you have any luck with this ?

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by jasminej » Sat Nov 19, 2016 7:47 pm

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 :-[

New member

Posts

Joined
Wed Nov 09, 2016 2:56 am

Post by cyclops12 » Sun Nov 20, 2016 11:56 pm

Ok then try this, just unzip and follow instructions in Readme file.

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by jasminej » Wed Nov 23, 2016 12:58 am

: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

New member

Posts

Joined
Wed Nov 09, 2016 2:56 am

Post by cyclops12 » Wed Nov 23, 2016 2:42 am

Glad to be of help :)

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am
Who is online

Users browsing this forum: No registered users and 5 guests