Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Copy product to multiple categories


mjm

Recommended Posts

I am looking for an easy way to copy a product to several categories at once. The current method of doing each categorty seperately is rather time consuming for the size of my store.

 

Any ideas?

 

Thanks.

Link to comment
Share on other sites

If you have direct access to your database it's very simple. In the products_to_categories table you just add a line linking the product id to the category id. To add product 1 to categories 1, 2, and 3 (let's assume it's already in cat 1, and everything looks good) you can run an SQL script like this:

 

INSERT into products_to_categories VALUES ('1','2');

INSERT into products_to_categories VALUES ('1','3');

 

It's as simple as that, as long as you know your product_id's and your category_id's.

 

ps you can write the script quickly using a word processor, or even more quickly using excel, I find, then copy and paste it to run the SQL.

 

Jeremy

Link to comment
Share on other sites

Thanks Jeremy, that is very helpful.

 

Here is a dumb followup question:

 

I assume that by adding a product through the database to multiple parent categories, when you go to the Admin site, you will be able to administer that product under multiple categories right?

 

And because there are no duplicate product records, any change you make to the product in "Category 1" will automatically appear in "Category 2", since all you are doing is changing a product attribute, is that right?

 

So there is no possibility of having a "relic" product in a category that you forgot it was in, with out of date info right? since the product ID has not changed for this product in question.

 

Please bear with me ;)

Link to comment
Share on other sites

Thanks Jeremy, that is very helpful.

 

Here is a dumb followup question:

 

I assume that by adding a product through the database to multiple parent categories, when you go to the Admin site, you will be able to administer that product under multiple categories right?

 

And because there are no duplicate product records, any change you make to the product in "Category 1" will automatically appear in "Category 2", since all you are doing is changing a product attribute, is that right?

 

So there is no possibility of having a "relic" product in a category that you forgot it was in, with out of date info right? since the product ID has not changed for this product in question.

 

Please bear with me  ;)

 

That is correct. The products information is stored in the products table and the products_to_categories table handles the mapping.

 

Now, Are there any contributions setup to handle copyign the products to multiple categories?

Link to comment
Share on other sites

Now, Are there any contributions setup to handle copyign the products to multiple categories?

 

 

I don't know, as I mentioned, I find it easiest to use excel to write scripts of SQL commands to run via phpmyadmin. The features in a spread sheet program can be very helpful for banging out a large number of commands very quickly. This particular function should be very simple, as there are only two variables in play, on one table.

 

 

Jeremy

Link to comment
Share on other sites

  • 4 years later...

bumping this back up. i understand the way to mod the products using PHPmyadmin.. but has anyone figured out a way to copy a products categories to another product. MUCH like the product attribute copier mod which allows you to copy attributes given to one product to another product. I have over 1000 categories and some products fit the same cars and it would be SO much easier to simply copy things over instead of selecting each category manually.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...