category_ids to category in magento

category_ids to category in magento

September 2, 2026 · Illustrated author avatarBy Stefan Bogdanescu
category_ids to category in magento

Migrating Magento Categories: Converting category_ids to _category

As you’re upgrading from Magento 1.3 to 1.6, you’ve likely noticed the shift in how categories are exported - moving from category_ids to _category. While this change simplifies the import process in later versions, it introduces a compatibility issue when trying to migrate your existing data.

Understanding the Category Structure

In Magento 1.3, category information is stored differently than in 1.6. The catalog_category_entity_varchar table holds some of the category data, but not all of it. Specifically, the value_id field you’re looking at corresponds to the category_id from the catalog_category_entity table.

Querying for Category Names

To retrieve the actual category names from your Magento 1.3 database, you’ll need to join several tables together:

SELECT cce.name FROM catalog_category_entity AS cce
JOIN eav_attribute AS ea ON (cce.entity_id = ea.entity_id AND ea.attribute_code = 'name')
JOIN eav_attribute_set AS eas ON (ea.attribute_set_id = eas.attribute_set_id)
WHERE cce.entity_type_id = 3;

This query retrieves all the category names from the catalog_category_entity table, which is where your actual category data resides.

Converting category_ids to Category Names

Now let’s convert those cryptic category_ids into human-readable names. To do this, we can use a subquery:

SELECT
    p.entity_id,
    GROUP_CONCAT(CONCAT(c.name, ', ') SEPARATOR '') AS categories
FROM
    catalog_product_entity AS p
LEFT JOIN
    catalog_category_product_index AS cpi ON (p.entity_id = cpi.product_id)
LEFT JOIN
    catalog_category_entity AS c ON (cpi.category_id = c.entity_id)
WHERE
    p.entity_id IN (154, 59, 63, 88, 61) -- replace with your product IDs
GROUP BY
    p.entity_id;

This query will return each product’s entity_id along with a comma-separated list of its associated category names.

Migrating Data Between Magento Versions

When it comes to migrating data between different Magento versions, always follow these best practices:

  1. Back up your existing database before making any changes.
  2. Export the minimum required data and use the default profile for compatibility.
  3. Test the import on a staging environment first.
  4. If possible, upgrade your database schema using Magento’s built-in tools.

For more detailed guidance on Magento upgrades and migrations, I recommend checking out our comprehensive guide at Laravel Company.

Conclusion

While the shift from category_ids to _category in Magento 1.6 simplifies imports, it requires careful data mapping during migrations. By understanding your database schema and using appropriate SQL queries, you can successfully convert category IDs into meaningful names.

Remember to always backup your data before making changes and test the migration process thoroughly on a staging environment before applying it to your production site. If you require further assistance with Magento upgrades or have any other development needs, don’t hesitate to contact our team at Laravel Company.

Magento 1 Catalog Database Import/Export

Our network