Creating custom Magento modules

Modules in Magento allow you to code additional functionality into your magento store. Today I’m making a module for a Pinterest competition!

First thing we do is create the file and folder structure in app/code/local/YOURLIB/YOURMODULE :

app
    /code
        /local
            /Madskull
                /Pinterest
                    /controllers
                    /etc

In the etc folder, create config.xml:




    
        
            0.1.0
        
    


    


        
            
                Madskull_Pinterest_Model
                madskull_pinterest_resource
            
            
                Madskull_Pinterest_Model_Resource
            
        


        
            
                Madskull_Pinterest_Block
            
        


        
            
                Madskull_Pinterest_Helper
            
        


    


    
    


        
            
                standard
                
                    Madskull_Pinterest
                    pinterest
                
            
        



        
            
                
                    madskull/pinterest.xml
                
            
        


    
    

To activate our module, we add a config file app/etc/modules/Madskull_Pinterest.xml :



    
        
            true
            local
        
    

Finally to get up and running add the controller code in controllers/IndexController.php :


    
        
            
                page/1column.phtml
            
        
        
            
        
    

Now reload the page, and you’ll have all the template gubbins rendering too.

Your module is primed and ready for you to start developing!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s