Jump to content
thirty bees forum

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


Recommended Posts

Posted (edited)

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
Posted
4 minutes ago, Occam said:

Maybe it helps to rename all instances of $dir to $dirX.

Ummm. Not sure what this would achieve, but ok...
Tried it and it doesn't work 😕 Any other ideas?

Posted (edited)
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
Posted

change lines 1256-1257 from

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

to

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

 

Posted
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 😀

Posted (edited)

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
Posted

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 😞

Posted (edited)
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
Posted (edited)
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
Posted
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

Posted
2 hours ago, datakick said:

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

Upgraded to Bleeding Edge, and sorted, thanks 👍

  • Like 1
  • 3 weeks later...
Posted

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

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