Add Magento Admin Account Using MySQL Script

Note: this script works on Magento Open Source and 1.4.0.* but does not work in the Magento Commerce Edition

As a Magento development company, we have a number of designers, developers, and project managers that need admin access to the sites that we build. As opposed to using one global admin account for our entire team, we believe it to be a much better practice to assign individual admin accounts to each team member who is going to be working on a project.

One of our developers, Matt Johnson, has developed a script to allow us to easily add an admin user to a Magento installation. Each member of our team that needs Magento admin access has a sql file that adds their admin account to Magento. When we start a new project, we run the sql script for the members of our team that is going to need access to the server. I hope you’ll find this snippet useful.

/* This is an example SQL script.
You should replace all the UPPERCASED variables.
The <USERNAME> variable can only be alphanumeric characters, and probably underscores (haven't tested)
You can either generate a password hash using the PHP code below,
or you can grab a password hash from the admin_user table from an
existing Magento install for which you know the admin password.
/* Use the following PHP script to generate a salted password hash. You can also use a straight md5 hash, but it's much more easily brute-forced
<?php $password = 'PASSWORD'; $salt = 'GF'; echo $hash = md5($salt.$password).':'.$salt; ?>
insert into admin_user
(select max(user_id) + 1 from admin_user) user_id,
'FIRST NAME' first_name,
'LAST NAME' last_name,
'EMAIL' email,
'USERNAME' username,
'HASH EXAMPLE: 178f29c8e4c6c801db90cd171e3b2b53:in' password, /* You can replace this value with an md5 hash */
now() created,
NULL modified,
NULL logdate,
0 lognum,
0 reload_acl_flag,
1 is_active,
(select max(extra) from admin_user where extra is not null) extra;
insert into admin_role
(select max(role_id) + 1 from admin_role) role_id,
(select role_id from admin_role where role_name = 'Administrators') parent_id,
2 tree_level,
0 sort_order,
'U' role_type,
(select user_id from admin_user where username = 'USERNAME') user_id,
'USERNAME' role_name

Enable/disable template/block Hints Using MySQL

When doing front end development with Magento, there are many times when I want to turn on template/block hints for a one-page load. I don’t like having to wait on the Magento admin to load up the System > Configuration > Developer page, switch to Website view, and then turn on template/path hints. I have written a couple of MySQL snippets that allow me to enable/disable hints with one query.

I wrote the scripts so that for clean Magento installs, they will insert the necessary records into the core_config_data table. For Magento installs that have had the hints enabled/disabled, the record will already be present in the config table, so the script will just update that record.

Enable template/block hints for the first* website

-- Enable template hints
SET @template_hints = 1;
INSERT INTO `core_config_data` ( `scope`, `scope_id`, `path`, `value`) VALUES ('websites','1','dev/debug/template_hints', @template_hints) ON DUPLICATE KEY UPDATE `value`=@template_hints;
-- Enable block hints
SET @template_hints_blocks = 1;
INSERT INTO `core_config_data` ( `scope`, `scope_id`, `path`, `value`) VALUES ('websites','1','dev/debug/template_hints_blocks', @template_hints_blocks) ON DUPLICATE KEY UPDATE `value`=@template_hints_blocks;

Disable template/block hints for the first* website

-- Enable template hints
SET @template_hints = 0;
INSERT INTO `core_config_data` ( `scope`, `scope_id`, `path`, `value`) VALUES ('websites','1','dev/debug/template_hints', @template_hints) ON DUPLICATE KEY UPDATE `value`=@template_hints;
-- Enable block hints
SET @template_hints_blocks = 0;
INSERT INTO `core_config_data` ( `scope`, `scope_id`, `path`, `value`) VALUES ('websites','1','dev/debug/template_hints_blocks', @template_hints_blocks) ON DUPLICATE KEY UPDATE `value`=@template_hints_blocks;

As I covered in this post, it is possible to turn on hints at a global level, which activates hints for all website and for the admin panel. This is useful if you’re making customizations to the admin panel, or if you have multiple websites for which you’re wanting to activate/deactivate hints at the same time. The following two snippets modify hints at a global level:

Enable template/block hints for the admin panel and ALL websites

-- Enable template hints
SET @template_hints = 1;
INSERT INTO `core_config_data` ( `scope`, `scope_id`, `path`, `value`) VALUES ('default','0','dev/debug/template_hints', @template_hints) ON DUPLICATE KEY UPDATE `value`=@template_hints;
-- Enable block hints
SET @template_hints_blocks = 1;
INSERT INTO `core_config_data` ( `scope`, `scope_id`, `path`, `value`) VALUES ('default','0','dev/debug/template_hints_blocks', @template_hints_blocks) ON DUPLICATE KEY UPDATE `value`=@template_hints_blocks;

Disable template/block hints for the admin panel and ALL websites

-- Enable template hints
SET @template_hints = 0;
INSERT INTO `core_config_data` ( `scope`, `scope_id`, `path`, `value`) VALUES ('default','0','dev/debug/template_hints', @template_hints) ON DUPLICATE KEY UPDATE `value`=@template_hints;
-- Enable block hints
SET @template_hints_blocks = 0;
INSERT INTO `core_config_data` ( `scope`, `scope_id`, `path`, `value`) VALUES ('default','0','dev/debug/template_hints_blocks', @template_hints_blocks) ON DUPLICATE KEY UPDATE `value`=@template_hints_blocks;

* If you have multiple websites, you’ll need to update the ‘1’ value set for the website field to reflect the ID of your website. If you have multiple websites, you can just turn on hints globally using the last two SQL snippets.

Initial Magento Setup Development Tips

Over the past year and a half of developing Magento sites, our development team has created a standard set of modifications/tweaks that we make to every Magento installation.

1. Automatically turn on developer mode based on the domain.

We have a stage site setup for all of our projects at We also develop projects locally at either .dev or .local (based on developer preference). This snippet of code will only enable error reporting and Magento’s developer mode on stage or local domains.

Insert the following code after “require_once $mageFilename;” in index.php

# If the domain is ***.dev, ***.local or stage.**** then run site in developer mode and turn on error reporting
if(in_array(substr($_SERVER['HTTP_HOST'], -4), array('.dev', 'ocal') )
  || strstr($_SERVER['HTTP_HOST'], 'stage.')
	ini_set('display_errors', 1);

2. Enable logging

Magento has a built-in logging method that allows you to log any variable type to a log file. This is very helpful when building Magento modules, as you can easily inspect data structures, without having to open a debugging session to inspect the variables in local scope. By default, logging is turned off in Magento. To enable logging, go to the “Developer” tab on the “System > Configuration” page. Change the “Enabled” select list under the “Log Settings” section to “Yes” and then save the page.

You can log variables to the Magento log using the following code: Mage::log($variable); By default, logs are stored in var/log/system.log

Here are some example usages of Mage::log()

# Log data from a Model
$model = Mage::getModel('catalog/product')->load(1);
# Log data from a Collection
$collection = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect('*')->load();
# Log data from array
$array = array('bar' => 'foo', 1, 2,);

If you’re developing on a Mac, I’d recommend opening the system.log file with the Console app. If you’re on a *nix based machine, you “tail” the latest contents of the log file using the following bash command:
tail -f


3. Enhance error backtraces

All of our developers use xdebug as a part of their Apache configuration. Xdebug has two main benefits: (1) It allows us to use PDT to debug PHP applications. (2) It overrides the default PHP error messages with detailed, fully customizable error backtraces. You can see an example backtrace below:

Magento has built-in error and exception handling. Since errors are being handled by Magento, we have to modify a core file to make Magento let PHP/xdebug handle the displaying of the messages.

In a future blog post, will cover how to make Magento let xdebug handle exceptions

In app/code/core/Mage/Core/Model/App.php, replace the setErrorHandler() method with the setErrorHandler() method below:

    public function setErrorHandler($handler)
        // HACK: Magento should only handle errors if developer mode is off
        return $this;

Modifying core Magento files is never recommended, but if Magento gets upgraded and this change gets overridden, there won’t be an issue, since it’s not critical for the site to function.

4. Enhance exception backtraces

In this Enabling Xdebug’s Exception Handler in Magento blog post, you can read about how to modify Magento to let Xdebug handle exceptions.


Hopefully, these few tips will help you in your Magento development.  If you have any general tips for Magento development, I’d love to hear about them.

Shortening Increment ID length for Orders, Invoices, and Shipments

We recently had a client who needed to shorten the default Magento Increment ID length from the default 9 characters (eg 100000000) to 6 characters.  This can be accomplished by modifying the “increment_pad_length” in the “eav_entity_type” for whatever entity you’re wanting to modify.

If you’re wanting to change the number from which Magento starts counting orders/invoices/shipments, or wanting to change the prefix for those entities, check out this great post by Timothy at Elias:…

Using ShipWorks with Magento (USPS, UPS, Fedex Shipping integration)

In this post, we will be exploring the integration of Interapptive’s ShipWorks with Magento.

ShipWorks is a Windows-only desktop application that integrates a number of different shopping carts with the most common shipping services.  It uses the Microsoft SQL server as its data storage engine, allowing it be installed on multiple computers on the same network.

ShipWorks currently has support for the following shipping methods:

  • UPS (direct integration)
  • UPS Worldship
  • DHL (direct integration)
  • FedEx
  • USPS (Label printing, w/out postage)
  • USPS (via desktop application – domestic shipping only)
  • USPS (via Endicia desktop application)

Benefits of using ShipWorks

  • Fast shipping fulfillment
  • Less error-prone than copy-and-pasting
  • Integration with multiple different shipping methods
  • Low cost (max. of $49.95/mo – see pricing)


  • Windows-only (this is a common trend with shipping management software)
  • Desktop-based (as opposed to web-based)

Typical Magento/ShipWorks Order Fulfillment Workflow

Here are the steps a typical order fulfillment process will look like, once the Magento/ShipWorks integration is completed:

  1. Download new orders from Magento by going to “Order > Download Orders” in Magento.  This will download all orders since the last order download.
  2. Select all orders that aren’t marked as “Closed” or “Complete”.  You can create filters in ShipWorks that will only show orders that match certain parameters.  If you offer multiple shipping providers (eg, UPS & Fedex), you’ll want to select and process orders from each shipping provider separately.
  3. Click the button on the toolbar for the shipping provider associated with the selected orders.
  4. You’ll then customize the shipping options (delivery confirmation, insurance, etc…) for the orders.  You can do this individually or as a group.
    1. Note:  I did notice that when you open the shipping label dialog, ShipWorks doesn’t properly associate shipping services imported from Magento to their respective service type in.  For example, when you select three orders, one with “USPS Priority” and the others with “USPS First-Class” mail, the “USPS Priority” option is selected for all orders.
  5. Once you’re done customizing the shipping options, you’ll print the shipping labels.
  6. Once an order is shipped, it will be marked as “Complete” in Magento.  A Shipment will also be created that will be associated with the associated Order and Invoice.  If a tracking number was provided from the associated shipping service, it will be added to the Shipment.  This will allow a customer to log in to the “My Account” section of the Magento store and see that their order has been shipped.
  7. ShipWorks has the ability to send shipping confirmation emails directly to the customer.  This may work fine for many merchants, but there will be those that want Magento to send the shipment confirmation email.  Based on my perusal of shipworks.php file, it doesn’t look like a shipment notification email is sent from Magento when a shipment is created.  If a merchant wants to have all emails sent from Magento, it would require a small change to be made to the shipworks.php file.

Alternative Solutions for Integrating Magento with UPS, USPS, or FedEx

There are alternatives to using ShipWorks.  Here are a few alternatives.  If you know of any integration methods that aren’t listed here, please let me know and I’ll add them to the list.

Installation – Magento Script

In order to install the Magento script for ShipWorks, all you have to do is copy the provided shipworks.php file into your Magento installation directory.

Installation – ShipWorks

Here are screenshots of the ShipWorks installation process:

If you choose the “Connect to and existing ShipWorks” database, you’ll see the following:

If you choose the “Create a new ShipWorks database” option, you’ll see this:

ShipWorks Screenshots

Here are some screenshots of ShipWorks in action.  More screenshots/screencasts can be found on the Interapptive site.

Magento’s “Global Record Search” Explained

Magento has a little-publicized feature called the “Global Record Search”, located at the top right of every admin page. It allows you to quickly search for Products, Customers, and Orders in the system. If you need to quickly find one of these types of records, using the Global Record Search is much quicker than going to the Product, Customer, or Order listing pages.  Here are the attributes you can use to search:

  • Product Name
  • Customer First Name
  • Customer Last Name
  • Customer Company
  • Customer Postal Code
  • Customer Phone Number
  • Orders by Billing or Shipping address (using the same information as Customer fields listed above)
  • Order Number (Increment ID) – must be exact number, no partial matches

Unfortunately, you’re not able to search by Product ID or Customer ID. This functionality would be simple for a Magento developer to add. It would require overriding one of the following classes: Mage_Adminhtml_Model_Search_Catalog orMage_Adminhtml_Model_Search_Customer. Hope that helps in the management of your Magento store!

Custom Admin Theme

Our Objective

If you need to make adjustments to the adminhtml theme files (template, layout, or skin), you have two options for accomplishing this. Here’s an example of what we would want to accomplish: Files in /app/design/adminhtml/default/custom_admin_theme/ need to override files in: /app/design/adminhtml/default/default/ Likewise, files in /skin/adminhtml/default/custom_admin_theme/ need to override files in: /skin/adminhtml/default/default/ The following two options accomplish this functionality:

Option 1 – “Admin Theme” module

Here is a screenshot of this module in action:

Option 2 – Add XML to your module’s config file

If you don’t want to install a module just to enable this functionality, you can add the following XML code inside the tag inside the config.xml file of any of your active modules. Alternatively, you can add this XML to your /app/etc/local.xml file. I prefer this option, due to its simplicity and the fact that the store administrator will have no need to update the adminhtml theme from the admin panel.

            <!-- custom admin theme -->

The code above overrides the XML from the /app/code/core/Mage/Adminhtml/etc/config.xml lines 410-422

            <!-- default admin design package and theme -->

Enable Template/Block Hints in Admin Panel

Anyone that has developed a theme in Magento knows how helpful template/block hints are. They help quickly identify which files are being loaded for a specific page.

Magento’s admin panel uses the exact same design pattern as the front end (layouts + blocks + templates). If you’ve ever done any modifications to the Magento admin panel, you’ve probably tried to turn on template/block hints for the admin panel. The only problem is, Magento doesn’t have built-in support for this. I did some digging around and found out how to enable this feature in the admin panel.

Step 1 – Connect to database

Using your favorite database administration tool, connect to your Magento database. These are tools I’ve used and recommend: Navicat ($129), MySQL Query Browser (Free), Sequel Pro (Mac Only – Free), or phpMyAdmin (free).

Step 2 – Enter values into ‘core_config_data’ table

Run the following query on the Magento database:

INSERT INTO core_config_data (scope, scope_id, path, value)
VALUES ('default', 0, 'dev/debug/template_hints', 1),
('default', 0, 'dev/debug/template_hints_blocks', 1);

Step 3 – Test in admin panel

Once you make this addition to the core_config_data database, template/block hints should show up in the admin panel.

Disabling Hints

When you’ve finished development want to turn off template hints in the admin panel, open the core_config_data table and change the ‘value’ column of the two row you inserted to “0”.

Why does this work?

For those of you who are like me and want to know the “why” as well as the “how”, I’m going to go over why this works. Here is the Magento code that checks to see if template/blocks hints are enabled:

File: /app/code/core/Mage/Core/Block/Template.php (Magento 1.3.2)
public function getShowTemplateHints()
    if (is_null(self::$_showTemplateHints)) {
        self::$_showTemplateHints = Mage::getStoreConfig('dev/debug/template_hints')
            && Mage::helper('core')->isDevAllowed();
        self::$_showTemplateHintsBlocks = Mage::getStoreConfig('dev/debug/template_hints_blocks')
            && Mage::helper('core')->isDevAllowed();
    return self::$_showTemplateHints;

The “Mage::getStoreConfig” method checks for config values that are set in the current scope (ie, default, website, store, store view). In the admin panel, only values set in the “Default Scope” are loaded.

Magento only allows you to turn on hints when you’re in the configuration scope of a Website or Store View. This means that when the code above tries to load the configuration, it returns “null” because that config value isn’t set in the “Default Config” scope. Running the MySQL query above adds the hint config values to the “Default Config” scope.


I hope this helps you in your development of Magento modules that integrate with the admin panel. I considered writing a module to enable the hints to be turned on in the “Default Scope”, but decided against it, due to the simplicity of the method outlined in this post.

What we REALLY think about winning Comparably’s Best Workplace for Career Growth

We’re beyond thrilled that we’ve received eight workplace-related awards in the last year, the most recent two being Best CEO for Women and Best Company for Career Growth!

That. Is. AWESOME!

But listen … I know that there’s this unwritten rule somewhere that says:

“If you receive an award for Best Company for [fill in the blank] you must say some variation of, ‘We are humbled and shocked by this honor!’”

Here’s the deal: 

Is humility at the core of who we are? 


Are we humbled and shocked by these awards? 


We’re SO proud of these awards because while Classy Llama is the recipient, the only reason we earned these is because our people are brave enough to be 100% unapologetically themselves. Not only that, they continually have the courage to share the kind of ideas and critical feedback that make this place the most amazing eCommerce agency around.

We (the people of Llama Nation) have spent a decade and a half investing in and cultivating our culture into the empowering (and super fun) community it is today.

HUGE shout out to the leadership team for lighting and carrying the torch this far. Even bigger shout out for hiring, trusting, and empowering people to run with that fire. 

Like our CEO, Kurt Theobald, says: “I don’t care about the accolades. I care about the hearts behind them.”

It’s the people we celebrate, not the awards. THAT is what we’re proud of — all the amazing people that make up Classy Llama.

Want to hear what our llamas are saying about life at Classy Llama? Head on over to and see their anonymous reviews firsthand.

Interested in becoming a llama? Check out our careers page to see what we’ve got brewing.

Don’t see anything that fits? Reach out to our very own Llama Sherpa on LinkedIn to keep a pulse on what we’ve got going on.

Read more about Classy Llama’s recent win on Business Insider.

Maintaining Excellent Customer Service at Scale for R&R Products, Inc.

Sometimes, no matter your best intentions, a project can be laden with difficulties. That was certainly true for the R&R Products, Inc., company in the early stages of their eCommerce journey. 

When the R&R team decided their new goals were to expand from the golf products industry into the landscaping market, all while keeping up their commitment to customer service, they knew they would need a stable website with a great user experience. Unfortunately, they were working with a Solutions Integrator that wasn’t able to handle the complexity of the upgrade their website needed, from M2 Open Source to M2 Commerce Cloud. 

That’s when R&R began their search for an agency partner that had the experience and confidence needed to get into the weeds of coding complexities and also the expertise to pull the project out of those same weeds. 


R&R Products, Inc., is a name that’s synonymous with quality. As the world’s leading manufacturer of turf equipment replacement parts for the commercial turf industry, their dedication to serving the needs of golf courses, athletic fields, and more with high quality products has never wavered since their founding in 1971.

Not only that, despite their catalog featuring over 32,000 quality replacement parts, accessories, and more, their team takes superior customer service so seriously, they proudly offer a 98% rate on products being shipped the same day their order is received. When you order from R&R, you can be assured that not only will you get a quality product, you’ll also get it in a timely fashion. 

Looking to the future, R&R is also pursuing growth into the general landscape industry, hopeful they can bring their brand of quality and service to another market. 

But, with a site that worked directly against these objectives, an update with better functionality wasn’t just wished for—it was an absolute necessity.


Standing in the way of the R&R team’s goals was an outdated website that wasn’t functioning at a level commensurate with their commitment to customer service. Their M2 Open Source website contained an abundance of archaic, specialty code, making it slow to load and hard to use. 

Having a stable website with a great user experience is absolutely crucial to R&R Products’ mission that every shopper gets the same excellent customer service every time they visit their website. 

Unfortunately, the complex fixes that would be needed weren’t achievable with the SI they were currently working with. Facing frustrated customers and internal team woes as well, Brian Larson from R&R felt the pressure to fix their eCommerce presentation so acutely it followed him home. He felt unable to disconnect from the stress even in his down time. If the company couldn’t get a better website launched, their eCommerce presentation would continue to stall the growth and expansion R&R saw for their brand. Not only that, their team members would suffer the continued weight of that stress. 


When the R&R team came to Classy Llama, we knew it would be a difficult project, but that didn’t dissuade us from digging in. Delivering what clients need even through storms of difficulty is what lights llamas up, so we rolled up our sleeves and got to work discovering what R&R needed to achieve their goals, and how we could make it happen for them. 

Fitment, UX, and more: Solutions for R&R

Because of the intense level of customization R&R’s M2 Open Source website started with, Classy Llama knew it wouldn’t be a simple process to move them to Adobe Commerce (Magento). Each area of their site that was built with custom code needed to be reviewed and a new—hopefully native to Magento—solution would need to be developed. From shipping to UX to their ERP, Classy Llama began the complicated process of auditing, roadmapping, and implementing each Adobe Commerce integration that would bring R&R’s website from buggy and archaic to functional and technically up-to-date. 

One feature that was intensely important to R&R’s user experience functionality and, therefore, their goals of stellar customer service, was the interactive schematics. This functionality, often referred to as, “Fitment,” is designed to make searching for parts super simple for shoppers and is extremely popular among all kinds of parts sellers. Fortunately, Classy Llama’s extensive experience in the automotive industry and dealing with large catalogs of aftermarket parts made us the team with the technical chops needed to create an excellent fitment search solution for R&R. 

After identifying that the previous SI’s work on the fitment solution would need to be scrapped, Classy Llama’s UX team got to work rebuilding the code from scratch. The team also implemented a functionality that made it possible for customers to save the models of their machinery (ex. lawn mowers) to a personal login so that when they searched, only parts for the models they own would display. 

An Ongoing Partnership

After almost two years of working through various problems during the new Adobe Commerce build, the Classy Llama and R&R teams were able to build the kind of trust and connection every brand needs in their eCommerce partner. Shortly before the official launch date, R&R signed on to an ongoing partnership with Classy Llama, to provide post launch support as well as continued maintenance on whatever they need most. 

Not only that, during our ongoing maintenance, the solutions team determined R&R would benefit from an upgrade to their Adobe Commerce site. Classy Llama is now working toward kicking off the upgrade project as soon as possible. 


Now that R&R Products, Inc., has an eCommerce partner like Classy Llama on their side, their brand is primed to achieve their growth goals. Plus, their dedication to customer service excellence has the technical back-up necessary to make sure they always keep their promise to their customers. 

Contact Us