Magento – How to Find Category Store ID

store-id

Magento categories and store id's.

In the catalog_category_flat_store_1 database table it says the store_id is 1.

When I checked catalog_category_entity_int al entries have a store_id of 0.

If I update this to 1 all categories disappear from the front end.

Manage Stores indicates:
Main Website id: 1
Main website store id: 1
Store view name engligh id: 1

I am having issues with updating categories displaying in navigation menu and wanted to confirm if its normal for magento to have to different store ids in the database tables.

Best Answer

First of all you should not edit the db directly.
Now an explanation.
store_id = 0 in a catalog_category_entity_* table means that this is the value set for an attribute on the 'Default config' level.
having all of them set to 0 means that you don't have any values set for a specific store view for any attributes. This means that all store views will use the default values for all the attributes.

The tables catalog_category_flat_store_* are autogenerated tables to speed up the reading process on the frontend.
The last number in the table name (1 in your example) is the store view id that will use this table.
the column store_id in these flat tables will always be the same as the last number in the table name even if it's 0 in the EAV tables.
This way you won't get strage results when calling $category->getStoreId().
So put everything back as it was before.
If you have issues with updating categories please ask a new question explaining what the issue is and what you are trying to achieve.