Page 1 of 1

Show category ID on categories page right hand column

Posted: Sat Jul 16, 2022 11:40 am
by 14Steve14
I am trying somethin in my current old store and I needed to show the category ID on the right hand side of the category page.

I created the language define and found the place to edit and have added the following to categories.php

Code: Select all

$contents[] = ['text' => TEXT_CATEGORIES_ID . ' ' . ($cInfo->categories_id)];
above

Code: Select all

$contents[] = ['text' => TEXT_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added)];
It does work, but I just wanted to check that I had it right. Is that the correct way to find the category_id.

Re: Show category ID on categories page right hand column

Posted: Sat Jul 16, 2022 12:23 pm
by burt
Yes, that is the way to do it. To save on a core code change, try it with a hook. UNTESTED:

Make file called cat_id.php and upload to /includes/hooks/admin/catalog/

Code: Select all

class hook_admin_catalog_cat_id {
  function listen_infoBox($parameters) {
    global $cInfo;
    
    $parameters['contents'][] = ['text' => TEXT_CATEGORIES_ID . ' ' . ($cInfo->categories_id)];
  }
}
If on an older Phoenix, catalog may need to be categories (in both places in the above code).

Re: Show category ID on categories page right hand column

Posted: Sat Jul 16, 2022 1:14 pm
by 14Steve14
Cheers Gary. Hopefully its only a temporary thing.