Magento Switchable Install Script Setup Class


When doing some database upgrades in Magento, and in general, the best and the smartest way would be to create install or upgrade scripts to keep a persistent data structure. When a core setup is not enough and attributes have to be created or updated, either the customer or catalog product setup class has to be defined. Switching between those two classes is not solved very well in Magento and this little snippet will make the switching as easy as pie.

Read more

Magento tip: Get a small sized version of a large production database


[Guest post] Sooner or later, while working, every developer needs to deal with uniform tasks that arise every now and then. The majority of our clients usually only need minor changes in their store’s appearance or bug fixing. Working for such clients typically requires a smaller amount of work. With this type of client, the process of ‘overtaking’ the project needs to be as quick as possible.

Read more

Magento – Install, install upgrade, data and data upgrade scripts


If you are in the business of creating your own custom extension (module) for magento, then chances are that at some point you will need your extension to be able to persist data to database, this is where the installation scripts come in place. Later on, when you upgrade your extension and decide to add few new tables to database or few new columns to database table that was initially created by the original installation extension you will need to look for upgrade script. Finally, if you want to set some initial default values in the database tables of your extension you will need to look for data scripts.

Read more

Magento archive database dumps (structure only, data only, full)


Sometimes during the various Magento upgrade projects you might find it handy to have a SQL file ready to “restore” the old Magento version. Maybe a client has the Magento Community Edition and is requesting an update to newest version. One of the actions you might want to take is to grab its database structure dump and compare it to original v. just to see if there were some custom tables added by developers, then you can compare it with original Magento installation.

Read more

Prepared filter for Magento admin grids


Maybe you can ask yourself why do I need prepared data for filters in my collections – in Magento admin grids. Well, I can perhaps create new grid and action for some custom functionality and show such grid and then additionally do (filter by) whatever I need.

But notice that if you create such collection with some addFieldToFilter() method you always use specified filter for that collection.
If you are interested how to use only one collection for showing different results for that collection (prepared filter), keep reading.

Read more

How to multiselect and filter in magento admin grids – IN and NOT IN


Did you ever need to create grid in Magento administration that is filterable by more column’s values, i.e. something from multiselect drop-down. Or perhaps more specific, you want to export all pending orders (order status: pending, pending_payment, pending_paypal) but you aren’t satisfied with Magento implementation of selecting, searching and exporting one by one pending order status. If you’re interested how I implemented similar behavior with input text field, simulating MySQL “IN” and “NOT IN” statement, keep reading!

Read more

New way to search through Magento administration grids – using *s

guzzle1 ©

Why Magento can’t use indexes on columns in admin grid when you are searching for some value e.g. order#?

This article will be really short but extremely useful in case if you have a Magento website that have “several” administrators. I’ve worked on project that have more than 2.000 administrators with different roles (that number constantly grows). You probably can imagine how slow things can be when lots of administrators use administration, specially when they are searching or sorting some data (order# or first_name, etc.).

Read more

Solving problems with Category tree database information

category_tree ©

Did you ever had a problem where you can not see all available categories in “Categories” tab while editing a product? Does your Indexer process hangs when updating “Catalog URL rewrites”? At the same time your category tree looks just fine on “Manage Categories” menu and you can see assigned products in each category? This issue can happen for a number of reasons, but it usually happens when you are using some bad script for importing category information from some other 3rd party system (like switching your shop from osCommerce, for example). Well, look no further, here’s the solution.

Read more

How to translate form labels in Magento’s Admin Area

Featured Image

Since Magento has built in functionality for translations, you can ask yourself why Magento doesn’t want to translate my labels… and everything is set up correctly!
For all of you who work on Magento for a while and you didn’t yet needed to translate everything in Magento admin area here is a short “howto” on what you can do:
go to app/code/core/Mage/Adminhtml/Block/Widget/Form.php
and find protected function _setFieldset($attributes, $fieldset, $exclude=array())
Instead of this line

//'label'     => $attribute->getFrontend()->getLabel(),
//put this:
'label'     => Mage::helper('core')->__($attribute->getFrontend()->getLabel()),

Of course you will not change Magento’s core file in this way 🙂 (more below).

Read more