Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to add a sub-category filter like manufacturers


julianpuje

Recommended Posts

Posted

I am trying to show the sub categories at the top of the product listing page the same as the manufacturers box but with that specific categories sub-categories in or a list of some kind.

Or:

eg; when you click on my snooker category I have all the products from the sub cats copied into the parent category, and my category box shows the sub cats. I want the sub cats to show at the top of the listing page but they go when i add a product. There must be an if-else statement in the index.php to show either products or sub-cats i want to show both but can't find the statement.

I hope that makes sense anyway :( you can see what i mean HERE.

Any help appreciated.

 

Thanks

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Posted

I think this is where i need to change the code in my index.php, can anyone please help with this as i am definitely no coder.

 

I need to add another if-else statement to the following so that if ($cateqories_products['total'] > 0) and if ($category_parent['total'] > 0) show both. At the moment it shows one or the other.

 

Any help please?

 

	$category_depth = 'top';

if (isset($cPath) && tep_not_null($cPath)) {

  $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

  $cateqories_products = tep_db_fetch_array($categories_products_query);

  if ($cateqories_products['total'] > 0) {

	$category_depth = 'products'; // display products

  } else {

	$category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");

	$category_parent = tep_db_fetch_array($category_parent_query);

	if ($category_parent['total'] > 0) {

	  $category_depth = 'nested'; // navigate through the categories

	} else {

	  $category_depth = 'products'; // category has no products, but display the 'no products' message

	}

  }
}

 

Thanks

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...