Knowledgebase
How do I include the downloads when cloning a product?
Posted by Nick Poindexter on 04 March 2010 04:57 PM
Make the following edits to the include/product_clone.php file:

Find this code near line 234:

func_array2update("products", $query, "productid = '$new_productid'");


After insert this code:

// Download Expander :: www.alteredcart.com //
if ($active_modules['Download_Expander']){

$downloads = func_query("SELECT * FROM xcart_downloads WHERE productid=".intval($product_info['productid'])." AND variantid=0");

if ($downloads){
foreach ($downloads as $key => $val){
db_query("INSERT INTO xcart_downloads (productid, variantid, display_name, path, size) VALUES (".intval($new_productid).", 0, '".addslashes($key['display_name'])."', '".addslashes($val['path'])."', '".addslashes($val['size'])."')");
}
}
}
// End Download Expander :: www.alteredcart.com //



Find this code near line 318:

$v['productcode'] = func_generate_sku($c_login, substr($productcode, 0, 28));
$v = func_addslashes($v);
$variantid = func_array2insert('variants', $v);


After insert this code:

// Download Expander :: www.alteredcart.com //
if ($active_modules['Download_Expander']){

$downloads = func_query("SELECT * FROM xcart_downloads WHERE variantid=".intval($old_variantid));

if ($downloads){
foreach ($downloads as $key => $val){
db_query("INSERT INTO xcart_downloads (productid, variantid, display_name, path, size) VALUES (".intval($v['productid']).", ".intval($variantid).", '".addslashes($key['display_name'])."', '".addslashes($val['path'])."', '".addslashes($val['size'])."')");
}
}
}
// End Download Expander :: www.alteredcart.com //

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments: