View Issue Details

IDProjectCategoryView StatusLast Update
0005517OXID eShop (all versions)1. ----- eShop frontend -----public2013-11-25 13:59
Status resolvedResolutionno change required 
Product Version4.8.0 / 5.1.0 
Target Version4.7.10 / 5.0.10Fixed in Version 
Summary0005517: different template blocks for mobile theme not possible without editing mobile theme
DescriptionMobile Theme documentation:
"Change the desired blocks (for example select_payment) name to have prefix mb_ (mb_select_payment) where you want blocks to be replaced in theme files."

The advantage of the template block system is that you do not have to edit template files. It should be possible to have different blocks for mobile theme without changing template files.
Additional InformationSuggestion: add the mb_ prefix virtually to mobile theme blocks:
block name used in desktop theme: "base_js"
block name used in mobile theme: "base_js"
If block "base_js" is used in module, it should work for desktop and mobile
if block "mb_base_js" is used in module, it should replace block "base_js" only in mobile theme.

So there would be no need to patch theme files and modules that do not need different blocks in mobile theme would work with desktop theme block names.
TagsNo tags attached.
PHP Versionany
MySQL Versionany


Linas Kukulskis

2013-11-25 13:59

reporter   ~0009300

answer from dev-general:

If i correctly understood, you want to write a module which extends templates (add changes) and is suitable for both mobile and desktop theme. You do not want add new block to mobile theme and it should not depend, how the mobile theme is named.

So in general there are no problem to do that: you can define which block you extend in metadata file (as usual in desktop theme). The problem occurs, when extended block should look differently (or have different functionality) in mobile theme than in desktop. In this case you can follow suggestion in documentation, but it need new blocks. There is also another way. What you need is in your block add check if its mobile theme or desktop, and proceed different action for example:

[{if check for mobile theme }]
    // do something for mobile


    // do something for desktop


oeThemeSwitcherThemeManager class provides functionality that your can get the active theme type (mobile or desktop): oeThemeSwitcherThemeManager::getThemeType(), oeThemeSwitcherThemeManager::isMobileThemeRequested(). Using these methods you can add functionality for check in your controllers or oxViewConfig and use in blocks. Do not forget ensure that shop has theme switcher activated. The code can be something like this:

public function isThemeMobile(){
$blIsMobile = false;
if ( !class_exists('oeThemeSwitcherThemeManager')) {
    $oThemeManager = new oeThemeSwitcherThemeManager();
        $blIsMobile = $oThemeManager->isMobileThemeRequested();
return $blIsMobile;