HomeBreadcrumb ArrowModulesBreadcrumb ArrowOpenCartBreadcrumb ArrowMailOnReturnBreadcrumb ArrowWarning: Invalid argument
New Discussion

Warning: Invalid argument

User Image
Robert Becerra member
#1 posted on 8/7/16

Warning: Invalid argument supplied for foreach() in /.../.../public_html/en/system/modification/system/library/mail.php on line 24Warning: Cannot modify header information - headers already sent by (output started at /.../.../public_html/en/index.php:98) in /.../.../public_html/en/system/library/response.php on line 12​

0
User Image
Teya Veselinova member
#2 posted on 14/7/16

Hello Robert,

The error is related to how the emails are being sent. Is the mail on return received? If it is, than the warning is not of importance. If it is not, however, please try looking for the following lines in the ocmod.xml file:

                if (VERSION < '2.0.2.0' || VERSION == '2.0.3.1') {                     $mail = new Mail($this->config->get('config_mail'));                 } else {                     $mail = new Mail();                     $mail->protocol = $this->config->get('config_mail_protocol');                     $mail->parameter = $this->config->get('config_mail_parameter');                     $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');                     $mail->smtp_username = $this->config->get('config_mail_smtp_username');                     $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');                     $mail->smtp_port = $this->config->get('config_mail_smtp_port');                     $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');                 }

This means that if your OpenCart version is < 2.0.2.0 OR it is 2.0.3.1 it will use:

                   $mail = new Mail($this->config->get('config_mail'));

otherwise:

                    $mail = new Mail();                     $mail->protocol = $this->config->get('config_mail_protocol');                     $mail->parameter = $this->config->get('config_mail_parameter');                     $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');                     $mail->smtp_username = $this->config->get('config_mail_smtp_username');                     $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');                     $mail->smtp_port = $this->config->get('config_mail_smtp_port');                     $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');

 

Since we don't know which version is your opencart and how exactly it is set (in some cases the mail functionality is customized and doesn't use the default one for the specific OC version), we will propose a few solutions, which you can try:

1. Try changing the lines to:

                        if (VERSION < '2.0.2.0' || (VERSION > '2.0.3.0' && VERSION < '2.1.0.1')) {                             $mail            = new Mail($this->config->get('config_mail'));                         } else {                             $mail = new Mail();                             $mail->protocol = $this->config->get('config_mail_protocol');                             $mail->parameter = $this->config->get('config_mail_parameter');                             $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');                             $mail->smtp_username = $this->config->get('config_mail_smtp_username');                             $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');                             $mail->smtp_port = $this->config->get('config_mail_smtp_port');                             $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');                         }     

2. Try replacing all of the lines with:

                           $mail            = new Mail($this->config->get('config_mail'));

3. Try replacing all of the lines with:

                            $mail = new Mail();                             $mail->protocol = $this->config->get('config_mail_protocol');                             $mail->parameter = $this->config->get('config_mail_parameter');                             $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');                             $mail->smtp_username = $this->config->get('config_mail_smtp_username');                             $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');                             $mail->smtp_port = $this->config->get('config_mail_smtp_port');                             $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');

 

Do each of the changes separately and test afterwards. After you make a change, save the file, delete your old modification from Extension > Modifications. Upload the modified file through the extension installer and refresh the modifications. Then try using the extension and check if the error will show up. One of the solutions suggested above should work for you.

I hope this helps!

0