Jump to content

How to get category_id and how to insert that into a new db


vazeem

Recommended Posts

It depends on where you try to get the category id. Is it inside the function of a module, a module hooked on a action, a function inside your own Front/Admin controller?

Try to give a more detailed scenario of what you're trying to do.

  • Like 1
Link to comment
Share on other sites

The code you are trying is working in renderForm().

It also works in renderList() if you're in a parent category other than Home.

Instead of echo use d($id_category) to output only the variable value.

 

A better alternative to get the category id if you're in a function that is fired after the init() function is:

$this->_category->id;
  • Like 1
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...