News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

How to highlight active submenu item from Module VirtueMart Category?

Started by BjornOnPole, April 11, 2013, 16:27:17 PM

Previous topic - Next topic

BjornOnPole

Hello,

I have a website where the Module Virtuemart Category is being used to display a category menu.

The website is behind a password which I cannot really share, so here is a screenshot: http://i.imgur.com/3iZ4tyz.png

As you can see this is the page 'Starterkits', which is in the submenu of the module.

I want to be able to highlight this menu item, but it does not seem to have a 'active' class, or something like that (see Firebug). And without that class I cannot add CSS to it.

Could anyone please tell me how I could highlight the active submenu item when using Module VirtueMart Category?

Thanks in advance!

BjornOnPole

Seems to me this should be a normal feature. Doesn't anyone know?

balai

Is this the default VM category module?

I think that if is, there should be a template override of the module's output which is responsible for that

BjornOnPole

Quote from: balai on April 15, 2013, 18:10:07 PM
Is this the default VM category module?

I think that if is, there should be a template override of the module's output which is responsible for that

Thanks for your reply!

Yes, it is the default VM category module.

Are you saying the template I am using causes this problem? Or that I have to create a template override to fix this problem?

The owner has removed the default Joomla templates, so it's hard for me to test.

BjornOnPole

I have just tested by uploading a new template.

When I click on a menu item then, I get the error 500 "Default not found".

So obviously more things are wrong. Anyone know a trick how I can add this active class myself?

balai

Hi

Open the categories module you are using and check the layout which is selected.
Change that and check if it works

BjornOnPole

Thanks for your reply! It did not work when I changed the templates, but it pointed me in the right direction.

For anyone with the same problem:

I added the following code to modules/mod_virtuemart_category/tmpl/default.php:

<?php
$mydoc JFactory::getDocument();
$mytitle $mydoc->getTitle();
if ($mytitle === $cattext) {
$active "class='active'";
}
else {
$active "";
}
?>


And then added that class to the links:

<?php echo JHTML::link($caturl$cattext$active); ?></div>

And then it worked!

Ofcourse, don't forget to make this a template override or your changes will be gone in the next update.
And you still need to style this yourself, ofcourse.

Thanks for your help!