0

I've installed Magento version 2.1.1 on my localhost. Then created few categories at backend. The issue is when I click on the category, it doesn't show ID of that category after the name of that category as it is showing in Magento1 (http://prntscr.com/e2z79c).

Is this a issue in Magento2? How can I show the ID of category? Any help would be appreciated. Thanks in advance!

2 Answers 2

1

Magento 2 is not showing categories Ids as it is showing in M1. You can check category id in the URL after selecting any category. If you want to show category id then you need to override core functionality of category page.

0

For anyone running into this, this seems to be a bug and it seems to be fixed (see https://github.com/magento/magento2/commit/14028aad37ee7435d89eb3b647e6d03ecd8e2e13) but I still have it in Magento 2.1.5.

A quick fix is : find or extend .. vendor\magento\module-catalog\Controller\Adminhtml\Category\Edit.php and (somewhere around line 102 in public function execute) simply add this line and comment out the other line:

// new line:
$resultPageTitle = $categoryId ? $category->getName() . ' (ID: ' . $categoryId . ')' : __('Categories');
$resultPage->setActiveMenu('Magento_Catalog::catalog_categories');
$resultPage->getConfig()->getTitle()->prepend(__('Categories'));
// remove: $resultPage->getConfig()->getTitle()->prepend($categoryId ? $category->getName() : __('Categories'));
$resultPage->getConfig()->getTitle()->prepend($resultPageTitle);
$resultPage->addBreadcrumb(__('Manage Catalog Categories'), __('Manage Categories'));

Now it will show your category name like this: MyCategory (ID: 15) in the top left corner.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.