How to change product categories in Magento via MySQL?

0

I've imported the from the products in my store but they came with the categories all changed.

Is there any way to change the categories via or some other faster way?

    
asked by anonymous 12.03.2014 / 18:31

1 answer

1

How to use phpMyAdmin to move products from one category to another in Magento

The administration panel offers a couple of ways to move products from one category to another. For example, you can move a single product by editing that product. When you go to Catálogo > Gerenciar os produtos and open the editing screen of a product there is a left button that you can use to select which category (categories) the product should be associated with. Another way is to edit the category. When you go to Catálogo > Gerenciar Categorias and open the edit screen of a category, you can use the categoria de Produtos tab to remove products from the category or associate products with the category.

By modifying the database in which your Magento is installed, you can quickly move products from one category to another. For example, this is a quick fix if you want to move all products from one category to another. You can do this with phpMyAdmin.

You can do this with a SQL query that looks like this:

UPDATE 'magento_catalog_category_product' SET 'category_id' = 8 WHERE 'category_id' = 7

In the query you run you need to replace magento with the actual prefix of your database tables (if you have a prefix). You also have to replace the category IDs with those of the specific categories.

In our query example above all products in category 7 will be moved to category with ID 8. If you are not sure that the IDs of your categories are in a way to verify that you are in the admin panel of your Magento. When you go to Catálogo > Gerenciar Categorias and you click on a category, it will show not only the category settings, but also your name and ID (at the top, above the category settings).

After you run the query reindex the Magento data. You can do this from the admin panel of Sistema > Gerenciar Índices .

Font

    
01.04.2014 / 23:02