Jump to content
thirty bees forum

[Solved] Trying to install PS 1.6 theme - PHP error


Acer

Recommended Posts

Hi there

I know this is a PHP error, but hopefully you guys can provide a fix...
I'm trying to install one of Leo Theme's templates: Game Gear
https://www.leotheme.com/prestashop/themes/313-leo-gamegear.html

But I'm getting the following 500 error:

in file modules/leotempcp/leotempcp.php at line 1263

Cannot use string offset as an array
in file modules/leotempcp/leotempcp.php at line 1263


1261:        if ($directories) {
1262:            foreach ($directories as $dir) {
1263:                $output['skins'][basename($dir)]['name'] = $this->l(basename($dir));
1264:                if (file_exists($dir.'/icon.png')) {
1265:                    $output['skins'][basename($dir)]['icon'] = _PS_BASE_URL_._THEME_DIR_.'css/skins/'.basename($dir).'/icon.png';
1266:                }
1267:            }
1268:        }

 

Can you please help? Got a feeling that line 1263 needs to be rewritten for latest PHP (I'm running 7.2+)

Your help is appreciated in advance!

Edited by Theo
Link to comment
Share on other sites

17 minutes ago, Occam said:

Did you recompile the theme afterwards?

Theme bombs out on accessing admin with Error 500, so I can't get to Performance screen.
The only way I got to see what was going on was by activating Debug in defines.inc.php.
Now after file update and page refresh, the error page reflects the update in the code that it displays and highlights (so not a caching thing where it still uses previous version).

Edited by Theo
Link to comment
Share on other sites

1 hour ago, datakick said:

change lines 1256-1257 from


        $output = array();
        $output = array('skins' => '', 'layouts' => '');

to


        $output = array('skins' => array(), 'layouts' => '');

 

Excellent. This worked, thank you 😀

Link to comment
Share on other sites

Ah spoke to soon... Sorry @datakick, need your help again please.


New error:

Call to a member function attributes() on boolean line 1480

Highlighted: $xmlAttributes = $xml->attributes();

 

Call to a member function attributes() on boolean in file controllers/admin/AdminThemesController.php at line 1480

 protected function installTheme($themeDir, $sandbox = false, $redirect = true)
1472:    {
1473:        if ($this->tabAccess['add'] && $this->tabAccess['delete'] && !_PS_MODE_DEMO_) {
1474:            $targetDir = _PS_ALL_THEMES_DIR_.$themeDir;
1475:
1476:            if ($sandbox) {
1477:                // Load configuration of the theme package.
1478:                $sandboxDir = $sandbox.'/'.$themeDir;
1479:                $xml = Theme::loadDefaultConfig($sandboxDir);
1480:                $xmlAttributes = $xml->attributes();
1481:                $targetDir = _PS_ALL_THEMES_DIR_.$xmlAttributes['directory'];

 

 

Edited by Theo
Link to comment
Share on other sites

9 minutes ago, AndyC said:

Glad someone else is having issues .. I thought it was just me.. I, too, had the 500 page and gave up ..Although now have bits left over from removing 😞

Do you know that you can show the error detail on the 500 page? Because normally it's just blank with 500 error. And it doesn't give any detail.

If you don't know: go to your sites folder/config and edit defines.inc.php.
Change:
define('_PS_MODE_DEV_', false); to 
define('_PS_MODE_DEV_', true);

This will then show you the error detail, which you can post here

Edited by Theo
Link to comment
Share on other sites

34 minutes ago, Theo said:

Ah spoke to soon...
New error:

Call to a member function attributes() on boolean line 1480

Highlighted: $xmlAttributes = $xml->attributes();

 


Call to a member function attributes() on boolean in file controllers/admin/AdminThemesController.php at line 1480

 protected function installTheme($themeDir, $sandbox = false, $redirect = true)
1472:    {
1473:        if ($this->tabAccess['add'] && $this->tabAccess['delete'] && !_PS_MODE_DEMO_) {
1474:            $targetDir = _PS_ALL_THEMES_DIR_.$themeDir;
1475:
1476:            if ($sandbox) {
1477:                // Load configuration of the theme package.
1478:                $sandboxDir = $sandbox.'/'.$themeDir;
1479:                $xml = Theme::loadDefaultConfig($sandboxDir);
1480:                $xmlAttributes = $xml->attributes();
1481:                $targetDir = _PS_ALL_THEMES_DIR_.$xmlAttributes['directory'];

 

 

What you can do is to test before and you won't get the error, like this on line 1480 :
 

1476:            if ($sandbox) {
1477:                // Load configuration of the theme package.
1478:                $sandboxDir = $sandbox.'/'.$themeDir;
1479:                $xml = Theme::loadDefaultConfig($sandboxDir);
1480:                if (isset($xml->attributes())) $xmlAttributes = $xml->attributes();
1481:                $targetDir = _PS_ALL_THEMES_DIR_.$xmlAttributes['directory'];

 

 

 

 

Edited by zen
Link to comment
Share on other sites

42 minutes ago, Theo said:

Ah spoke to soon... Sorry @datakick, need your help again please.


New error:

Call to a member function attributes() on boolean line 1480

Highlighted: $xmlAttributes = $xml->attributes();

Upgrade your tb to bleeding edge. This issue is already fixed there

Link to comment
Share on other sites

  • 3 weeks later...

Hi

I am attempting to change to this theme again now too

I've done the datakick suggestion on line 1256-1257  and am attempting to upgrade to bleeding edge .. I have never dome this before so is the latest 1.1 or the issue -905

thanks

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