Jump to content

How to hide/disable a category in a specific language?


LMadsen

Recommended Posts

Hello Forum,

I have a webshop in Danish and I have recently translated the product texts into English.
However there are a few categories that makes no sense to translate, because they contain e-products in Danish that are not translated into English(e-books etc.).

Is it possible to hide/disable these categories in English and still have them visible in Danish?

(PS version 1.6.1.23)

Best regards
Lars

Edited by LMadsen (see edit history)
Link to comment
Share on other sites

You can add a condition to:

./controllers/front/CategoryController.php

function: public function initContent()

rg:

public function initContent()
    {
        parent::initContent();

        $this->setTemplate(_PS_THEME_DIR_.'category.tpl');
		
        // prohibited id languages
		$disable_languages = array('1', '2');

		// prohibited id categories
		$disable_categories = array('4', '5', '6');
		
        // hide specific category for specific language
		if (!in_array($this->context->language->id, $disable_languages) && !in_array($this->category->id, $disable_categories)){
			return;
		}
..
..
..
..

 

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