Virtuemart breaking my js sliding submenu’s


I am having an issue with a javascript sliding menu. It is for a joomla website using virtuemart.

Please take a look at ... (this keep redirecting back to the live site because of a cookie issue but when that happens just go back to the dev area)

If you use the + and - next to some of the menu items you will see the working effect.

The problem starts when you actually go into the sub menu product pages. Eg.

You will see here that all of the sub menu's are now expanded and will not close.

I can't work out why this is the case. It only breaks when actually within the virtuemart component and it used to work. Its proving to be a real headache for me.

Thanks for reading and hopefully helping me. Cheers

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Allan NisbetOwner at Storm IT Solutions LTDCommented:
Try disabling all the vm modules and plugins and see if it wworks

this will work out if its the component

if not slowly activate plugins and modules to locate which one is breaking it

i think it will be one of the modules with the javascript for scrolling products or soemthing like that

javascript conflicts are the most common issue for breaking dropdowns

SnarflesAuthor Commented:
I've narrowed it down a little I think.... kinda

When I disabled the 'RokVirtueMart Product Categories' module ... the menu naturally disappared

When I enabled the default menu 'VirtueMart Product Categories' module ... it kind of works... obviously not how the menu is meant to with the slide though.

One of the interesting things is.... if you open and click on one of the submenu's further down the page... the submenu's above that point do work fine.
SnarflesAuthor Commented:
What I mean by the last paragraph above is that if you go to this link

The current submenu and the bottom submenu dont work but the 2 at the top do.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Allan NisbetOwner at Storm IT Solutions LTDCommented:
It looks like  conflict between rok module and your site,
I see what you mean that part of it works and the rest doesnt

i had this issue on a module recently for a menu all menu items worked on the menu except the last which ovelapped another div.

I would report this on the rok forums and see if they have a solution as it seems to be that module causing the issue

Allan NisbetOwner at Storm IT Solutions LTDCommented:
Ah actually just had a thought does the module have a limit of levels check that it doesnt and maybe set it to 100 and see if that works

SnarflesAuthor Commented:
In regards to your last comment... I can;t see any level variable... This is the code for building the category tree if that helps...


* @package mod_rokvirtuemart_categories

* @copyright	Copyright (C) 2009 RocketTheme. All rights reserved.

* @license GNU/GPL, see LICENSE.php

* RokVirtuemart Product Categories is free software. This version may have been modified pursuant

* to the GNU General Public License, and as distributed it includes or

* is derivative of works licensed under the GNU General Public License or

* other free or open source software licenses.



defined('_JEXEC') or die('Restricted access');


global $mosConfig_live_site, $mainframe, $current_cat_id;

require_once(CLASSPATH . 'ps_product_category.php');

$uri =& JURI::getInstance($_SERVER['REQUEST_URI']);

$query = $uri->getQuery(true);

$current_cat_id = (count($query) && isset($query['category_id'])) ? intval($query['category_id']) : false;

class RokVMCategoryTree {

	function traverse_tree_down(&$category_html, $category_id = '0', $level = '0', $parent_id = '0') {

		static $ibg = -1;

		global $mosConfig_live_site, $sess, $current_cat_id;

		$db = new ps_DB();


		$query = "SELECT category_name, category_id, category_child_id "

		. "FROM #__{vm}_category as a, #__{vm}_category_xref as b "

		. "WHERE a.category_publish='Y' AND "

		. " b.category_parent_id='$category_id' AND a.category_id=b.category_child_id "

		. "ORDER BY category_parent_id, list_order, category_name ASC";


		while ($db->next_record()) {


			if ($parent_id == 0) {



			else {

				$jj = $parent_id;


			$tree_id = ($ibg == 0) ? 1 : $ibg;

			$item_id = '&Itemid=' . $sess->getShopItemid();

			$category_id = $db->f("category_id", false);

			$category_child_id = $db->f("category_child_id");

			$category_name = $db->f("category_name", false);

			//$link = sefRelToAbs('index.php?option=com_virtuemart&page=shop.browse&category_id=' . $category_id . $item_id . "&TreeId=$tree_id");

			$link = JRoute::_('index.php?option=com_virtuemart&page=shop.browse&category_id=' . $category_id . $item_id . "&TreeId=$tree_id");

			$hasChilds = ps_product_category::has_childs($category_id);

			$active = ($current_cat_id == $category_id) ? ' active ' : '';

			$current = ($current_cat_id == $category_id) ? ' id="current" ' : '';

			$category_html .= "<li " . $current . " class='item " . (($hasChilds) ? 'parent' : '') . $active . "'>";

			//if ($hasChilds) $category_html .= "<div class='arrow arrow-collapse'><span>+</span></div>";

			if ($hasChilds) $category_html .= "<div class='arrow arrow-collapse'></div>";

			//$category_html .= 	"<a id='i_txt0_".$jj."' href='$link'><span class='menuitem'>" . $category_name . "</span></a>";

			$category_html .= 	"<a id='i_txt0_blue' href='$link'><nobr><span class='menuitem'>" . $category_name . "</span></nobr></a>";

			if ($hasChilds) {

				$category_html .= "<ul class='submenu'>";

				$this->traverse_tree_down($category_html, $category_child_id, $level, $jj);

				$category_html .= "</ul>";


			$category_html .= "</li>";





Open in new window

SnarflesAuthor Commented:
wooohoo. some progress!

I commented out the following two lines and it kinda works..

//$active = ($current_cat_id == $category_id) ? ' active ' : '';

                  //$current = ($current_cat_id == $category_id) ? ' id="current" ' : '';

I think it is the $active class that is stuffing it up..
SnarflesAuthor Commented:
So its definitely the active class that is doing it. Current works fine. I commented out the css that related to this section for the active class (which I have listed below) but it didn't make any difference.

So the thing that the active class does is opens up the current submenu to display the whole thing. So its a problem with that, but I'm not sure where to look.
ul.rokvm_categories a span {

	background-position: 15px 11px;

	color: #999999;


ul.rokvm_categories div ul li a span {

	background-position: 15px 11px;



ul.rokvm_categories div ul li a span:hover {



Open in new window

Allan NisbetOwner at Storm IT Solutions LTDCommented:
ill have a look when im back from docs

SnarflesAuthor Commented:
Any ideas Storm? :)
Amanda WatsonWeb DeveloperCommented:
So you have narrowed it down to a problem with the template.
I had exactly the same problem with VM and and rockettheme template.
You could just test to see if another template works for you.  Not an ideal solution but then you could perhaps use their javascript and css if that helps
Allan NisbetOwner at Storm IT Solutions LTDCommented:
HI SNarfles,

Forgot to post an update, if you use one of the developer tools for firefox or chrome you can click on the faulty part and see what its called in both the div and css, then go to the rockvm php files in and comment out the references for active

as memory serves me its either in your module folder or the template might have its own custom php files that control the module in that case it will be in the template folder somewhere.

as snowball said test if it works with another template if so then the answer is probably the theme folder.

SnarflesAuthor Commented:
Thanks for your comments. I know where it is setting the active class and have temporarily excluded this, but its not the ultimate solution as when 'active' is not set it doesn't keep the current category expanded and highlight the current subcategory.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I am having the same problem on my site

Snarfles, I followed your advice and changed the following line in helper.php

$category_html .= "<li " . $current . " class='item " . (($hasChilds) ? 'parent' : '') . $active . "'>";

$category_html .= "<li " . $current . " class='item " . (($hasChilds) ? 'parent' : '') .  "'>";

Doesnt seem to help :(

Snarfles do you remember how you fixed it?? I can see it working in

Please help!!


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.