23.02.2015 Views

www.it-ebooks.info

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Backend Development<br />

To modify the backend, we need to create a new scope in our configuration file called<br />

admin. Perform the following steps to do so:<br />

1. Open the config.xml file, which can be found at the location app/code/<br />

loca/Mdg/Giftregistry/etc/.<br />

2. Add the following code to <strong>it</strong>:<br />

<br />

<br />

<br />

admin<br />

<br />

Mdg_Giftregistry_Adminhmtl<br />

giftregistry<br />

<br />

<br />

<br />

<br />

This code is very similar to the one we used before to specify our frontend route;<br />

however, by declaring the route this way we are breaking an unwr<strong>it</strong>ten Magento<br />

design pattern.<br />

In order to keep things consistent on the backend, all new modules should extend<br />

the main admin route.<br />

Instead of defining the route w<strong>it</strong>h the previous code, we are creating a completely<br />

new admin route. Normally, you don't want to do this for the Magento backend<br />

unless you are creating a new route that requires admin access but not the rest of the<br />

Magento backend. A callback URL for an admin action would be a good example of<br />

something like this.<br />

Fortunately, there is a very easy way to share route names among Magento modules.<br />

Sharing route names was introduced in Magento 1.3<br />

but to this day, we still see extensions that don't use this<br />

pattern properly.<br />

[ 134 ]<br />

<strong>www</strong>.<strong>it</strong>-<strong>ebooks</strong>.<strong>info</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!