In the example below we will calculate the summary of field no 47 for the current category view,
e.g. place this code at the top or at the bottom of category_items.php of your FLEXIcontent template
<?php $_cid = JRequest::getInt('cid', 0); $field_id = 47; // CHANGE THIS !!! if ($_cid) { $db = JFactory::getDBO(); $query = 'SELECT SUM(value) as sum, COUNT(*) as total' .' FROM #__flexicontent_fields_item_relations as val' .' JOIN #__flexicontent_cats_item_relations as rel ON rel.itemid=val.item_id' .' WHERE field_id='.$field_id.' AND rel.catid='.$_cid.' GROUP BY rel.catid' ; $db->setQuery($query); $cat_info = $db->loadObject(); ?> <span class="my_fieldNN_sum"> <?php echo JText::_('MY_SUM_OF_FIELD_NN').': '; echo $cat_info->sum; ?> </span> <span class="my_fieldNN_total"> <?php echo JText::_('MY_OUT_OF_TOTAL_ITEMS_IN_CAT').': '; echo $cat_info->total; ?> </span> <?php } ?>