Jump to content

Error 500 después de activar módulo


Recommended Posts

Hola, ayer después de activar un módulo llamado confirmaccount, comenzó a salirme el error 500 tanto en el front como backend. Puse directo el dev mode para poder ver cuál podría ser el error y esto es lo que me arroja: Parse error: syntax error, unexpected '*', expecting function (T_FUNCTION) in /homepages/10/d692486260/htdocs/clickandbuilds/PrestaShop/MyE-Commerce/override/classes/Cookie.php on line 6

Intente modificar esa línea o ver que pasaba y nada cambió. Llego un punto que desactivé dicho módulo y otros dos módulos empezaron a fallar (PriceHidePro y el mailchimp integration) los deesactive y vuelve a funcionar el ecommerce, pero hay partes que no funcionan bien.

 

El archivo Cookie.php al que hace referencia enste error es el siguiente:

 

<?php
 
if (!defined('_PS_VERSION_'))
    exit;
class Cookie extends CookieCore {
     * Delete cookie
     * As of version 1.5 don't call this function, use Customer::logout() or Employee::logout() instead;
     */
    /*
    * module: confirmaccount
    * date: 2017-12-07 18:21:07
    * version: 2.0.1
    */
    public function logout() {
        $confirmaccount = "";
        $id_cart = $this->__get('id_cart');
        if ($this->exists('confirmaccount'))
            $confirmaccount = $this->__get('confirmaccount');
        $this->_content = array();
        $this->_setcookie();
        unset($_COOKIE[$this->_name]);
        $this->_modified = true;
        if (!empty($confirmaccount)){
            $this->__set('confirmaccount', $confirmaccount);
            $this->__set('id_cart', $id_cart);
        }
    }
}
 

Agradeceré mucho su ayuda.

 

Ricardo.

Link to comment
Share on other sites

  • 2 years later...

Hi, 

I know that this is an old topic but, as I have been able to solve it, I put my solution just to help someone that come here with the same problem.

You have to modify "override\classes\Cookie.php" in the original confirmaccount module in such a way that, at the end, the code appears as:

<?php
 
if (!defined('_PS_VERSION_'))
    exit;

class Cookie extends CookieCore {






    
    public function logout() {
        $confirmaccount = "";
        $id_cart = $this->__get('id_cart');
        if ($this->exists('confirmaccount'))
            $confirmaccount = $this->__get('confirmaccount');
        $this->_content = array();
        $this->_setcookie();
        unset($_COOKIE[$this->_name]);
        $this->_modified = true;
        if (!empty($confirmaccount)){
            $this->__set('confirmaccount', $confirmaccount);
            $this->__set('id_cart', $id_cart);
			if (version_compare(Tools::substr(_PS_VERSION_, 0, 5), '1.7', '>='))
			Tools::redirect('index.php?controller=authentication?create_account=1');
        }
    }

}

(note those empty lines between the class definition and the first function: they are the key)

Then, you must install from scratch the module with these changes. After doing that you will see that the file in /override/classes/Cookie.php, now, looks like the following:

<?php

if (!defined('_PS_VERSION_'))
    exit;
class Cookie extends CookieCore {
    /*
    * module: confirmaccount
    * date: 2020-07-09 16:32:07
    * version: 2.0.3
    */
    public function logout() {
        $confirmaccount = "";
        $id_cart = $this->__get('id_cart');
        if ($this->exists('confirmaccount'))
            $confirmaccount = $this->__get('confirmaccount');
        $this->_content = array();
        $this->_setcookie();
        unset($_COOKIE[$this->_name]);
        $this->_modified = true;
        if (!empty($confirmaccount)){
            $this->__set('confirmaccount', $confirmaccount);
            $this->__set('id_cart', $id_cart);
                        if (version_compare(Tools::substr(_PS_VERSION_, 0, 5), '1.7', '>='))
                        Tools::redirect('index.php?controller=authentication?create_account=1');
        }
    }
}

And... that's all.

 

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