Maynard Posted December 13, 2008 Share Posted December 13, 2008 (edited) Download File Helper - for help with downloads admin http://addons.oscommerce.com/info/6410 Download File Helper: What it does If you've got downloads enabled, on the 'products attributes' page, when you do downloads you have to type in the filename - eek! What if I make a mistake? What if I haven't uploaded the file? Here are two buttons: 1. "Choose" - opens a dialog for you to choose a file from your downloads folder, or UPLOAD a file - cool, eh? 2. "Check" - checks the file you've got in the 'Filename' box exists if it does: if it doesn't: It's fairly straight forward to install. Hope it helps. I'm happy to support the contrib here. Edited December 13, 2008 by Maynard Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
polieno Posted January 11, 2009 Share Posted January 11, 2009 I have (I think) some problems (My English is very bad): - pdf cut some lines and when "cut and paste" into the *.php may malfunction example: <input type="button" value="<?php echo TEXT_DFH_CANCEL; ?>" onClick="return closeDownloadPopup();"> this should be?: <input type="button" value="<?php echo TEXT_DFH_CANCEL; ?>" onClick="returncloseDownloadPopup();"> - instruction: " D.3. Edit catalog/admin/includes/languages/english/modules/products_attributes.php" problem: products_attributes.php isn't here, are in catalog/admin/includes/languages/english/ - instruction: "replace (line 635) in catalog/admin/products_attributes.php ?> <td><form name="attributes" action="<?php echo tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=' . $form_action . '&option_page=' . $option_page . '&value_page=' . $value_page . '&attribute_page=' . $attribute_page); ?>" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="2">" Problem: In catalog/admin/products_attributes.php, the text is: ?> </td> </tr> </table> <form name="attributes" action="<?php echo tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=' . $form_action . '&' . $page_info); ?>" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="2"> - write well?: <?php // EOF Download File Helper ######################################################## ?> or?: <?php // EOF Download File Helper ######################################################## ?> Thank you for your job Quote Link to comment Share on other sites More sharing options...
Maynard Posted January 11, 2009 Author Share Posted January 11, 2009 I have (I think) some problems (My English is very bad): - pdf cut some lines and when "cut and paste" into the *.php may malfunction example: <input type="button" value="<?php echo TEXT_DFH_CANCEL; ?>" onClick="return closeDownloadPopup();"> this should be?: <input type="button" value="<?php echo TEXT_DFH_CANCEL; ?>" onClick="returncloseDownloadPopup();"> - instruction: " D.3. Edit catalog/admin/includes/languages/english/modules/products_attributes.php" problem: products_attributes.php isn't here, are in catalog/admin/includes/languages/english/ - instruction: "replace (line 635) in catalog/admin/products_attributes.php ?> <td><form name="attributes" action="<?php echo tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=' . $form_action . '&option_page=' . $option_page . '&value_page=' . $value_page . '&attribute_page=' . $attribute_page); ?>" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="2">" Problem: In catalog/admin/products_attributes.php, the text is: ?> </td> </tr> </table> <form name="attributes" action="<?php echo tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=' . $form_action . '&' . $page_info); ?>" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="2"> - write well?: <?php // EOF Download File Helper ######################################################## ?> or?: <?php // EOF Download File Helper ######################################################## ?> Thank you for your job Many thanks, you're absolutely right. I'll replace the pdf with a .txt version and update that file reference :D Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
polieno Posted January 12, 2009 Share Posted January 12, 2009 Some more things. I think is the problem with the directories - Does not work the button to cancel the popup window - Although there are several files in the catalog/download/ (755 permission) do not appear in the box to choose. - Do not take the texts of the buttons, appear the label pj: TEXT_DFH_UPLOAD - Do not upload files but... I don't know if the problem is mine best regards Quote Link to comment Share on other sites More sharing options...
Maynard Posted January 29, 2009 Author Share Posted January 29, 2009 Some more things. I think is the problem with the directories- Does not work the button to cancel the popup window - Although there are several files in the catalog/download/ (755 permission) do not appear in the box to choose. - Do not take the texts of the buttons, appear the label pj: TEXT_DFH_UPLOAD - Do not upload files but... I don't know if the problem is mine best regards I think these are issues to do with the line breaks in the PDF file. I'm really sorry. I've updated the install info on the contribution page. Installation instructions are now in a TXT file. Hope it works for you now. Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
Maynard Posted January 29, 2009 Author Share Posted January 29, 2009 Updated Contribution As mentioned about, I've updated the install info for this contribution http://addons.oscommerce.com/info/6410 Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
shankscomp Posted January 30, 2009 Share Posted January 30, 2009 I think these are issues to do with the line breaks in the PDF file. I'm really sorry. I've updated the install info on the contribution page. Installation instructions are now in a TXT file. Hope it works for you now. Just followed the new instructions this morning... Step for Step and got the same issues... Warning: move_uploaded_file(DIR_FS_DOWNLOADREADME.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in /var/www/web6/web/catalog/admin/products_attributes.php on line 22 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php66Db4n' to 'DIR_FS_DOWNLOADREADME.txt' in /var/www/web6/web/catalog/admin/products_attributes.php on line 22 Also, the Choose File dialog box does not populate with files from the download directory. Quote Link to comment Share on other sites More sharing options...
Maynard Posted January 30, 2009 Author Share Posted January 30, 2009 Just followed the new instructions this morning... Step for Step and got the same issues... Warning: move_uploaded_file(DIR_FS_DOWNLOADREADME.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in /var/www/web6/web/catalog/admin/products_attributes.php on line 22 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php66Db4n' to 'DIR_FS_DOWNLOADREADME.txt' in /var/www/web6/web/catalog/admin/products_attributes.php on line 22 Also, the Choose File dialog box does not populate with files from the download directory. Didn't someone once say "Publish and be damned" ? Once again - my sincere apologies. The following is missing from the installation instructions: F. Edit catalog/admin/includes/configure.php === before the final ?>, add === // Download File Helper ############################################################ define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); // EOF Download File Helper ######################################################## === you might need to change that value depending on where the folder is in relation to your /catalog folder === The Contribution has been updated http://addons.oscommerce.com/info/6410 Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
shankscomp Posted January 30, 2009 Share Posted January 30, 2009 Didn't someone once say "Publish and be damned" ? Once again - my sincere apologies. The following is missing from the installation instructions: F. Edit catalog/admin/includes/configure.php === before the final ?>, add === // Download File Helper ############################################################ define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); // EOF Download File Helper ######################################################## === you might need to change that value depending on where the folder is in relation to your /catalog folder === The Contribution has been updated http://addons.oscommerce.com/info/6410 Thank you... I kept digging and digging thru the code on products_attributes.php and added a / and removed it and went thru other files trying to figure out where the download directory was defined. Well, atleast I didn't change too much info. Thanks for your QUICK response. Very much appreciated. Tim Quote Link to comment Share on other sites More sharing options...
volau Posted February 8, 2009 Share Posted February 8, 2009 (edited) Hello, I got some more time to look at this (my problems reported via messages), and found the problem; now that I know this forum thread, am posting here instead of messages for anyone else who may encounter this error. For those who have not seen the messages between myself and the contribution author, first let me brief such individuals. I installed this contribution, but in the admin products attributes panel, the display of the attributes at the bottom of the screen was shifted OVER TO THE RIGHT almost all the way off the edge of the screen, and one of the php comment lines was displayed to the left of it, ie: // Download File Helper ############################################## ?> I modified ALL such comment lines in the install package, with unique text per line so I could see exactly WHICH comment line was creating the screen garbage. like so: // Download File Helper ##################### DEBUG 04 ######################### ?> it was the occurance preceeding the fix specified for approximately line 635 Upon initial examination, the beginning "<?php" tag associated with the comment line appeared to be missing, so I added it, which made the garbage line dis-appear, but the attribute table was STILL shoved over to the right of the screen. This contribution was stated to be for the CURRENT "vanilla 2.2MS-051113" version, which may be right for said version, but apparently I have something earlier - I believe I have "2.2MS-051112". At any rate, the code specified to be scanned for to be replaced by the code change associated with line 635 DID NOT MATCH the code I have; at the beginning of the code to be replaced, it said to expect a "<td>" tag, ie: <td><form name="attributes" action="<? . . . . . . . . . . . . . . . . . . My version code did NOT have this "<TD>" tag at the beginning of the OLD code, but the NEW code was expecting it, so the new code started out with such a tag. As soon as I commented out said tag, ie: <?php // Download File Helper ################### DEBUG 04 #################### ?> <!-- Download File Helper --> <!-- <td> comment this code out to make work for my release of oscommerce --> <!-- hidden layered box for download file choice --> <div id="attributes_download_popup" THEN WHOOPIE !!!! It looks GOOD now, so this applies to at least SOME earlier versions prior to vanilla 2.2MS-051113, .for anyone who may be running something before the latest version. I was REALLY glad to see this contribution that Maynard put together, since I want to offer ALOT of digital downloads, and this contribution IS A LIFE SAVER in time and effort !!! Edited February 8, 2009 by volau Quote Link to comment Share on other sites More sharing options...
Maynard Posted February 8, 2009 Author Share Posted February 8, 2009 (edited) My version code did NOT have this "<TD>" tag at the beginning of the OLD code, but the NEW code was expecting it, so the new code started out with such a tag. Intriguing! Glad you found the solution. Edited February 8, 2009 by Maynard Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
♥14steve14 Posted February 11, 2009 Share Posted February 11, 2009 I have added this contribution. With a little bit of playing it seems ok. myu question is this. When i click on use this file, should the filename be entered automatically in the filename box. If it is supposed to do this, i seem to have installed something wrong. Quote REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
Maynard Posted February 11, 2009 Author Share Posted February 11, 2009 I have added this contribution. With a little bit of playing it seems ok. myu question is this. When i click on use this file, should the filename be entered automatically in the filename box. If it is supposed to do this, i seem to have installed something wrong. Hmm - looks like it doesn't work in IE. Get Firefox. Meanwhile, I'll fix it. Back soon. Sorry. Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
♥14steve14 Posted February 11, 2009 Share Posted February 11, 2009 You could be right i am using IE. For now will use firefox. Quote REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
Maynard Posted February 11, 2009 Author Share Posted February 11, 2009 (edited) I have added this contribution. With a little bit of playing it seems ok. myu question is this. When i click on use this file, should the filename be entered automatically in the filename box. If it is supposed to do this, i seem to have installed something wrong. OK - here's the thing: IE7 has a little bug where it won't pick up the VALUE of a SELECT box by Script unless each option specifically has the value declared (you shouldn't have to declare a value...). So here's the fix: find this: foreach ($dfh_files as $dfh_file) { if (isset($upLoadFile) && $dfh_file == $upLoadFile) echo "\n<option selected='true'>"; else echo "\n<option>"; echo "$dfh_file</option>"; } and replace with this: foreach ($dfh_files as $dfh_file) { echo "<option value='$dfh_file' " . ((isset($upLoadFile) && $dfh_file == $upLoadFile) ? "selected" : "") . ">$dfh_file</option>"; } Not only is it better formatted :blush:, but it now assigns a value, which the script will pick up. Meanwhile, you might also like to add a width to the popup box - IE needs it: find style="position: absolute; z-index: 100; background-color: #ffffcc; border: 2px solid #000099; padding: 10px; And change to style="position: absolute; z-index: 100; background-color: #ffffcc; border: 2px solid #000099; padding: 10px; width: 260px; I'll alter the contribution - Done, we're on v1.4 :D Edited February 11, 2009 by Maynard Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
♥14steve14 Posted February 11, 2009 Share Posted February 11, 2009 Great thats a bit better, but now the box is being filled with the file name, but when you click on insert the box colour is changing to red, and nothing else happens. Quote REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
Maynard Posted February 11, 2009 Author Share Posted February 11, 2009 Great thats a bit better, but now the box is being filled with the file name, but when you click on insert the box colour is changing to red, and nothing else happens. Hmm. I can't replicate that. Have you got the /catalog/admin/includes/downloadfile_checkAjax.php file in the right place? Once the input has gone red, the javascript does an ajax call to that file. The colour is only changed once the ajax returns. The fact that you get no colour change, nor an alert box, suggests to me that the ajax call isn't working. Have you tried pressing the 'check' button? That uses the same ajax call. It should turn the input box red then green for a valid file. If you have Firefox + Firebug, you can check the Ajax call in the console to see what's going on. Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
♥14steve14 Posted February 11, 2009 Share Posted February 11, 2009 The box stays red, even if i make up a file name. I do not get a popup or anything. Everything seems to be in the correct place. The only thing i have noticed is that in the Javascript file there is a line that reads var filename = '/catalog/admin/includes/downloadfile_checkAjax.php'; As my store is in the root folder, should this be altered. Quote REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
Maynard Posted February 12, 2009 Author Share Posted February 12, 2009 The box stays red, even if i make up a file name. I do not get a popup or anything. Everything seems to be in the correct place. The only thing i have noticed is that in the Javascript file there is a line that reads var filename = '/catalog/admin/includes/downloadfile_checkAjax.php'; As my store is in the root folder, should this be altered. Just edit the file and remove the /catalog bit then, and it should work - try it. I'll put something in the instructions. Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
Maynard Posted February 12, 2009 Author Share Posted February 12, 2009 (edited) Just edit the file and remove the /catalog bit then, and it should work - try it. I'll put something in the instructions. In fact, replace line 31 var filename = '/catalog/admin/includes/downloadfile_checkAjax.php'; with var filename = 'includes/downloadfile_checkAjax.php'; and it will work wherever you've put the store... Edited February 12, 2009 by Maynard Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
♥14steve14 Posted February 12, 2009 Share Posted February 12, 2009 Its still no different. I have checked the install twice, everything is as it should be, as per the instructions. The box still stays red. Any other ideas. Quote REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
Maynard Posted February 12, 2009 Author Share Posted February 12, 2009 Any other ideas. Try deleting your browser's cache - it might still have the old version of the js file. Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
♥14steve14 Posted February 12, 2009 Share Posted February 12, 2009 Done that still the same. Quote REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
Maynard Posted February 12, 2009 Author Share Posted February 12, 2009 Done that still the same. try this: http://YOURWEBSITE/admin/includes/downloadfile_checkAjax.php?f=AFILENAMEYOUKNOWISTHERE (ie, calling the Ajax response script to see what result it gives. - I've put it in code brackets to stop the site shortening it) change YOURWEBSITE and AFILENAMEYOUKNOWISTHERE to sensible things (the filename should just be the file eg test.zip), and see what the result is. You might get a php error - or a 'sensible' result - let me know. Quote I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!) Link to comment Share on other sites More sharing options...
♥14steve14 Posted February 12, 2009 Share Posted February 12, 2009 I got a warning message. It said "You don't have permission to access /admin/includes/downloadfile_checkAjax.php on this server." Permissions are set to 644 on both files added to admin. Quote REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.