This actually intrigued me, and due to your posting of the filesize code, I took it upon myself to automate the filesize (I believe when I set it up manually, I did not know enough php/sql to properly deal with it.
But I do now! This is code that will add the TOTAL filesize of all attributes to the page; If you need them separate, you can modify it (I'll mention below).
On the product_info page's Modules/pages/product_info/header_php.php (and any other module for other product types), you will need to add this (the first line is already there, the second line is modified with an else):
header('HTTP/1.1 404 Not Found');
} else {
//~~~! Add download filesize check
$downloads_query = "select pa.products_attributes_id , pa.products_id, pad.products_attributes_filename as filename
from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
where pa.products_id = '" . (int)$_GET['products_id'] . "'
and pa.products_attributes_id = pad.products_attributes_id";
$downloads = $db->Execute($downloads_query);
}
What this does is, ELSE (ie: if NOT "there is no product with that product_id"), grab the filename of any download attribute associated with that product_id.
Then, in your product template you need to add the following wherever you want the filesize to appear:
<?php
//calculate filesize
$filesize = 0;
while (!$downloads->EOF) {
$filesize = $filesize + filesize (DIR_FS_DOWNLOAD . $downloads->fields['filename']);
$downloads->MoveNext();
}
if ($filesize >= 1024) {
$filesize = number_format($filesize/1024/1024,2);
$filesize_units = TEXT_FILESIZE_MEGS;
} else {
$filesize = number_format($filesize);
$filesize_units = TEXT_FILESIZE_BYTES;
}
echo (($filesize !=0) ? TEXT_PRODUCT_FILESIZE . $filesize . $filesize_units : ' ');
?>
Note: TEXT_PRODUCT_FILESIZE is a language variable I added to my custom english.php - or you could add it to a custom language file. TEXT_PRODUCT_FILESIZE is defined as "Filesize: " - you could also hardcode the actual text into the template if you wanted.
Note: The code in the "While" basically totals the filesizes of all downloads for that product. If you wanted to echo the filesizes one by one, you'd have to do two things: Instead of adding "$filesize + filesize..." you want to move the calculation if statement and the echo into the while, so that it calculates and echos the filesize for each file one by one. BUT the second thing you have to do is figure out a way to get the downloads to echo in the right order. Either you can figure out what is used to sort the attributes and add a SORT BY to the SQL query, or you could probably use the attribute_id to identify which download is which, but I'm not going to get into that myself.
Hope this helps. I'm guessing it's quite possible to use similar techniques to have filesizes appear on product listing pages, and or other places, but it's easiest on the product_info page, because there is only one product to lookup, not multiple.