Latest News: (loading..)
bkellum

OsCommerce Download Feature

210 posts in this topic

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

Share this post


Link to post
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!!!

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Any more trouble shooting ideas Bill?

 

I still can't get the actual download link to show.

rebubbler likes this

Share this post


Link to post
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

Share this post


Link to post
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!

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Oops! Never mind - error was left over code from Download Controller 5.3.

 

Still no download though

Edited by mpm

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

MPM....opps, we must have replied at the same time.

Edited by bkellum

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
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.

Edited by mpm

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
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

 

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now