Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Virtuemart breaking my js sliding submenu’s

Posted on 2010-08-16
Medium Priority
Last Modified: 2013-11-11

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

Please take a look at dev.indigoniche.com ... (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. http://dev.indigoniche.com/Indigo/View-all-products?TreeId=1

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

Question by:Snarfles
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 14

Expert Comment

by:Allan Nisbet
ID: 33454868
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


Author Comment

ID: 33462464
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.

Author Comment

ID: 33462483
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.
Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

LVL 14

Assisted Solution

by:Allan Nisbet
Allan Nisbet earned 2000 total points
ID: 33462549
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

LVL 14

Expert Comment

by:Allan Nisbet
ID: 33462552
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


Author Comment

ID: 33462595
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		http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 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


Assisted Solution

Snarfles earned 0 total points
ID: 33462628
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..

Author Comment

ID: 33463021
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 li.active a span {

	background-position: 15px 11px;

	color: #999999;


ul.rokvm_categories li.active div ul li a span {

	background-position: 15px 11px;



ul.rokvm_categories li.active div ul li a span:hover {



Open in new window

LVL 14

Expert Comment

by:Allan Nisbet
ID: 33463179
ill have a look when im back from docs


Author Comment

ID: 33471009
Any ideas Storm? :)
LVL 11

Expert Comment

by:Amanda Watson
ID: 33479508
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
LVL 14

Expert Comment

by:Allan Nisbet
ID: 33479573
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.


Accepted Solution

Snarfles earned 0 total points
ID: 33481922
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.

Expert Comment

ID: 37143700
I am having the same problem on my site http://wholesalers-china.relaxitude.com/

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 http://www.indigoniche.com

Please help!!



Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question