Hi,
I wanted to use the edit orders to be able to add products to some of my orders and it works well for everything except for the download links.
And unfortunately, i work almost only with download links. I think i came up with a solution that seems to be working, at least for now, it generates the download links in the order details. I did not add a lot to the code, and i'm not a great php coder so i may have missed some stuff (for example, i know that the table names should not be hardcoded...).
If somebody is interested, here is the code i added (please don't just tell me that my code isn't clean, i already know that :) and maybe if you think so, then correct me :) ).
I just edited the edit_orders.php file,
i added this at line 478 just outside the for loop
PHP Code:
$result11a=mysql_query("SELECT products_attributes_filename,products_attributes_maxdays,products_attributes_maxcount FROM products_attributes_download, products_attributes
WHERE products_attributes.products_id= '$add_product_products_id'
AND products_attributes_download.products_attributes_id = products_attributes.products_attributes_id
ORDER BY products_attributes_filename ")
or die("Failed to connect database: ");
$i = 1;
while($row11a=mysql_fetch_array($result11a, MYSQL_NUM)) {
$downloadnames[$i]=$row11a[0];
$downloaddays[$i]=$row11a[1];
$downloadcount[$i]=$row11a[2];
$i++;
}
and then this at line 550 in the for loop:
PHP Code:
$Query2 = "insert into orders_products_download set
orders_id = $oID,
orders_products_id = $new_product_id,
download_maxdays = '" . $downloaddays[$i] . "',
download_count = '" . $downloadcount[$i] . "',
orders_products_filename = '" . $downloadnames[$i] . "';";
$db -> Execute($Query2);
I know this isn't deleting any download links when you remove a product, but it seems that by default when you delete an order, it does not remove the links from the download table either...
Maybe a coding master could correct my mistakes or this could even be usefull to someone, and even maybe added to the add on, who knows :)
Arno