Log in

View Full Version : Download File Getting Corrupted - Fix



Greystoke
29-04-2010, 21:35
Hi,

There is a problem in the download area, when a customer purchases a digital product.

The file is getting corrupted on download, as the header is getting merged into the zip file.

The osc_download.php in the shop folder needs to be edited:

Change the osc_download.php below:


<?php

/*================================================= =========================*\
|| ################################################## ###################### ||
|| # vB Osc Shopping Cart Pro v1.0.6 # ||
|| # -------------------------------------------------------------------- # ||
|| # Copyright ©2010 ITVault Solutions. All Rights Reserved. # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # # ||
|| # http://www.itvault.com # ||
|| ################################################## ###################### ||
\*================================================ ==========================*/

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
$search = array('osc_');
$replace = array('');
$file = basename($_SERVER['SCRIPT_FILENAME'], '.php');

$shopfile = str_replace($search, $replace, $file);

define('THIS_SCRIPT', $file);
define('CSRF_PROTECTION', false);
define('NO_REGISTER_GLOBALS', 1);

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('oscShop',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

ob_start();
require_once('./packages/shop/' . $shopfile . '.php');
$includeshopbody = ob_get_contents();
ob_end_clean();

$navbits = array();
$navbits[$parent] = 'vB Osc Shopping Cart Pro';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('oscShop') . '");');

?>To:


<?php

/*================================================= =========================*\
|| ################################################## ###################### ||
|| # vB Osc Shopping Cart Pro v1.0.6 # ||
|| # -------------------------------------------------------------------- # ||
|| # Copyright ©2010 ITVault Solutions. All Rights Reserved. # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # # ||
|| # http://www.itvault.com # ||
|| ################################################## ###################### ||
\*================================================ ==========================*/

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
$search = array('osc_');
$replace = array('');
$file = basename($_SERVER['SCRIPT_FILENAME'], '.php');

$shopfile = str_replace($search, $replace, $file);

define('THIS_SCRIPT', $file);
define('CSRF_PROTECTION', false);
define('NO_REGISTER_GLOBALS', 1);

// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

require_once('./packages/shop/' . $shopfile . '.php');

?>

This fix has been added to the vB Osc Shopping Cart Pro 1.0.6 download file, as of the 29/04/10.