2

This error appears when I try to go to the frontend of the Server web. The admin works perfectly.

And even further, if I use the local files and the local installation of Magento everything works fine.

I'm getting a HTTP error 500, and in the logs appears this code:

Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function getId() on null in /var/www/vhosts/a//vendor/magento/framework/View/Model/Layout/Merge.php:751\nStack trace:\n#0 /var/www/vhosts///vendor/magento/framework/View/Model/Layout/Merge.php(684): Magento\Framework\View\Model\Layout\Merge->_getPhysicalTheme(Object(Magento\Theme\Model\Theme))\n#1 /var/www/vhosts///vendor/magento/framework/View/Model/Layout/Merge.php(633): Magento\Framework\View\Model\Layout\Merge->_loadFileLayoutUpdatesXml()\n#2 /var/www/vhosts//vendor/magento/framework/View/Model/Layout/Merge.php(527): Magento\Framework\View\Model\Layout\Merge->getFileLayoutUpdatesXml()\n#3 /var/www/vhosts///vendor/magento/framework/View/Model/Layout/Merge.php(506): Magento\Framework\View\Model\Layout\Merge->_fetchPackageLayoutUpdates('default')\n#4 /var/www/vhosts///vendor/magento/frame...\n'

The code that fails is this one:

protected function _getPhysicalTheme(\Magento\Framework\View\Design\ThemeInterface $theme)
{
    $result = $theme;
    while ($result->getId() && !$result->isPhysical()) {
        $result = $result->getParentTheme();
    }
    if (!$result) {
        throw new \Magento\Framework\Exception\LocalizedException(
            new \Magento\Framework\Phrase(
                'Unable to find a physical ancestor for a theme \'%1\'.',
                [$theme->getThemeTitle()]
            )
        );
    }
    return $result;
}

I run the commands:

rm -rf pub/static/*;
/opt/plesk/php/7.0/bin/php bin/magento setup:upgrade; 
/opt/plesk/php/7.0/bin/php bin/magento setup:static-content:deploy; 
/opt/plesk/php/7.0/bin/php bin/magento setup:static-content:deploy es_ES;
2

While I was writing the question I managed to get it fixed:

I have modified my theme in app\design\frontend\TemplateMonster\theme094\theme.xml:

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">
<title>TemplateMonster Theme</title>
<parent>Magento/blank</parent> <!--Added-->
<media>
    <preview_image>media/preview.jpg</preview_image>
</media>

The <parent> tag was empty. Hope it helps someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.