Archive for May, 2010

Operating in Trust

Thursday, May 20th, 2010

One of the things that we treasure most here at Classy Llama Studios is trust. We operate as a very close knit team, in an environment that is open, free and flexible. Its an incredibly powerful way to operate, and makes working together a beautiful experience because we don’t waste time on politics or power plays or jockeying for position. Everyone strives for the good of the team and the growth of our clients, and the synergy that is created by that is very powerful.

But maintaining an operating environment like this isn’t easy, and it requires above almost everything else that everyone on the team have a mutual trust and respect for each other. To work in an environment where you are very open, about everything including your faults, means that people have more opportunities than they would in many companies to hurt you. If you’re afraid of being damaged by something you say, or by expressing vulnerability in some fashion, you’re going to have a hard time being open.

In order to be open, to really work together, you have to believe in the quality and the intentions of the people around you. If you doubt your team members, if you always have questions in the back of your mind about whether or not they are really working for your best interest and looking out for those around them, then you won’t be able to be open. Instead, you’ll be operating in a very protective fashion. You have to guard yourself because you are the only one who is looking out for you.

The problem with operating in this fashion is that it is inefficient, stressful and a detriment to building a solid team. When everyone in a team concerned with guarding their rear, jockeying for position and making sure that there are no chinks in their armor, they spend more time being cautious and dancing around trying to find the highest ground than they do actually being productive.

The beautiful thing is that here at CLS, we don’t have to do that. We operate in an environment where it is okay to let down your guard because everyone else on the team isn’t a bunch of bloodthirsty piranhas looking for a weak moment to take you out. Instead, everyone here works toward helping everyone else out.

It really is the best way to operate. When you see a weakness in a fellow team member, you don’t jump on them and find a way to exploit the opportunity to make yourself look better. Instead, you strive to help that team member grow. You show them how to be stronger, how to improve, how to better themselves as a worker and a person. You flex as needed to help everyone find the best fit and role for themselves.

When this is the approach that everyone on a team is taking, you don’t have to defend yourself all the time. Instead, you can focus on doing things to really serve people. Here at Classy Llama Studios our goal is to selflessly serve the best interests of the other people on our team and our clients. It sound dangerous, serving selflessly. Doing things without worrying about yourself. But when you have a team of people who believe in trust and growth, who believe in really serving each other, then it really is very safe. Instead of you looking out for you, you have many people looking out for you. Everyone has your back, and you are free to run with the tasks you’ve been given.

Don’t waste time building an organization based on politicking and posturing and protecting yourself. Instead, focus on building a team where you can trust the people around you. Find people to work with who are solid folks, who care about those around them… and then trust them to be who you believe they are! When you can begin to trust the people around and live and work in an environment where people are watching your back for you instead of trying to stab it, you’ll get more done, you’ll be much happier, and ultimately you’ll be free to serve and protect and build up those around you – because you trust the people around you to do the same for you.

Trust is a choice. You can know a lot about a person, but choosing to trust them is an act of your will. It does mean you’re at risk of getting hurt, but if you are willing to trust the quality people around you, you might find yourself beginning to lose the armor, and instead be free to run a little faster, to work a little better and to breathe a little easier. Its a beautiful thing.

Cheers!

Posted in General Business | 1 Comment »

Productive Distractions

Tuesday, May 11th, 2010

milton

What is it that makes people hate their jobs?

“I don’t get paid enough?”  Possibly.

“My boss is an idiot.”  Feasible.

“The hours are too long.”  Perhaps.

“I’m not productive enough.”  … HUH?

That’s not something you’ll hear often.  You’ll never hear someone complain that they’re not productive enough; probably because they’d get fired.

Why is this question avoided so often?  I believe that productivity, or lack thereof, can play a huge part in how fulfilling a person’s job can be.  Doesn’t it make sense for someone to be frustrated?  5 days per week, working 8-10 hours doing nothing, accomplishing very little, and making zero progress?  Sounds like fun, eh?

Sadly, too many people believe this is the only option; they’ll have to deal with it for the rest of their lives; just holding out until retirement.  Then!… Then they’ll be able to finally enjoy life and experience fulfillment.  But until then, they just have to grit their teeth and deal with the dismal day that is their job.

At this point many of you are probably asking, “So how do I stop hating my job and start enjoying it?”

1. Leave your expectations for the day at the doorstep.

Many of us plan out a boring day the night before, or the morning of our job.  We already know what to expect, the same thing as always.  You’ve probably heard this referred to as “self fulfilling prophesy”.  This doesn’t have to be the case.  How about letting the day determine that for itself?  And if you absolutely insist on having expectations, maybe try having positive expectations for a change.

2.  Get to know your co-workers

It’s very comfortable for people to just clock in, and clock out.  Grab your paycheck and head home.  Try to get to know your co-workers and maybe even outside your job.  Maybe you’ll share a common interest and who knows, maybe even be … friends!  Believe me, working alongside people you know and have something in common with can make a world of a difference.

3.  Welcome Critiques, but don’t take them personally

Don’t get mad if someone makes a suggestion.  Take all critiques and criticism in stride.  Learn from it, and move on.

4.  Be Proactive

Take charge of your tasks.  If you finish what you had planned for the day ask to take on something else.  Or study and research.  Take initiative on developing your personal knowledge and skill in your field of work.

5.  TAKE BREAKS… Often!

“Oh no!  If I take a break, won’t I be breaking some rule or something?”  No.

In fact, studies have shown that periodic breaks throughout the work day are beneficial to productivity.  This is what I like to call “Productive Distractions”.  Breaks like these will help you clear your mind, regain your focus and feel refreshed.

Working at Classy Llama Studios is an incredible experience.  Productivity is high, but we still have fun.  It’s a great dynamic that is hard to find in a work environment.  Not every office can fit into the same mold, but hopefully small adjustments like these can help make your 40 hours a week more enjoyable.

productive-distractions

A snapshot of our favorite past-time around the office. Hacky Sack. (From left to right: Kristian, Rob, Erik, Kevin)


CLS

Project kick-off meeting. (From left to right: Joey, Kurt, Rob, Erik, Joshua)

Tags: , , ,
Posted in General Business | 1 Comment »

Enabling Xdebug’s Exception Handler in Magento

Saturday, May 8th, 2010

Magento’s default error and exception handlers provide more information than the default php handlers, as they print out a basic backtrace (example) as opposed to just printing out the file and line number of the error but there are many times when Magento’s handlers just don’t cut it; times when you need to see the fully expanded variables that get passed to the functions/methods in the backtrace.

In the Initial Magento Setup Development Tips blog post, I wrote about how Xdebug overrides the default php error handler with a detailed, customizable error backtrace. I explained how to modify Magento’s core code so that php errors get handled by Xdebug, not Magento’s default error handler.

In this blog post, I’m going to explain how to modify Magento so that exceptions get handled by Xdebug, not Magento’s default exception handler.

The Mage::run() method is the method that gets the entire Magento request cycle started, so it makes sense that this is where the exceptions get handled:

    /**
     * Front end main entry point
     *
     * @param string $code
     * @param string $type
     * @param string|array $options
     */
    public static function run($code = '', $type = 'store', $options=array())
    {
        try {
            Varien_Profiler::start('mage');
            self::setRoot();
            self::$_app = new Mage_Core_Model_App();
            self::$_events = new Varien_Event_Collection();
            self::$_config = new Mage_Core_Model_Config();
            self::$_app->run(array(
                'scope_code' => $code,
                'scope_type' => $type,
                'options'    => $options,
            ));
            Varien_Profiler::stop('mage');
        } catch (Mage_Core_Model_Session_Exception $e) {
            header('Location: ' . self::getBaseUrl());
            die();
        } catch (Mage_Core_Model_Store_Exception $e) {
            require_once(self::getBaseDir() . DS . 'errors' . DS . '404.php');
            die();
        } catch (Exception $e) {
            if (self::isInstalled() || self::$_isDownloader) {
                self::printException($e);
                exit();
            }
            try {
                self::dispatchEvent('mage_run_exception', array('exception' => $e));
                if (!headers_sent()) {
                    header('Location:' . self::getUrl('install'));
                } else {
                    self::printException($e);
                }
            } catch (Exception $ne) {
                self::printException($ne, $e->getMessage());
            }
        }
    }

The problem with the above code is that any exceptions that get thrown by any Magento code get handled by the Mage::printException() method. What we need to do is run the essential code without wrapping it in any try/catch blocks if the developer mode is enabled from the index.php. This will result in all exceptions being handled by the Xdebug exception handler. Here is the resulting code:

    /**
     * Front end main entry point
     *
     * @param string $code
     * @param string $type
     * @param string|array $options
     */
    public static function run($code = '', $type = 'store', $options=array())
    {
        if(!self::getIsDeveloperMode()){
            try {
                Varien_Profiler::start('mage');
                self::setRoot();
                self::$_app = new Mage_Core_Model_App();
                self::$_events = new Varien_Event_Collection();
                self::$_config = new Mage_Core_Model_Config();
                self::$_app->run(array(
                    'scope_code' => $code,
                    'scope_type' => $type,
                    'options'    => $options,
                ));
                Varien_Profiler::stop('mage');
            } catch (Mage_Core_Model_Session_Exception $e) {
                header('Location: ' . self::getBaseUrl());
                die();
            } catch (Mage_Core_Model_Store_Exception $e) {
                require_once(self::getBaseDir() . DS . 'errors' . DS . '404.php');
                die();
            } catch (Exception $e) {
                if (self::isInstalled() || self::$_isDownloader) {
                    self::printException($e);
                    exit();
                }
                try {
                    self::dispatchEvent('mage_run_exception', array('exception' => $e));
                    if (!headers_sent()) {
                        header('Location:' . self::getUrl('install'));
                    } else {
                        self::printException($e);
                    }
                } catch (Exception $ne) {
                    self::printException($ne, $e->getMessage());
                }
            }
        } else { // If we're running in developer mode, we want all exceptions to be handled by the php|xdebug error handler
            Varien_Profiler::start('mage');
            self::setRoot();
            self::$_app = new Mage_Core_Model_App();
            self::$_events = new Varien_Event_Collection();
            self::$_config = new Mage_Core_Model_Config();
            self::$_app->run(array(
                'scope_code' => $code,
                'scope_type' => $type,
                'options'    => $options,
            ));
            Varien_Profiler::stop('mage');
        }
    }

This code allows Xdebug’s exception handler to do its magic, resulting in fully detailed exception backtraces like this:

XdebugException

Hopefully this little trick allows you to code Magento more effectively!

Posted in Magento Development | 2 Comments »

Track Inventory for Configurable Products

Saturday, May 8th, 2010

We recently had a client who needed to be able to manage inventory for configurable products in Magento. Since configurable products are intended to merely group simple products together, the ability to track inventory for configurable products is not something that is possible in a vanilla Magento install.

I dug into the Magento codebase to better understand how inventory is managed for the different product types in Magento. As you could probably guess, the CatalogInventory module handles all of Magento’s inventory management. In side of the /app/code/core/Mage/CatalogInventory/etc/config.xml file, you’ll find the following section of xml contained in the global tag:

<catalog>
<product>
        <type>
            <simple>
                <is_qty>1</is_qty>
            </simple>
            <virtual>
                <is_qty>1</is_qty>
            </virtual>
            <configurable>
                <stock_indexer>cataloginventory/indexer_stock_configurable</stock_indexer>
            </configurable>
            <grouped>
                <stock_indexer>cataloginventory/indexer_stock_grouped</stock_indexer>
            </grouped>
        </type>
    </product>
</catalog>

This section of xml is used by Mage_CatalogInventory_Helper_Data::getIsQtyTypeIds method to determine if a certain product type “qualifies” for inventory tracking. It is also used to indicate if there is a custom resource model that needs to be used to calculate the stock availability for a certain product type.

The beautiful thing about the way Magento handles the configuration xml is that we can create xml nodes that mirror the structure of the above xml in a config.xml file in a custom module – this allows us to change pretty much any configuration value without having to touch any of the config.xml files of core Magento modules. Magento will then merge the xml nodes from both config.xml files. Since custom modules are loaded after core modules, any nodes that override default Magento nodes will take precedence.

I created a small module that enables inventory tracking for configurable products. The following sections in Magento are overridden by this module:

You can download this module here. All you need to do to install the module is to copy the app folder into your Magento install folder. Note:

UPDATE (5/12/10): After working with this test module on a dev site, it looks like the $item->getProduct() method call on line 21 in the CLS_ConfigurableInventory_Model_CatalogInventory_Observer class actually isn’t returning a product model for all order items. This is something that I’ll be debugging once we actually implement this test code in a project. I’ll try to post an update here when we do that.

I’d love to hear from any of you that end up implementing this code on your site.

Posted in Magento Development | 4 Comments »

Call us at 417-597-3397, email us at sales@classyllama.com, or use this form to contact us:

  1. (required)
  2. (required)
 

cforms contact form by delicious:days

Full builds (design and development) start at $70k