Jump to content



Latest News: (loading..)

- - - - -

Total Number of Products


  • Please log in to reply
6 replies to this topic

#1   EchoGuns

EchoGuns

    Supreme Overlord

  • Members
  • 122 posts
  • Real Name:Clint Freeman
  • Gender:Male
  • Location:Texas

Posted 17 June 2012 - 12:04 AM

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.
My Addons:

Product Tabs - 2.3x Download| Support
Product Info Page Box - 2.3x Download | Support

#2   germ

germ
  • Members
  • 13,921 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

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 >

#3   germ

germ
  • Members
  • 13,921 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 17 June 2012 - 03:02 AM

Disregard my last post.

Stupid should hurt...
:huh:
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 >

#4   germ

germ
  • Members
  • 13,921 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

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 >

#5   EchoGuns

EchoGuns

    Supreme Overlord

  • Members
  • 122 posts
  • Real Name:Clint Freeman
  • Gender:Male
  • Location:Texas

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?
My Addons:

Product Tabs - 2.3x Download| Support
Product Info Page Box - 2.3x Download | Support

#6   germ

germ
  • Members
  • 13,921 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 17 June 2012 - 12:09 PM

New code:

<?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 >

#7   EchoGuns

EchoGuns

    Supreme Overlord

  • Members
  • 122 posts
  • Real Name:Clint Freeman
  • Gender:Male
  • Location:Texas

Posted 17 June 2012 - 05:03 PM

Worked perfectly.

Thanks Jim
My Addons:

Product Tabs - 2.3x Download| Support
Product Info Page Box - 2.3x Download | Support