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.

What have we learned?<br />

So far, we have learned to:<br />

Chapter 4<br />

• Create the base directory structure for our Magento module<br />

• The role and importance of the configuration files<br />

• Creating models and setup resources<br />

• The role and order of installation, upgrade, and data scripts<br />

Here's a challenge for you. Try improving the model structure for our<br />

module even further by converting the ent<strong>it</strong>y into an EAV model; this will<br />

require modifications to the installation scripts and to the resource model.<br />

To see the answer w<strong>it</strong>h the complete code and full breakdown, vis<strong>it</strong><br />

http://<strong>www</strong>.magedevguide.com/challenge/chapter4/2.<br />

Setting up our routes<br />

Now that we are capable of saving and manipulating the data by using our models,<br />

we need to provide a way for customers to interact w<strong>it</strong>h the actual gift registries;<br />

that is our first step. We need to create valid routes or URLs in the frontend.<br />

As w<strong>it</strong>h many things in Magento, this is controlled by the configuration file. A route<br />

will convert a URL into a valid controller, action, and method.<br />

Open our config.xml file. The file location is app/code/local/Mdg/Giftregistry/<br />

etc/config.xml. Refer to the following code:<br />

<br />

…<br />

<br />

<br />

<br />

standard<br />

<br />

Mdg_Giftregistry<br />

giftregistry<br />

<br />

<br />

<br />

<br />

…<br />

<br />

[ 107 ]<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!