Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Need help with Super Download Store as a module


Recommended Posts

My store sells downloads. Those downloads need to be instantly available once paid for by the customer.


Now my current store uses the super download store addon found at http://addons.oscommerce.com/info/7783


This addon was created from the original download controller addon to remove a hole in the downloads process and to also automate the process after checking that a payment had been made. As far as my testing shows the hole is still there, but less publicized than it used to be in the latest version of oscommerce BS. I can also, by playing with the standard download settings, not get to a position where the download is automatically available for the customer to get even if they have paid.As my store also sells physical products I cant mess with the setting too much, otherwise they are affected.


To keep in line with current thinking I was wondering if anyone had any idea how to convert this addon to a module that requires no core code changes. My store also uses PWA so that may need modding as well. If this can be sorted some how it would be great, and I can make my store live.


What ideas do people have in creating a better downloads process and/or converting this addon.


If this cant be done as a module I am more than happy to add it in manually, and will update the addon, but may be its time to re write the download process files in the core code to make them safe and immediate.


Link to comment
Share on other sites

I'm not intimate with the downloads system in osc.  Never used it.


So...first thing I need you or @@newburns to do is write down the steps you (shopowner) take to create and sell a downloadable product;


Although as mentioned I am not intimate with osc-downloads;


  1. make a downloadable product
  2. make an order status allow access to downloads
  3. set a completed payment to a certain order status, if that order status happens to be set up for downloads, customer should be able to immediately download...


Those three items, set up correctly, should (and I stress should, by my understanding) be all that's needed ....


But, you, shopowner, who is at the sharp-end and does use downloads said:



remove a hole in the downloads process


I dont know what this hole is ... could you elaborate?  

Note that I do not disbelieve whatever you say as I have almost zero knowledge of the downloads process...


And you say:



and to also automate the process after checking that a payment had been made


See above three items...

Once again, I will not disbelieve what you say, as you are far more knowledgable about that area of osc than I am.




So....I think I really need a low down on how it works and whats wrong with it ...

Link to comment
Share on other sites

Right now downloads work by attaching a file to a product by using attributes.

Once the status, payment, downloads remaining, and link expiry meet the qualifications;

the download is available in your account_history_info.php by using a text-hyperlink.

Ideally, this would never work with any Guest Checkout addon.


However, the current workflow is too cumbersome. Not enough attention is given to accessing downloads.

Possible solutions:

1. Change ../includes/modules/downloads.php to utilize a bootstrap based button. Adding color and separation.

2. Add immediate access to available downloads in your account by using a sidebar module or account module.

3. Highlight downloads available in your account in multiple "My Account" screens. If the download is valid, not expired, and downloads are available.


I took a stab at making the download link a little more pretty. But I am very "green" at OSC Bootstrap.


  osCommerce, Open Source E-Commerce Solutions

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License

// Get last order id for checkout_success
    $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by orders_id desc limit 1");
    $orders = tep_db_fetch_array($orders_query);
    $last_order = $orders['orders_id'];
  } else {
    $last_order = $HTTP_GET_VARS['order_id'];

// Now get all downloadable products in that order
  $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, " . TABLE_ORDERS_STATUS . " os where o.customers_id = '" . (int)$customer_id . "' 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 != '' and o.orders_status = os.orders_status_id and os.downloads_flag = '1' and os.language_id = '" . (int)$languages_id . "'");
  if (tep_db_num_rows($downloads_query) > 0) {

  <h2><?php echo HEADING_DOWNLOAD; ?></h2>

  <div class="contentText">
    while ($downloads = tep_db_fetch_array($downloads_query)) {
// MySQL 3.22 does not have INTERVAL
      list($dt_year, $dt_month, $dt_day) = explode('-', $downloads['date_purchased_day']);
      $download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads['download_maxdays'], $dt_year);
      $download_expiry = date('Y-m-d H:i:s', $download_timestamp);

// The link will appear only if:
// - Download remaining count is > 0, AND
// - The file is present in the DOWNLOAD directory, AND EITHER
// - No expiry date is enforced (maxdays == 0), OR
// - The expiry date is not reached
      if ( ($downloads['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {
        echo '        <div class="col-sm-12 col-md-4"><a href="' . tep_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '">' . $downloads['products_name'] . '</a></div>' . "\n";
      } else {
        echo '        <div class="col-sm-12 col-md-4"><em>' . $downloads['products_name'] . '</em></div>' . "\n";

      echo '        <div class="col-sm-12 col-md-4">' . TABLE_HEADING_DOWNLOAD_DATE . tep_date_long($download_expiry) . '</div>' . "\n" .
           '        <div class="col-sm-12 col-md-4">' . "\n" .
           '             <div class="col-xs-12 col-sm-6">' . $downloads['download_count'] . TABLE_HEADING_DOWNLOAD_COUNT . '</div>' . "\n";

// The link will appear only if:
// - Download remaining count is > 0, AND
// - The file is present in the DOWNLOAD directory, AND EITHER
// - No expiry date is enforced (maxdays == 0), OR
// - The expiry date is not reached
      if ( ($downloads['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {
        echo '             <div class="col-xs-12 col-sm-6"> <a class="btn-block btn btn-success" href="' . tep_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '">Download Now</a></div>' . "\n";
             '             </div>';
      } else {
        echo '             <div class="col-xs-12 col-sm-6"><p class="btn-block btn btn-danger"><strong>Download Expired</strong></p></div>';
        echo '          </div>';


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

  <div class="clearfix"></div>

Link to comment
Share on other sites

How to allow downloads:

1. Configure your store to have downloads available in admin configuration.

     a. Global download expiration and download limit can be set here, however, each download attribute can override this setting if necessary.

2. Create a new attribute associated with downloads, such as "MP3" attribute or "Windows Download" attribute.

3. After you have created the product, add the user defined attribute for downloads.

4. Type in the directory and file name for your download. All downloads must be located in the download folder.

     a. Example: the file location mp3/20160223.mp3 would give download access to a file located in ../catalog/downloads/mp3/20160223.mp3

5. Create an order status that allows access to the downloads.

6. Customer orders that product/attribute and the completed payment or store owner changes the order status to the appropriate status for downloads.

7. Customer receives an email once order is placed/completed.

8. Customer goes to My Account to login.

9. Customer goes to My Account page then click on order history.

10. Customer views the appropriate order with downloadable attribute attached. (Currently, there is no way of knowing without already knowing what order number has product)

11. Download text link is available at the bottom of the page.


Couple of issues I run into:

1. Customers want download link immediately after checkout.

2. If customer accidentally clicks the store home or different page, there is no way of "knowing" that your download is in account history without asking store owner.

3. Digital content module in My Account page was a suggestion to combat issues. Similar to Amazon's software and digital content page.

4. Digital content sidebar module was a suggestion to combat issues.

5. Link within email that is sent to the customer (Not sure how likely this is since the ../catalog/download folder is protected by .htaccess)

Link to comment
Share on other sites

For years I have been selling downloads and have always used the super download store mod, and before that the downloads controller mod, so its hard for me to say what happens when using the standard setup. I use the super downloads store mod and as far as I can tell as it changes the process some how to allow immediate downloads once payment has been made and checked. The download link is available when the customer returns to the website, and is a button on the checkout_success page. It saves the store owner hassle of having to go into the admin area and change the order status to enable the customer to get the download. It also means that the customer gets the download straight away, which is what most people want today.


There was a post somewhere I read about changing the order status for downloads, but that didn't work if a customer had physical and downloadable products in there cart. Again I cant remember why it didn't work. It was probably something to do with returning to the site without paying and getting the download.



The hole in the downloads process that I mentioned was where people could get the downloads for free by selecting say paypal as the payment, clicking to go to the paypal website and when they get there they just return to the website and the download will be in their account. I tested this on 2.3.1 and I could get the downloads for free when I wasn't using the super download store mod. It may be fixed with the latest paypal versions.



Other ecommerce software systems send the customer a link in the email after the sale has been made, but how they do that I have no idea. An email link is not too much of a bad idea, as long as the customer completes the checkout process correctly and returns to the site, otherwise they do not get the confirmation email. A link on the checkout_sucess page works really well.


Link to comment
Share on other sites

Checkout Success has a downloads module...


I ass-u-me that these two items are done correctly:


a/ make an order status allow access to downloads

b/ set a completed payment to a certain order status, if that order status happens to be set up for downloads, customer should be able to immediately download...




c/ the payment module ends up at checkout_success.php


The checkout_success downloads module will activate and show the downloads.


In other words it is down to two things;


- order status allows downloads

- payment module when completed sets relevant order status

=> downloads are available


Note, as mentioned I have never used the downloads system so could be way off. But that is how it should be...


There should be no way to get at a download unless the order_status allows it, so ensuring that your payment modules (on successful payment!) set that order status, should be enough..

Link to comment
Share on other sites


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

  • Create New...