Solved

Virtuemart breaking my js sliding submenu’s

Posted on 2010-08-16
14
557 Views
Last Modified: 2013-11-11
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
0
Comment
Question by:Snarfles
14 Comments
 
LVL 13

Expert Comment

by:StormITSolutions
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

Storm
0
 
LVL 9

Author Comment

by:Snarfles
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.
0
 
LVL 9

Author Comment

by:Snarfles
ID: 33462483
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.
0
 
LVL 13

Assisted Solution

by:StormITSolutions
StormITSolutions earned 500 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

Storm
0
 
LVL 13

Expert Comment

by:StormITSolutions
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

Storm
0
 
LVL 9

Author Comment

by:Snarfles
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...
<?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

0
 
LVL 9

Assisted Solution

by:Snarfles
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..
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Author Comment

by:Snarfles
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;



	color:#333333;



}	



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



	color:#999999;



}*

Open in new window

0
 
LVL 13

Expert Comment

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

Storm
0
 
LVL 9

Author Comment

by:Snarfles
ID: 33471009
Any ideas Storm? :)
0
 
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
0
 
LVL 13

Expert Comment

by:StormITSolutions
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.

Storm
0
 
LVL 9

Accepted Solution

by:
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.
0
 

Expert Comment

by:Zuda
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 . "'>";
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

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now