views:

34

answers:

1

Ok so i built a module now I need to move it so it shows up as a tab in edit product

I tried creating directory

app/code/local/mycompanyname/adminhtml/Catalog/Product

with all the same sub directories and file structure of my original module

and in each of the files change the classes for example

edit.php from

 class <myCompany>_<moduleName>_Block_Adminhtml_<moduleName>_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
 {
 //clip
 }

to

 class <myCompany>_<moduleName>_Block_Adminhtml_Catalog_Product_Edit extends Mage_Adminhtml_Block_Catalog_Product_Widget_Form_Container

but nothing is showing up in my edit product ?? { //clip }

A: 

I suspect there are a couple of problems here.

Firstly, CamelCase naming for Namespaces and Modules will often fail silently in Magento. I assume you actually meant that the path is app/code/local/myCompanyname/moduleName/Block/Adminhtml/Catalog/Product? I suggest you recreate your module using all lowercase names.

Secondly, you need to update the layout xml for the adminhtml_catalog_product_edit and adminhtml_catalog_product_new to insert your Block. For a great example of how to do this, look at googleoptimizer.xml in app/design/adminhtml/default/default/layout. Pasting for reference:

<adminhtml_catalog_product_edit>
    <reference name="product_tabs">
        <block type="googleoptimizer/adminhtml_catalog_product_edit_tab_googleoptimizer" name="tab_googleoptimizer" />
        <action method="addTab"><name>googleoptimizer</name><block>tab_googleoptimizer</block></action>
    </reference>

...

Jonathan Day
you were right to assume that I made a mistake in my showing of the directory and I dont' use camelCase name. so for adding to the layout xml I don't won't people to have to modify that file when they install my plugin is there a way I can accomplish the same goal without having to mode that file ?
mcgrailm
thanks John, between your answer and this blog http://www.magestore.com/blog/2010/04/10/how-to-add-a-tab-in-product-edit-page/comment-page-1/#comment-1388 i was able to bang my head allot less and get it done 8 ^ )
mcgrailm
No problem. You could set the layout in the controller, but expected practice is to use the xml files. I don't think many users will be messing around in adminhtml layout. Certainly in the frontend layout, but if they are keen enough to mess with adminhtml, then they should be prepared to wear the consequences! As someone once said, you can't legislate for stupidity...
Jonathan Day