Solved: Fatal error on reset password page after upgrade to Magento CE 1.7

Hello friends,

In last month, I had a task to upgrade one Magento site to the latest version

I upgraded the site successfully to the latest version of Magento. But while testing of that site we found one critical error related to reset password, which I want to discuss here:

In login page on click of forgot password link, Magento asks customer’s email address to send reset password link to their email address.

Above functionalities were working fine.

But in the reset password mail while clicking on reset password link, the page gave the following error:

PHP Fatal error: Call to a member function setCustomerId() on a non-object in app/code/core/Mage/Customer/controllers/AccountController.php on line 587

I was just shocked, and tried hard to find the cause and the solution of that problem. For that I had searched the web, and at last found the cause and solution of the problem.

The error was occurred because of incompatible customer.xml file in our custom theme. Magento did many useful changes in customer.xml file in latest version

Now the solution of above error is very simple. Just remove the customer.xml file used by your theme from /app/design/frontend/<your_package_name>/<your_theme_name>/layout/. By doing this Magento will use the customer.xml file from the base/default theme.

If you have did some useful changes in customer.xml file according to your theme and not able to remove that file then update your customer.xml file by putting the under given section in it.

<customer_account_resetpassword translate="label">
    <label>Reset a Password</label>
    <remove name="right"/>
    <remove name="left"/>

    <reference name="head">
        <action method="setTitle" translate="title" module="customer">
            <title>Reset a Password</title>
    <reference name="root">
        <action method="setTemplate">
        <action method="setHeaderTitle" translate="title" module="customer">
            <title>Reset a Password</title>
    <reference name="content">
        <block type="customer/account_resetpassword" name="resetPassword" template="customer/form/resetforgottenpassword.phtml"/>

That’s it.

Now see the result, the error will go away.

Also refer the under given link to get knowledge about some nasty issues which can occur after upgrading magento to 1.7.

Hope this will help you.


Pass PHP array as argument to JavaScript function

We all know that, we widely use JavaScript in our PHP page to perform some task. Those tasks could be either any small calculation or anything else. We know that we use array in PHP for our tasks. Some time it’s a requirement to use PHP array into JavaScript function. So I write this blog to fulfill that requirement.

There are two ways to pass the PHP array to JavaScript function as arguments. I have explained both of them here.


First method is to convert the PHP array into JSON_ENCODE so that function that receives that array use as a JavaScript array. Complete example is given as follows:

<script type="text/javascript">
function displayarrayelement(demoarray)
	for(i=0;i< demoarray.length;i++) 
alert(demoarray [i]); 
	$newarray = array();
	For($i = 10; $i<100; $i=$i+10)
		$newarray [] = $i;
<a onclick="displayarrayelement(<?php echo json_encode($newarray) ?>);"> Array in JavaScript </a>

Method 2: Manually make PHP array like JavaScript array (use implode and split)

In Second method, we make the PHP array format like the JavaScript array manually. So the function direct use that array. Complete example is given as follows:

<script type="text/javascript">
function displayarrayelement(demoarray)
	demoarray = demoarray.split(",");
	for(var i=0;i<demoarray.length;i++) 
		alert(demoarray [i]); 
	$newarray = array('a','b','c');
	$mov_str = implode(",", $newarray);
<a href="#" onclick="displayarrayelement('<?php echo $mov_str ?>');"> Array in JavaScript </a>

Hope this will help you as it did to me.

Sign In with LinkedIn and Twitter on Your Website

LinkedIn and Twitter have become large in the social network world and both networks offering oAuth support. We developed a system to login with Twitter and LinkedIn. Nowadays web users not interested to filling the big registration forms. This script helps you to avoid registration forms, It’s is very useful and simple to integrate.

1) Sign In With Twitter

Some @Anywhere functionality doesn’t require the user to login to Twitter or authorize your site for access When user login and authorization is required, @Anywhere handles all of that for you out of the box.

The “Connect with Twitter” button provides a method for users to authenticate securely with Twitter, yielding your application with an access token for use in API calls.

Adding “Connect with Twitter” buttons to your application is easy: simply call T passing in a selector indicating where you want the button to appear, and call the connectButton method.

For example, the following will place a “Connect with Twitter” button into the element with an id of “login”:

        <meta http-equiv="Content-type" content="text/html; charset=utf-8">
        <title>Anywhere Sample</title>
        <script src="" type="text/javascript"></script>
<span id="login"></span>
    <script type="text/javascript">  

      twttr.anywhere(function (T) {


@Anywhere provides an authComplete and signOut event that can be used to determine whether or not users of your web site or web application have logged in to Twitter and authorized your application for access.

Using the “Connect with Twitter” button it is possible to bind listeners for both the authComplete and signOut events via an object literal passed to the connectButton method. Listeners for the authComplete are passed the logged in user as a single argument.

<script type="text/javascript"> 
      twttr.anywhere(function (T) {    
        T.bind("authComplete", function (e, user) {
          // triggered when auth completed successfully

        T.bind("signOut", function (e) {
          // triggered when user logs out

For further information :-

2) Sign In With LinkedIn

The LinkedIn JavaScript API makes it incredibly easy to let you customers authenticate using their LinkedIn account. You can then use that information to register them for your own site, identify them in a blog comment, or otherwise use this to streamline their experience. This provides you with increased registrations with minimal work.

The most important piece of data for you to capture and store is the LinkedIn member id. This is an application-specific unique identifier for every member. With this token, you can easily retrieve profile information about any of your users who have authenticated using Sign In with LinkedIn.

An alternative approach is using the JavaScript API to directly fetch the person’s information. You can then pass that back using either a web form, like above, or an AJAX call.

Place the following in your :

<script type="text/javascript" src="">
  authorize: true
onLoad: onLoadLinkedIn

function onLinkedInLoad() 
   IN.UI.Authorize().params({"scope":["r_basicprofile", "r_emailaddress"]}).place();
   IN.Event.on(IN, "auth", loadFields);
function loadFields() 
     profile = me.values[0];
     position = profile.positions.values[0];

And the following in your :

<script type="IN/Login" data-onAuth="onLinkedInAuth"></script>

This generates a Sign In with LinkedIn button and triggers the onLinkedInAuth() function upon completion. That function makes an IN.API.Profile() API call for the current viewer and provides you with the member id in the callback function. You can then use the AJAX framework of your choice, such as Dojo, YUI, or jQuery, to pass that value back to your server.
For further information :-

Done ! 🙂
Hope this will help you.

Add custom attribute in magento admin product grid

We all know that magento admin product grid display some attribute of the product. Some time we require displaying the custom attribute value into that grid. So I post this blog to fulfill that requirement.

Step: 1: Create the attribute for the product and give the proper type.

Example: Crates attribute ‘newstatus’


Step: 2: Crate directory structure.

For that first we create the following directory structure in our magento.



Step: 3: Overwrite the default product grid.

For adding new attribute to grid, overwrite the default grid file. For that we copy the file “Grid.php” from the following location


And paste this file at our new created location. So path become like this:



Step: 4­: Add Attribute to grid.

First find out the following function.

protected function _prepareColumns()

Now add the code for displaying the attribute to grid. Here I insert the attribute ‘newstatus’ created at step-1.



'header'=> Mage::helper('catalog')->__('Company Status'),

'width' => '80px',

'index' => 'newstatus',

'type'  => ‘text’,


Step: 5­: Add Attribute to filter grid.

Find the following function.

protected function _prepareCollection()


Add the fields in that code for filtration.



Refresh the cache memory and reindexing the data. Now this attributes display into admin product grid.

I hope this will help you.

Thank you.

Registering android App with facebook

Hello Friends,

First of all you might be thinking that what is the need of registering your android application with facebook? Then I want to clarify that If you want to integrate Android application with facebook then  you need to register your android app with the facebook.

Today I am going to explain you how to register your android application with facebook.

Following are two  easy steps to do this.

Step: 1   Generating App Signature for Facebook Settings

You can generate your application signature (keyhash) using keytool that comes with java. But to generate signature you need openssl installed on your pc. If you don’t have one download openssl from here and set it in your system environment path.

Open your command prompt (CMD) and run the following command to generate your keyhash. While generating hashkey it should ask you password. Give password as android. If it don’t ask for password and don’t give you app signature then your keystore path is incorrect.

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Indies\.android\debug.keystore" | openssl sha1 -binary | openssl base64

Step: 2    Registering your Facebook Application

After generating your app signature successfully, register your facebook application by going to create new facebook   application and fill out all the information needed. And select Native Android App and give your hashkey there which you generated previously using keytool.


See the following image which shows application Id which you have to use in your application for accessing facebook: