Magento Forum

   
A question about folder structure when extending core modules
 
Jonathan Hedrén
Member
 
Total Posts:  67
Joined:  2007-08-31
Sweden
 

I’ve now worked with my own modules quite a lot. One thing I soon realized is that when making quite comprehensive extensions, you tend to overload a lot of core modules. To keep the code maintainable and easy to read I’ve used a folder structure looking like this when overloading core modules:

MyModule/
MyModule/Block/
MyModule/Block/AdminHtml/
MyModule/Block/AdminHtml/Customer/
MyModule/Block/Catalog/
MyModule/Block/Catalog/Product/
MyModule/controllers/
MyModule/controllers/AdminHtml/
MyModule/controllers/AdminHtml/Customer/

However, I’ve also thought about having this kind of structure (it doesn’t ‘feel right’ though):

MyModule/
MyModule/AdminHtml/
MyModule/AdminHtml/Block/
MyModule/AdminHtml/Block/Customer/
MyModule/AdminHtml/controllers/
MyModule/AdminHtml/controllers/Customer/
MyModule/Catalog/
MyModule/Catalog/Block/
MyModule/Catalog/Block/Product/

What kind of structure do you recommend (i.e. what convention should I and the community stick to)?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

There might be even different approach I’ve seen people use:

app/code/local/MyNameSpace/
app/code/local/MyNameSpace/AdminHtml/
app/code/local/MyNameSpace/AdminHtml/Block/
app/code/local/MyNameSpace/AdminHtml/Block/Customer/
app/code/local/MyNameSpace/AdminHtml/controllers/
app/code/local/MyNameSpace/AdminHtml/controllers/Customer/
app/code/local/MyNameSpace/Catalog/
app/code/local/MyNameSpace/Catalog/Block/
app/code/local/MyNameSpace/Catalog/Block/Product/
You’re right, we’ll need to compile the custom code recommendations into developer guide.

 
Magento Community Magento Community
Magento Community
Magento Community
 
gamelodge
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2007-08-31
Brisbane, Qld, Australia
 

Is there an Official way that this should be done yet, is what they are doing here correct? :
http://www.magentocommerce.com/boards/viewthread/10473/ -
WIKI - http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table

Which structure should we use for the Developer Challenge
http://www.magentocommerce.com/boards/viewthread/14045/

All guidance from the magento team is much appreciated

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top