News:

Looking for documentation? Take a look on our wiki

Main Menu

Using Joomla alternative layout feature with VirtueMart

Started by sandomatyas, April 08, 2016, 17:12:11 PM

Previous topic - Next topic

sandomatyas

Here is an article about 'layout override' and 'alternative layout' mechanism of Joomla:
https://docs.joomla.org/Layout_Overrides_in_Joomla
I want to create two new alternative layouts in VM for a "VirtueMart Front page" menu item. Layout override doesn't fit because I need two of them and the default is already overrided and used.
So I created a new php and a new xml file (copied and renamed default to newvirtuemartlayout) and Joomla let me to select the new menu item type, and my new link is something like this:
index.php?option=com_virtuemart&view=virtuemart&layout=mytemplate:newvirtuemartlayout
But if I open the menu item, VM loads the default layout although the link above.
I tried the same mechanism with a core Joomla component (content, contact) and works well.
Joomla: 3.5.1, VirtueMart: 3.0.14
Did I miss something?

sandomatyas

I checked the core components and an idea to the view.html.php right before parent::display($tpl);
if(isset($menu->query['layout']))
{
// We need to set the layout in case this is an alternative menu item (with an alternative layout)
$this->setLayout($menu->query['layout']);
}

This is from the core contact component but it's in every other core components even in the JViewCategory class, in commonCategoryDisplay function.
I tried and it works and as far I can see id doesn't break the original functionality.
So it's a feature request :)

jjk

Did you try VirtueMart 'Sublayouts' already? See here: http://docs.virtuemart.net/tutorials/templating-layouts/199-sublayouts.html
You may also find some hints if you search this forum for 'sublayout'
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations