Magento Developer Token Contest

This project was created to investigate if you understand all the different aspects of Magento.  All code is yours and you are free to show the code to other potential employers/clients if you don’t get a job offer from us!

Contest Description

Your job is to create a new Magento extension [1] that gives customers a ‘Token’ every time they complete an order [2]. Nothing else matters about the order. You make an order of any amount, shipped to any location, with any payment method and you get ONE token.  A token is associated with a customer_id, an order_id and a list of order items as a STRING. The ‘order_items’ attribute is always set to a comma separated list of all the item (product) names that were part of the order/quote. Let’s say customer John Doe with customer_id = 4 ordered the following products:
1 Blue T-Shirt
2 Orange Sweat Pants
3 Titanium special baseball bat

 

If the order ID is ‘32’, then the resulting token created (if this was the first token ever created) would be:

token_id
(int, autoincr)

order_id
(int)

customer_id
(int)

order_items
(string)

1

32

4

Blue T-Shirt,Orange Sweat Pants,Titanium special baseball bat

 

If other modules want to access the tokens for a given customer model that has been loaded, they should be able to run the “getTokens()” method on the customer model.  This should return back a collection of Token objects [3].

Add a side box to the catalog listing pages on the side that says how many tokens the currently logged in customer has. There should be a custom css skin file for your extension even though the custom skin file does not need to contain anything. It will be included on every page. You should have a custom layout XML file for this module to define all theme-specific JS, CSS, and block insertions. BIG HINT: You can add to the base theme to the side panel using the layout xml file.

In the back-end there should be a grid that lists all tokens.  You can’t edit a token, you can only view them in the grid. The back-end grid should be accessed from the main back-end menu as a “View Tokens” section of the main menu, under ‘Customer’; ie “Customers -> View Tokens”. Menu items should be added in the module’s config.xml, and do not need to do anything other than redirect the user to the View Tokens grid of all user tokens.


Helpful Hints

[1] You should be creating a new Community extension module for Magento Community Edition 1.5.x

[2] You should be creating an observer that reacts to the sales_order_place_after event which is dispatched every time an order is placed.  When an order model is saved it should check to see if it’s a new order. See the following code to get the Order model from the observer event method. 

    /**
     *  This function runs when an order is saved.
     * @param Varien_Event_Observer $observer
     * @return
     */
    public function orderCompleted($observer)
    {
        /* @var $order Mage_Sales_Model_Order */
        $order = $observer->getEvent()->getOrder();
        return $this;
    }

[3] You should be doing a rewrite of the Customer model in your config.xml here.  If it’s not the best way you, do your own way (although you should probably do the rewrite)

Considerations

The point of this is to illustrate that you can understand requirements and convert them into an implementation in the correct way with consideration for future use.  If you know how to do something but do not have time to code it up, write a COMMENT stub saying what you would otherwise do and it will be gladly accepted.

Submission or Contacting us

Send any questions, concerns, comments and/or a request to send your submission to recruitment at** wdca.ca and someone will get back to you. DO NOT send your submissin without asking first, as your submission may be blocked by our filters and all your teim would be wasted.

Looking forward to seeing everyone's submissions!