Let me preface this by the fact that I am 100% new to Magento.
I am trying to extend the contact us page to allow me to add some information to the page, like the form, in which it cannot be change via the CMS (specifically the address information to start). I have done a ton of google searches and looked at similar questions here (this seems to be the closest: Contact Us form is not displaying) but I am not figuring it out.
I have tried various methods of solving but I am currently trying to add a block. All I am trying to do at this point is get the "special" text to show on the page along with form. Realize that might be wrong, just looking for some direction on what I am missing.
Code:
etc/modules/TPW_Contacts.xml
<?xml version="1.0"?>
<config>
<modules>
<TPW_Contacts>
<active>true</active>
<codePool>local</codePool>
</TPW_Contacts>
</modules>
</config>
app/code/local/TPW/Contacts/controllers/IndexController.php
<?php
require_once Mage::getModuleDir('controllers', 'Mage_Contacts') . DS . 'IndexController.php';
class TPW_Contacts_IndexController extends Mage_Contacts_IndexController
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
?>
app/code/local/TPW/Contacts/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<TPW_Contacts>
<version>0.1.0</version>
</TPW_Contacts>
</modules>
<global>
<blocks>
<contacts>
<class>TPW_Contacts_Block</class>
</contacts>
</blocks>
</global>
<frontend>
<routers>
<contacts>
<args>
<modules>
<TPW_Contacts before="Mage_Contacts">TPW_Contacts</TPW_Contacts>
</modules>
</args>
</contacts>
</routers>
</frontend>
</config>
app/design/frontend/enterprise/hellov/layout/contacts.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="footer_links">
<action method="addLink" translate="label title" module="contacts" ifconfig="contacts/contacts/enabled"><label>Contact Us</label><url>contacts</url><title>Contact Us</title><prepare>true</prepare></action>
</reference>
</default>
<contacts_index_index translate="label">
<label>Contact Us Form</label>
<reference name="head">
<action method="setTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
<action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>
<reference name="content">
<block type="contacts/location" name="contacts.locationinfo" template="contacts/locationinfo.phtml"/>
</reference>
<reference name="content">
<block type="core/template" name="contactForm" template="contacts/form.phtml"/>
</reference>
</contacts_index_index>
</layout>
app/code/local/TPW/Contacts/Block/Contacts.php
<?php
class TPW_Contacts_Block_Location extends Mage_Core_Block_Template
{
public function getLocation()
{
return 'This is my address!';
}
}
?>
app/design/frontend/enterprise/hellov/template/contacts/locationinfo.phtml
<p><?php echo $this->getLocation(); ?></p>
Your help is appreciated. Thank you!