rendered paste body<?php
/** modified for alternative layout for vc_vm_blue theme
**
** see forum thread for more info
** http://forum.virtuemart.net/index.php?topic=59227.0
**
**/
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
mm_showMyFileName(__FILE__);
$iCol = 1;
if( !isset( $categories_per_row )) {
$categories_per_row = 4;
}
$cellwidth = (intval( 100 / $categories_per_row )-2.5);
if( empty( $categories )) {
return; // Do nothing, if there are no child categories!
}
$cdb = new ps_DB; /** for cat desc routine below Mike D (MikeUK) **/
?>
<div>
<?php
foreach( $categories as $category ) {
/** routine to get category description.
** Maybe a call to ps_product_categories get_description funciton would be better?
** Mike D (MikeUK) **/
$category_id = $category['category_id'];
$q = "SELECT category_description FROM #__{vm}_category ";
$q .= "WHERE category_id='$category_id' ";
$cdb->query($q);
$cdb->next_record();
$category_desc = $cdb->f("category_description");
/** end routine **/
if ($iCol == 1) { // this is an indicator wether a row needs to be opened or not
echo "<div class=\"CatContainer1\" style=\"width:". $cellwidth ."%;float:left;\" >";
}
else {
echo "<div class=\"CatContainer1\" style=\"width:". $cellwidth ."%;float:left;\">";
}
?>
<div class="ProductTitle1">
<div class="Inside1">
<div class="InsideIE1">
<a title="<?php echo $category["category_name"] ?>" href="<?php $sess->purl(URL."index.php?option=com_virtuemart&page=shop.browse&category_id=".$category["category_id"]) ?>">
<?php echo $category["category_name"]; ?>
</a>
</div>
</div>
</div>
<div class="ProductImageContainer1">
<div class="Inside1">
<div class="InsideIE1">
<a title="<?php echo $category["category_name"] ?>" href="<?php $sess->purl(URL."index.php?option=com_virtuemart&page=shop.browse&category_id=".$category["category_id"]) ?>">
<?php if ( $category["category_thumb_image"] ) {
echo ps_product::image_tag( $category["category_thumb_image"], "alt=\"".$category["category_name"]."\"", 1, "category"); /** Mike D (MikeUK) **/
} ?>
</a>
</div>
</div>
</div>
<?php if ($category['number_of_products']) { ?>
<div align="center" style="margin:4px 0 4px 0">
<?php echo $category['number_of_products']; ?>
</div>
<?php } ?>
<div class="CatDescription1">
<div class="Inside1">
<div class="InsideIE1">
<?php echo $category_desc; ?>
</div>
</div>
</div>
<?php
// Do we need to close the current row now?
if ($iCol == $categories_per_row) { // If the number of products per row has been reached
$iCol = 1;
}
else {
$iCol++;
}
echo "</div>\n";
}
// Do we need a final closing row tag?
/*if ($iCol != 1) {
echo "</div>\n";
}*/
?>
</div>