Jump to content

Product delete/update category very slow


Recommended Posts


I'm developing a module to import data from CSV. The whole process works fine, unless I have to massively update product categories. In this case I want to remove the old categories from the product and let only the new one. Here's an example:

CSV 1, categories: 200, 300, 400
CSV 2, categories: 200, 301, 401

After the first run my product will have categories like in CSV 1 row, after the second import it will have categories like CSV 2 row. Category 300 and 400 will be removed from it using the Product.php deleteCategory method.
After that, categories are updated using the Product.php updateCategories method: this two operations take a lot of time, which can vary from around 6 or 7 seconds to several minutes per product, depending on the server.
Is this the right procedure to follow in order to always have an updated situation for product categories? Do you have any suggestions on what I could change to improve it?
Thank you.

Link to comment
Share on other sites

  • 2 years later...

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...