Jump to content
AlexStudio

[contribution] Super Download Store

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


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


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

Share this post


Link to post
Share on other sites

I see there's a version of this contrib for v2.3. It didn't work for me. Has anyone tried this one on v2.3?

Share this post


Link to post
Share on other sites

I installed this, it's working great. But, now everything that was previously added set as 0 for Expiry Days now comes up as expiring the same day of purchase, instead of never expiring. Any idea about this?

 

Thanks,

Steve

Share this post


Link to post
Share on other sites

@@vmjarala

 

The v2.3.x contribution DOES work. The 2.2 version of this contribution WILL NOT work on v2.3.x

 

 

 

 

Chris


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


Link to post
Share on other sites

@@steve-doherty

 

 

This contribution does not allow for ZERO days to expiry. Zero would indicate same day. You will need to set an exact number of days for the file to expire, up to 999 I believe.

 

 

 

Chris


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


Link to post
Share on other sites

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

Share this post


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

Share this post


Link to post
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 != ””);

Share this post


Link to post
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 != ””);

Share this post


Link to post
Share on other sites

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

Share this post


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

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

×