Super Download Shop for osCommerce

## Super Download Shop for osCommerce 2.2 MS2 by AlexStudio
Menu
Support Forum Latest Release Introduction Screen Shots Installation Upgrading Setup Downloads Setup Orders Status Setup File Groups Direct vs Redirect Changelog Known Issues
Make a Donation!
US$ |
Many hours have been spent writing and supporting this contribution. If it helped you out (and is making you money), donations are a great way of saying "Thanks!"
Introduction
Super Download Shop contribution is an enhancement of the osCommerce download module and download file management, including following features: Secure download for pending orders based on DownLoads Controller v5.3 by Linda McGrath which was the best solution to secure downloads. Without similar control, customers could get their downloads before they actually pay. Group files download per product which enable download shops to offer multiple files in a single product. With this ability, shop owners can: Break a large download file into a group of files, to prevent problems like insufficient resource, time out errors...etc. Bundle multiple downloads in one package to increase sells. Store download files in sub folders under the download directory to improve the file management. Improve reliability when download by redirect not enabled. Built-in superior file management interface in admin panel.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Screen Shots
Main backend interface in Products Attributes panel
Single product multiple download files
Installation Instructions
Do a complete backup of your store and database before installing this! STEP #1 - Run sql scripts BACKUP YOUR DATABASE NOW! Run both sql scripts via phpMyAdmin. - Notice - If Downloads Controllers has already been installed before, DO NOT run downloads_controller_english.sql again. STEP #2 - Copy all files in new_files/catalog over /catalog/admin/filegroup_db_setup.php /catalog/admin/includes/group_download.php /catalog/admin/includes/languages/english/images/buttons/ic_down.gif /catalog/admin/includes/languages/english/images/buttons/ic_up.gif /catalog/includes/languages/english/images/buttons/button_download.gif STEP #3 - Modify existing files BACKUP THESE FILES NOW! catalog/checkout_process.php catalog/download.php catalog/admin/orders.php catalog/admin/products_attributes.php catalog/admin/includes/configure.php catalog/admin/includes/database_tables.php catalog/admin/includes/languages/english/products_attributes.php catalog/includes/database_tables.php catalog/includes/modules/downloads.php - STEP 3.1 - Modified files are in modified_files folder of this package. Plaese use file comparing tool like WinMerge to make modifications to catalog/checkout_process.php catalog/download.php catalog/includes/modules/downloads.php catalog/admin/orders.php catalog/admin/products_attributes.php If you didn't modify these 5 files before, you can upload them and overwrite the existing files. (Only apply to osCommerce 060817 update) - STEP 3.2 - And then add new definitions to files list below: (Do NOT overwrite your existing files with the ones came with this package!!) catalog/includes/database_tables.php catalog/admin/includes/configure.php catalog/admin/includes/database_tables.php catalog/admin/includes/languages/english/products_attributes.php STEP #4 - Run db setup Run catalog/admin/filegroup_db_setup.php in your browser. This file will create the initial file group entry in your database for each language you have. - Important! - The file group id #0 must be defined by this file, it's for downloads which are not using file groups (single file per item). STEP #5 - Modify Payment Modules Some payment modules, such as osCommerce PayPal IPN module, bypass checkout_process.php, which causes the modification skipped and fails this contribution. Modification in checkout_process.php must be manually coded into such payment modules. STEP #6 - Setup Super Download Shop Please refer to the Setup Downloads section to setup Super Download Shop.
Upgrading Instructions
Upgrade from v1.0x to v1.1 Please use file comparing tool to modify these files: catalog/download.php catalog/admin/products_attributes.php with these updated files in this package: modified_files/catalog/download.php modified_files/catalog/admin/products_attributes.php You can replace these files if you didn't have any other modification applied.
Setup Downloads
The download settings in admin panel under Configuartion -> Download needs to be setup correctly for this contribution to work properly. Enable download Must set to true. Download by redirect NOT recommened to set this to true unless the non-redirect method doesn't work. Set this to true only if hosting on Unix/Linix, will save the required system resource. Do NOT set this to true if hosting on Windows, otherwise the download won't work. Please refer to the Direct vs Redirect section for further info. Expiry delay (days) Default setting for a download link to expire in days. The similar setting in products attributes will override this one on each product. Maximum number of downloads Default setting for how many times a download link can be used. The similar setting in products attributes will override this one on each product. Downloads Controller Update Status Value You can reset the download expiry for each order, to re-enable an expired download under Customers -> Orders panel. The value set in this field is for the updated/reset order status. This value must exceeds the Downloads Controller Order Status Value. (See below) Downloads Controller Download on hold message Define the message shown when a download is blocked by Downloads Controller. Downloads Controller Order Status Value This is the most important setting for Downloads Controller to work. The value set in this field is the gate for orders to reach download accesses. Downloads Controller will block download accesses from orders which have the order status value below this setting. Note: The stock osCommerce download module grants download access immediately after the order created in databse. It doesn't check any order status. Payment modules like eCheck, PayPal IPN...etc, which create orders before the payments completed, can cause serious problems. Customers are able to download their products and then cancel the payments. Enable Group File Download? Set this to Yes will enable the group files for download feature. Please refer to the Setup Orders Status section to setup orders Status.
Setup Orders Status
For this contribution to work properly, the orders status need to be managed. Please follow the instruction below: Many people have trouble setting orders status to work with Downloads Controller, there for a step-by-step guide with screen shots provided here. In osCommerce admin panel, under Localization -> Orders Status, insert 2 new orders status: Download Now Available Updated And the new list may look like this: Open phpMyAdmin and load the database assigned to your osCommerce. Select orders_status table. Click on the Browse tab. Edit the new orders status' orders_status_id values. The Downloads Controller Order Status Value defaults to 10 by this contribution (4 in the Downloads Controller v5.3), we need to set both new orders status above 10 for them to reach download accesses. The Updated orders status id value must set as the one set in Configuration -> Download -> Downloads Controller Update Status Value. The edited new value may look like this: In Payment modules which provided a Completed orders status setting, you can set it to the new Download Now Available status, or edit the Completed orders_status_id to a value above 10. With Downloads Controller, only those orders with an orders_status_id value exceeds 10 can have a working download link. You may also need to modify other orders_status_id to be blocked by Downloads Controller, by setting the id value lower than 10 (or what ever you set to the Downloads Controller Order Status Value). Please refer to the Setup File Groups section to setup file groups.
Setup File Groups
The File Groups panel is under Catalog -> Products Attributes. To use the File Groups feature, first upload some .zip or .rar files to your catalog/download folder.
Please notice that you must chmod catalog/download folder to 777, and check if the .htaccess file is in there. osCommerce uses this file to secure the download folder and keeps it from any direct access via browsers or agents. If the .htaccess file is missing, the download folder is not secured. You also need to chmod catalog/pub folder to 777, for download by redirect to work. It requires the .htaccess file to be secured as well. If you want to store files in sub folders under catalog/download folder, you need to chmod those sub folders to 777 as well.
In Catalog -> Products Attributes pannel, first create a file group and assign a group name for at least one language. Then you can add files to the group just created one by one, or add multiple files in a folder at one time. The File Description will be shown at the front end download pages (checkout_success.php or account_history_info.php) behind the product name. You can assign the file group to a product attribute, by using the File Group drop down menu at the bottom of Products Attributes panel. If you want to switch back to use single filename, you must set No File Group (group id #0) to the product attribute and then change the filename.
Direct vs Redirect
What is Download by Redirect? Download by redirect only works on Unix/Linux servers. It creates an invisible temporary subfolder and a symbolic link to the actual download file through this temporary folder, then redirects the user's browser to this symbolic link. In this way, the actual location of the download file is hidden, and save the server resource as well while downloading. Why Download by Redirect doesn't work on Windows servers? The function symlink(), which creates the symbolic links, is not implemented on Windows platforms. Why Download by Redirect is not recommended? The stock download.php utilizes the header() magic to force the 'Save As' dialog to show up, no matter download by redirect enabled or not. However, the header() magic doesn't work well with download by redirect if you have a download file extension which can be opened in the browser, such as .pdf .mp3 .jpg ...., etc. The download file will be opened in the browser, and the reusable symbolic link is shown in the URL line, which can cause serious security problems. (Thanks to tbreslow for pointing this out in the support thread) There is no way to destory the reusable symbolic link and the temporary folder immediately after the download job done. The link remains until the next time when the download by redirect code is called, all temporary folders and links previously created will then be cleaned up. Security breach might exist if the user grabbed the redirected URL by using a custom browser and share it with others. Super Download Shop v1.1 improved the reliability of the non-redirect download code. The old problems caused by insufficient system resource and the script execution timeout have been taken care of. When download by redirect is disabled, the stock download.php uses the function readfile() to send the downlod file via system memory. Significant system resource is required in this way, especially for large files. In Super Download Shop v1.1 the readfile() function has been replaced by a buffered fread() loop to save the system resource, and sets the execution time limit to zero to prevent the default 30sec timeout. With these modifications, the reliability of non-redirecting download is improved. By using the direct method, there is no reusable link for downloads, there for it is recommended. Do not set download by redirect to true unless you have problem with the direct method.
Changelog
Release v1.1 on 2007-03-05 by AlexStudio Added a buffered fread() loop in download.php to save system resource. Added to set the script execution time limit to zero, to prevent the default 30 seconds timeout. Added to turn off GZip compression while downloading. Minor bug fix in products_attributes.php for the error message to be shown when a non-existing file assigned to a group. re-wrote the install.html Release v1.0a on 2007-02-13 by AlexStudio Bug fixed: Thanks to Lada Niva who found this bug and reported in the support thread. In v1.0 code when an attribute created without any filename assigned, a record inserted into database products_attributes_download table with an empty products_attributes_filename field, which caused the checkout_shipping.php page skipped (treated as a 'virtual' item). Release v1.0 on 2007-02-08 by AlexStudio Initial Release
Known Issues
GZip compression doesn't work well with downloads. It might bring up a blank page rather than the 'Save As' dialog box. To work around this issue, please follow the instruction below: Find in catalog/includes/application_top.php around line 74: if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) { Replace with: if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') && !strstr($PHP_SELF, 'download.php') ) {
THIS IS RELEASED WITH NO WARRANTY WHATSOEVER! Use at your own risk!! Before Adding This Contribution To Your Online Shop, You Should Back Up All Files Related To This Contribution and your database as well. Use the forums for support.