Reputation: 1322
I am quite new to Magento, and I'm trying to echo the built in contact form in the footer of a custom Magento-theme. It can't get it working, this is my code:
Path to form.phtml: (app/design/frontend/default/mytheme/template/contacts/form.phtml)
XML (app/design/frontend/default/mytheme/layout/page.xml:
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
<label>Page Footer</label>
<action method="setElementClass">
<value>bottom-container</value>
</action>
</block>
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
<block type="page/template_links" name="top.links" as="topLinks"/>
<block type="contacts/form" name="form" as="form" template="contacts/form.phtml"/>
//the contact form
<block type="newsletter/subscribe" name="newsletter" template="newsletter/subscribe.phtml"/>
<block type="cms/block" name="cms_footer_contact">
<action method="setBlockId">
<block_id>contact_info</block_id>
</action>
</block>
</block>
php (app/design/frontend/default/mytheme/template/page/html/footer.phtml):
<div class="footer">
<div class="col3-set">
<div class="col-1">
<div class="footer-links">
<?php echo $this->getChildHtml('cms_footer_links') ?>
<?php echo $this->getChildHtml('footer_links') ?>
</div>
</div>
<div class="col-2">
<h2 class="<footer-title"><?php echo $this->__('Ask us') ?></h2>
<?php echo $this->getChildHtml('contact-form') ?>
<?php echo $this->getChildHtml('form') ?> //echoing the form
</div>
<div class="col-3">
<h2 class="footer-title"><?php echo $this->__('Contact Details') ?></h2>
<div class="footer-contacts">
<?php
if(Mage::getStoreConfig("trego_settings/footer/newsletter", $code)){
echo $this->getChildHtml('newsletter');
}
?>
<div class="contact-info">
<?php echo $this->getChildHtml('cms_footer_contact') ?>
</div>
</div>
</div>
</div>
<div class="footer-menu">
<?php echo $this->getChildHtml('topLinks') ?>
<?php echo $this->getChildHtml('footer_socialIcons'); ?>
<?php echo $this->getChildHtml('footer_copyrights'); ?>
</div>
</div>
Upvotes: 1
Views: 3417
Reputation: 1
Try to do this on your own. Use e. g. Contact Form 7 plugin, create your form and insert the shortcode provided by CF7 into a text widget.
Upvotes: -2
Reputation: 7611
If you are warred about xml code then paste
the below code in footer.phtml
<?php echo $this->getLayout()->createBlock("core/template")->setTemplate("contacts/form.phtml")->toHtml();?>
and after that goto form.phtml change the action of form to $this->getUrl('contacts/index/post');
There are not need of xml
More details http://inchoo.net/ecommerce/magento/contact-form-in-magento/
Upvotes: 1
Reputation: 8050
Use core/template
as block type. Therefore change:
<block type="contacts/form" name="form" as="form" template="contacts/form.phtml"/>
to
<block type="core/template" name="form" as="form" template="contacts/form.phtml"/>
Upvotes: 4