Jump to content

[SOLVED] How to Get All Categories Except 'Home'?


abhisek

Recommended Posts

Thanks, Pascal. It's of much help. However, I spent some time with classes/Category.php and there seems to be no existing function that serves the purpose. So, I made a custom sql inside a function ($id_lang is a parameter of the function OR we can use $this->context->language->id):

	$q = 'SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`
		FROM `'._DB_PREFIX_.'category` c
		LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').')
		'.Shop::addSqlAssociation('category', 'c').'
		WHERE cl.`id_lang` = '.(int)$id_lang.'
		AND c.`id_category` != '.Configuration::get('PS_ROOT_CATEGORY').'
		AND c.`level_depth` > 1
		GROUP BY c.id_category
		ORDER BY c.`id_category`, category_shop.`position`';
Edited by abhisek (see edit history)
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
×
×
  • Create New...