As the topic states Im trying to find a way to display that on a page. I have searched for a while and all I have been able to find is a way to display the stock level of a product.
Any help with this would be appreciated.
Latest News: (loading..)
Total Number of Products
Started by EchoGuns, Jun 17 2012 12:04 AM
6 replies to this topic
#1
Posted 17 June 2012 - 12:04 AM
#2
Posted 17 June 2012 - 02:43 AM
<?php echo tep_get_products_stock($product_id); ?>
If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
#3
Posted 17 June 2012 - 03:02 AM
Disregard my last post.
Stupid should hurt...
Stupid should hurt...
If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
#4
Posted 17 June 2012 - 03:16 AM
<?php
$categories_array = array();
tep_get_subcategories($categories_array);
$n = count($categories_array);
$total = 0;
for ( $i = 0 ; $i < $n ; $i++) {
if ( ! tep_has_category_subcategories($categories_array[$i]) ) {
$total += tep_count_products_in_category($categories_array[$i]);
}
}
echo $total;
?>
If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
#5
Posted 17 June 2012 - 03:29 AM
Thanks, that's exactly what I was looking for. What about taking that another step forward, is there also a way to show total number of catgories and manufacturers?
#6
Posted 17 June 2012 - 12:09 PM
New code:
After that code executes:
To display total categories:
<?php echo $n; ?>
To display total products:
<?php echo $total; ?>
To display total manufacturers:
<?php echo $m; ?>
<?php
$categories_array = array();
tep_get_subcategories($categories_array);
$n = count($categories_array);
// Total categories = $n
$total = 0;
for ( $i = 0 ; $i < $n ; $i++) {
if ( ! tep_has_category_subcategories($categories_array[$i]) ) {
$total += tep_count_products_in_category($categories_array[$i]);
}
}
// Total products = $total
$m = 0;
$manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS);
if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {
while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
++$m;
}
}
//Total manufacturers = $m
?>
After that code executes:
To display total categories:
<?php echo $n; ?>
To display total products:
<?php echo $total; ?>
To display total manufacturers:
<?php echo $m; ?>
If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
#7
Posted 17 June 2012 - 05:03 PM
Worked perfectly.
Thanks Jim
Thanks Jim









