Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
make terms and conditions filename configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
fheyer committed Jul 3, 2019
1 parent 51c365b commit af4ae4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Model/MailEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,13 @@ private function setPdfAttachment($emailType, Message $message, $obj)
private function setTACAttachment(Message $message, $tacPath)
{
list($filePath, $ext, $mimeType) = $this->getTacFile($tacPath);
$tacFilename = $this->dataHelper->getConfigGeneral('tac_filename');
$tacFilename = ((empty($tacFilename)) ? 'terms_and_conditions' : $tacFilename) . '.'. $ext;
if($this->dataHelper->versionCompare("2.3")) {
$attachment = new \Zend_Mime_Part(file_get_contents($filePath));
$attachment->type = $mimeType;
$attachment->disposition = \Zend_Mime::DISPOSITION_ATTACHMENT;
$attachment->filename = 'terms_and_conditions.'. $ext;
$attachment->filename = $tacFilename;
return $attachment;
}
else{
Expand All @@ -203,7 +205,7 @@ private function setTACAttachment(Message $message, $tacPath)
$mimeType,
\Zend_Mime::DISPOSITION_ATTACHMENT,
\Zend_Mime::ENCODING_BASE64,
'terms_and_conditions.' . $ext
$tacFilename
);
}
}
Expand Down
4 changes: 4 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
<field id="is_enabled_attach_tac">1</field>
</depends>
</field>
<field id="tac_filename" translate="label comment" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Terms and Conditions filename</label>
<comment>Basename for attachment</comment>
</field>
</group>
</section>
</system>
Expand Down
1 change: 1 addition & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</module>
<general>
<enabled>1</enabled>
<tac_filename>terms_and_conditions</tac_filename>
</general>
</mp_email_attachments>
</default>
Expand Down

0 comments on commit af4ae4b

Please sign in to comment.