Jump to content

Hook, The server returned a "500 Internal Server Error".


Matt

Recommended Posts

Hi!

I have a problem about, to move the hook "Login in the top of nav1" that had moved to nav2 back to nav1, cuz i made a misstake and moved it to wrong place to the "header something in the backoffice. I get "The server returned a "500 Internal Server Error" in the backoffice, and in every page that are in backoffice.

Are there any solutions to move it to nav1 without  do it in backoffice, maybe in som php file or tpl? or am i screwed. 

 

Best Regards

Matt

Link to comment
Share on other sites

11 minutes ago, Matt said:

Hi!

I have a problem about, to move the hook "Login in the top of nav1" that had moved to nav2 back to nav1, cuz i made a misstake and moved it to wrong place to the "header something in the backoffice. I get "The server returned a "500 Internal Server Error" in the backoffice, and in every page that are in backoffice.

Are there any solutions to move it to nav1 without  do it in backoffice, maybe in som php file or tpl? or am i screwed. 

 

Best Regards

Matt

 

Hi Matt,

 

enable errors.

Link to comment
Share on other sites

And the logs looks lite this

 

Level Channel Message
CRITICAL10:37:18 php Call to a member function isLogged() on null
DEBUG10:37:18 doctrine SELECT name FROM psf_module WHERE active = 1
CRITICAL10:37:18 request Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function isLogged() on null" at /customers/2/e/f/ftg.se/httpd.www/foretaget/modules/ps_customersignin/ps_customersignin.php line 55
Link to comment
Share on other sites

Hi,

Do you have any idea of the phpMyAdmin (accessing DB table)? Entry can be deleted from the table to fix the issue but its a little bit tricky.

I believe you have added the login block in "displayAdminNavBarBeforeEnd" hook.  In the ps_hook DB table search for the displayAdminNavBarBeforeEnd. It will give you the hook id.

image.png.de826acdc89266cff2f69113e85cf7bb.png

You will get ID like 174. Now search 174 (In your case it may be different) in ps_hook_module table in id_hook column.

 

image.png.af43b282cb8295541f40a81a9097736d.png

 

In my case, there is one result but I believe there will be 2 entries in your case. You need to delete one entry (Most probably 2nd one).

Kindly ensure to take the backup of the DB before deleting the same.

 

 

 

 

Link to comment
Share on other sites

Ok Matt, I have reread your message again because I thought it only happened when you tried to move the module :) 

 

I would modify file modules/ps_customersignin/ps_customersignin.php, line 55

//$logged = $this->context->customer->isLogged();
$logged = false;

 

Link to comment
Share on other sites

29 minutes ago, Matt said:

Thanks Knowband Plugins! It was just one entries not 2 unfortunately.

I did what you tell me.

image.thumb.png.916bdbf44e060010aab81688f1bc5d43.png

And there was only one entries

image.png.9e1d9098ce87ac989e8576760525aed3.png

 

You can also fix it by database. If module ID 51 is ps_customersignin (check ID it at ps_module table) then change id_hook to nav1 (check ID at table ps_hook).

Link to comment
Share on other sites

I have reproduced error and fixed it this way:

 

    public function getWidgetVariables($hookName, array $configuration)
    {
        if (!isset($this->context->customer)) {
            return false;
        }

        $logged = $this->context->customer->isLogged();

        if ($logged) {
            $customerName = $this->getTranslator()->trans(
                '%firstname% %lastname%',
                array(
                    '%firstname%' => $this->context->customer->firstname,
                    '%lastname%' => $this->context->customer->lastname,
                ),
                'Modules.Customersignin.Admin'
            );
        } else {
            $customerName = '';
        }

        $link = $this->context->link;

        return array(
            'logged' => $logged,
            'customerName' => $customerName,
            'logout_url' => $link->getPageLink('index', true, null, 'mylogout'),
            'my_account_url' => $link->getPageLink('my-account', true),

        );
    }

 

(note the if at the beginning)

  • Like 1
Link to comment
Share on other sites

Thank you joseantgv very much, you´re Gold. It was the "return false;" that helped me. i haven´t tryied the other suggestions above yet, but can i re-hook the  ps_customersignin to the nav1 again from the backoffice or is it better to make changes like you shown me in the topic above? 

"Solved"

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...