How to use phpMyAdmin to move products from one category to another in PrestaShop
One way to move products from one category to another is by using the admin panel. This can be done when editing each individual product. When you edit a product in PrestaShop 1.4 the setting is on the Info sub-tab page, while to configure the setting when editing a product in PrestaShop 1.5 and newer versions you have to click on the Associations button on the left. This is useful if you want to move several products. However, if the category contains a lot of products and you want to move all of them, the task will be too lengthy and time-consuming.
You can move all products from one category to another directly in the database with a single SQL query. You can do that with phpMyAdmin. You can access phpMyAdmin from the Databases section of the Pixie control panel; there's a phpMyAdmin link in the black area on the right.
After you access phpMyAdmin you'll see the databases that you have created in the frame on the left. Click on the name of the database in which the particular PrestaShop instance is installed. This will display the tables of the database in the right frame. Click on the SQL tab that's above the tables. This will display a text area. In the text area type the following query:
UPDATE `prestashop_category_product` SET `id_category` = 6 WHERE `id_category` = 9
Then click on the Go button in the lower right corner to execute the query. You have to replace prestashop with the actual table prefix of your database, and change the category IDs with those of the particular categories. With the above example query all products from category 9 will be moved to the category with id 6.
If you're not sure what the IDs of the categories are, you can check them in the admin panel of your PrestaShop. In PrestaShop 1.4 just click on the Catalog tab, and in PrestaShop 1.5 and newer versions go to Catalog>Categories. In the table listing the categories there's a column that shows the ID of each category.
Was this answer helpful?
- How to create and manage credit slips in PrestaShop 1.5-1.6
- How to add and manage customer groups in PrestaShop 1.5-1.6
- How to remove the phone fields from the customer registration form in PrestaShop
- How to turn on error reporting in PrestaShop
- How to add a red asterisk to a field on the registration form in PrestaShop