Skip to content

Instantly share code, notes, and snippets.

@ScreamingDev
Last active December 23, 2015 03:29
Show Gist options
  • Select an option

  • Save ScreamingDev/6573453 to your computer and use it in GitHub Desktop.

Select an option

Save ScreamingDev/6573453 to your computer and use it in GitHub Desktop.
LeMike_DevMode

LeMike_DevMode

An extension to help you develop beautiful Magento Stores.

  • Secured by restricted IPs
  • Redirect Email or show em directly in browser
  • Rerun setups for extensions from backend
  • See all rewrites
  • Login every customer Account with Master Password
  • See all Events, change config or quick translate via URL
  • Tested with UnitTests almost everywhere
  • Find it on GitHub: https://github.com/sourcerer-mike/magento-devMode
Created by [Mike Pretzlaw](http://mike-pretzlaw.de) / [@fxrmp](http://twitter.com/fxrmp)

General configuration

Security

Only allow restricted IPs

  • Magento can restrict IPs in System > Config > Devleoper
  • Inherited this via System > Config > Developer Mode > General

2013-09-07-selection_002

Note: When Magento is in DEVELOPER_MODE everyone is allowed.

The Magento_Core

E-Mail

  • See an E-Mail in the Browser instead of sending them

Easily design an E-Mail

  • In the Backend go to: System > Configuration > Developer Mode - Core
  • Open E-Mail
  • Set "Send mails" to "No"

Note: Now the mails will stuck in your browser instead of sending them.

Core

  • phpinfo() in the backend
  • Take a look at the rewrites

PHP-Info

Look up a PHP-Info in Development > Core > PHP if you want to know what the environment says.

Lookup phpinfo

Resource

Rerun setup scripts with a single click.

2013-09-07-tooltip_003

Note: You see the name, the cached version, the installed as in the database and the available filesystem version. With an click on "Run setup again" the version will be set back to "0.0.0" and the config cache will be cleaned up. Reinstalling something with Mage_Admin* is forbidden because this would harm the instance.

Rewrites

Go to Development > Core > Config

Rewrites in menu "Development" > "Core" > "Config"

The Magento_Customer

  • Login as any user you want

Login via Master-Password

  • Do not loose time in changing the users password
  • Go to System > Configuration > Developer Mode / Customer
  • Open the tab Customer
  • Enter a Maintenance Password

Master Password

Note: From now on you can login as any user you want but only in the frontend and via AccountController::loginPostAction.

Additional tricks

via URL or Shell

Mighty URL

  • See what events and observer has been used.
  • Change config on the fly

Events and Observers

  • Add ?__events to the URL (or Query)
  • The original output will be replaced with something like this:
Array (
    [global] => Array (
            [controller_front_init_before] =>
            [controller_front_init_routers] => Array (
                    [observers] => Array (
                            [cms] => Array (
                                    [type] =>
                                    [model] => Mage_Cms_Controller_Router
                                    [method] => initControllerRouters
                                    [args] => Array ()
    ...

Note: This will show all used events and observer only almost in the called order. Global means that they are used in frontend and backend. So the other keys are frontend and backend.

Change the config on the fly

Imagine the config dev/translate_inline/active. Enable it with foo.html?__dev__translate_inline__active=1

Enable translation on the fly

Note: A prefix is added and the slashes became the same. Think about a JavaScript Bookmark to enable this even faster.

Shell Tools

  • Change the admin password without nagging mail
  • List the current rewrites
  • Truncate products or categories
  • Work with modules

Change admin password

  • Run shell/adminPassword.php
  • You can promt the username of the admin
  • and a new password

Note: The admin have to exist.

List current rewrites

magento/shell$ php coreConfig_listRewrites.php

 Config path                                       | New class
---------------------------------------------------+-----------------------------------------------------
 global/models/core/rewrite/email                  | LeMike_DevMode_Model_Core_Email
 global/models/core/rewrite/email_template         | LeMike_DevMode_Model_Core_Email_Template
 global/models/core/rewrite/email_transport        | LeMike_DevMode_Model_Core_Email_Transport
 global/models/tax/rewrite/config                  | FireGento_GermanSetup_Model_Tax_Config
 global/blocks/customer/rewrite/account_navigation | Webguys_CustomerNavigation_Block_Account_Navigation

Note: Duplicates / Conflicts will be marked or highlighted.

Truncate products or categories

Run in shell php delete.php {what?} and "what?" can be:

  • catalog_category to delete all categories
  • catalog_product to delete all products
  • customer_customer to delete all customers

Note: Use screen and tail -f var/log/LeMike_DevMode.log to see what is happening.

Work with modules

Take a look at the current modules is easy with php core_modules.php. You got the options:

  --codePool local          Get only the modules in the "local" code pool.
                            Also works with "core" and "community".
  --name LeMike             Get all modules beginning with "LeMike".

Note: Filter like codePool or name can be combined.

Here is an example output:

    Module name      | Cached  | Installed | Filesystem | Code Pool |
---------------------+---------+-----------+------------+-----------+-
EcomDev_PHPUnit      | 0.1.0   |           | 0.1.0      | community |
LeMike_DevMode       | 0.2.0   | 0.2.0     | 0.2.0      | community |
Phoenix_Moneybookers | 1.6.0.0 | 1.6.0.0   | 1.6.0.0    | community |

Module name: The name of the module
     Cached: What is stored in the cache
  Installed: What is stored in the db
 Filesystem: The version in the according config.xml
  Code Pool: Where the extensions resides

LeMike_DevMode

Power of the documentation

  • Use it for release notes
  • Generate a manual
  • Have something to read in GitHub
  • Use it as presentation in no time

Tools

Within the doc folder you find some helpful scripts:

  • makeManual.sh - will generate a Manual.pdf
  • makePresentation.php - will create a reveal.js presentation

Note: This is all generated by using the MD

Structure

To make this possible the MD must have this:

  • Double-New-Line to let it be a new slide (e.g. above headings)
  • "Note: " as prefix for paragraphs that shall be a note in presentation.
  • A limit of 5 bullets or one image per slide.
  • Clean structure and short sentences.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment