Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Adding New Functions and Blocks
 
BaskingShark
Jr. Member
 
Total Posts:  7
Joined:  2008-10-24
 

I’ve been working on extending Magento’s code with additional functions and blocks in a MyCompany module but I’m running into some problems. After lots of digging through the wiki and the forums I’m finding a number of sets of conflicting instructions for modifying (or not) etc/local.xml, etc/modules/MyCompany.xml, code/local/MyCompany/Catalog/Block/Navigation/Featured.php, and the config.xml file that resides in an etc directory somewhere along the path just mentioned (it seems to vary in different instruction sets). Once I get a single example working, I can take it from there, but I haven’t made it to that point so for now I’m simply working on extending Mage_Catalog_Block_Navigation with a new function that simply returns a text string (the database query I’ve written can go in later).

Could someone please either point me to a clear list of what needs to be done to add a new function and block or give me a quick “best practices” outline? For example, should local.xml be modified? Some tutorials do it, some don’t. The same with the etc/modules/MyCompany.xml file. Where should the module declaration go? I’m also very confused at this point about the naming scheme and when and how far it is required to list the path to the function in the config files.

Here is the list of tutorials and threads I’ve been working from and which approaches I’ve tried, all without luck:

http://www.magentocommerce.com/wiki/how_to_create_a_featured_product
http://www.magentocommerce.com/wiki/groups/174/changing_and_customizing_magento_code
http://www.magentocommerce.com/wiki/sort_order_by_customer_groups
http://www.magentocommerce.com/boards/viewthread/2191
http://www.magentocommerce.com/boards/viewthread/8901/
http://www.magentocommerce.com/wiki/changing_the_adminhtml_template
http://www.magentocommerce.com/boards/viewthread/14103/
http://www.magentocommerce.com/boards/viewthread/8941/

There seems to be a lot of guesswork going on and I think there are certain organizational changes between versions that may be responsible for the conflicting approaches. Can anybody help me out here with a definitive list of steps?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
BaskingShark
Jr. Member
 
Total Posts:  7
Joined:  2008-10-24
 

Several more hours into it and I learned a simple but critical lesson about Magento: do not name your module with the same name as your theme. If you do, then code in your module won’t be recognized. I now have a custom module working properly with all the code I had before, all I did was, in desperation, to rename the module.

As for a nice clean tutorial on which configuration files need to be modified, this blog post is extremely helpful: http://www.exploremagento.com/magento/simple-custom-module.php

 
Magento Community Magento Community
Magento Community
Magento Community
 
XWare
Jr. Member
 
Total Posts:  8
Joined:  2008-10-03
 

Thanks for the link cause any additional tutorials or help is really needed to figure out how to fully customize Magento.

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