我想创建一个允许客户附加文件的magento模块联系页面。我遵循magephsycho这个教程,并创建了自己的模块,但是我收到空白的电子邮件。在google上搜索时,我发现这个stackexchange question并修改了IndexController.php。我现在收到带有内容但没有附件的电子邮件。magento联系电子邮件附件,没有收到附件
我是新来的magento,我不知道什么是错的。
这是我的html代码:
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post" enctype="multipart/form-data">
<input name="MAX_FILE_SIZE" type="hidden" value="2000000" />
<input name="fileattachment" id="fileattachment" title="<?php echo Mage::helper('contacts')->__('FileAttachment') ?>" placeholder="<?php echo Mage::helper('contacts')->__('Upload File') ?>" value="fileattachment" class="input-text" type="file" />
这是我的config.xml保存在应用程序/代码/本地/附件/ Eattachment /等
<?xml version="1.0"?>
<config>
<frontend>
<routers>
<contacts>
<args>
<modules>
<Attachment_Eattachment before="Mage_Contacts">Attachment_Eattachment</Attachment_Eattachment>
</modules>
</args>
</contacts>
</routers>
</frontend>
</config>
这是我在更换代码是保存在应用程序/代码IndexController.php /本地/附件/ Eattachment /控制器
if(file_exists($attachmentFilePath)){
mailTemplate->getMail()->createAttachment(
file_get_contents($attachmentFilePath),
Zend_Mime::TYPE_OCTETSTREAM,
Zend_Mime::DISPOSITION_ATTACHMENT,
Zend_Mime::ENCODING_BASE64,
$fileName
);
}
最后,这是叔他说config.xml文件介绍了模块的Magento保存在应用的/ etc /模块
<?xml version="1.0"?>
<config>
<modules>
<Attachment_Eattachment>
<active>true</active>
<codePool>local</codePool>
</Attachment_Eattachment>
</modules>
</config>
更新:这是从管理事务电子邮件
Name: {{var data.name}}
Email: {{var data.email}}
Telephone: {{var data.telephone}}
PollQuestions: {{var data.pollquestions}}
OtherSpecify: {{var data.othersSpecify}}
FileAttachment: {{var data.fileattachment}}
Comment: {{var data.comment}}
我希望我给有用信息的代码。截至目前我不知道发生了什么事。我不确定是否将文件保存在适当的位置。
我的问题是我没有收到联系我们页面发送的任何电子邮件附件。
谢谢!