News:

Looking for documentation? Take a look on our wiki

Main Menu

Joomla setTemplate() function not working with virtuemart

Started by JLinker, July 17, 2015, 14:05:22 PM

Previous topic - Next topic

JLinker

Hi everyone,

I use this code in a Joomla system plugin, in order to change the default Joomla template on the fly:

$app = JFactory::getApplication();
$app->setTemplate('mytemplate');


I works on all joomla and 3rd party extensions, but not on virtuemart pages.
Any idea why?
Thanks a lot
JLinker - Mass Menu Link Generator for Joomla 2.5 and Joomla 3.x.
Generate hundreds of menu links in a few seconds for Joomla, K2, Community Builder, Phoca Download, JDownloads, SobiPro, Virtuemart. Website: http://www.jlinker.com

JLinker

I can see in the vm configuration that there is a setting defining the Joomla template vm should use.
So, vm probably ignores the code above and sticks to the template set in the vm config.

I'm building a mobile template for my shop. Using the code above, I've managed to change the Joomla template to use if the device trying to connect to the site is a mobile.

So the question is: how do I ask virtuemart to use a specific template for a client, using php?
JLinker - Mass Menu Link Generator for Joomla 2.5 and Joomla 3.x.
Generate hundreds of menu links in a few seconds for Joomla, K2, Community Builder, Phoca Download, JDownloads, SobiPro, Virtuemart. Website: http://www.jlinker.com

JLinker

The answer is:
setTemplate() will work only if the vm config says "use default Joomla template" for the template parameter.
if this parameter is set to something else, virtuemart will ignore the setTemplate() function.
JLinker - Mass Menu Link Generator for Joomla 2.5 and Joomla 3.x.
Generate hundreds of menu links in a few seconds for Joomla, K2, Community Builder, Phoca Download, JDownloads, SobiPro, Virtuemart. Website: http://www.jlinker.com

Milbo

no, vm does not ignore it. and you are going to write programs?

Vm just calls the setTemplate function LATER ! that is all. Btw the function setTemplate does not correctly work for styles.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/