Jump to content

PS 1.7 error when setting SMTP mail / AdminEmailsController.php


DD_DD2

Recommended Posts

Hi,

 

On PS 1.7.0.2, after setting smtp parameters and clicking on Save, I've got this error:

"

ContextErrorException in AdminEmailsController.php line 84: Notice: Trying to get property of non-object

"

the lines are 

        foreach (Contact::getContacts($this->context->language->id) as $contact) {
            $arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']);
        }
 
It appears that $this->context is NULL !
 
Does anyone know more about that ?
 
 
Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Thanks jeroen80 !


 


Or if you don't want to log emails,


- keep the parameter to 0 (ps_configuration > PS_LOG_EMAILS)


- change the controllers/admin/AdminEmailsController.php. The issue is the line 



46 parent::__construct();

which is included into the test         if (Configuration::get('PS_LOG_EMAILS')) { !

So write the parent::__construct(); instruction just before the if, like this :



public function __construct()
{
$this->bootstrap = true;
parent::__construct();
if (Configuration::get('PS_LOG_EMAILS')) {
$this->table = 'mail';
$this->className = 'Mail';

$this->lang = false;
$this->noLink = true;
$this->list_no_link = true;
$this->explicitSelect = true;
$this->addRowAction('delete');

// parent::__construct();



Hope Prestashop team is listen to us to include it in the next update !
Link to comment
Share on other sites

  • 5 years later...
Le 03/02/2017 à 6:46 PM, DD_DD2 a dit :

Thanks jeroen80 !

 

 

 

 

Or if you don't want to log emails,

 

 

- keep the parameter to 0 (ps_configuration > PS_LOG_EMAILS)

 

 

- change the controllers/admin/AdminEmailsController.php. The issue is the line 

 

 


46 parent::__construct();

 

which is included into the test         if (Configuration::get('PS_LOG_EMAILS')) { !

 

 

So write the parent::__construct(); instruction just before the if, like this :

 

 

 

    public function __construct()

    {

        $this->bootstrap = true;

        parent::__construct();

        if (Configuration::get('PS_LOG_EMAILS')) {

            $this->table = 'mail';

            $this->className = 'Mail';


            $this->lang = false;

            $this->noLink = true;

            $this->list_no_link = true;

            $this->explicitSelect = true;

            $this->addRowAction('delete');


            // parent::__construct();

 

 

Hope Prestashop team is listen to us to include it in the next update !

 

thanks for your help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...