Prestashop: Error notice on psaddonsconnect - BO

Created on 9 Oct 2018  路  29Comments  路  Source: PrestaShop/PrestaShop

Hi, I have php issues display when i connect to my backoffice. Here are the error messages:

Notice 脿 la ligne 227 du fichier /home/www/modules/psaddonsconnect/psaddonsconnect.php
[8] Undefined variable: advice

Notice 脿 la ligne 228 du fichier /home/www/modules/psaddonsconnect/psaddonsconnect.php
[8] Undefined variable: link_advice

Can you help to fix that please?
This is the lines on the file:
Line227: 'advice' => $advice,
Line228: 'link_advice' => $link_advice,

Additionnal information
PrestaShop version: 1.7.3.0
PHP version: 7.1.21
Th猫me actif : classic

github
github2

Thank you for your reply and help

1.7.4.3 1.7.6.0 BO Bug Fixed Minor Modules Topwatchers psaddonsconnect

Most helpful comment

Hello Guys,

PS version: 1.6.1.23

Just encountered this issue today. I believed it is a Prestashop bug, the error is a connection from Prestashop server. It prompt's an error in the dashboard because some of the variables has no values the $advice and the $link_advice.

So this is my quick fix for the issue while Prestashop haven't provide any fix for it.

  1. Go to your root website folder
  2. Navigate to /modules/psaddonsconnect/
  3. Look for psaddonsconnect.php
  4. Add an "else" statement so that we can still fill value for the variables $advice and $link_advice. (See attached code image)
    Screen Shot 2019-05-15 at 8 57 59

Hope this helps.

Cheers!

All 29 comments

Hi @Marwazeinoo88,

I manage to reproduce this issue.
When I access the BO, the red alert is displayed.
This issue is randomly.
image
Reported here: http://forge.prestashop.com/browse/BOOM-5781
Thanks!

So for now, i should just rename the folder "psaddonsconnect" (in www/modules/)?

@Marwazeinoo88, you can navigate to your BO => IMPROVE => Modules => Modules & Services => search for this module & disable it.
Thanks!

okey, Thank you for your reply and help

I just had the same problem with 1.7.4.

Hi @masiorama,

Have you tried to disable the psaddonsconnect module?
PS: this issue is added to our bug roadmap, it is not fixed yet.
Thanks!

I did @khouloudbelguith , and that specific error on login disappeared. Still today I'm experiencing so many difficulties with prestashop, expecially in getting modules updates... does it mean anything to you?
Thanks in advance.

@masiorama, This issue is a different issue, can you open a new one with more information about your configuration & your different issue.
Thanks!

Ok thanks I'll try to gather infos and open an issue... I'm kinda lost anyway, it seems everything random, I'll do the best I can.

@khouloudbelguith just a brief update: during the last 3 days the problem was simply gone, so I don't see a reason to investigate more in depth. I'm pretty sure it was because of some problem with PS sending infos about modules updates, plus maybe my server behavior (which was pretty slow). We managed to upgrade to a different server and now everything seems solid. I will definitely open an issue in case I'll find mysql involved in this problem again. Thanks.

Hello Guys,

PS version: 1.6.1.23

Just encountered this issue today. I believed it is a Prestashop bug, the error is a connection from Prestashop server. It prompt's an error in the dashboard because some of the variables has no values the $advice and the $link_advice.

So this is my quick fix for the issue while Prestashop haven't provide any fix for it.

  1. Go to your root website folder
  2. Navigate to /modules/psaddonsconnect/
  3. Look for psaddonsconnect.php
  4. Add an "else" statement so that we can still fill value for the variables $advice and $link_advice. (See attached code image)
    Screen Shot 2019-05-15 at 8 57 59

Hope this helps.

Cheers!

Hi everyone,

I have the same problem too.

I have this configuration:

  • Windows Server 2019 with IIS 10
  • Prestashop 1.7.5.1
  • MySql 5.6.16.0
  • PhpMyAdmin 4.8.5
  • PHP 7.2.18

I have always connected to the BO side without any difficulty but since yesterday I do not access any more.

I can enter user and password but then a page appears with:

PHP Notice: Undefined variable: advice in C:\inetpub\wwwroot\modulespsaddonsconnectpsaddonsconnect.php on line 227
PHP Notice: Undefined variable: link_advice in C:\inetpub\wwwroot\modulespsaddonsconnectpsaddonsconnect.php on line 228

If I insert the code suggested by jomdacillo now I can log in.

But now if I want disable the psaddonsconnect module, what can I search on PrestaShop Addons Marketplace? (if i look for psaddonsconnect it finds nothing)

Kind regards

Create file /override/modules/psaddonsconnect/psaddonsconnect.php with content:

<?php

class PsaddonsconnectOverride extends Psaddonsconnect
{

    /**
     * @param array $params
     * @return string
     * @throws SmartyException
     */
    public function hookDashboardZoneOne($params)
    {
        $this->loadAsset();

        $url = "";
        $logged_on_addons17 = 0;

        if ((bool)version_compare(_PS_VERSION_, '1.7', '>=')) {
            global $kernel;

            //router to get the addons URL
            $instance = $kernel->getContainer();
            $router = $instance->get('router');
            $url = $router->generate('admin_addons_login');

            if (isset($_COOKIE['username_addons'])) {
                $logged_on_addons17 = 1;
            }
        }

        // API DATA
        include_once(_PS_MODULE_DIR_ . 'psaddonsconnect/classes/WeekAdvice.php');
        $api = new WeekAdvice();
        $api_json = $api->getWeekData();

        if (!empty($api_json)) {
            $advice = $api_json->advice;
            $link_advice = $api_json->link;
        }

        // assign var to smarty
        $this->context->smarty->assign(array(
            'img_path' => $this->img_path,
            'ps_version' => (bool)version_compare(_PS_VERSION_, '1.7', '>='),
            'advice' => isset($advice) ? $advice : null,
            'link_advice' => isset($link_advice) ? $link_advice : null,
            'url_connexion' => $url,
            'logged_on_addons17' => $logged_on_addons17,
            'practical_links' => $this->practicalLinks(),
        ));

        $this->output .= $this->context->smarty->fetch(
            $this->local_path . 'views/templates/hook/dashboard_zone_one.tpl'
        );

        return $this->output;
    }

}

and remove files:
/var/cache/dev/class_index.php
/var/cache/prod/class_index.php

Hi,

I had to disable the module for the bad way: changing directory name.

But no more error notice on sign in

Hope I helped.

I am facing the same issue on 1.7.5.1 version of Prestashop. I am guessing I got this issue after I clicked on the google link showed in below image.

image

I am now not able to go to Module Catalog and when I click on Module Manager it gives me internal error 500

Hope this helps someone.

Hey Guys! I enabled debug mode from the BO and tried accessing Module Manager again and this time I get exception details related to another plugin (https://github.com/cashfree/).

Here are few things that are important.

  1. I copied (not installed) CashFree almost 3 weeks back and I was still able to access Module Manager
  2. About 3 days back I clicked on the "Link to your google analytics account" and since then I started getting this error.
  3. I removed the CashFree folder from Modules and I am now able to access Module Manager and install new modules.

P.S. None of the above solution worked for me, probably because the issue was from CashFree.

The notices have been fixed with the v2.0.0 of the module which was released today. Thanks for the report.

Sorry for disturbing a closed issue. This still happens in prestashop 1.7.6.

Hi @arafatx,

This issue is fixed in the psaddonsconnectmodule v2.0.0.
In my case it is ok.

Thanks!

@khouloudbelguith I'm using v2.0.0. Strange behaviour is, when I put prestashop into sub domain with the same setup it works:

www.mywebsite.com - got error
dev.mywebsite.com - no error

Same setup files clone from github. Maybe this happen with specific domain ?

Hi, sorry for making everybody panic. It was the cache issue! Problem solved! Thanks a lot.

@arafatx, Try to access to this link: www.mywebsite.com/modules/psaddonsconnect/config.xml & check the version of this module.

Thanks!

@arafatx, great!
Thanks!

Sorry for commenting on the closed issue but I don't think this issue is fixed and related to cache. I got the same error again on the latest 1.7.6.1 (production). This happen randomly and I guess @jomdacillo is right this issue perhaps related to prestashop server. If i rename or remove the psaddonsconnect there is no problem connecting to Back Office.

Hi @arafatx,

The notices have been fixed with the v2.0.0 of the module psaddonsconnect.
The last release of this module is v2.1.0.

Thanks!

I guess this is random. I just went away from my PC and coming back (refresh the back office page) and it works. Didn't do anything.

@arafatx, since the upgrade of the module psaddonsconnect, this issue doesn't occur in my case.
Could you please navigate to your BO => Module Manager page & search for the psaddonsconnect & check the exact version.
image

Thanks!

The exact same version 2.1.0. I thought the error message was the same (sorry for this. This might be different issue related to CacheStorage):

I only got this error when navigating to BO -> Dashboard.

cache-storage

Perhaps, I should open a new issue? Sorry and TQ.

  • I tried clear the cache from BO - not working
  • removed the prod and dev cache folder - not working

PS 1.7.6.1

@arafatx, This issue is currently closed & it seems different, can you open a new one with more information about your configuration

Thanks!

Was this page helpful?
0 / 5 - 0 ratings