PrestaShop get current category information
Today we talk about how PrestaShop get current category information. You can use this code in hook related to the category page or controller and any other class. In this example, it will be shown the category name and category description, and other information. So let’s start with our example.
$categoryId = (int)Tools::getValue('id_category'); // get current category id
$categoryData = new Category ($categoryId,Context::getContext()->language->id); // get category object with id
$name = $categoryData->name; // get category name
$description = $categoryData->description; // get category description
$categoryData = new Category ($categoryId,Context::getContext()->language->id); // get category object with id
$name = $categoryData->name; // get category name
$description = $categoryData->description; // get category description