Hi Everyone,
The first issue is downloads no longer work with the upgrade. They download as either 0 bytes or several bytes and stop.
The second issue is when clicking on “Add to Cart” the dialogue asking “continue shopping/checkout/and a summary of the price&product added to cart” doesn’t show up anymore. It shows up on a fresh install of 2.1.3 but not since having upgraded.
For the first problem, can you verify that you mean that the customer can’t dlownload a downloadable product after purchasing?
For the 2nd, what does your browser error console say. That is an ajax request so there is either a javascript error or there is a php error in processing the ajax request on the server.
Hi Tbirnseth,
Neither the customer or myself in the admin area can download anything. It starts and stops immediately giving a miniature file.
I will have to do a local install to test the browser error console, I already restored the previous version on our live store (guess I never check for the most obvious stuff…downloads)
look in your var/downloads directory (and a sub-directory that is system generated) and find your file. Make sure it has a proper size and otherwise looks correct. If not, make sure you have appropriate permissions. Check your PHP error log and make sure there’s not a file not found notice for the requested file, etc. It’s a debugging process so you’ll need to start at the lowest level and work your way up. It may become time consuming.
Can you upload a new file? If so, will it download?
Hi again-
I am not able to download after having upgraded, even if creating a new product. I have checked & ran repair scripts on all permissions and still no use.
Here’s my error log. Whenever I hit download, it gets a memory error as seen at the bottom of the log.
[18-Feb-2011 03:11:29] PHP Fatal error: Smarty error: the $compile_dir ‘/home/sublim/public_html/var/compiled/customer’ does not exist, or is not a directory. in /home/sublim/public_html/lib/templater/Smarty.class.php on line 1095
[18-Feb-2011 04:11:31] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 683
[18-Feb-2011 04:11:31] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 683
[18-Feb-2011 03:15:21] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 683
[18-Feb-2011 03:15:21] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 683
[18-Feb-2011 04:30:46] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 04:30:46] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 04:30:56] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 04:30:56] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:32:13] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:32:13] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:32:25] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:32:25] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:33:10] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72093726 bytes) in /home/sublim/public_html/core/fn.fs.php on line 291
[18-Feb-2011 03:34:32] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:34:32] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:34:35] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:34:35] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:34:38] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:34:38] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:35:49] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:35:49] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:35:49] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/sublim/public_html/core/fn.control.php:690) in /home/sublim/public_html/core/fn.init.php on line 401
[18-Feb-2011 03:35:49] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/sublim/public_html/core/fn.control.php:690) in /home/sublim/public_html/core/fn.control.php on line 490
[18-Feb-2011 03:37:48] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:37:48] PHP Warning: strpos() expects parameter 1 to be string, array given in /home/sublim/public_html/core/fn.control.php on line 690
[18-Feb-2011 03:38:12] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72074898 bytes) in /home/sublim/public_html/core/fn.fs.php on line 291
[18-Feb-2011 03:58:52] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 162392065 bytes) in /home/sublim/public_html/core/fn.fs.php on line 291
[18-Feb-2011 03:58:58] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 162392065 bytes) in /home/sublim/public_html/core/fn.fs.php on line 291
[18-Feb-2011 03:59:03] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 162392065 bytes) in /home/sublim/public_html/core/fn.fs.php on line 291
Not sure why, but you’re exceeding 128MB of memory that is allocated.
Go to your config.local.php file and find a line that looks something like:
ini_set(‘memory_size’, ‘128M’);
and change it to ‘256M’.
For the strpos issue, edit core/fn.control.php and go to line 690. Change it from:
if (strpos($v, ‘#M#’) === 0) {
to
if ( is_string($v) && strpos($v, ‘#M#’) === 0) {
The strpos warnings can be safely ignored but they do tend to plug up the error_log.
I think the memory is going to be your big thing. If 256M doens’t work, take it up to a max of 512M. Beyond that, there is something else seriously wrong. But if your downloads are BIG, this may be what’s needed.
Hi Tbirnseth,
I forgot to mention I set both the server and the config to 512mb as well and it still didn’t work. By default they are both at 128. I just don’t see why the server would never have a problem catering to up to a dozen people downloading at a time, then with the cs-cart 2.1.3 upgrade not be able to do a single one because of memory. It just doesn’t make sense. We have downloads ranging from 70mb to 1gb to 3gb and have never had a problem with 128mb of memory allocated. I can allocate up to 1gb for php, but before I am comfortable doing that I’d like to at least get to where I was with 2.1.1. I also tried replacing almost all the core/controller/lib files as well as most the files in the root dir etc with a fresh install on an identical server as that’s fixed probs in the past but no luck.
Thanks for the tip about the strpos! I’ll nip that one in the bud.
Still can’t get downloads to work with 2.1.4 same failures, anyone else having this problem? I’ve changed around server configurations, changed caching methods, increased memory & php limits to ludicrous levels, done fresh core file replacements, no luck. So far nothing past 2.1.1 (2.1.2 worked except I had the frozen admin tabs so that’s not an option) has allowed our downloads to function. Our entire store is based off downloads of around 70-500mb, and we’ve never had any problem before this. The downloads are simply cut off, immediately after initiation transfer.
What does your php error_log show. If you’re getting a time out or exceeding php limits, it will be recorded there.
Update:
I’ve made a fresh install of a blank CsCart 2.1.4 on the same server system of our webstore to troubleshoot.
Here’s the error log:
[04-Jun-2011 10:34:14] PHP Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 144111617 bytes) in /home/redstrip/public_html/clients/indigo/core/fn.fs.php on line 287
[04-Jun-2011 10:37:51] PHP Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 144111617 bytes) in /home/redstrip/public_html/clients/indigo/core/fn.fs.php on line 287
[04-Jun-2011 10:55:36] PHP Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 72003585 bytes) in /home/redstrip/public_html/clients/indigo/core/fn.fs.php on line 287
What it’s doing is it is allocating the exact amount of memory as the file itself! I upped the memory limit and got these downloads to “work”-except it took up to 15sec for the download to start and the web browser would only show progress in how much it had download so far (for example it would NOT show i.e. 34 mb / 73 mb : 50 sec remaining, it would only show 34mb and the amount would keep increasing).
What this would mean then, is that if I had a 1gb file, I would need 1gb of memory for a single person downloading.
Now remember this problem did NOT exist in 2.1.1 (which I have our store set to) and we’ve had multiple users download a 1.8gb file at the same time with the config file set to a max of 512M.
So far this makes me think something in the fn.fs.php has been re-written, and is bugged post 2.1.1. Perhaps no one has noticed this because no one else does large online downloads? I’ve analyzed my server settings to death and see nothing wrong, and I’m inclined to think that since it has worked just fine since the release of 2.0xx that it is not something on my server.
TBIRN- How do I find the php error log? Where do I get that from? I’m on cpanel/whm
Where should I go from here? Should I hope/pray Cs-Cart fixes this in 2.2? Pay them for support? Submit a bug report?
The error_log should be availabe from cpanel. You should also be able to configure your system to put the error_log for your store in the home directory of your site (same directory that contains public_html) or even inside the public_html directory.
When files are uploaded/downloaded, they are done via an HTTP POST. Depending on your PHP configuration, you may not be able to POST that much data.
Contact your host for help in setting up the error_log and for modifying the maximum size of a POST.
I am the host, I control the WHM back-end. I found a solution.
I took the old downloading code from the fn.fs.php of 2.1.1 and replaced the new one in its entirety. Their new code appears to be broken or otherwise non-function. I replaced this non-working 2.1.4 code:
```php
/**
- Get the EDP downloaded
*
-
@param string $path path to the file
-
@param string $filename file name to be displayed in download dialog
*
*/
function fn_get_file($filepath, $filename = ‘’)
{
$fd = @fopen($filepath, ‘rb’);
if ($fd) {
$fsize = filesize($filepath);
$ftime = date(‘D, d M Y H:i:s T’, filemtime($filepath)); // get last modified time
if (isset($_SERVER[‘HTTP_RANGE’])) {
header($_SERVER[‘SERVER_PROTOCOL’] . ’ 206 Partial Content’);
$range = $_SERVER[‘HTTP_RANGE’];
$range = str_replace(‘bytes=’, ‘’, $range);
list($range, $end) = explode(‘-’, $range);
if (!empty($range)) {
fseek($fd, $range);
}
} else {
header($_SERVER[‘SERVER_PROTOCOL’] . ’ 200 OK’);
$range = 0;
}
if (empty($filename)) {
// Non-ASCII filenames containing spaces and underscore characters are chunked if no locale is provided
setlocale(LC_ALL, ‘en_US.UTF8’);
$filename = basename($filepath);
}
// Browser bug workaround: Filenames can’t be sent to IE if there is any kind of traffic compression enabled on the server side
if (USER_AGENT == ‘ie’) {
if (function_exists(‘apache_setenv’)) {
apache_setenv(‘no-gzip’, ‘1’);
}
ini_set(“zlib.output_compression”, “Off”);
// Browser bug workaround: During the file download with IE, non-ASCII filenames appears with a broken encoding
$filename = rawurlencode($filename);
}
header(“Content-disposition: attachment; filename="$filename"”);
header("Content-type: " . fn_get_file_type($filepath));
header('Last-Modified: '.$ftime);
header(‘Accept-Ranges: bytes’);
header(‘Content-Length: ‘.($fsize - $range));
header(“Pragma: public”);
header(“Expires: 0”);
header(“Cache-Control: must-revalidate, post-check=0, pre-check=0”);
header(“Cache-Control: private”, false);
if ($range) {
header(“Content-Range: bytes $range-”.($fsize - 1).’/’.$fsize);
}
fpassthru($fd);
fclose($fd);
exit;
}
return true;
} ```
With the old 2.1.1/2.1.2 Code:
function fn_get_file($path, $filename = '')
{
$fd = fopen($path, 'r');
if ($fd) {
//Fixes: Filenames can't be sent to IE if there is any kind of traffic compression enabled on the server side
if (function_exists('apache_setenv')) {
apache_setenv('no-gzip', '1');
}
ini_set("zlib.output_compression", "Off");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-type: " . fn_get_file_type($path));
header("Content-Length: " . filesize($path));
if (empty($filename)) {
//Fixes: Non-ASCII filenames containing spaces and underscore characters are chunked
setlocale(LC_ALL, 'en_US.UTF8');
$filename = basename($path);
}
if (USER_AGENT == 'ie') {
//Fixes: During the file download with IE, non-ASCII filenames appears with a broken encoding
$filename = rawurlencode($filename);
}
header("Content-disposition: attachment; filename=\"$filename\"");
while (!feof($fd)) {
echo(fread($fd, 30000)); // Read by 30k blocks to avoid memory leaks
fn_flush();
}
exit; // stop script execution after reading file contents
}
return true;
}
Everything is now functioning as it should. I am not sure if there are consequences for swapping the code but I’m sure I’ll find out.
Sure would help if you used code tags and I hope you submitted the problem/solution to the bugtracker.
Thanks, didn’t know about the code tags. At first I actually just took this snippet from 2.1.1 and put it into 2.1.4:
while (!feof($fd)) {
echo(fread($fd, 30000)); // Read by 30k blocks to avoid memory leaks
fn_flush();
This made the download function again (without changing memory limits to ludicrous levels) but I still didn’t have the ##mb / ##mb time remaining indicators on the browser. So I just tried dropping the whole thing in and that did it.
I don’t post much, don’t really know about the bug tracker but I’ll try and submit it.
Now I’m having problems with the “Continue to Checkout” popups, as well as the notifications for customers after submitting the contact-us form or placing an order (i.e. thank you for contacting us, thank you for placing order ####). It just shows up blank.
Both work on a fresh install of 2.1.4 on a different part of the server. I tried replacing all the arbitrary files of the main install with the fresh files, even the skin files, and just can’t get those darn things to work. Flushed cache on both browsers and server on every attempt.
I found a solution to the “continue to checkout” popup not showing up as well as general notifications.
I had the modification in place to disable bread crumbs via my_changes. I took out both the columns.override.tpl and columns.tpl . I can no longer find the thread in which I found how to disable breadcrumbs (the one that was messing up pop ups in 2.1.4)
What is the best way now to disable breadcrumbs?
Also I still have not figured out why the Contact Us and Order “success” messages aren’t showing up. I did have a order.confirmation.override from my affiliate tracker software I tried disabling, but not luck.
Why are you using an override versus a pre or post?
Override is like hitting a tack with a sledge hammer. It works, but sometimes creates more damage than solutions. Other addons might use the hooks and since you’res simply adding some code (not changing display or functionality), there’s no reason (generally) to use an override.
[quote name='tbirnseth' timestamp='1307403995' post='114352']
Why are you using an override versus a pre or post?
Override is like hitting a tack with a sledge hammer. It works, but sometimes creates more damage than solutions. Other addons might use the hooks and since you'res simply adding some code (not changing display or functionality), there's no reason (generally) to use an override.
[/quote]
Because the knowledge-base told me to:
CS-Cart Documentation — CS-Cart 4.15.x documentation
If you can tell me how to get rid of the breadcrumbs without doing that I'd be very greatful!
Appropriate if replacing or eliminating template code within a hook.
Sorry, there was just far too many topics embedded in this one thread.