Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Download Problem


samvelyano

Recommended Posts

Hello.

 

I have some problem with the download module.

I've enabled the download module, so that the customer can download the product after the payment is received. The download works fine, but now the problem is, that the customer can also download the product if the payment is still not received.

I don't know what i'm doing wrong. I've enabled the Check/Money Order and I've enabled also the download module. After i've added the Products Attributes with download option.

Now when the customer buys this product and he choose to pay by Check/Money order, he can immidiately download that product without paying.

How can I configure, that he can download the product first, when I've received the payment?

 

Thanks

Sam

Link to comment
Share on other sites

Can nobody help me?

 

I found in the file download.php the following line:

 

// Die if file is not there

if (!file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) die;

 

 

How can i do, that Die also works if moneyorder=true ? and download works if the product Status is = delivered ?

 

Any suggestion?

 

Thanks

Sam

Link to comment
Share on other sites

back download.php and change this code

 

  $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.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 != ''");

 

to this

  $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.orders_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 != ''");

 

Then the download should be available only if the administrator sets the order status to delivered.

Link to comment
Share on other sites

Then the download should be available only if the administrator sets the order status to delivered.

 

 

Hi Enigma1,

 

I have the same concerns regarding the download feature and I pasted your new code into the download.php file. It effectively removed the download link from the checkout completion page but when the status of the order has been changed to delivered the link does not appear in the customers "account info" where it should be. It does indicate that the order has been delivered...just no download link or other download info:( Is there some code that must be added to the account_history_info.php page? Thanks for your help :thumbsup:

Muskokee

Link to comment
Share on other sites

I'd like an answer to this as well. I was checking downloadable purchases in my own store and noticed that purchases w/ check/MO were able to be downloaded without paying. Definately want to be able to fix this one so I am not effectively giving away all the downloads in my store.

Unique handcrafted jewelry, accessories, toys, home decor, digital art and much more.

Link to comment
Share on other sites

I fiddled with it a bit, and I got the changed code to work. It now directs the buyer to a blank page until I set the item as delivered, then it is available for download under My Account: Previous Orders. So, what I'm wondering now is this: is it possible to make it so that insted of just receiving a blank page when they try to download before payment is processed, to have the page display a notice to go to their "My Account" area to download the item once it has been marked Delivered? It would probably save a legitimate buyer a lot of confusion.

Unique handcrafted jewelry, accessories, toys, home decor, digital art and much more.

Link to comment
Share on other sites

the blank page appears because of the php die command. So as a test replace the

die;

in the download.php file with:

tep_redirect(tep_href_link(FILENAME_DEFAULT));

Now it will redirect you to the home page instead. You could create a custom page like 'download error' and put some description for each of the error cases.

 

 

It does indicate that the order has been delivered...just no download link or other download info:( Is there some code that must be added to the account_history_info.php page?

should work with the default osc code. But if you have additional order status entries or if that sql table was rearranged/customized it may not work. You have to look the sql table what is the id for the delivered status and replace the number 3 there. I mean ideally you could put some admin control over it to specify what status entries you want to download to be available to.

Link to comment
Share on other sites

should work with the default osc code.

 

 

Thanks for the reply :) I do have the default code as I am just setting up my site, but couldn't get your new code to budge an inch...so, I took your "o.order_status='3' addition and placed it in the original code where is belongs and now it works!!! Thank you so much for answering the call for help, made my brain begin to move :-) I'll past the double modified code here in case someone else has the same problems with this issue.

 

$downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, op.products_name, opd.orders_products_download_id, opd.orders_products_filename, opd.download_count, opd.download_maxdays from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = '" . (int)$last_order . "' and o.orders_id = op.orders_id and o.orders_status='3' and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ''");

 

Thanks again :thumbsup: :thumbsup:

Link to comment
Share on other sites

  • 3 weeks later...
the blank page appears because of the php die command. So as a test replace the

die;

in the download.php file with:

tep_redirect(tep_href_link(FILENAME_DEFAULT));

Now it will redirect you to the home page instead. You could create a custom page like 'download error' and put some description for each of the error cases.

should work with the default osc code. But if you have additional order status entries or if that sql table was rearranged/customized it may not work. You have to look the sql table what is the id for the delivered status and replace the number 3 there. I mean ideally you could put some admin control over it to specify what status entries you want to download to be available to.

 

 

Which "die;" should I replace with the

tep_redirect(tep_href_link(FILENAME_DEFAULT));

? It appears 6 times in the download.php file. Do I change just one instance, or all of them? Sorry if I seem dense on this one, but it's been a long day and it took me half an hour just to find this post again :blink:

Unique handcrafted jewelry, accessories, toys, home decor, digital art and much more.

Link to comment
Share on other sites

  • 1 month later...

Has anyone figured out whether one or all of the "die" commands in the code need to be replaced to make this work?

Unique handcrafted jewelry, accessories, toys, home decor, digital art and much more.

Link to comment
Share on other sites

  • 1 month later...
Which "die;" should I replace with the
tep_redirect(tep_href_link(FILENAME_DEFAULT));

? It appears 6 times in the download.php file. Do I change just one instance, or all of them? Sorry if I seem dense on this one, but it's been a long day and it took me half an hour just to find this post again :blink:

 

 

replace the line..

if (!tep_db_num_rows($downloads_query)) die;

with

if (!tep_db_num_rows($downloads_query)) tep_redirect(tep_href_link(FILENAME_DEFAULT));

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...