Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Super Download Store


AlexStudio

Recommended Posts

@@Winston_C

 

My apologies Mitch, I was thinking of a different contribution.

 

Does that product have two download attributes by chance ? I can't think of any reason it would duplicate the download link.

 

 

Chris

Link to comment
Share on other sites

Figured it out! Thank you so much!

 

 

 

@@Winston_C

 

My apologies Mitch, I was thinking of a different contribution.

 

Does that product have two download attributes by chance ? I can't think of any reason it would duplicate the download link.

 

 

Chris

Link to comment
Share on other sites

  • 5 months later...
  • 4 months later...

Hello!

 

I've just installed this on 2.3.3 and got the Tuesday December 1999 date problem it was rather easily resolved by applying the following from ConradAskLand:

 

 

OsCommerce 2.2 Download Mod – Problems with:

  • Download Expires Tuesday December 1999″
     
  • Download link not showing (not clickable linking – no link) after approval of payment.

I’m posting this here off the support forums because the search functions wouldn’t allow me to search and find this fix, I had to find it on Google. Assuming others are doing the same, here it is. Keyword help to find this: Osc MS2, Super Download Mod, error, problem, downloads expiry, no link not showing unable to download.

Within download.php in modules I changed the following:

 

$downloads_query = tep_db_query(“select o.orders_status, date_format(o.last_modified, ‘%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_status >= ‘” . DOWNLOADS_CONTROLLER_ORDERS_STATUS . “‘ and o.orders_id = ‘” . (int)$last_order . “‘ and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ””);

$downloads_query = tep_db_query(“select o.orders_status, 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_status >= ‘” . DOWNLOADS_CONTROLLER_ORDERS_STATUS . “‘ and o.orders_id = ‘” . (int)$last_order . “‘ and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ””);

 

Its actually a very small change: Within the quiry I changed “o.last_modified” to “o.date_purchased”.

Edited by herbsandhelpers
Link to comment
Share on other sites

If it's not too clear then all you need to do is modify BOTH download.php files changing o.last_modified to o.date_purchased in the line:

 

 

$downloads_query = tep_db_query(“select o.orders_status, date_format(o.last_modified, ‘%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_status >= ‘” . DOWNLOADS_CONTROLLER_ORDERS_STATUS . “‘ and o.orders_id = ‘” . (int)$last_order . “‘ and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ””);

to

$downloads_query = tep_db_query(“select o.orders_status, 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_status >= ‘” . DOWNLOADS_CONTROLLER_ORDERS_STATUS . “‘ and o.orders_id = ‘” . (int)$last_order . “‘ and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ””);

 

 

Yep! that's it!

 

Lorraine

Edited by herbsandhelpers
Link to comment
Share on other sites

[/background][/size][/font][/color]
[color=#151515][font=Verdana, Georgia, 'Times New Roman', Times, serif][size=3][background=rgb(248, 248, 236)]$downloads_query = tep_db_query(“select o.orders_status, date_format(o.last_modified, ‘%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_status >= ‘” . DOWNLOADS_CONTROLLER_ORDERS_STATUS . “‘ and o.orders_id = ‘” . (int)$last_order . “‘ and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ””);[/background][/size][/font][/color]

[color=#151515][font=Verdana, Georgia, 'Times New Roman', Times, serif][size=3][background=rgb(248, 248, 236)]$downloads_query = tep_db_query(“select o.orders_status, 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_status >= ‘” . DOWNLOADS_CONTROLLER_ORDERS_STATUS . “‘ and o.orders_id = ‘” . (int)$last_order . “‘ and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ””);
Link to comment
Share on other sites

[/background][/size][/font][/color]
[color=#151515][font=Verdana, Georgia, 'Times New Roman', Times, serif][size=3][background=rgb(248, 248, 236)]$downloads_query = tep_db_query(“select o.orders_status, date_format(o.last_modified, ‘%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_status >= ‘” . DOWNLOADS_CONTROLLER_ORDERS_STATUS . “‘ and o.orders_id = ‘” . (int)$last_order . “‘ and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ””);[/background][/size][/font][/color]

[color=#151515][font=Verdana, Georgia, 'Times New Roman', Times, serif][size=3][background=rgb(248, 248, 236)]$downloads_query = tep_db_query(“select o.orders_status, 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_status >= ‘” . DOWNLOADS_CONTROLLER_ORDERS_STATUS . “‘ and o.orders_id = ‘” . (int)$last_order . “‘ and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ””);
Link to comment
Share on other sites

  • 1 year later...

Hello,

 

I am struggling with an issue already raised some time ago (See post #569 and the provided answer post#570): how to get the pages displaying the remaining downloads (checkout_success.php and account_history_info.php) to refresh and show the actual number of downloads still allowed after clicking the download button. (Hopefully this should also take care of the blank page emerging after the customer has exceeded the maximum number of downloads).

 

As suggested in post #570, the pages should be reloaded (from the server) when the download button is clicked to acheive the desired result.

 

I found some suggestions on how to accomplish this with javascript here:

 

http://www.mediacollege.com/internet/javascript/page/reload.html

http://stackoverflow.com/questions/5404839/how-can-i-refresh-a-page-with-jquery?rq=1

 

I added the following code to the download button links in catalog/includes/modules/downloads.php:

onClick="window.location.reload(true);"

The full code for the link now looks like this:

          echo '            <td class="main" align="left" width="70%"><div><a href="' . tep_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '" onClick="window.location.reload(true);">' . tep_image_button('button_download.gif', 'Download', 'style="vertical-align:middle;padding-top:5px;padding-bottom:5px;"') . '</a><span style="">  '  . $downloads['products_name'] . ' - '. $file_array['download_group_file_description'] . '</span></div></td>' . "\n";

The resulting output is:

            <td class="main" align="left" width="25%"><a href="http://www.mydomain.com/catalog/download.php?order=67&id=72" onClick="window.location.reload(true);"><img src="includes/languages/english/images/buttons/button_download.gif" alt="Download" title="Download" width="120" height="20" style="vertical-align:middle;padding-top:5px;padding-bottom:5px;" /></a></td>

However, the page is still not updated after the download button is clicked. If I refresh the page manually using the browser (in my case Firefox), the remaining number of downloads is set to 0 (as would be expected when the allowed 2 downloads in my case are fully used).

 

Can anyone offer an explantion (and possibly a solution) for this issue?

 

Thanks in advance.

 

Kind regards,

 

Dennis

Edited by dennish
Link to comment
Share on other sites

Hello,

 

I found a pretty straightforward solution to the "blank page" issue (the question related to updating the remaining number of allowed downloads after each download click is still open: any suggestions to solve this are very much appreciated!).

 

My solution involves the following changes:

 

1. In catalog/checkout_succes.php:

 

After

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);

Insert

// New code - Start
$navigation->set_snapshot();	
// New code - End

2. In catalog/account_history_info.php:

 

After

  if (!tep_session_is_registered('customer_id')) {
    $navigation->set_snapshot();
    tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  }

Insert

// New code - Start
$navigation->set_snapshot();	
// New code - End

3. In calatog/download.php:

 

Replace

if ($downloads['download_count'] <= 0) die;

By

// if ($downloads['download_count'] <= 0) die;
// New code - Start
   if ($downloads['download_count'] <= 0) {
// Return to the last page visited
  if (sizeof($navigation->snapshot) > 0) {
    $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
    $navigation->clear_snapshot();
  } else {
    $origin_href = tep_href_link(FILENAME_DEFAULT);
  }
    tep_redirect($origin_href);
}	
// New code - End

Done!

 

Another thing I came accross is the message displayed at catalog/checkout_succes.php refering the customer to the catalog/account.php page (in case he/she wishes to download at a later moment). This message is shown even if there are no downloads left.

 

In this case I would rather leave that message out.

 

In catalog/includes/modules/downloads.php:

 

Replace

<?php
    if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
?>

    <p><?php printf(FOOTER_DOWNLOAD, '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a>'); ?></p>

<?php
    }
?>

By

<?php
    if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
// New code - Start
// Don't refer customer to My account for downloads if no remaining downloads are left
$downloads_query = tep_db_query("select o.orders_status, date_format(o.last_modified, '%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_status >= " . DOWNLOADS_CONTROLLER_ORDERS_STATUS . " and o.orders_id = '" . (int)$last_order . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ''");
$downloads = tep_db_fetch_array($downloads_query);
if ( ($downloads['download_count'] > 0) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {
// New code - End
?>

    <p><?php printf(FOOTER_DOWNLOAD, '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a>'); ?></p>

<?php
// New code - Start
}
// New code - End
    }
?>

Kind regards.

 

Dennis
 

Edited by dennish
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...