<?php // no direct access

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

//JHTML::stylesheet ( 'menucss.css', 'modules/mod_virtuemart_category/css/', false );



/* ID for jQuery dropdown */

$ID = str_replace('.', '_', substr(microtime(true), -8, 8));



		$categoryModel = VmModel::getModel('category');

		$document = JFactory::getDocument();

		//$document->addScriptDeclaration($js);
?>



<ul class="VMmenu<?php echo $class_sfx ?>" id="<?php echo "VMmenu".$ID ?>" >

<?php foreach ($categories as $category) {

	$categoryModel->addImages($category,1);

	$count = $categoryModel->countProducts($category->virtuemart_category_id);

	$url_img = $category->images[0]->file_url;

		 $active_menu = 'class="VmClose"';

		$caturl = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$category->virtuemart_category_id);

		$cattext = $category->category_name;

		//if ($active_category_id == $category->virtuemart_category_id) $active_menu = 'class="active"';

		if (in_array( $category->virtuemart_category_id, $parentCategories)) $active_menu = 'class="VmOpen"';



		?>



<li <?php echo $active_menu ?>>

	<!--

	<div class="thumb"><img src="<?php echo $url_img;?>" alt=""></div>

	-->

	<div class="name <?php echo $category->slug;?>">

		<?php echo JHTML::link($caturl, $cattext.' ('.$count.')');?>


			  <?php
		if ($category->childs) {

			?>

			<span class="icon_child"><i class="fa fa-plus-square-o"></i></span>

			<?php

		}

		?>

	</div>

<?php if ($category->childs) { ?>

<ul class="menu<?php echo $class_sfx; ?>">

<?php

		foreach ($category->childs as $child) {



		$active_child_menu = 'class="VmClose"';

		$caturl = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$child->virtuemart_category_id);

		$cattext = vmText::_($child->category_name);

		if ($child->virtuemart_category_id == $active_category_id) $active_child_menu = 'class="VmOpen"';

		?>

		<li <?php echo $active_child_menu ?>>

<li>

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

</li>

<?php		} ?>

</ul>

<?php 	} ?>

</li>

<?php

	} ?>

</ul>

