我对Magento很陌生,我试图在自定义Magento主题的页脚中回应内置的联系表单。 它无法正常运行,这是我的代码:
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>
答案 0 :(得分:4)
使用core/template
作为块类型。因此改变:
<block type="contacts/form" name="form" as="form" template="contacts/form.phtml"/>
到
<block type="core/template" name="form" as="form" template="contacts/form.phtml"/>
答案 1 :(得分:1)
如果您在footer.phtml
中加注了以下代码about xml code then paste
<?php echo $this->getLayout()->createBlock("core/template")->setTemplate("contacts/form.phtml")->toHtml();?>
之后goto form.phtml将表单的操作更改为$this->getUrl('contacts/index/post');
不需要xml
更多详情http://inchoo.net/ecommerce/magento/contact-form-in-magento/
答案 2 :(得分:-2)
尝试自己动手。你看。 G。联系Form 7插件,创建表单并将CF7提供的短代码插入文本小部件。