PDA

View Full Version : Product Attributes Clone tool



michael_s
09-10-2008, 07:50 PM
I was frustrated that it seems no tool existed to clone all attributes from one product to multiple others, so I came up with the attached solution

FIND at line 27:
************
case 'clone_attributes':
$clone_product_id_from = $HTTP_POST_VARS['clone_products_id_from'];
$clone_product_id_to = $HTTP_POST_VARS['clone_products_id_to'];
tep_db_query("delete from ".TABLE_PRODUCTS_ATTRIBUTES." WHERE products_id='".$clone_product_id_to."'");
$attributes = tep_db_query("select products_id, options_id, options_values_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES ." where products_id='".$clone_product_id_from."'");

while($attributes_values = tep_db_fetch_array($attributes)) {

tep_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " ( products_id, options_id, options_values_id, options_values_price, price_prefix ) VALUES (".$clone_product_id_to.", ".$attributes_values['options_id'].", ".$attributes_values['options_values_id'].", ".$attributes_values['options_values_price'].", '".$attributes_values['price_prefix']."')");

}
break;
************


REPLACE WITH:
************
// BOF Multiple Product Attributes Clone
case 'clone_attributes':
$multi_clone_products_id_to=$HTTP_POST_VARS['clone_products_id_to'];
for ($i=0;$i