Magento themes and extensions

How to extend Magento core controller?

Share
Posted on June 27th, 2011 | Posted by admin

Hi, today I’ll show you how to edit Magento’s core module without messing with core files themselves, or “the right way of doing things”.:D

First of all, I chose Magento’s Customer module and its Account controller as an example. First, you need to find it in Magento’s Core folder (full path: “app/code/core/Mage/Customer/controllers/AccountController.php“).

First step is to create and place folders in your module that will override Magento’s core controller. On to that part:

  1. First, create this file in same folder structure:app/code/local/Inchoo/Coreextended/controllers/Frontend/Customer/AccountController.php. (of course, you can always replace Inchoo with desired namespace, and Coreextended with some other module name, but you’ll need to edit the rest accordingly).
  2. Then create xml for our module located here:app/code/local/Inchoo/Coreextended/etc/config.xml (same analogy as above applies)
  3. And finally, create this file app/etc/modules/Inchoo_Coreextended.xml.

Handling intensive Magento tasks in the background, simulating AJAX via CRON

Share
Posted on June 27th, 2011 | Posted by admin

For those of a weak hart, please skip this article. Before I start presenting the idea, please note that this is just an idea. So what’s it about? In our everyday Magento development there are numerous examples/tasks where we need to import some data into Magento or programmatically create some entries like products, orders, customers, etc. When dealing with larger scale of things, importing/creating 50000 of products can turn out to be a real challenge. Usually we (the developers) strive to a simplest possible solution, which in this case ideally would be to make simple foreach loop where we would have our code handling product creation in each iteration of the loop. Technically this works, but with extreme PHP/environment configurations only.

Second thing that might come to a mind is AJAX approach, like the one seen on the default Magento store where you initiate your product import. This solution is better than previously mentioned as it eliminates the system ending up “resource-less” . If you catch my point. There is one major drawback with this approach as well. That is, this approach works only while your browser is turned on.

Magento and Google Services Integration – All-In-One Guide

Share
Posted on June 24th, 2011 | Posted by admin

There are tutorials all around the web as well as at the Inchoo website that guide you through various Google services integration with Magento eCommerce platform. I wanted to unite all of these resources on one place and also bring something new to the table.

In this guide, we’ll talk about:

1. Google Analytics integration with Magento
2. Google AdWords conversion tracking with Magento
3. Google Base integration with Magento
4. Google’s Feedburner service integration with Magento
5. Tracking conversions in numbers instead of percentage with Google Analytics custom report

Simple Magento Extension generator

Share
Posted on June 24th, 2011 | Posted by admin

Writing Magento modules on a everyday basis can become extremely boring job when it comes to the part where you define your module directories, config file, model, block, helper, etc. What I am trying to say is that there is significant amount of repetitive work being done each time you start new module development. To compensate for this a little bit, I created this little Magento module that helps you create other modules. Hope it does not sound to much confusing.

To access the module functionality you need to install by copy-pasting the content of archive to your Magento installation and then open the http://mystore.loc/alpha url. I realize that using “alpha” for the module name is not much innovative. Basically you can look at this module as being a skeleton upon which you might build your own module generator. The code itself was done in a hasty way so it might need some refactoring if you wish to play with it. I plan on continuing my work on this module. This is just an alpha version  .

How to generate your own reports in Magento

Share
Posted on June 22nd, 2011 | Posted by admin

Coolest thing in Magento’s is generating your own reports.
The quickest way to create Magento’s reports is to generate them through the grids.

First you will need to create collection of data which you want to display and save.
Then you have to add those fields in your grid, the rest is piece of cake.

In your custom grid class you need to call method “addExportType” from “Mage_Adminhtml_Block_Widget_Grid” class
(your custom grid class needs to extend Mage_Adminhtml_Block_Widget_Grid class).
Code of protected function _prepareColumns() in your Grid class: