Re: [oxid-dev-general] Extending mobile Theme with modules

2013-11-25 Thread Linas Kukulskis
Hi, Frank

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;
}


 

Linas Kukulskis
Developer

linas.kukuls...@oxid-esales.com
Phone +370 37 333053
Fax +370 37 333054
www.oxid-esales.com





From: dev-general-boun...@lists.oxidforge.org 
[dev-general-boun...@lists.oxidforge.org] on behalf of Frank Zunderer 
[frank.zunde...@zunderer.de]
Sent: Thursday, November 14, 2013 6:53 PM
To: dev-general@lists.oxidforge.org
Subject: Re: [oxid-dev-general] Extending mobile Theme with modules

Hi Linas,

thanks for the response. I also filed a bug for this topic:
https://bugs.oxid-esales.com/view.php?id=5517

Regards,
Frank

-Ursprüngliche Nachricht-
Von: dev-general-boun...@lists.oxidforge.org
[mailto:dev-general-boun...@lists.oxidforge.org] Im Auftrag von Linas
Kukulskis
Gesendet: Donnerstag, 14. November 2013 17:21
An: dev-general@lists.oxidforge.org
Betreff: Re: [oxid-dev-general] Extending mobile Theme with modules

Hi,

Thanks Frank, good point - we'll have a meeting about it on Monday and let
you know about the results as soon as possible

Linas Kukulskis
Developer

linas.kukuls...@oxid-esales.com
Phone +370 37 333053
Fax +370 37 333054
www.oxid-esales.com





From: dev-general-boun...@lists.oxidforge.org
[dev-general-boun...@lists.oxidforge.org] on behalf of Frank Zunderer
[frank.zunde...@zunderer.de]
Sent: Tuesday, November 12, 2013 2:11 PM
To: dev-general@lists.oxidforge.org
Subject: [oxid-dev-general] Extending mobile Theme with modules

Hello All,

i just had a look into extending a module for usage in the mobile theme, and
somehow I cannot find a way to manage this. It seems quite impossible to me
to write a module that just installs and works for mobile and desktop.

I read the section in documentation Adding complete module support for
mobile:

Due to changes to template files in the mobile theme, some modules might
not work with a mobile theme from the get-go. However it is possible to get
modules working for the theme without needing to patch or alter the module.
You can add specific blocks for modules in a theme switcher, which allows
for module developers to have different module looks on mobile devices. With
this, you don't need to make additional patches for the module itself, when
it can be added to module switcher.

This might be useful for the Shop-Owner, the module developer does not want
to change the theme switcher, but have all changes in the module itself.

To have an example of how to make a module look differently on mobile
devices, look at PayPal implementation. For any shops using the PayPal
module, the new mobile theme switcher has changes for PayPal, insuring that
module works as well as it does in the desktop theme. Edit the mobile theme
switcher metadata.php, located in /modules/oe/oethemeswitcher, override
blocks like this: 'blocks' = array( . array('template' =
'page/checkout/payment.tpl', 'block'='mb_select_payment',
'file'='views/mobile/blocks/oepaypalpaymentselector.tpl'), ), Use mb_
prefix for block name, so it's clear that this block is for mobile.

Paypal-like implementation inside the theme switcher is not an option for
other modules. Even the paypal module seems to leave that road and has the
blocks inside the module itself.

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.

I looked in the template

Re: [oxid-dev-general] Extending mobile Theme with modules

2013-11-25 Thread Frank Zunderer
Hi Linas,

thank you, this sounds good, i would suggest to add this to standard, a
method that returns false in shop's oxviewconfig and this method in
themeswitcher's oxviewconfig, and change paypal module so it makes use of
this method instead of changing block names in mobile theme, so programmers
could take paypal module as an example for integration.

Regards Frank




-Ursprüngliche Nachricht-
Von: dev-general-boun...@lists.oxidforge.org
[mailto:dev-general-boun...@lists.oxidforge.org] Im Auftrag von Linas
Kukulskis
Gesendet: Montag, 25. November 2013 13:54
An: dev-general@lists.oxidforge.org
Betreff: Re: [oxid-dev-general] Extending mobile Theme with modules

Hi, Frank

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;
}


 

Linas Kukulskis
Developer

linas.kukuls...@oxid-esales.com
Phone +370 37 333053
Fax +370 37 333054
www.oxid-esales.com





From: dev-general-boun...@lists.oxidforge.org
[dev-general-boun...@lists.oxidforge.org] on behalf of Frank Zunderer
[frank.zunde...@zunderer.de]
Sent: Thursday, November 14, 2013 6:53 PM
To: dev-general@lists.oxidforge.org
Subject: Re: [oxid-dev-general] Extending mobile Theme with modules

Hi Linas,

thanks for the response. I also filed a bug for this topic:
https://bugs.oxid-esales.com/view.php?id=5517

Regards,
Frank

-Ursprüngliche Nachricht-
Von: dev-general-boun...@lists.oxidforge.org
[mailto:dev-general-boun...@lists.oxidforge.org] Im Auftrag von Linas
Kukulskis
Gesendet: Donnerstag, 14. November 2013 17:21
An: dev-general@lists.oxidforge.org
Betreff: Re: [oxid-dev-general] Extending mobile Theme with modules

Hi,

Thanks Frank, good point - we'll have a meeting about it on Monday and let
you know about the results as soon as possible

Linas Kukulskis
Developer

linas.kukuls...@oxid-esales.com
Phone +370 37 333053
Fax +370 37 333054
www.oxid-esales.com





From: dev-general-boun...@lists.oxidforge.org
[dev-general-boun...@lists.oxidforge.org] on behalf of Frank Zunderer
[frank.zunde...@zunderer.de]
Sent: Tuesday, November 12, 2013 2:11 PM
To: dev-general@lists.oxidforge.org
Subject: [oxid-dev-general] Extending mobile Theme with modules

Hello All,

i just had a look into extending a module for usage in the mobile theme, and
somehow I cannot find a way to manage this. It seems quite impossible to me
to write a module that just installs and works for mobile and desktop.

I read the section in documentation Adding complete module support for
mobile:

Due to changes to template files in the mobile theme, some modules might
not work with a mobile theme from the get-go. However it is possible to get
modules working for the theme without needing to patch or alter the module.
You can add specific blocks for modules in a theme switcher, which allows
for module developers to have different module looks on mobile devices. With
this, you don't need to make additional patches for the module itself, when
it can be added to module switcher.

This might be useful for the Shop-Owner, the module developer does not want
to change the theme switcher, but have all changes in the module itself.

To have an example of how to make a module look differently on mobile
devices, look at PayPal implementation. For any shops using the PayPal
module, the new mobile theme switcher has changes for PayPal, insuring that
module works as well as it does in the desktop theme. Edit the mobile theme
switcher metadata.php

Re: [oxid-dev-general] Extending mobile Theme with modules

2013-11-14 Thread Frank Zunderer
Hi Linas,

thanks for the response. I also filed a bug for this topic:
https://bugs.oxid-esales.com/view.php?id=5517

Regards,
Frank

-Ursprüngliche Nachricht-
Von: dev-general-boun...@lists.oxidforge.org
[mailto:dev-general-boun...@lists.oxidforge.org] Im Auftrag von Linas
Kukulskis
Gesendet: Donnerstag, 14. November 2013 17:21
An: dev-general@lists.oxidforge.org
Betreff: Re: [oxid-dev-general] Extending mobile Theme with modules

Hi,

Thanks Frank, good point - we'll have a meeting about it on Monday and let
you know about the results as soon as possible

Linas Kukulskis
Developer

linas.kukuls...@oxid-esales.com
Phone +370 37 333053
Fax +370 37 333054
www.oxid-esales.com





From: dev-general-boun...@lists.oxidforge.org
[dev-general-boun...@lists.oxidforge.org] on behalf of Frank Zunderer
[frank.zunde...@zunderer.de]
Sent: Tuesday, November 12, 2013 2:11 PM
To: dev-general@lists.oxidforge.org
Subject: [oxid-dev-general] Extending mobile Theme with modules

Hello All,

i just had a look into extending a module for usage in the mobile theme, and
somehow I cannot find a way to manage this. It seems quite impossible to me
to write a module that just installs and works for mobile and desktop.

I read the section in documentation Adding complete module support for
mobile:

Due to changes to template files in the mobile theme, some modules might
not work with a mobile theme from the get-go. However it is possible to get
modules working for the theme without needing to patch or alter the module.
You can add specific blocks for modules in a theme switcher, which allows
for module developers to have different module looks on mobile devices. With
this, you don't need to make additional patches for the module itself, when
it can be added to module switcher.

This might be useful for the Shop-Owner, the module developer does not want
to change the theme switcher, but have all changes in the module itself.

To have an example of how to make a module look differently on mobile
devices, look at PayPal implementation. For any shops using the PayPal
module, the new mobile theme switcher has changes for PayPal, insuring that
module works as well as it does in the desktop theme. Edit the mobile theme
switcher metadata.php, located in /modules/oe/oethemeswitcher, override
blocks like this: 'blocks' = array( . array('template' =
'page/checkout/payment.tpl', 'block'='mb_select_payment',
'file'='views/mobile/blocks/oepaypalpaymentselector.tpl'), ), Use mb_
prefix for block name, so it's clear that this block is for mobile.

Paypal-like implementation inside the theme switcher is not an option for
other modules. Even the paypal module seems to leave that road and has the
blocks inside the module itself.

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.

I looked in the template, there are already some blocks prefixed with mb_,
and these are the blocks paypal uses. So if I want to use another block in
my own module, it looks like I'm supposed do the same and edit the theme
files, and this prevents easy installation and might break other modules
that use the blocks without prefix.

Adding desired mobile device functionality in other ways: You can add
different looks and feels for your module in another way. You can use
getActiveThemeId() method to get the active theme, and then add desired
functionality for that.

In theme switcher you have the possibility to enter another theme name in
module options, so one can't rely on the theme id mobile. All in all I
don't see how extending mobile theme with own blocks is possible without
manually changing files.

When I saw you could prefix mobile blocks with mb, at first I thought this
would already be possible for all blocks, maybe this would be a solution to
prepend mb_ to all blocks in mobile theme so they are always different than
the desktop ones, or maybe this could be done by the theme switcher in a
transparent way, so that block base_js would work in desktop and mobile,
but if mb_base_js is additionally specified, this would point to the block
base_js in mobile theme.

Regards,
Frank Zunderer



___
dev-general mailing list
dev-general@lists.oxidforge.org
http://dir.gmane.org/gmane.comp.php.oxid.general
___
dev-general mailing list
dev-general@lists.oxidforge.org
http://dir.gmane.org/gmane.comp.php.oxid.general

___
dev-general mailing list
dev-general@lists.oxidforge.org
http://dir.gmane.org/gmane.comp.php.oxid.general


[oxid-dev-general] Extending mobile Theme with modules

2013-11-12 Thread Frank Zunderer
Hello All,

i just had a look into extending a module for usage in the mobile theme, and
somehow I cannot find a way to manage this. It seems quite impossible to me
to write a module that just installs and works for mobile and desktop. 

I read the section in documentation Adding complete module support for
mobile:

Due to changes to template files in the mobile theme, some modules might
not work with a mobile theme from the get-go. However it is possible to get
modules working for the theme without needing to patch or alter the module.
You can add specific blocks for modules in a theme switcher, which allows
for module developers to have different module looks on mobile devices. With
this, you don't need to make additional patches for the module itself, when
it can be added to module switcher.

This might be useful for the Shop-Owner, the module developer does not want
to change the theme switcher, but have all changes in the module itself.

To have an example of how to make a module look differently on mobile
devices, look at PayPal implementation. For any shops using the PayPal
module, the new mobile theme switcher has changes for PayPal, insuring that
module works as well as it does in the desktop theme. Edit the mobile theme
switcher metadata.php, located in /modules/oe/oethemeswitcher, override
blocks like this: 'blocks' = array( . array('template' =
'page/checkout/payment.tpl', 'block'='mb_select_payment',
'file'='views/mobile/blocks/oepaypalpaymentselector.tpl'), ),
Use mb_ prefix for block name, so it's clear that this block is for mobile.

Paypal-like implementation inside the theme switcher is not an option for
other modules. Even the paypal module seems to leave that road and has the
blocks inside the module itself.

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.

I looked in the template, there are already some blocks prefixed with mb_,
and these are the blocks paypal uses. So if I want to use another block in
my own module, it looks like I'm supposed do the same and edit the theme
files, and this prevents easy installation and might break other modules
that use the blocks without prefix.

Adding desired mobile device functionality in other ways: You can add
different looks and feels for your module in another way. You can use
getActiveThemeId() method to get the active theme, and then add desired
functionality for that.

In theme switcher you have the possibility to enter another theme name in
module options, so one can't rely on the theme id mobile. All in all I
don't see how extending mobile theme with own blocks is possible without
manually changing files. 

When I saw you could prefix mobile blocks with mb, at first I thought this
would already be possible for all blocks, maybe this would be a solution to
prepend mb_ to all blocks in mobile theme so they are always different than
the desktop ones, or maybe this could be done by the theme switcher in a
transparent way, so that block base_js would work in desktop and mobile,
but if mb_base_js is additionally specified, this would point to the block
base_js in mobile theme.

Regards,
Frank Zunderer



___
dev-general mailing list
dev-general@lists.oxidforge.org
http://dir.gmane.org/gmane.comp.php.oxid.general