Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

OsCommerce Download Feature


bkellum

Recommended Posts

For those experiencing problems using the download feature in osCommerce.

  1. Enable downloads in the admin/configure/downloads section of your store,
  2. Upload your product to the cataloag/downloads folder as a zip file (using no spaces in the name)
  3. Create a products page as you would normally for any product you sell
  4. Go to admin/catalog/product attributes page. Under "Product Options", create a new option called "Download" or something that you and your customer will recognize.
  5. In the same Product Attributes page, create a Option Value of "YEs" or "Only" or whatever.
  6. Still in the Product Attributes page, at the bottom of the page, you will find a drop down menu of each of your products. Find the product that you wish to offer as a download and select it.
  7. Under the Option Name, choose "Download" or whatever you used in step 4 above.
  8. Under Option Value, choose "yes" or whatever you used in step 5 above.
  9. Set your price for the product or leave blank.
  10. Skip the Prefix section.
  11. Type in the exact name of the download file as it is saved in your catalog/downloads folder as you did in step 2 above. Remember, no spaces in the filename and include the .zip extention.
  12. Set the number of days the purchased download will be available to your customer.
  13. Set the maximum amount of downloads tries you wish to grant to your customer. You should at the very least give your customer 2 tries, in case something happens to thier connection.
  14. Finally, click the "insert" button at the far right.
  15. Your product is now available for download.

:thumbsup:

 

Good Luck,

Bill Kellum

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Troubleshooting if download link does not work:

 

 

 

In your catalog/includes/configure.php file, down in the downloads section, their maybe a

 

missing "/" in your catalog name:

 

  define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 define('DIR_FS_CATALOG', '/home/sounkel6/public_html/catalog');
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

It should be:

 

  define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 define('DIR_FS_CATALOG', '/home/sounkel6/public_html/catalog/');
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

Where "catalog" is the name of your store.

 

Now your download link will work perfectly. Yippee!! Woo Hoo!!!

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

  • 1 month later...

Great guide.

 

Does anyone know why the download is accessible on pending status and not delivered!?

 

Seems stupid especially if you are using a manual CC entry system. Credit Cards that are bogous or the fake test number could allow people to steal your download without payment.

 

If anyone has a work around that works so you can change the Status that the link is active for download that would be super.

 

Have tried replacing this code in the dowload.php from >>HERE<<

 

CODE USED:

// Check that order_id, customer_id and filename match
$downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, opd.download_count, opd.download_maxdays, opd.orders_products_filename from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . $customer_id . "' and o.orders_id = '" . (int)$HTTP_GET_VARS['order'] . "' and o.order_status = '3' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_download_id = '" . (int)$HTTP_GET_VARS['id'] . "' and opd.orders_products_filename != ''");

 

ERROR:

1054 - Unknown column 'o.order_status' in 'where clause'

select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, opd.download_count, opd.download_maxdays, opd.orders_products_filename from orders o, orders_products op, orders_products_download opd where o.customers_id = '2' and o.orders_id = '3' and o.order_status = '3' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_download_id = '3' and opd.orders_products_filename != ''

[TEP STOP]

Link to comment
Share on other sites

  • 3 weeks later...
Great guide.

 

Does anyone know why the download is accessible on pending status and not delivered!?

 

Seems stupid especially if you are using a manual CC entry system. Credit Cards that are bogous or the fake test number could allow people to steal your download without payment.

 

If anyone has a work around that works so you can change the Status that the link is active for download that would be super.

 

Have tried replacing this code in the dowload.php from >>HERE<<

 

CODE USED:

// Check that order_id, customer_id and filename match
$downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, opd.download_count, opd.download_maxdays, opd.orders_products_filename from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . $customer_id . "' and o.orders_id = '" . (int)$HTTP_GET_VARS['order'] . "' and o.order_status = '3' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_download_id = '" . (int)$HTTP_GET_VARS['id'] . "' and opd.orders_products_filename != ''");

 

ERROR:

1054 - Unknown column 'o.order_status' in 'where clause'

select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, opd.download_count, opd.download_maxdays, opd.orders_products_filename from orders o, orders_products op, orders_products_download opd where o.customers_id = '2' and o.orders_id = '3' and o.order_status = '3' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_download_id = '3' and opd.orders_products_filename != ''

[TEP STOP]

 

 

I came across this error. I checked the db and noticed that o.order_status doesn't exist, it should be o.orderS_status (plural of order)

Link to comment
Share on other sites

I came across this error. I checked the db and noticed that o.order_status doesn't exist, it should be o.orderS_status (plural of order)
try setting in downloads redirect to false

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

try setting in downloads redirect to false

 

Don't quite understand whay you mean. Downloads redirect is on flase and I still get the above error.

 

Can anyone above get the code working right? I also have mail in payment as an option but it allows them to download before they have mailed in the payment. Kinda silly actually, but a fix like this would be spot on.

 

Anyone?

 

Andrew

www.hostyorkshire.com

Edited by hostyork

Andrew

Link to comment
Share on other sites

To all who continue to have download issues:

 

I was able to get my downloads to work without any issues using my step by step above. I did not have to edit any code in order to get it to work other than correcting the slash "/" after the word catalog as mentioned above.

 

Check that you have at least followed my step by step first. Then be sure your download file is named using either all upper or all lowercase letters with no spaces and ends with the extension ".zip".

 

For example: download123.zip

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Bill,

 

Can you tell me what this error means at least?

 

Fatal error: Call to undefined function tep_get_configuration_key_value() in /home/mpmorg/public_html/shop_dev/admin/orders.php on line 56

 

I get this when I change the order status through the admin/customer/orders

 

It is my only clue to why downloads won't work for me!

Link to comment
Share on other sites

Also,

 

Here are some more tips:

 

Check your permissions for your download and pub directories.

You can use a ftp program like http://www.smartftp.com to change the permissions of those folders if you don't have access to the server root. It is called CHMOD.

 

The product you want people to download has to be in the download folder.

 

Did you turn the download function on in the store admin under "configuration"?

 

Did you setup the product to be downloaded in the products attributes section?

 

Again make sure the pub and download directory has permissions of 777 or 755.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Don't quite understand whay you mean. Downloads redirect is on flase and I still get the above error.

 

Andrew

www.hostyorkshire.com

Yeah, that is what I meant...to set the "Download Redirect" to "FALSE" in your admin.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Bill,

 

Can you tell me what this error means at least?

 

Fatal error: Call to undefined function tep_get_configuration_key_value() in /home/mpmorg/public_html/shop_dev/admin/orders.php on line 56

 

I get this when I change the order status through the admin/customer/orders

 

It is my only clue to why downloads won't work for me!

MPM, did you try installing the "Download Conroller" contribution or some other type of modification to the order/payment process? The error that includes "tep_get_configuration_key_value" is not a default line of code in a standard osCommerce store.

 

It appears you did not either complete the modifications for the contribution or did not install it correctly.

 

Do a file compare using Winmerge or Beyond Compare to compare your files with the attempted contributions install files.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Bill,

 

I must have posted while you were writing a reply.

 

I did install the download controller but then went back to basics, and that error was because of the code left in orders.php, yes.

Link to comment
Share on other sites

Hi Bill, everything listed here is what ive tried already, so i tried it again a few times and still no joy. i dont know why its suddenly just stopped. The folder permissions are set. the filenames are correct. there is a '/' after my catalogue directory and downloads are enabled and not set for redirect...

 

im loosing my hair over this thing!

Link to comment
Share on other sites

Bill,

 

I use STS 3.2 - when I delete my product_info file I get the download link and product availability options.

 

However, I want to be able to have customisable product info pages.

 

Do you have any recommendations on what I should be looking at next?

Link to comment
Share on other sites

Bill,

 

I use STS 3.2 - when I delete my product_info file I get the download link and product availability options.

 

However, I want to be able to have customisable product info pages.

 

Do you have any recommendations on what I should be looking at next?

Mike, do you mean you use STSv 4.2? The product_info.php file should not effect your download link or your product attributes.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Nah still using the previous version. If I remove the file - I get a download link. If I leave it in - no link.
Try comparing your product_info.php with a stock osC version to see what is in yours that is causing the problem.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

I mean my product_info.php.html file in my sts_templates folder btw.

 

For that matter, what is the order of importance of product_info, sts_product_info and product_info.php.html?

Link to comment
Share on other sites

Hello,

 

I am experiencing a similar problem as outlined in this thread ... no download link. I followed the instruction to the letter (so I think), and still nothing. Overall though, I've noticed two things that might be preventing this and was hoping I could get someone (Bill) to confirm if this is my issue:

 

 

1) Catalog Path

 

In your above example you have some like this:

 

define('DIR_FS_CATALOG', '/home/sounkel6/public_html/catalog/');

 

I've had several hosting accounts, all with different types of "paths". When I open up the root of my files in an FTP session I have a path of: /www/www/catalog/ in my Remote Site path. That is what I put in the above define statement, but now I have to question if that is the "exact" path.

 

 

2) PUB directory

 

In the same config file there is also:

 

define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

The issue I see here is I have no PUB directory. I created one, but there is not one that I can see and I'm using the "out of box" install of OSC (I've only changed the graphics).

 

 

Please advise. I can get everything else to work except this.

 

Thanks in advance for the help.

Link to comment
Share on other sites

Hello,

 

I am experiencing a similar problem as outlined in this thread ... no download link. I followed the instruction to the letter (so I think), and still nothing. Overall though, I've noticed two things that might be preventing this and was hoping I could get someone (Bill) to confirm if this is my issue:

 

 

1) Catalog Path

 

In your above example you have some like this:

 

define('DIR_FS_CATALOG', '/home/sounkel6/public_html/catalog/');

 

I've had several hosting accounts, all with different types of "paths". When I open up the root of my files in an FTP session I have a path of: /www/www/catalog/ in my Remote Site path. That is what I put in the above define statement, but now I have to question if that is the "exact" path.

 

 

2) PUB directory

 

In the same config file there is also:

 

define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

The issue I see here is I have no PUB directory. I created one, but there is not one that I can see and I'm using the "out of box" install of OSC (I've only changed the graphics).

 

 

Please advise. I can get everything else to work except this.

 

Thanks in advance for the help.

Evil,

 

1) Your define('DIR_FS_CATALOG', '/home/username/public_html/catalog/'); should look very similar to this with your username in place of "username" and the name of your catalog directory in place of "catalog". If you have a cpanel hosting account, log into your file manager and click through starting with the public_html directory until you reach your store directory. This will be your catalog path.

 

2) You should have something very similar to the following:

 

define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');

define('DIR_FS_CATALOG', '/home/username/public_html/catalog/'); (username and catalog will be replaced with what is appropriate for your store)

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

If not, which version of osCommerce did you install? The last two releases included a pub directory. The "pub" directory is the public download path where permissions should be set so that the public can access your downloads after the purchase. You may not have completed the install properly or you are using an older version of osC.

 

If you created you own pub directory, then you should add a .htaccess file inside of it. The .htaccess file should have at least one line of code:

 

 Options +FollowSymLinks -Indexes

 

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Thanks for your reply Bill; however, problems remain. Regarding your replies:

 

1) It turned out I had the right path for the catalog/download define. Thanks.

 

2) I am on the current version of OSC, and I had no errors or issues during installation. After I did the install I backed up everything under catalog, and I found out last night that I did have a PUB directory at that time. What has happened to is since then is a mystery. I copied over the directory and reset the file permissions on everything.

 

After doing this the link I had been testing with still did not work. Now I have a few more questions please:

 

-- In your setup instructions you mention creating item options for DOWNLOAD/YES for the item properties. Does that do anything that would effect the link, or is it just an identifer for the product? I was just wondering if there was something else that needed to be done with that to make the download work.

 

-- Would it be beneficial to delete the item I've been testing with and just start over from scratch with a new item to test? Or should the link "appear" under the test items if everything is all linked correctly.

 

 

I really don't want to have to start this process all over again with a new install of OSC, since everything is working properly *except* the download link.

 

Thanks for your help.

 

Kevin

Link to comment
Share on other sites

-- In your setup instructions you mention creating item options for DOWNLOAD/YES for the item properties. Does that do anything that would effect the link, or is it just an identifer for the product? I was just wondering if there was something else that needed to be done with that to make the download work.

 

-- Would it be beneficial to delete the item I've been testing with and just start over from scratch with a new item to test? Or should the link "appear" under the test items if everything is all linked correctly.

 

 

I really don't want to have to start this process all over again with a new install of OSC, since everything is working properly *except* the download link.

 

Thanks for your help.

 

Kevin

Kevin, sorry to hear you are having such a hard time at this. I'll try and help you out...

 

You do need the Download/Yes set in the Product Attributes page along with all of the other information in that part as well. You do not need to delete what you have done but I suggest that you go to the product attributes page, at the bottom of the page scroll through your products available to select the one you want to set for download. Click the "Edit" button on the right. Make the neccessary changes so that the "option name" is set to "download" and that the "option value" is set to "yes". Be sure the file name is correct and then click on the update button.

 

If you continue to have problems, osC has a "dummy" file download setup called unreal tournament (unreal.zip). Use this file as a template to go by and let me know if the link shows up for this file or not. If you have not changed your download folder, the unreal.zip should be in there.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

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