Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Download File Helper (for downloads) - support


Maynard

Recommended Posts

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:

dfh1_buttons.png

1. "Choose" - opens a dialog for you to choose a file from your downloads folder, or UPLOAD a file - cool, eh?

dfh1_dialog.png

2. "Check" - checks the file you've got in the 'Filename' box exists

if it does:

dfh1_fileexists.png

if it doesn't:

dfh1_fileabsent.png

 

It's fairly straight forward to install. Hope it helps.

 

I'm happy to support the contrib here.

Edited by Maynard
favicon.gif 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

  • 5 weeks later...

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

Link to comment
Share on other sites

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

favicon.gif 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

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

Link to comment
Share on other sites

  • 3 weeks later...
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.

favicon.gif 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

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.

Link to comment
Share on other sites

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

favicon.gif 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

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

Link to comment
Share on other sites

  • 2 weeks later...

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 by volau
Link to comment
Share on other sites

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 by Maynard
favicon.gif 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

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.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

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.

favicon.gif 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

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 by Maynard
favicon.gif 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

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.

favicon.gif 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

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.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

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.

favicon.gif 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

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 by Maynard
favicon.gif 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

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.

favicon.gif 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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...