View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005517 | OXID eShop (all versions) | 1. ----- eShop frontend ----- | public | 2013-11-13 12:26 | 2024-09-18 10:38 |
Reporter | leofonic | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Product Version | 4.8.0 / 5.1.0 | ||||
Target Version | 4.7.10 / 5.0.10 | ||||
Summary | 0005517: different template blocks for mobile theme not possible without editing mobile theme | ||||
Description | Mobile 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 Information | Suggestion: 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. | ||||
Tags | No tags attached. | ||||
Theme | Both | ||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||
|
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 [{else}] // do something for desktop [{/if}] 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; } |