Home » Archive

Articles in the Magento Category

Magento »

[1 May 2011 | 3 Comments]

This article shows how to add default value to any system configuration option fields. System configuration option fields means those options under System -> Configuration. Suppose, you have the following system.xml file. System.xml file is necessary to add admin configuration options.

Magento »

[29 Apr 2011 | No Comment]

Scenario:- I am getting the fatal error saying:- Fatal error: Call to a member function getTable() on a non-object in /var/www/magento/app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php on line 456 This error occurs when I try to browse Configurable product in frontend. Or, when I try to add Configurable product in backend.

Magento »

[25 Apr 2011 | 23 Comments]

Here, I will show you how you can get information about all items in your Magento Shopping Cart. You will see how you can :- – Get products id, name, price, quantity, etc. present in your cart. – Get number of items in cart and total quantity in cart. – Get base total price and [...]

Magento »

[18 Apr 2011 | 4 Comments]

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:-

Magento »

[11 Apr 2011 | 4 Comments]

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

Magento »

[4 Apr 2011 | 7 Comments]

Case: Here, I am taking the scenario of a custom Magento module. You are developing a custom Magento module and you don’t want to show the ‘Add New’ button in the Grid. The Add New button is present in top right corner of Grid Page. Rename ‘Add New’ button

Magento »

[28 Mar 2011 | 9 Comments]

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 [...]

Magento »

[9 Mar 2011 | 10 Comments]

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();

Magento »

[3 Mar 2011 | 9 Comments]

Problem: I transfered my Magento site files from one computer to another. I imported the database. Now, when I try to login to admin (when I go to admin login url), it shows 404 Not Found Error page. The same error is also displayed in the module’s page that are installed in site. However, the [...]

Javascript, jQuery, Magento »

[2 Mar 2011 | 7 Comments]

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 [...]

Magento »

[25 Feb 2011 | 4 Comments]

Gift Message facility is present in Magento by default. You can add gift message in order as a whole or in individule order items. By default, the gift message is not enabled in Magento.

Magento »

[22 Feb 2011 | 3 Comments]

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 »

[14 Feb 2011 | 4 Comments]

Suppose you have a Magento shop installed. You also have another php installation in your server (may it be wordpress, joomla, drupal, or any other php code system). Now, you want to get Magento shop data in your external website which is not Magento. So, how to do this?

Magento »

[9 Feb 2011 | 7 Comments]

Suppose you have a multi select attribute and you have displayed it in admin grid. You have displayed the multi select attribute options as selection list. Now, you want to filter/search the grid by the multiselect attribute. The problem here is that the multiselect attribute value is store as comma separated value in database. When [...]

Magento »

[30 Jan 2011 | 3 Comments]

Here, I will be showing you how to get the top/highest rated product. The basic idea for getting the top rated products is fetching all products, looping through them, getting ratings of each product and populating a ratings array. After that sort the array and then slice the array for limiting the number of product [...]