Magento: Track Visitor’s (User / Customer) Information

Here, I will show you how to track visitor’s data information in Magento. By visitor’s information, I mean information like remote address, http host, user agent (browser), referer url, first visit date time, last visit date time, etc. The following code fetches the vistor data:- [source language=”php”] $visitorData = Mage::getSingleton(‘core/session’)->getVisitorData(); // printing visitor information data … Read more

Magento: Helper Data not found error

I created a module, let’s say, ‘MyModule’. When I go to the Admin -> System -> Configuration section of this module, I get this weird error. Fatal error: Class ‘Mage_MyModule_Helper_Data’ not found – My Module is enabled. – I have helper class in ‘Helper’ folder of my module. – I have deleted/refreshed all cache and … Read more

Magento: Fatal error: Call to a member function setSaveParametersInSession() on a non-object

Scenario I was creating a module. I already had one Grid displayed in admin. The Grid was being displayed by a Block class, for example: MyNamespace_MyModule_Block_Adminhtml_MyModule Now, I had to display another Grid using a new Block class. Let’s say, I created a new Block class: MyNamespace_MyModule_Block_Adminhtml_MyNewGrid I just copied code from MyNamespace_MyModule_Block_Adminhtml_MyModule and copied … Read more

Magento: How to get admin user id, name, username, email, etc?

Here is a quick code to get the admin user’s data (id, name, username, email, password, etc). By admin user, I mean the users that login through the admin panel and those who have access to the admin panel of Magento. The users can be administrator, or with some specific roles. $userArray = Mage::getSingleton('admin/session')->getData(); // … Read more

Magento jQuery: How to use them together?

By default, Magento contains and uses the Prototype javascript library. You can also integrate the other most popular javascript library ‘jQuery‘ in your Magento site. While integrating jQuery in Magento, you might get some javascript conflict and errors as you will be using two javascript libraries (prototype and jQuery) at a time. This is caused … Read more

Magento: Event Observer with Save before and Save after

Magento has this cool functionality of Event Observer. Magento follows the Observer Design Pattern for its event hooking system. With this Event Observer Hook, additional functionality can be added without modifying the core code. The full list of Magento Event Observer Hooks is present over here:- Magento Event/Observer Hooks Cheat Sheet Magento has been programmed … Read more