Carlos Roque Code Hints, Examples and more

24Nov/102

X-Cart File too large for egoods download

I have been working on xcart and even thought I really like it there is a huge problem with their egoods downloads.

The site I was working on distributes large videos, up to 500 MB, but I was running on the problem that x-cart eGoods would only download 24.5 MB maximum. After browsing the interwebs i came across a piece of code in the php manual website. (thanks to chrisbloom7 ) I took a small part of his code, modified it and replaced it in the download.php in the xcart root diretory.

Here is what needs to be replaced. this applies to x-Cart 4.4.1

Open the download.php file located in the xcart root directory

find  this:
while (
!feof($fd)
&& connection_status() == 0
) {

print(fread($fd, 8192));

flush();

}

fclose($fd);

and replace with this:
$buffer = '';
$chunksize = 1 * (1024 * 1024);
while (!feof($fd)) {
$buffer = fread($fd, $chunksize);
echo $buffer;
ob_flush();
flush();
}
fclose($fd);

Filed under: PHP, x-Cart 2 Comments
14Nov/1011

Adding the Authorize.net PHP SDK to CodeIgniter 1.7

I am writing a site that requires credit card processing through authorize.net. I am building the site using the CodeIgniter framework. I was thinking I would have to do some fancy hacking or using a 3rd party library to make this work but it turns out that you can user the SDK provided by Authorize.net directly into CI. here is what you need to do.

12Nov/102

jQuery .show() not working properly in Chrome

So I finally got around learning jQuery, better late than never, so on my first script I ran into this weird problem.
I made this simple click once hide an element show another scrip for a simple accordion, it worked great in IE and FF but then when i tested in Chrome, it didn't work!
I could display the element but it would not hide. and even thought it did show, the slow effect did not work. The weird thing is that it worked for the second element.
After looking in the internets I didn't find anything useful, they talked about updating to the latest jQuery but i already had the latest version.
Finally I had a stroke of genius! the element I was trying to hide was a span tag, so I figure changing it to a div couldn't hurt and what do you know? the darn thing worked like a charm effects and everything!
Damn you Chrome!
here is what my code look like, there might be an easier way to do this but for what I need it works just fine
$(document).ready(function(){
$("#showup").click(function(){
$("#signin_body").hide("fast");
$("#signup_body").show("slow");
});
$("#showin").click(function(){
$("#signup_body").hide("fast");
$("#signin_body").show("slow");
});
});

and here is the HTML

New Users Click <button id="showup">Here</button>
<div id="signup_body" style="display: none;">Some Content here</div>
Existing Users Click <button id="showin">Here</button>
<div id="signin_body" style="display: none;">Some more content here</div>

Filed under: jQuery 2 Comments