Magento Themes and Magento Extensions

Modify “Interface locale” dropdown in administration

Share
Posted on July 1st, 2011 | Posted by admin

It is really cool when you can see large list of languages in the footer of Magento administration. You might think that all those languages you can see are available by default, but that is not the case. What to do when you need only two? English and Spanish for example? What seamed to be a simple task, turned up to be quite challenging.

Mage_Core_Model_Locale_Config has protected property $_allowedLocales containing array of locales that will be used to show language dropdown.

I have failed to rewrite that class, but that would be bad idea anyway, mostly because I don’t have time to spend half day testing if that has any sideefects that I’m not aware of, so here’s what I came up in the end.

How to extend Magento Order Grid?

Share
Posted on July 1st, 2011 | Posted by admin

Here is small example which explains how to modify order grid. Main class for order grid is “Mage_Adminhtml_Block_Sales_Order_Grid”, if you want to add some column you have to rewrite this class (block).

How to rewrite magento block:

1
2
3
4
5
6
7
<blocks>
<adminhtml>
<rewrite>
<sales_order_grid>Inchoo_Test_Block_Adminhtml_Order_Grid</sales_order_grid>
</rewrite>
</adminhtml>
</blocks>

Programmatically change Magento’s core config data

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

Every Magento installation has certain core configuration data already set. When you update those values from the administration interfaces, changes are saved mainly to core_config_data database table. It seems important and something that you shouldn’t touch, right? As always, there are times you will wish to get your hands on it. In some cases you will wish to chance settings directly from the code. This article demonstrates the proper way.
Let’s say we want to change “demo store notice” (on/off) – change value from 0 to 1 and vice versa.
All you need to do is open your database,
for example with phpmyadmin,
browse table “core_config_data“,

Merging JavaScript in Magento

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

This is not very tehnical article and most of you already use this feature, however I have noticed that there are many shops that are not using Magento’s default feature to merge JavaScript files. At the time prior to Magento 1.4, JavaScript merging was included, however it was limited to 10 files. Now that’s not a case anymore.

All you need to do is:

1) Go to admin section
2) Go to System->Configuration->ADVANCED (Developer)
3) Set “Merge JavaScript Files” to Yes (“No” is default)
4) What left is to Flush Javascript/CSS Cache at Cache management admin interface.

That’s it!

Setting up Magento on Git repository

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

Hello everyone! Recently I wrote a short article  Git vs SVN A.K.A. Everyone likes control. Now, I wanted to give you an “real life” example of putting Magento project into Git repository.

So, let’s begin. First of all, I assume that you wish to start with fresh project and that you’ll be doing only back-end programming. This is important because I’ll set up repository only for /app/code/local/ folder. It will keep the repository lightweight and enough for this practical example. At the end, I’ll explain .gitignore file so that you can make modifications to folders you wish to include.

Preparing Git locally

There are two steps you must go through before you start working with Git:

  1. To get started, you need to install Git on your machine – you can find instructions by going on this page.
  2. Next thing you need to do is to find yourself a Git repository that you’ll use for your projects. For this example, I used free private repository located at http://gitfarm.appspot.com/.