Magerun Tips

Creating a local Magento repository for n98-magerun

Milan Simek created a blog post about creating your own local repository of sample-data and Magento installers.

Magerun Tips

Send all queued emails


Since Magento CE 1.9.1 all “new order emails” are queued. A new defined cronjob core_email_queue_send_all is now processing the queued emails.
During development it’s not very handy to run the job by a minute based scheduler. In this case you can use n98-magerun to start the cronjob manually.


Quick Tip: If you only see some question marks…

… this could be a PHP Unicode setting.
Try to turn off detect_unicode in your php.ini.
You can simply try this by running n98-magerun like this:

If question marks are gone the problem is solved.

The PHP issue also affects some popular tools like composer or phpunit.
Settings can be persisted in php.ini or you can create an alias on your system.

Magerun Tips

Add your own check to sys:check command

For two days we published the new n98-magerun version 1.90.0 with a refactored sys:check command.
The command is now modular and all checks are organized in sub-classes.
It’s now possible to add own checks to the command. The blog post shows you how easy it is.

Registration of Check Classes

If you investigate the distribution config of n98-magerun you can see a bunch of new configuration for the command.
The new config node is “checks” which contains the class names of all checks. All classes are organized in check groups.

Check Class Config

Magerun Tips

Quick Tip: Run multiple specific indexers

To reindex all indexers we have the index:reindex:all command.
In some cases it’s only needed to reindex only some indexers.

Since version 1.75.0 you can specify the indexer by code if you run pass index codes direct as argument:

Magerun Tips

Tip: Use aliases to quick reference Magento XML config

Magento’s merged XML config is very huge but not all parts must be referenced during development. Some parts are really important for debugging.
To do this smart n98-magerun offers the “config:dump” command which prints all the merged XML config at once.
As second parameter you can add an XQuery like argument.

Magerun Tips

Tip: Create a Console Helper

Since version 1.77.0 we provide an easy registration of console helpers.
Console Helpers are way to share functionality with other commands.

I will show you how easy it is to create such a helper.
Out example helper will return the current system time.

Create a new module

Create a new folder in your home directory with the name “.n98-magerun/modules/example-module”.

Magerun Tips Videos

PhpStorm Symfony Console Tool Support – Configure n98-magerun

The video shows you how easy it is to embedd n98-magerun in PhpStorm.
Please download latest EAP Version.

Magerun Tips

Quick Tip: Find login issues with sys:check command

Sometimes it’s not possible to login to Magento Admin Panel.
Searching for a solution can be very frustrating.

One of the most common purposes for this is a wrong configuration of the cookie domains.
Another problem is that Magento searches for a dot in the hostname.
Also wrong directory permission can cause this issue.

To prevent manually checks you can use the sys:check command bundled with n98-magerun.
All the sys:check commands are created by netz98 employees who had the same problems over the last month.

Magerun Tips

Quick Tip: PhpStorm command line tool support

This quick tip shows you how easy it it to integrate n98-magerun in your PhpStorm IDE.

Download n98_magerun.xml file for PhpStorm command line tool support