Hack your open cart pagination library to enable AJAX calls


Open cart pagination

Okay, I just faced and solved an very interesting problem and can’t wait to share with you all.

PROBLEM: I was trying to do pagination calls by ajax as my whole project  architecture is like that. But open cart’s pagination do not by default support ajax call.

I’ll go step by step through the solution.

Pagination class returns a string what we just echo in our page. Now what is the architecture actually of that generated code?

open cart  pagination class generated code

How this code is generated?

Untitled2

You need to change the followings:

Untitled2So, can you see what is the change? I am sending a new flag “isCustomized” and changed the url.

Now you have to change in pagination.php library.Untitled3

Now write your code in classAjax()(Actually it’d callAjax) method.

Change base url of your magento application (And a bonus problem!)


Starting work with magetno (eCommerce platform). I installed the framework defining the base url as “localhost“. Everything was OK  but yet i was unable to login to admin panel. I even tried changing password in database (Changing the original password to md5 hash).

I just figured out that magento requires “.” in the host name (it should be 127.0.0.1 instead of localhost). So, i had to change the host name      every time browsing each new page from admin panel. This solved my bonus problem ;P.

Continue reading

New Website Developed


Very recently I developed website for an software firm of Bangladesh called tetra soft. (www.tetrasoft.com.bd)

Tetra Soft was developed to help business organizations running properly in the world of globalization. For these responsibilities and challenges, Tetra Soft is applying its acquired knowledge, skills, experience, expertise and professionalism.

The firm is one of the best solution provider in Bangladesh.

Tetrasoft Bangladesh

Using colorbox(a jquery plugin) ajax in a complex situation


Colorbox is a lightweight customizable lightbox plugin for jQuery.

I am using colorbox for another perpose: to show a (semi!) modal window to show information on ajax call.

You can get the plugin here .

Here I’ll give a simple example how to load ajax data and show through colorbox plugin. In second phase i’ll try to give the scenario of the complex situation and give the solution. Though the solution looks so obvious now, i had to go through lots of other solutions (Not worthy for that situation).

Continue reading

jQuery Ajax Tooltip


This is very much based on the Coda Popup Bubble example for jQuery that’s been going around with a few important differences:

  1. The information is requested via AJAX, so you don’t have to include all of this extra information in a hidden div. This keeps your markup smaller for grids with tons of names in it.
  2. When you mouse over another name, the previous one will disappear. If you tried this with the original Coda example, you’d end up with a weird streaking animation since there’s a delay before the div is hidden.
  3. Works in IE (just turned off the fade animation)

Image

Continue reading

Php page redirection problem


So far i did web development I used javascript redirection. But recently i needed to do that with php. But i got stacked with some annoying problems.
1. Headers are already sent.
2. SESSION variables are not setting.

1. Ok, now here javascript again rescue me see how.

function redirect($url) {
	if(!headers_sent()) {
	        //If headers not sent yet... then do php redirect
	        header('Location: '.$url);
	        exit;
	} 
	else {
	        //If headers are sent... do javascript redirect
	        echo '';
	        echo 'window.location.href="'.$url.'";';
	        echo '';
	        echo '';
	        echo '';
	        echo '';
	        exit;
	}
}

What you need to do just call this method with your desired parameter.

2.-> And now number second! SESSION variables are not setting means you are not getting SESSION variables from redirected page.
The solution is never forget to add “exit;” like a added here.

If you are stilling facing second problem, may you forgot to start session in that page!

A nice script to upload a image and re-sizing them


MAX_SIZE*1024){
echo "You have exceeded the size limit";
$errors=1;
}

if($extension=="jpg" || $extension=="jpeg" ){
$uploadedfile = $_FILES['file']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
}
else if($extension=="png"){
$uploadedfile = $_FILES['file']['tmp_name'];
$src = imagecreatefrompng($uploadedfile);
}
else {
$src = imagecreatefromgif($uploadedfile);
}

list($width,$height)=getimagesize($uploadedfile);

$newwidth=60;
$newheight=($height/$width)*$newwidth;
$tmp=imagecreatetruecolor($newwidth,$newheight);

$newwidth1=25;
$newheight1=($height/$width)*$newwidth1;
$tmp1=imagecreatetruecolor($newwidth1,$newheight1);

imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth1,$newheight1,$width,$height);

$filename = "images/small/". $_FILES['file']['name'];
$filename1 = "images/small/". $_FILES['file']['name'];

imagejpeg($tmp,$filename,100);
imagejpeg($tmp1,$filename1,100);

imagedestroy($src);
imagedestroy($tmp);
imagedestroy($tmp1);
}
}
}
//If no errors registred, print the success message

if(!$errors)
{
// mysql_query("update SQL statement ");
echo "Image Uploaded Successfully!";
}

Change default username and/or password of phpMyAdmin in xampp


If you want to change  default username and/or password of your xampp for any reason like my one(Using different mySql already installed in my machine ).  You simply do the following.

1. Open phpMyAdmin’s config file. In my case I’am using xampp-1.7.4 the config file named config.inc.php in ../xampp/phpMyAdmin/.

2. Check if $cfg[‘Servers’][$i][‘auth_type’] = ‘config’ if it’s not ‘config’ but ‘cookie’ or ‘http’  then you need to create a new MySQL user account before you change those(username and password) values.

3. Now change the value of $cfg[‘Servers’][$i][‘user’]  and $cfg[‘Servers’][$i][‘password’].

Good luck with that.