Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Complete COPY of a product, including Category Path


Drako

Recommended Posts

  • 2 months later...

OK, nobody bthered to answer, even if it was quite aeasy to solve, and i did it myself. In case anybody else need this one just do the following.

 

Open categories.php in Admin and find around line 400, under the "elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate')":

 

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");

 

and change that to this:

 

	    $path_duplicate_query = tep_db_query("SELECT products_to_categories.categories_id FROM products_to_categories WHERE products_id = '" . $products_id . "'");
   while ($path_duplicate = tep_db_fetch_array($path_duplicate_query)){
 tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $dup_products_id . "', '" . $path_duplicate['categories_id'] . "')");	
   }
   //tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");

 

Tested and work without problem for me.

my contribution: Alex's Contributions

Link to comment
Share on other sites

  • 1 month later...

Just tried it out and it works great!! Saves precious time... using 2.3.1

 

But I compared it to the original code (same as your original line), and it does the exact same thing. Copies all the same things, seemingly. What does your version do differently?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...