I need to display at the main page the total number of items for 2-3 categories/subcategories.
eg
Smartphones: 300 items, Laptops:220 items, Tablets:130 items
I tried some code but doesnt display anything. i know its a simple function but i cant find it. I think the function already exists because when you click a main category on the main/home page inside the fancy box it displays the total number of the items per category and also in the search page it display the number of items per subcategory.. I tried to find some code that will do the job inside the file inc.category.php but i didnt figure it out how i can make it work. Then after many failures i tried to add this in veronika's functions.php file:
function cust_cat_item_count($id) {
$cat = osc_get_category('id', $id);
View::newInstance()->_exportVariableToView('category', $cat);
return osc_category_total_items();
}
and then i called it inside the main.php file of veronika theme with:
<?php echo cust_cat_item_count('12'); ?>
<?php echo cust_cat_item_count('54'); ?>
<?php echo cust_cat_item_count('85'); ?>
12, 54, 85 are the category ids for the categories smartphones,laptops,and tablets
But it didnt work. If you could take a look it would be great as i really need your help !!!!!