Link to home
Start Free TrialLog in
Avatar of Snarfles
SnarflesFlag for Australia

asked on

Virtuemart breaking my js sliding submenu’s

Hi

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

Luke
Avatar of Allan Nisbet
Allan Nisbet
Flag of United Kingdom of Great Britain and Northern Ireland image

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

Storm
Avatar of Snarfles

ASKER

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.
What I mean by the last paragraph above is that if you go to this link
http://dev.indigoniche.com/index.php?option=com_virtuemart&page=shop.browse&category_id=31&Itemid=53&TreeId=24

The current submenu and the bottom submenu dont work but the 2 at the top do.
SOLUTION
Avatar of Allan Nisbet
Allan Nisbet
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

Storm
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...
<?php

/**

* @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');

$jj=0;

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();

		$level++;



		$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";



		$db->query($query);



		while ($db->next_record()) {

			$ibg++;

			if ($parent_id == 0) {

            	$jj=$jj+1;

			}

			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

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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;

	color:#333333;

}	

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

	color:#999999;

}*

Open in new window

ill have a look when im back from docs

Storm
Any ideas Storm? :)
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
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.

Storm
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zuda
Zuda

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 . "'>";
to

$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!!

Thanks