Closed lfritsche closed 6 years ago
I had some great help and can provide an update on this:
startEnvironmentEmulation in \Magento\Store\Model\App\Emulation:
$storeTheme = $this->_viewDesign->getConfigurationDesignTheme($area, ['store' => $storeId]);
$this->_viewDesign->setDesignTheme($storeTheme, $area);
If run by cronjob $storeTheme
seems to be empty.
Within getConfigurationDesignTheme
the Single Store Mode seems to involved.
if ($this->_storeManager->isSingleStoreMode()) {
$theme = $this->_scopeConfig->getValue(
self::XML_PATH_THEME_ID,
ScopeInterface::SCOPE_WEBSITES
);
} else {
$theme = (string) $this->_scopeConfig->getValue(
self::XML_PATH_THEME_ID,
ScopeInterface::SCOPE_STORE,
$store
);
}
I turned SingleStore Mode OFF and everything worked as expected again. Any Idea why getConfigurationDesignTheme doesn't respond with a valid $storeTheme, if the Single Store Mode is turned on?
Thank you!
@lfritsche Thanks for reporting this issue. This is migration bug. You can use "Single Store Mode" = "Yes" after resave your theme configuration in: Content>Design>Configuration
We update description:
If you have Magento 2.0.4 and use Single Store Mode = On and set theme in Store>Configuration>Design>Design Theme and update magento to 2.1.x, then $theme not retrieve from config in \Magento\Theme\Model\View\Design::getConfigurationDesignTheme
if ($this->_storeManager->isSingleStoreMode()) {
$theme = $this->_scopeConfig->getValue(
self::XML_PATH_THEME_ID,
ScopeInterface::SCOPE_WEBSITES
);
} else {
$theme = (string) $this->_scopeConfig->getValue(
self::XML_PATH_THEME_ID,
ScopeInterface::SCOPE_STORE,
$store
);
}
@lfritsche, thank you for your report. We've created internal ticket(s) MAGETWO-80156 to track progress on the issue.
Hi @lfritsche This issue already fixed in 2.1.10 version
I am experiencing this issue in Magento CE 2.2.5.
Debugging the code, I see that from cron jobs, the following code returns nothing for the theme id:
$theme = $this->_scopeConfig->getValue(
self::XML_PATH_THEME_ID,
ScopeInterface::SCOPE_WEBSITES
);
However, the same code not triggered by a cronjob gets the theme id correctly.
@serhii-balko and @magento-engcom-team Was this fixed in Magento 2.2.x? Can you link to the commit that has the fix?
Thanks!
@JeremyPlease I had the same issue in 2.2.5. Here's the solution that worked for me:
Thanks for the suggestion @jfmontanaro.
I ended up working around this by moving the email template to an extension and using etc/email_templates.xml
to override the email template.
Preconditions
Steps to reproduce
Expected result
Actual result
Problem:
If you have Magento 2.0.4 and use Single Store Mode = On and set theme in Store>Configuration>Design>Design Theme and update magento to 2.1.x, then $theme not retrieve from config in \Magento\Theme\Model\View\Design::getConfigurationDesignTheme