Post by jkungfu » Wed Jan 20, 2010 3:42 pm

thanks! it works!

淄博网站建设, 淄博网站优化


Active Member

Posts

Joined
Fri Jan 01, 2010 8:03 pm


Post by lith07 » Thu Jan 21, 2010 3:54 am

Hey does anyone know how to do this in v0.x? Thanks!

New member

Posts

Joined
Thu Jan 14, 2010 2:20 pm

Post by WSurfer » Wed Jul 21, 2010 9:56 pm

Qphoria wrote:Try this:

Change:

Code: Select all

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

Code: Select all

if (substr_count($new_path, '_') < 1) {
    $children = $this->getCategories($result['category_id'], $new_path);
}
Hi!

I applied this code to my web store and it's working great; I set < 2 so main category and subcategory are displayed.
But here is the problem... I have 2nd and 3rd level sub categories added to my categories as well and in case someone click in 1st level of subcategory second one (second level of subcategory) doesn't appear.

What I would like is to have displayed main category and first subcategory, but when someone click on this subcategory, subcategory of this subcategory should be displayed as well (in case there is sub-subcategory).

Can someone please help me on this?

http://playroom.si


New member

Posts

Joined
Thu Mar 11, 2010 5:17 am

Post by Boxerworks » Mon Aug 30, 2010 7:10 am

We too are having this same issue. Boxerworks is using the latest incarnation of OpenCart - 1.4.9. I would have thought something like this would have been solved WAY before now as it appears to be an ongoing issue starting many versions back.

Is there a mod someone can recommend that would provide a bandaid for this issue? Please advise ASAP. Thank you.

Newbie

Posts

Joined
Fri Aug 27, 2010 12:13 am

Post by hagelslag » Thu Oct 14, 2010 8:01 pm

Qphoria wrote:all categories work with SEO for me.. even 4 levels deep
Hi Q,

How do you do that?
As soon as i use a SEO keyword for a product, the breadcrumb and Category module links are lost as soon as you click that product.

I have set up an example with 2 products here:
http://bit.ly/cpuD61


One product with an SEO keyword, and one without. As you can see, if you click the left one, the subcat. closes and the subcat in the breadcrumb padth too.
Any idea why?

Thanks in advance!

Newbie

Posts

Joined
Tue Apr 20, 2010 10:38 pm

Post by Qphoria » Thu Oct 14, 2010 9:05 pm

I dont' see any SEO on your site.
My demo shows
Desktop as the parent category with seo "desktop"
PC as the subcategory with seo "pc"
HP LP3065 as the product with seo "HP-LP3065"

http://unbannable.com/v149/desktops/pc

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by hagelslag » Thu Oct 14, 2010 9:24 pm

Hi,
First i only had SEO on the product itself. Now with SEO on the cat and subcat it works! Thanks.

Newbie

Posts

Joined
Tue Apr 20, 2010 10:38 pm

Post by hagelslag » Thu Oct 14, 2010 9:25 pm

Q, it even works perfect with your multiple cat block module!!
Great.

Newbie

Posts

Joined
Tue Apr 20, 2010 10:38 pm

Post by jty » Fri Oct 15, 2010 11:30 pm

hagelslag wrote:Q, it even works perfect with your multiple cat block module!!
Great.
Thanks Hagelslag
With the help of Mr Q's Category Box Clone found here http://theqdomain.com/ocstore/opencart_ ... _box_clone
I have been able to solve my menu problem that has been frustrating me for a couple of months.

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by grongor » Sat Oct 23, 2010 2:19 am

hagelslag wrote: Hi Q,
How do you do that?
As soon as i use a SEO keyword for a product, the breadcrumb and Category module links are lost as soon as you click that product.
I have set up an example with 2 products here:
http://bit.ly/cpuD61
One product with an SEO keyword, and one without. As you can see, if you click the left one, the subcat. closes and the subcat in the breadcrumb padth too.
Any idea why?
Thanks in advance!
Hello, I had same problem too now. I was looking into it for some minutes and I think I figured it out. I am using OC just one day lol, but I hope it will work, try it:
Instead of lines ~55-57

Code: Select all

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

Code: Select all

if ($category_id == $result['category_id']) {
	$children = $this->getCategories($result['category_id'], $new_path);
}elseif(substr_count($new_path, '_') < 1){
        array_unshift( $this->path, $category_id );
        $children = $this->getCategories($result['category_id'], $new_path);
 }
If you find an bug, please tell me :)

Newbie

Posts

Joined
Sat Oct 23, 2010 2:15 am

Post by pixelpuncher » Tue Jul 12, 2011 4:00 pm

thank you!!!

Newbie

Posts

Joined
Sun Jul 03, 2011 3:09 pm

Post by DrunkMunki » Sun Jul 17, 2011 6:05 pm

is there a version of this code for version 1.5?
i notice the html code is the same, the php code is different, could this be done through css?

attached is the /catalog/controller/module/category.php file.

Code: Select all

<?php  
class ControllerModuleCategory extends Controller {
	protected function index() {
		$this->language->load('module/category');
		
    	$this->data['heading_title'] = $this->language->get('heading_title');
		
		if (isset($this->request->get['path'])) {
			$parts = explode('_', (string)$this->request->get['path']);
		} else {
			$parts = array();
		}
		
		if (isset($parts[0])) {
			$this->data['category_id'] = $parts[0];
		} else {
			$this->data['category_id'] = 0;
		}
		
		if (isset($parts[1])) {
			$this->data['child_id'] = $parts[1];
		} else {
			$this->data['child_id'] = 0;
		}
							
		$this->load->model('catalog/category');
		$this->load->model('catalog/product');
		
		$this->data['categories'] = array();
					
		$categories = $this->model_catalog_category->getCategories(0);
		
		foreach ($categories as $category) {
			$children_data = array();
			
			$children = $this->model_catalog_category->getCategories($category['category_id']);
			
			foreach ($children as $child) {
				$data = array(
					'filter_category_id'  => $child['category_id'],
					'filter_sub_category' => true
				);		
					
				$product_total = $this->model_catalog_product->getTotalProducts($data);
							
				$children_data[] = array(
					'category_id' => $child['category_id'],
					'name'        => $child['name'] . ' (' . $product_total . ')',
					'href'        => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])	
				);					
			}
			
			$data = array(
				'filter_category_id'  => $category['category_id'],
				'filter_sub_category' => true	
			);		
				
			$product_total = $this->model_catalog_product->getTotalProducts($data);
						
			$this->data['categories'][] = array(
				'category_id' => $category['category_id'],
				'name'        => $category['name'] . ' (' . $product_total . ')',
				'children'    => $children_data,
				'href'        => $this->url->link('product/category', 'path=' . $category['category_id'])
			);
		}
		
		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();
  	}
}
?>

Newbie

Posts

Joined
Sun Jul 17, 2011 6:02 pm

Post by DrunkMunki » Thu Jul 21, 2011 4:17 pm

ok i think i have solved my issue, all i did was change/remove

Code: Select all

.box-category > ul > li ul {
	display: none;
}
to

Code: Select all

.box-category > ul > li ul {
	/*display: none;*/
}
e.g remove the display: none

Newbie

Posts

Joined
Sun Jul 17, 2011 6:02 pm

Post by OnNets » Fri Aug 12, 2011 2:05 pm

Hi,

Any update for v1.5.1.1 ?

I want to make the sub-category always showing.

Thanks

New member

Posts

Joined
Wed Jan 06, 2010 5:53 pm

Post by OnNets » Sun Aug 21, 2011 7:52 pm

Anyone....help??

New member

Posts

Joined
Wed Jan 06, 2010 5:53 pm

Post by kevinbud » Sun Sep 25, 2011 7:20 pm

Did anyone figure this out (subcategories always showing) in v1.5.1?

Thanks

Newbie

Posts

Joined
Wed Sep 07, 2011 8:24 pm

Post by Qphoria » Sun Sep 25, 2011 9:33 pm

If you follow DrunkMunki's post that will show all subs at all times. However, there is a 2 level max that can be displayed at this time so if you have:
Parent
----SubA
----SubB
--------SubSubB


You won't see SubSubB as it is the 3rd level

This was done to cut down on the page loading times because the recursive category query is very taxing.

But perhaps that should be left to the discretion of the admin to choose how many levels are shown at the per-module basis.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Xciso » Wed Nov 16, 2011 4:01 am

Anyone know how to fix this for 1.5.1.3?
Or how i can make a tree. U know with the + if it excist subs and - if it not excist..

Please help!

Active Member

Posts

Joined
Fri Jul 15, 2011 5:20 am

Post by quocbinhvip » Sat Nov 19, 2011 1:19 am

grongor wrote: Hello, I had same problem too now. I was looking into it for some minutes and I think I figured it out. I am using OC just one day lol, but I hope it will work, try it:
Instead of lines ~55-57

Code: Select all

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

Code: Select all

if ($category_id == $result['category_id']) {
	$children = $this->getCategories($result['category_id'], $new_path);
}elseif(substr_count($new_path, '_') < 1){
        array_unshift( $this->path, $category_id );
        $children = $this->getCategories($result['category_id'], $new_path);
 }
If you find an bug, please tell me :)
It works very well. but I need a little more such as:
----SubA
--------Sub Su1
--------SubSub2
----SubB
--------Sub Su1
--------SubSub2
--------Sub Su3
--------SubSub4
We hope to receive help from you. thanks much

https://quocbinhvip.blogspot.com
https://sites.google.com/site/qbinh68/
https://sites.google.com/site/qbinh68/t ... t/opencart


New member

Posts

Joined
Sun Mar 20, 2011 3:58 pm

Post by xseon » Thu Dec 01, 2011 4:03 pm

The solution here is the same as the one found at One more level of subcategory. The only difference is that instead of

Code: Select all

if($sisters) {
foreach ($sisters as $sisterMember) {
they suggest using

Code: Select all

if(count($sisters) > 1) {
foreach ($sisters as $sisterMember) {
And there is some CSS rules defined.

I can confirm that the SEO URL problem also solves if all categories within a brunch (both parents and children) have their SEO keyword set. BTW, in my oppinion, 'SEO address' would be more relevant than 'SEO keyword'.

So, I think this topic is SOLVED.

Deeper and Better Category Module
Mass Product Price Change
Unlimited hosting with free domain and all extras


User avatar
New member

Posts

Joined
Thu Dec 01, 2011 3:04 pm
Location - Bulgaria
Who is online

Users browsing this forum: No registered users and 44 guests