Hi,
I want to add a basic function of active (sub)menu highlighting to Virtuemart 3 menus, but there is no class for active menu to add css style.
Unbelievable that VM is lacking such a basic feature...
I found a solution for older versions https://forum.virtuemart.net/index.php?topic=114722.0 (https://forum.virtuemart.net/index.php?topic=114722.0) - changing the modules/mod_virtuemart_category/tmpl/default.php file, but it doesn't work anymore with Virtuemart 3.0.8
Joomla 3.4.1
Virtuemart 3.0.8
PHP 5.4.4-14
Hi
On using layout "All" in the vm category module, the active class is set on active category.
If you need a more advanced category module with more then 2 levels and active class see:
In my shop : http://shop.st42.fr/en/categories-tools/virtuemart-categories-menu.htm
or here : http://extensions.virtuemart.net/categories
Greets,
Patrick
Hi, thank you for your answer.
I have 2 levels but I don't want to use a separate module for this.
YOu can always do overide in your template from the module tmpl.
See : https://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
I discovered that the problem on my site was title manager plugin that changed the $title variable
If anybody else needs the solution:
The code that works in all.php (modules/mod_virtuemart_category/tmpl/all.php):
<li <?php echo $active_menu ?>>
<div>
<?php echo JHTML::link($caturl, $cattext); ?>
</div>
<?php if ($category->childs ) {
?>
<ul class="menu<?php echo $class_sfx; ?>">
<?php
foreach ($category->childs as $child) {
//BEGIN active checking
$vm_doc = JFactory::getDocument();
$vm_title = $vm_doc->getTitle();
$vm_text = $child->category_name;
if ($vm_title === $vm_text) {
$active = "class='active2'";
}
else {
$active = "";
}
//END active checking
$caturl = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$child->virtuemart_category_id);
$cattext = $child->category_name;
?>
<li <?php echo $active; //ADD active class ?>>
<div ><?php echo JHTML::link($caturl, $cattext); ?></div>
</li>