Interfacing the admin panel with the theme
Now that we have a full working theme admin panel, and you know how to create any type of option, we need to show the values in the frontend.
Retrieving the data saved in your configuration is quite easy. You can use the following code:
<?php echo Mage::getStoreConfig(bookstore/general/options,Mage::app()->getStore()); ?php>
In the preceding code, bookstore
is the sections, general
is the fields group, and option
is the options field.
Customizing the frontend
Now it is very easy to customize the frontend, because you need to change the stuff in the frontend with the options you created and some conditions. Let's start with a basic example: let's set the telephone number in the header from the admin panel.
Getting the value of an input text field
To get the value of the input text field, we will perform the following steps:
Open the
header.phtml
file inapp/design/frontend/bookstore/default/template/html
and find the following lines of code:<...