Advertisement

Thursday 18 April 2013

Difference Between Overloading and Overriding

Overloading:
In Simple words, Same function name but different signature(Parameters)



Ex:

class Maths{

function sum($a, $b) {

$c=$a+$b;
return c; 

}

function sum($a, $b, $c) {           //PARAMETERS DIFFERS

$d=$a+$b+$c;
 return $d;
}


}



Overriding(Polyphormism):
Same Function Name, same signature, different functionality.




Ex:

class Maths{

function sum($a, $b) {

$c=$a+$b;
return c; 

}
 
}

Class Another extends Maths{


function sum($a, $b) {

$c=$a-$b;                            // FUNCTIONALITY DIFFERS
return c; 

}
}

Tuesday 9 April 2013

Magento Redirect After Login Not Working - FIXED

1. Go to

           System > Configuration > Customers > Customer Configuration > Login Options

            Make it as NO



2. To Redirect to previous page after login. Go to page login.phtml and replace form action i.e. line 40 or if you are using mini login than go to page mini.login.phtml and replace form action i.e. line 28 with the one given here.


Replace with:

          
<form action="<?php echo $this->getPostActionUrl() ?>" method="post"> 


to:

<form action="<?php echo str_replace('login', 'loginPost', $this->helper('customer')->getLoginUrl()) ?>"  
method="post" id="login-form">