PDA

View Full Version : Download File Getting Corrupted - Fix



Greystoke
29-04-2010, 21:24
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 #######################
$_shopfile = basename($_SERVER['SCRIPT_FILENAME'], '.php');

define('THIS_SCRIPT', $_shopfile);
define('CSRF_PROTECTION', false);

// ################### 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');
require_once('./includes/osc_func_var.php');

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

$navbits = construct_navbits(array('' => 'vB Osc Shopping Cart Pro'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'vB Osc Shopping Cart Pro';



// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######


$templater = vB_Template::create('oscShop');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('includeshopbody', $includeshopbody);
print_output($templater->render());


?>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 #######################
$_shopfile = basename($_SERVER['SCRIPT_FILENAME'], '.php');

define('THIS_SCRIPT', $_shopfile);
define('CSRF_PROTECTION', false);

// ######################### 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 ############################
// ################################################## #####################

include('./packages/shop/download.php');

?>You then need to edit the oscShopBody-global_start plugin.

Go to the vBulletin Admincp -> Plugins & Products -> oscShop Body global_start

In that plugin, find the below, and remove:


elseif (THIS_SCRIPT == 'osc_download')
{
ob_start();
include('./packages/shop/download.php');
$includeshopbody = ob_get_contents();
ob_end_clean();
}


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