View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005085 | OXID eShop (all versions) | 4.07. Source code, Test | public | 2013-04-25 15:07 | 2022-02-01 08:33 |
Reporter | vanilla thunder | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 4.7.4 / 5.0.4 revision 57063 | ||||
Fixed in Version | 6.0.0 | ||||
Summary | 0005085: adding attachments to order email for customer does not work | ||||
Description | adding any kind of attachments does not work in order email for customer. There are no php/smarty errors or exceptions. Email arrives but without attachments. Order email for shop owner is OK. | ||||
Steps To Reproduce | get the attached module or add function $this->addAttachment($sPath); to oxEmail->sendOrderEMailToUser() or oxEmail->_addUserInfoOrderEMail() Last one is used in both emails for shop owner and customer, so you will see the code actually working. | ||||
Additional Information | worked earlier with ce/pe 4.4 & 4.5 & 4.6 tested on 4.7.2, 4.7.3 and 4.7.4 ce/pe | ||||
Tags | |||||
Attached Files | |||||
Theme | Not defined | ||||
Browser | All | ||||
PHP Version | 5.3 | ||||
Database Version | Not defined | ||||
|
This case is related with your own shop configuration etc. if you have problems with extending shop functionality with modules please contact our support: [email protected] |
|
I really do not want to be discourteous, but its almost impossible to properly extend sendOrderEmailToUser() because: -> it sends the email at the end of the function, so i have to run my code before the original code, -> just at the beginning the function calls $this->_setMailParams($oShop), which resets all params and attachments of the email made before. And now the reason why i still suppose this being a bug and not a configuration problem: "sendOrderEmailToUser()" calls "_addUserInfoOrderEMail()" right before "_setMailParams()", so "_setMailParams()" would reset all settings set by "_addUserInfoOrderEMail()", which makes no sense for me. And know, that "_addUserInfoOrderEMail()" contains no settings, but "sendOrderEmailToOwner()" calls "_addUserInfoOrderEMail()" after resetting settings. And finally i haven't found any setting could prevent resetting email params and attachments. |
|
yes, design of this class not perfect. we suggest to rewrite sendOrderEmailToUser() in your module and we from our side as the fix will improve the design of the class. |
|
If you want to improve the design, maybe you want upgrade PHPMailer too? ;) Ticket: https://bugs.oxid-esales.com/view.php?id=4200 |
|
one of the main problems is that oxemail is overriding PHPMailer-methods without having the ability to access them. this is what i used to put my own attachements to the order-mail (i tried to disable the clean method when i have to): const skipFlag = "skipClearAttachments"; public function sendOrderEmailToUser( $oOrder, $sSubject = null ){ $modifiedOrder = $this->addMySpecialFiles($oOrder); oxRegistry::getSession()->setVariable(self::skipFlag, true); $parentResult = parent::sendOrderEmailToUser($modifiedOrder, $sSubject); oxRegistry::getSession()->deleteVariable(self::skipFlag); return $parentResult; } // workaround for not deleting special attachments public function clearAttachments(){ // clear oxid-attachments $this->_aAttachments = array(); if( oxRegistry::getSession()->getVariable(self::skipFlag) === true ){ // dont clear oxid- and phpmailer-attachments return; } return parent::clearAttachments(); } |
|
The Email class has been refactored with v6.0.0 so it should now be a lot easier to overwrite it. Regarding the PHPMailer upgrade: We do this on a regular basis. oxideshop_ce in Version 6.10 uses PHPMailer 6.5 |