2

I need to implement some custom functionality in admin/backend section where users have the option of creating a manual order. The main objectives are to:

  • Add a mini form above the option to select products to add to the order

  • Add a javascript file when on this page

  • The option of saving this form as normal or through a custom handler based on a session var set after the first form submission

I understand how to do each individual part but I could use some guidance on the best approach.

Should I create a module which contains all of this functionality? If so, is it possible using the layout file to reference the various blocks on this page and insert the custom blocks as required without calling them from the core files?

OR

Should I copy the core files to a local directory and make the changes as necessary? If so what's the best practice regarding the template files for the admin section in terms of where modified ones should go?

develophper
  • 2,214
  • 6
  • 32
  • 52

1 Answers1

3

I'd recommend creating a dedicated module for several reasons:

  • All related code is grouped together in a single module
  • The entire module can be easily disabled if needed
  • You can override single methods (whereas the local approach requires full copies of the original code)
  • Easier to upgrade Magento, for the reason above

Your module can absolutely have its own layout XML file. It would work exactly like frontend modules, where you can reference certain blocks, add child blocks, call methods on them, etc. Just add this to your module's config.xml file:

<?xml version="1.0">
<config>
    ...
    <adminhtml>
        <layout>
            <updates>
                <slider>
                    <file>modulename.xml</file>
                </slider>
            </updates>
        </layout>
    </adminhtml>
</config>

Just replace modulename.xml with whatever your layout file is called.

Ninja edit: The best-practices are basically the same as the frontend.

Colin O'Dell
  • 1,215
  • 1
  • 7
  • 23