
<ul class="list-group">
	<?php
	//pr($categorias_ps);
	foreach($categorias_ps as $c) { ?>
		<li class="list-group-item">
			<?php
			if (empty($c['subcategories'])) { ?>
				<h5 class="categoria clickable">
					<a href="/productos/categorias_ps/<?php echo $c['id_category']; ?>"><?php echo $c['name']; ?></a>
				</h5>
				<?php
			}
			else {
			?>
				<h5 class="categoria">
					<a href="/productos/categorias_ps/<?php echo $c['id_category']; ?>"> <?php echo $c['name'];?></a> 
					<span class="badge badge-pill badge-success clickable ml-4" data-toggle="collapse" href="#collapse<?php echo $c['id_category'];?>">Ver subcategorías</span>
				</h5>
				


				<div class="collapse" id="collapse<?php echo $c['id_category']; ?>">
					<ul class="list-group">
				<?php 
					foreach($c['subcategories'] as $sc) {
						?>
						<li class="list-group-item">
							<h4><a href="/productos/categorias_ps/<?php echo $sc['id_category']; ?>"><?php echo $sc['name']; ?></h4>
						</li>
						<?php 
					}
				?>
				</ul>
		<?php
		}
		?>
		</li>
		<?php
	}
	?>
</ul>