Jump to content

Category Footer / Categories Level Output / Multishop


dogbytes.ch

Recommended Posts

Hi

 

I'm using PS 1.6.1.7 and Modula Theme installed. The shop is preconfigured for multishop enviroment, that means the feature is not activate, but I set up a category tree like this:

Shop 1 (www.cbd.ch)

- Cat 1.1

- Cat 1.2

 

Shop 2 (inactive)

- Cat 2.1

- Cat 2.2

 

So now I want to output the categories from Shop 1 in the Category Block in Footer. How can I do it, because with every setting I tried, the wrong output was published in this block.

 

I need the help of you professionals out there. Until now, on every article of me in this forum, I get no answers.  :(  Do anyone read articles/questions in this forum?

Thanks for your help.

Urs

Edited by dogbytes.ch (see edit history)
Link to comment
Share on other sites

It's the following code on line 295 of modules/blockcategories/blockcategories.php that gets the categories in the footer:

			if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
				SELECT DISTINCT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
				FROM `'._DB_PREFIX_.'category` c
				'.Shop::addSqlAssociation('category', 'c').'
				LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('cl').')
				LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
				WHERE (c.`active` = 1 OR c.`id_category` = '.(int)Configuration::get('PS_ROOT_CATEGORY').')
				'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
				AND cg.`id_group` IN ('.pSQL($groups).')
				ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'category_shop.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC')))

You could try changing the WHERE clause to:

				WHERE category_shop.`id_shop` = '.(int)$this->context->shop->id.' AND (c.`active` = 1 OR c.`id_category` = '.(int)Configuration::get('PS_ROOT_CATEGORY').')

This should select only the categories from the current shop.

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...